Skip to content

Commit 8d6163a

Browse files
authored
Merge branch 'main' into metricsCypressFixes
2 parents d4e93f7 + a1dfaea commit 8d6163a

File tree

4 files changed

+81
-56
lines changed

4 files changed

+81
-56
lines changed

.cypress/integration/trace_analytics_test/trace_analytics_services.spec.js

+63-26
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55

66
/// <reference types="cypress" />
77

8-
import { expandServiceView, SERVICE_NAME, SERVICE_SPAN_ID, setTimeFilter, verify_traces_spans_data_grid_cols_exists, count_table_row, AUTH_SERVICE_SPAN_ID } from '../../utils/constants';
8+
import {
9+
expandServiceView,
10+
SERVICE_NAME,
11+
SERVICE_SPAN_ID,
12+
setTimeFilter,
13+
verify_traces_spans_data_grid_cols_exists,
14+
count_table_row,
15+
AUTH_SERVICE_SPAN_ID,
16+
} from '../../utils/constants';
917
import { suppressResizeObserverIssue } from '../../utils/constants';
1018

11-
suppressResizeObserverIssue();//needs to be in file once
19+
suppressResizeObserverIssue(); //needs to be in file once
1220

1321
describe('Testing services table empty state', () => {
1422
beforeEach(() => {
@@ -52,7 +60,9 @@ describe('Testing services table', () => {
5260
});
5361

5462
it('Verify columns in Services table', () => {
55-
cy.get('.euiFlexItem.euiFlexItem--flexGrowZero .panel-title').contains('Services').should('exist');
63+
cy.get('.euiFlexItem.euiFlexItem--flexGrowZero .panel-title')
64+
.contains('Services')
65+
.should('exist');
5666
cy.get('.euiTableCellContent__text[title="Name"]').should('exist');
5767
cy.get('.euiTableCellContent__text[title="Average duration (ms)"]').should('exist');
5868
cy.get('.euiTableCellContent__text[title="Error rate"]').should('exist');
@@ -61,17 +71,20 @@ describe('Testing services table', () => {
6171
cy.get('.euiTableCellContent__text[title="Connected services"]').should('exist');
6272
cy.get('.euiTableCellContent__text[title="Traces"]').should('exist');
6373
cy.get('[data-test-subj="tablePaginationPopoverButton"]').click();
64-
cy.get('.euiIcon.euiIcon--medium.euiIcon--inherit.euiContextMenu__icon').eq(0).should('exist').click();
74+
cy.get('.euiIcon.euiIcon--medium.euiIcon--inherit.euiContextMenu__icon')
75+
.eq(0)
76+
.should('exist')
77+
.click();
6578
cy.get('[data-test-subj="pagination-button-next"]').should('exist').click();
6679
cy.get('.euiLink.euiLink--primary').contains('order').should('exist');
67-
})
80+
});
6881

6982
it('Navigate from Services to Traces', () => {
7083
cy.get('.euiTableCellContent__text[title="Traces"]').should('exist');
7184
cy.contains('74').should('exist').click();
7285
cy.get('.euiText.euiText--medium .panel-title').should('exist');
7386
cy.get('.euiBadge__childButton[data-test-subj="filterBadge"]').should('exist');
74-
})
87+
});
7588
});
7689

7790
describe('Testing service view empty state', () => {
@@ -102,7 +115,7 @@ describe('Testing service view', () => {
102115
setTimeFilter();
103116
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}`);
104117
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
105-
cy.get('.euiTableRow').should('have.length.lessThan', 3);//Replaces wait
118+
cy.get('.euiTableRow').should('have.length.lessThan', 3); //Replaces wait
106119
expandServiceView(0);
107120
});
108121

@@ -123,7 +136,9 @@ describe('Testing service view', () => {
123136
});
124137

125138
it('Renders spans data grid, flyout, filters', () => {
126-
cy.get("[data-test-subj='spanId-link']").contains(SERVICE_SPAN_ID).trigger('mouseover', { force: true });
139+
cy.get("[data-test-subj='spanId-link']")
140+
.contains(SERVICE_SPAN_ID)
141+
.trigger('mouseover', { force: true });
127142
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });
128143
cy.contains('Span detail').should('exist');
129144
cy.contains('Span attributes').should('exist');
@@ -157,7 +172,7 @@ describe('Testing Service map', () => {
157172
cy.contains('100');
158173
cy.get('.euiFormLabel.euiFormControlLayout__prepend').contains('Focus on').should('exist');
159174
cy.get('[placeholder="Service name"]').focus().type('database{enter}');
160-
})
175+
});
161176
});
162177

163178
describe('Testing traces Spans table verify table headers functionality', () => {
@@ -188,50 +203,68 @@ describe('Testing traces Spans table verify table headers functionality', () =>
188203
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click({ force: true });
189204
cy.get('.panel-title-count').contains('8').should('exist');
190205
cy.get('.euiSwitch.euiSwitch--compressed.euiSwitch--mini .euiSwitch__button').eq(3).click();
191-
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click().should('have.text', '2 columns hidden');
206+
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]')
207+
.click()
208+
.should('have.text', '2 columns hidden');
192209
count_table_row(8);
193210
});
194211

195212
it('Show all button Spans table', () => {
196213
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
197214
expandServiceView(1);
198215
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click();
199-
cy.get('.euiPopoverFooter .euiFlexItem.euiFlexItem--flexGrowZero').eq(0).should('have.text', 'Show all').click();
216+
cy.get('.euiPopoverFooter .euiFlexItem.euiFlexItem--flexGrowZero')
217+
.eq(0)
218+
.should('have.text', 'Show all')
219+
.click();
200220
cy.get('.euiDataGrid__focusWrap').click().should('exist');
201221
verify_traces_spans_data_grid_cols_exists();
202222
});
203223

204224
it('Hide all button Spans table', () => {
205225
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
206226
expandServiceView(1);
207-
cy.get('.euiTableRow').should('have.length.lessThan', 2);//Replace wait
227+
cy.get('.euiTableRow').should('have.length.lessThan', 2); //Replace wait
208228
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click();
209-
cy.get('.euiPopoverFooter .euiFlexItem.euiFlexItem--flexGrowZero').eq(1).should('have.text', 'Hide all').click();
229+
cy.get('.euiPopoverFooter .euiFlexItem.euiFlexItem--flexGrowZero')
230+
.eq(1)
231+
.should('have.text', 'Hide all')
232+
.click();
210233
cy.get('.euiDataGrid__focusWrap').click().should('exist');
211-
cy.get('[data-test-subj="dataGridColumnSelectorPopover"]').should('have.text', '10 columns hidden');
234+
cy.get('[data-test-subj="dataGridColumnSelectorPopover"]').should(
235+
'have.text',
236+
'10 columns hidden'
237+
);
212238
});
213239

214240
it('Render Spans table and change data table Density', () => {
215241
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
216242
expandServiceView(1);
217243
verify_traces_spans_data_grid_cols_exists();
244+
cy.get('[data-test-subj="service-dep-table"]').should('exist');
218245
cy.get('.euiButtonEmpty__text').contains('Density').click();
219-
cy.get('.euiButtonContent__icon').eq(5).click();
220-
cy.get('.euiButtonContent__icon').eq(6).click();
221-
cy.get('.euiButtonContent__icon').eq(7).click();
246+
cy.contains('.euiButtonContent', 'Compact density').find('.euiButtonContent__icon').click();
247+
cy.contains('.euiButtonContent', 'Normal density').find('.euiButtonContent__icon').click();
248+
cy.contains('.euiButtonContent', 'Expanded density').find('.euiButtonContent__icon').click();
222249
});
223250

224251
it('Render Spans table and and click on sort', () => {
225252
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
226253
expandServiceView(1);
227254
verify_traces_spans_data_grid_cols_exists();
228-
cy.get('[data-test-subj="dataGridColumnSortingButton"]').contains('Sort fields').should('exist').click();
255+
cy.get('[data-test-subj="service-dep-table"]').should('exist');
256+
cy.get('[data-test-subj="dataGridColumnSortingButton"]')
257+
.contains('Sort fields')
258+
.should('exist')
259+
.click();
229260
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection"]').click();
230261
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-spanId').click();
231262
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-parentSpanId"]').click();
232263
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-traceId"]').click();
233264
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-traceGroup').click();
234-
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-durationInNanos"]').click();
265+
cy.get(
266+
'[data-test-subj="dataGridColumnSortingPopoverColumnSelection-durationInNanos"]'
267+
).click();
235268
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-startTime"]').click();
236269
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-endTime').click();
237270
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-status.code"]').click();
@@ -262,11 +295,15 @@ describe('Testing traces Spans table and verify columns functionality', () => {
262295
cy.get('.euiFlyoutBody .panel-title').contains('Overview').should('exist');
263296
cy.get('.euiTextColor.euiTextColor--subdued').contains('Span ID').should('exist');
264297
cy.get('[data-test-subj="parentSpanId"]').contains('d03fecfa0f55b77c').should('exist');
265-
cy.get('.euiFlyoutBody__overflowContent .panel-title').contains('Span attributes').should('exist');
298+
cy.get('.euiFlyoutBody__overflowContent .panel-title')
299+
.contains('Span attributes')
300+
.should('exist');
266301
cy.get('.euiDescriptionList__description .euiFlexItem').eq(0).trigger('mouseover').click();
267302
cy.get('[aria-label="span-flyout-filter-icon"]').click();
268303
cy.get('.euiFlyout__closeButton.euiFlyout__closeButton--inside').click();
269-
cy.get('.euiBadge__content .euiBadge__text').contains('spanId: 277a5934acf55dcf').should('exist');
304+
cy.get('.euiBadge__content .euiBadge__text')
305+
.contains('spanId: 277a5934acf55dcf')
306+
.should('exist');
270307
count_table_row(1);
271308
cy.get('[aria-label="remove current filter"]').click();
272309
cy.get('.panel-title-count').contains('8').should('exist');
@@ -277,6 +314,7 @@ describe('Testing traces Spans table and verify columns functionality', () => {
277314
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
278315
expandServiceView(1);
279316
verify_traces_spans_data_grid_cols_exists();
317+
cy.get('[data-test-subj="service-dep-table"]').should('exist');
280318
cy.get('.euiDataGridHeaderCell__content').contains('Span ID').click();
281319
cy.get('.euiListGroupItem__label').contains('Hide column').click();
282320
cy.get('.euiDataGridHeaderCell__content').contains('Trace ID').click();
@@ -286,7 +324,6 @@ describe('Testing traces Spans table and verify columns functionality', () => {
286324
});
287325
});
288326

289-
290327
describe('Testing switch mode to jaeger', () => {
291328
beforeEach(() => {
292329
cy.visit('app/observability-traces#/services', {
@@ -312,9 +349,9 @@ describe('Testing switch mode to jaeger', () => {
312349
});
313350

314351
it('Verifies traces links to traces page with filter applied', () => {
315-
cy.get('.euiTableRow').should('have.length.lessThan', 7);//Replaces Wait
352+
cy.get('.euiTableRow').should('have.length.lessThan', 7); //Replaces Wait
316353
cy.get('.euiLink').contains('7').click();
317354
cy.contains(' (7)').should('exist');
318-
cy.get("[data-test-subj='filterBadge']").eq(0).contains('process.serviceName: customer')
319-
})
320-
});
355+
cy.get("[data-test-subj='filterBadge']").eq(0).contains('process.serviceName: customer');
356+
});
357+
});

public/components/trace_analytics/components/common/plots/service_dependencies_table.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const ServiceDependenciesTable = ({ serviceMap, graph }: ServiceDependenc
9999
);
100100

101101
return (
102-
<EuiPanel>
102+
<EuiPanel data-test-subj="service-dep-table">
103103
<PanelTitle title="Service Dependencies" />
104104
<EuiHorizontalRule margin="m" />
105105
<EuiInMemoryTable

public/components/trace_analytics/components/services/__tests__/__snapshots__/service_view.test.tsx.snap

+1-15
Original file line numberDiff line numberDiff line change
@@ -248,21 +248,7 @@ exports[`Service view component renders service view 1`] = `
248248
<EuiHorizontalRule
249249
margin="m"
250250
/>
251-
<div>
252-
<SpanDetailTable
253-
DSL={Object {}}
254-
dataSourceMDSId=""
255-
hiddenColumns={
256-
Array [
257-
"serviceName",
258-
]
259-
}
260-
http={[MockFunction]}
261-
mode="data_prepper"
262-
openFlyout={[Function]}
263-
setTotal={[Function]}
264-
/>
265-
</div>
251+
<div />
266252
</EuiPanel>
267253
</EuiPageBody>
268254
</EuiPage>

public/components/trace_analytics/components/services/service_view.tsx

+16-14
Original file line numberDiff line numberDiff line change
@@ -488,20 +488,22 @@ export function ServiceView(props: ServiceViewProps) {
488488
}, [spanFilters]);
489489

490490
const [total, setTotal] = useState(0);
491-
const spanDetailTable = useMemo(
492-
() => (
493-
<SpanDetailTable
494-
http={props.http}
495-
hiddenColumns={['serviceName']}
496-
DSL={DSL}
497-
openFlyout={(spanId: string) => setCurrentSpan(spanId)}
498-
setTotal={setTotal}
499-
mode={mode}
500-
dataSourceMDSId={props.dataSourceMDSId[0].id}
501-
/>
502-
),
503-
[DSL, setCurrentSpan, spanFilters]
504-
);
491+
const spanDetailTable = useMemo(() => {
492+
// only render when time and service state updates in DSL
493+
if (Object.keys(DSL).length > 0)
494+
return (
495+
<SpanDetailTable
496+
http={props.http}
497+
hiddenColumns={['serviceName']}
498+
DSL={DSL}
499+
openFlyout={(spanId: string) => setCurrentSpan(spanId)}
500+
setTotal={setTotal}
501+
mode={mode}
502+
dataSourceMDSId={props.dataSourceMDSId[0].id}
503+
/>
504+
);
505+
return <></>;
506+
}, [DSL, setCurrentSpan, spanFilters]);
505507

506508
const pageToRender = (
507509
<>

0 commit comments

Comments
 (0)