-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM] Cannot click through to details of an error on the waterfall pa…
…ge if the error is missing `transaction.id` (#66386) (#66522) * removing transaction from link when it isnt defined * refacroting test * refacroting test
- Loading branch information
1 parent
3510add
commit ab9a668
Showing
8 changed files
with
93 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
x-pack/plugins/apm/public/components/shared/charts/Timeline/Marker/ErrorMarker.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { ErrorMarker } from './ErrorMarker'; | ||
import { ErrorMark } from '../../../../app/TransactionDetails/WaterfallWithSummmary/WaterfallContainer/Marks/get_error_marks'; | ||
import { render, fireEvent } from '@testing-library/react'; | ||
import { act } from '@testing-library/react-hooks'; | ||
import { expectTextsInDocument } from '../../../../../utils/testHelpers'; | ||
|
||
describe('ErrorMarker', () => { | ||
const mark = { | ||
id: 'agent', | ||
offset: 10000, | ||
type: 'errorMark', | ||
verticalLine: true, | ||
error: { | ||
trace: { id: '123' }, | ||
transaction: { id: '456' }, | ||
error: { grouping_key: '123' }, | ||
service: { name: 'bar' } | ||
}, | ||
serviceColor: '#fff' | ||
} as ErrorMark; | ||
|
||
function openPopover(errorMark: ErrorMark) { | ||
const component = render(<ErrorMarker mark={errorMark} />); | ||
act(() => { | ||
fireEvent.click(component.getByTestId('popover')); | ||
}); | ||
expectTextsInDocument(component, ['10,000 μs']); | ||
return component; | ||
} | ||
function getKueryDecoded(url: string) { | ||
return decodeURIComponent(url.substring(url.indexOf('kuery='), url.length)); | ||
} | ||
it('renders link with trace and transaction', () => { | ||
const component = openPopover(mark); | ||
const errorLink = component.getByTestId('errorLink') as HTMLAnchorElement; | ||
expect(getKueryDecoded(errorLink.hash)).toEqual( | ||
'kuery=trace.id : "123" and transaction.id : "456"' | ||
); | ||
}); | ||
it('renders link with trace', () => { | ||
const { transaction, ...withoutTransaction } = mark.error; | ||
const newMark = { | ||
...mark, | ||
error: withoutTransaction | ||
} as ErrorMark; | ||
const component = openPopover(newMark); | ||
const errorLink = component.getByTestId('errorLink') as HTMLAnchorElement; | ||
expect(getKueryDecoded(errorLink.hash)).toEqual('kuery=trace.id : "123"'); | ||
}); | ||
it('renders link with transaction', () => { | ||
const { trace, ...withoutTrace } = mark.error; | ||
const newMark = { | ||
...mark, | ||
error: withoutTrace | ||
} as ErrorMark; | ||
const component = openPopover(newMark); | ||
const errorLink = component.getByTestId('errorLink') as HTMLAnchorElement; | ||
expect(getKueryDecoded(errorLink.hash)).toEqual( | ||
'kuery=transaction.id : "456"' | ||
); | ||
}); | ||
it('renders link without trance and transaction', () => { | ||
const { trace, transaction, ...withoutTraceAndTransaction } = mark.error; | ||
const newMark = { | ||
...mark, | ||
error: withoutTraceAndTransaction | ||
} as ErrorMark; | ||
const component = openPopover(newMark); | ||
const errorLink = component.getByTestId('errorLink') as HTMLAnchorElement; | ||
expect(getKueryDecoded(errorLink.hash)).toEqual('kuery='); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
30 changes: 0 additions & 30 deletions
30
...plugins/apm/public/components/shared/charts/Timeline/Marker/__test__/ErrorMarker.test.tsx
This file was deleted.
Oops, something went wrong.
49 changes: 0 additions & 49 deletions
49
...components/shared/charts/Timeline/Marker/__test__/__snapshots__/ErrorMarker.test.tsx.snap
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters