Skip to content

Commit 1c16bcf

Browse files
authored
Fix UX E2E tests (#85722)
They look for `.kbnLoadingIndicator` which is no longer there in the new loading indicator design. This changes it to look for an element that does exist and makes it a function in utils. Change not.be.visible to not.exist in places where the element does not exist at in that state.
1 parent ab07a00 commit 1c16bcf

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
"__version": "5.4.0"
2+
"__version": "6.0.1"
33
}

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/breakdown_filter.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
88
import { DEFAULT_TIMEOUT } from './csm_dashboard';
9+
import { waitForLoadingToFinish } from './utils';
910

1011
/** The default time in ms to wait for a Cypress command to complete */
1112

1213
Given(`a user clicks the page load breakdown filter`, () => {
13-
// wait for all loading to finish
14-
cy.get('kbnLoadingIndicator').should('not.be.visible');
15-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
14+
waitForLoadingToFinish();
15+
cy.get('.euiStat__title-isLoading').should('not.exist');
1616
const breakDownBtn = cy.get(
1717
'[data-test-subj=pldBreakdownFilter]',
1818
DEFAULT_TIMEOUT
@@ -27,7 +27,7 @@ When(`the user selected the breakdown`, () => {
2727
});
2828

2929
Then(`breakdown series should appear in chart`, () => {
30-
cy.get('.euiLoadingChart').should('not.be.visible');
30+
cy.get('.euiLoadingChart').should('not.exist');
3131

3232
cy.get('[data-cy=pageLoadDist]').within(() => {
3333
cy.get('div.echLegendItem__label[title=Chrome] ', DEFAULT_TIMEOUT)

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/client_metrics_helper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { DEFAULT_TIMEOUT } from './csm_dashboard';
8+
import { waitForLoadingToFinish } from './utils';
89

910
/**
1011
* Verifies the behavior of the client metrics component
@@ -17,15 +18,14 @@ export function verifyClientMetrics(
1718
) {
1819
const clientMetricsSelector = '[data-cy=client-metrics] .euiStat__title';
1920

20-
// wait for all loading to finish
21-
cy.get('kbnLoadingIndicator').should('not.be.visible');
21+
waitForLoadingToFinish();
2222

2323
if (checkTitleStatus) {
2424
cy.get('.euiStat__title', DEFAULT_TIMEOUT).should('be.visible');
25-
cy.get('.euiSelect-isLoading').should('not.be.visible');
25+
cy.get('.euiSelect-isLoading').should('not.exist');
2626
}
2727

28-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
28+
cy.get('.euiStat__title-isLoading').should('not.exist');
2929

3030
cy.get(clientMetricsSelector).eq(0).should('have.text', metrics[0]);
3131

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/csm_dashboard.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import { Given, Then } from 'cypress-cucumber-preprocessor/steps';
88
import { loginAndWaitForPage } from '../../../integration/helpers';
99
import { verifyClientMetrics } from './client_metrics_helper';
10+
import { waitForLoadingToFinish } from './utils';
1011

1112
/** The default time in ms to wait for a Cypress command to complete */
1213
export const DEFAULT_TIMEOUT = { timeout: 60 * 1000 };
@@ -36,9 +37,9 @@ Then(`should display percentile for page load chart`, () => {
3637

3738
cy.get('.euiLoadingChart', DEFAULT_TIMEOUT).should('be.visible');
3839

39-
// wait for all loading to finish
40-
cy.get('kbnLoadingIndicator').should('not.be.visible');
41-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
40+
waitForLoadingToFinish();
41+
42+
cy.get('.euiStat__title-isLoading').should('not.exist');
4243

4344
cy.get(pMarkers).eq(0).should('have.text', '50th');
4445

@@ -52,21 +53,19 @@ Then(`should display percentile for page load chart`, () => {
5253
Then(`should display chart legend`, () => {
5354
const chartLegend = 'div.echLegendItem__label';
5455

55-
// wait for all loading to finish
56-
cy.get('kbnLoadingIndicator').should('not.be.visible');
57-
cy.get('.euiLoadingChart').should('not.be.visible');
56+
waitForLoadingToFinish();
57+
cy.get('.euiLoadingChart').should('not.exist');
5858

5959
cy.get(chartLegend, DEFAULT_TIMEOUT).eq(0).should('have.text', 'Overall');
6060
});
6161

6262
Then(`should display tooltip on hover`, () => {
63-
cy.get('.euiLoadingChart').should('not.be.visible');
63+
cy.get('.euiLoadingChart').should('not.exist');
6464

6565
const pMarkers = '[data-cy=percentile-markers] span.euiToolTipAnchor';
6666

67-
// wait for all loading to finish
68-
cy.get('kbnLoadingIndicator').should('not.be.visible');
69-
cy.get('.euiLoadingChart').should('not.be.visible');
67+
waitForLoadingToFinish();
68+
cy.get('.euiLoadingChart').should('not.exist');
7069

7170
const marker = cy.get(pMarkers, DEFAULT_TIMEOUT).eq(0);
7271
marker.invoke('show');

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/csm_filters.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
88
import { DEFAULT_TIMEOUT } from './csm_dashboard';
99
import { verifyClientMetrics } from './client_metrics_helper';
10+
import { waitForLoadingToFinish } from './utils';
1011

1112
When(/^the user filters by "([^"]*)"$/, (filterName) => {
12-
// wait for all loading to finish
13-
cy.get('kbnLoadingIndicator').should('not.be.visible');
14-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
13+
waitForLoadingToFinish();
14+
cy.get('.euiStat__title-isLoading').should('not.exist');
1515
cy.get(`#local-filter-${filterName}`).click();
1616

1717
cy.get(`#local-filter-popover-${filterName}`, DEFAULT_TIMEOUT).within(() => {
@@ -51,9 +51,8 @@ When(/^the user filters by "([^"]*)"$/, (filterName) => {
5151
});
5252

5353
Then(/^it filters the client metrics "([^"]*)"$/, (filterName) => {
54-
// wait for all loading to finish
55-
cy.get('kbnLoadingIndicator').should('not.be.visible');
56-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
54+
waitForLoadingToFinish();
55+
cy.get('.euiStat__title-isLoading').should('not.exist');
5756

5857
const data =
5958
filterName === 'os'

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/js_errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { DEFAULT_TIMEOUT } from './csm_dashboard';
99
import { getDataTestSubj } from './utils';
1010

1111
Then(`it displays list of relevant js errors`, () => {
12-
cy.get('.euiBasicTable-loading').should('not.be.visible');
13-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
12+
cy.get('.euiBasicTable-loading').should('not.exist');
13+
cy.get('.euiStat__title-isLoading').should('not.exist');
1414

1515
getDataTestSubj('uxJsErrorsTotal').should('have.text', 'Total errors112');
1616

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/percentile_select.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66

77
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
88
import { verifyClientMetrics } from './client_metrics_helper';
9-
import { getDataTestSubj } from './utils';
9+
import { getDataTestSubj, waitForLoadingToFinish } from './utils';
1010

1111
When('the user changes the selected percentile', () => {
12-
// wait for all loading to finish
13-
cy.get('kbnLoadingIndicator').should('not.be.visible');
12+
waitForLoadingToFinish();
1413

1514
getDataTestSubj('uxPercentileSelect').select('95');
1615
});

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/service_name_filter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
88
import { verifyClientMetrics } from './client_metrics_helper';
99
import { DEFAULT_TIMEOUT } from './csm_dashboard';
10+
import { waitForLoadingToFinish } from './utils';
1011

1112
When('the user changes the selected service name', () => {
12-
// wait for all loading to finish
13-
cy.get('kbnLoadingIndicator').should('not.be.visible');
13+
waitForLoadingToFinish();
1414
cy.get(`[data-cy=serviceNameFilter]`, DEFAULT_TIMEOUT).select('client');
1515
});
1616

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/url_search_filter.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
import { When, Then } from 'cypress-cucumber-preprocessor/steps';
88
import { DEFAULT_TIMEOUT } from './csm_dashboard';
9+
import { waitForLoadingToFinish } from './utils';
910

1011
When(`a user clicks inside url search field`, () => {
11-
// wait for all loading to finish
12-
cy.get('kbnLoadingIndicator').should('not.be.visible');
13-
cy.get('.euiStat__title-isLoading').should('not.be.visible');
12+
waitForLoadingToFinish();
13+
cy.get('.euiStat__title-isLoading').should('not.exist');
1414
cy.get('span[data-cy=csmUrlFilter]', DEFAULT_TIMEOUT).within(() => {
1515
cy.get('input.euiFieldSearch').click();
1616
});
1717
});
1818

1919
Then(`it displays top pages in the suggestion popover`, () => {
20-
cy.get('kbnLoadingIndicator').should('not.be.visible');
20+
waitForLoadingToFinish();
2121

2222
cy.get('div.euiPopover__panel-isOpen', DEFAULT_TIMEOUT).within(() => {
2323
const listOfUrls = cy.get('li.euiSelectableListItem');
@@ -38,17 +38,17 @@ Then(`it displays top pages in the suggestion popover`, () => {
3838
});
3939

4040
When(`a user enters a query in url search field`, () => {
41-
cy.get('kbnLoadingIndicator').should('not.be.visible');
41+
waitForLoadingToFinish();
4242

4343
cy.get('[data-cy=csmUrlFilter]').within(() => {
4444
cy.get('input.euiSelectableSearch').type('cus');
4545
});
4646

47-
cy.get('kbnLoadingIndicator').should('not.be.visible');
47+
waitForLoadingToFinish();
4848
});
4949

5050
Then(`it should filter results based on query`, () => {
51-
cy.get('kbnLoadingIndicator').should('not.be.visible');
51+
waitForLoadingToFinish();
5252

5353
cy.get('div.euiPopover__panel-isOpen', DEFAULT_TIMEOUT).within(() => {
5454
const listOfUrls = cy.get('li.euiSelectableListItem');

x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66

77
import { DEFAULT_TIMEOUT } from './csm_dashboard';
88

9+
export function waitForLoadingToFinish() {
10+
cy.get('[data-test-subj=globalLoadingIndicator-hidden]', DEFAULT_TIMEOUT);
11+
}
12+
913
export function getDataTestSubj(dataTestSubj: string) {
10-
// wait for all loading to finish
11-
cy.get('kbnLoadingIndicator').should('not.be.visible');
14+
waitForLoadingToFinish();
1215

1316
return cy.get(`[data-test-subj=${dataTestSubj}]`, DEFAULT_TIMEOUT);
1417
}

0 commit comments

Comments
 (0)