Skip to content

Commit d37c2b5

Browse files
author
Adam Tackett
committed
add cypress testing
Signed-off-by: Adam Tackett <[email protected]>
1 parent b3adb25 commit d37c2b5

File tree

3 files changed

+72
-2
lines changed

3 files changed

+72
-2
lines changed

Diff for: .cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

+70-1
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,78 @@ describe('Testing switch mode to jaeger', () => {
294294
// Waiting time for render to complete
295295
cy.get("[data-test-subj='treeExpandAll']").click();
296296
cy.get("[data-test-subj='treeCollapseAll']").click();
297-
297+
298298
cy.get("[data-test-subj='treeViewExpandArrow']").should('have.length', 1);
299299
cy.get("[data-test-subj='treeExpandAll']").click();
300300
cy.get("[data-test-subj='treeViewExpandArrow']").should('have.length.greaterThan', 1);
301301
});
302302
});
303+
304+
describe.only('Testing traces Custom source', () => {
305+
beforeEach(() => {
306+
cy.visit('app/observability-traces#/traces', {
307+
onBeforeLoad: (win) => {
308+
win.sessionStorage.clear();
309+
},
310+
});
311+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
312+
cy.get("[data-test-subj='indexPattern-switch-link']").click();
313+
cy.get("[data-test-subj='custom_data_prepper-mode']").click();
314+
setTimeFilter();
315+
});
316+
317+
it('Renders the traces custom source all spans as default, clicks trace view redirection ', () => {
318+
cy.get('.euiDataGridHeaderCell__content').contains('Span Id').should('exist');
319+
cy.get('.euiDataGridHeaderCell__content').contains('Trace Id').should('exist');
320+
cy.get('.euiDataGridHeaderCell__content').contains('Parent Span Id').should('exist');
321+
cy.get('.euiDataGridHeaderCell__content').contains('Trace group').should('exist');
322+
cy.get('.euiDataGridHeaderCell__content').contains('Duration (ms)').should('exist');
323+
cy.get('.euiDataGridHeaderCell__content').contains('Errors').should('exist');
324+
cy.get('.euiDataGridHeaderCell__content').contains('Last updated').should('exist');
325+
326+
cy.get('a.euiLink.euiLink--primary').first().click();
327+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
328+
cy.get('.overview-content').should('contain.text', '4fa04f117be100f476b175e41096e736');
329+
});
330+
331+
it('All spans column attributes as hidden, shows column when added', () => {
332+
cy.get('span.euiButtonEmpty__text').contains('60 columns hidden').should('exist');
333+
cy.get('span.euiButtonEmpty__text').contains('60 columns hidden').click();
334+
cy.get('button[name="span.attributes.http@url"]').click();
335+
cy.get('button[name="span.attributes.http@url"]').should('have.attr', 'aria-checked', 'true');
336+
cy.get('.euiDataGridHeaderCell__content').contains('span.attributes.http@url').should('exist');
337+
});
338+
339+
it('Verifies column sorting and pagination works correctly', () => {
340+
cy.contains('Duration (ms)').click();
341+
cy.contains('Sort Z-A').click();
342+
343+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
344+
cy.contains('467.03 ms').should('exist');
345+
346+
cy.get('[data-test-subj="pagination-button-next"]').click();
347+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
348+
cy.contains('399.10 ms').should('exist');
349+
350+
cy.get('[data-test-subj="pagination-button-previous"]').click();
351+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
352+
cy.contains('467.03 ms').should('exist');
353+
});
354+
355+
it('Renders the traces custom source traces, clicks trace view redirection', () => {
356+
cy.get('[data-test-subj="trace-table-mode-selector"]').click();
357+
cy.get('.euiSelectableListItem').contains('Traces').click();
358+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
359+
360+
cy.get('.euiDataGridHeaderCell__content').contains('Trace ID').should('exist');
361+
cy.get('.euiDataGridHeaderCell__content').contains('Trace group').should('exist');
362+
cy.get('.euiDataGridHeaderCell__content').contains('Duration (ms)').should('exist');
363+
cy.get('.euiDataGridHeaderCell__content').contains('Percentile in trace group').should('exist');
364+
cy.get('.euiDataGridHeaderCell__content').contains('Errors').should('exist');
365+
cy.get('.euiDataGridHeaderCell__content').contains('Last updated').should('exist');
366+
367+
cy.get('a.euiLink.euiLink--primary').first().click();
368+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
369+
cy.get('.overview-content').should('contain.text', '02feb3a4f611abd81f2a53244d1278ae');
370+
});
371+
});

Diff for: .cypress/utils/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
8383
.type('{selectall}' + endTime, { force: true });
8484
}
8585
if (refresh) cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
86-
cy.get('.euiTableRow').should('have.length.greaterThan', 3); //Replaces Wait
86+
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist'); //Replaces Wait
8787
};
8888

8989
export const expandServiceView = (rowIndex = 0) => {

Diff for: public/components/trace_analytics/components/common/shared_components/custom_datagrid.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ export const RenderCustomDataGrid: React.FC<RenderCustomDataGridParams> = ({
150150
<EuiFlexItem grow={false}>
151151
<EuiText size="s">
152152
<EuiTextColor
153+
data-test-subj="trace-table-mode-selector"
153154
color="success"
154155
onClick={() => setIsPopoverOpen(!isPopoverOpen)}
155156
style={{ cursor: 'pointer', display: 'flex', alignItems: 'center' }}

0 commit comments

Comments
 (0)