Skip to content

Commit 0b11787

Browse files
authored
[Bug]Fix flakey reports test in 2.9 (#1736)
* updated edit reports test to match gitfram Signed-off-by: sumukhswamy <sumukhhs@amazon.com> * updated edit reports test to match gitfram Signed-off-by: sumukhswamy <sumukhhs@amazon.com> --------- Signed-off-by: sumukhswamy <sumukhhs@amazon.com>
1 parent 21c5e45 commit 0b11787

File tree

2 files changed

+92
-12
lines changed

2 files changed

+92
-12
lines changed

cypress/integration/plugins/reports-dashboards/02-edit.spec.js

+84-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ describe('Cypress', () => {
1717

1818
cy.wait(12500);
1919

20+
cy.intercept(
21+
'GET',
22+
`${BASE_PATH}/api/reporting/getReportSource/dashboard`
23+
).as('dashboard');
24+
25+
cy.intercept(
26+
'GET',
27+
`${BASE_PATH}/api/reporting/getReportSource/visualization`
28+
).as('visualization');
29+
30+
cy.intercept('GET', `${BASE_PATH}/api/reporting/getReportSource/search`).as(
31+
'search'
32+
);
33+
34+
cy.intercept('GET', `${BASE_PATH}/api/observability/notebooks/`).as(
35+
'notebook'
36+
);
37+
2038
cy.get('#reportDefinitionDetailsLink').first().click({ force: true });
2139

2240
cy.get('#editReportDefinitionButton').should('exist');
@@ -26,14 +44,23 @@ describe('Cypress', () => {
2644
cy.url().should('include', 'edit');
2745

2846
cy.wait(1000);
47+
cy.wait('@dashboard');
48+
cy.wait('@visualization');
49+
cy.wait('@search');
50+
cy.wait('@notebook');
2951

3052
// update the report name
31-
cy.get('#reportSettingsName').type(' update name');
53+
cy.get('#reportSettingsName').type('{selectall}{backspace} update name');
3254

3355
// update report description
34-
cy.get('#reportSettingsDescription').type(' update description');
56+
cy.get('#reportSettingsDescription').type(
57+
'{selectall}{backspace} update description'
58+
);
3559

36-
cy.get('#editReportDefinitionButton').click({ force: true });
60+
cy.get('#editReportDefinitionButton')
61+
.contains('Save Changes')
62+
.trigger('mouseover')
63+
.click({ force: true });
3764

3865
cy.wait(12500);
3966

@@ -52,6 +79,24 @@ describe('Cypress', () => {
5279

5380
cy.wait(12500);
5481

82+
cy.intercept(
83+
'GET',
84+
`${BASE_PATH}/api/reporting/getReportSource/dashboard`
85+
).as('dashboard');
86+
87+
cy.intercept(
88+
'GET',
89+
`${BASE_PATH}/api/reporting/getReportSource/visualization`
90+
).as('visualization');
91+
92+
cy.intercept('GET', `${BASE_PATH}/api/reporting/getReportSource/search`).as(
93+
'search'
94+
);
95+
96+
cy.intercept('GET', `${BASE_PATH}/api/observability/notebooks/`).as(
97+
'notebook'
98+
);
99+
55100
cy.get('#reportDefinitionDetailsLink').first().click();
56101

57102
cy.get('#editReportDefinitionButton').should('exist');
@@ -61,12 +106,20 @@ describe('Cypress', () => {
61106
cy.url().should('include', 'edit');
62107

63108
cy.wait(1000);
109+
110+
cy.wait('@dashboard');
111+
cy.wait('@visualization');
112+
cy.wait('@search');
113+
cy.wait('@notebook');
64114
cy.get('#reportDefinitionTriggerTypes > div:nth-child(2)').click({
65115
force: true,
66116
});
67117

68118
cy.get('#Schedule').check({ force: true });
69-
cy.get('#editReportDefinitionButton').click({ force: true });
119+
cy.get('#editReportDefinitionButton')
120+
.contains('Save Changes')
121+
.trigger('mouseover')
122+
.click({ force: true });
70123

71124
cy.wait(12500);
72125

@@ -85,6 +138,24 @@ describe('Cypress', () => {
85138

86139
cy.wait(12500);
87140

141+
cy.intercept(
142+
'GET',
143+
`${BASE_PATH}/api/reporting/getReportSource/dashboard`
144+
).as('dashboard');
145+
146+
cy.intercept(
147+
'GET',
148+
`${BASE_PATH}/api/reporting/getReportSource/visualization`
149+
).as('visualization');
150+
151+
cy.intercept('GET', `${BASE_PATH}/api/reporting/getReportSource/search`).as(
152+
'search'
153+
);
154+
155+
cy.intercept('GET', `${BASE_PATH}/api/observability/notebooks/`).as(
156+
'notebook'
157+
);
158+
88159
cy.get('#reportDefinitionDetailsLink').first().click();
89160

90161
cy.get('#editReportDefinitionButton').should('exist');
@@ -95,11 +166,19 @@ describe('Cypress', () => {
95166

96167
cy.wait(1000);
97168

169+
cy.wait('@dashboard');
170+
cy.wait('@visualization');
171+
cy.wait('@search');
172+
cy.wait('@notebook');
173+
98174
cy.get('#reportDefinitionTriggerTypes > div:nth-child(1)').click({
99175
force: true,
100176
});
101177

102-
cy.get('#editReportDefinitionButton').click({ force: true });
178+
cy.get('#editReportDefinitionButton')
179+
.contains('Save Changes')
180+
.trigger('mouseover')
181+
.click({ force: true });
103182

104183
cy.wait(12500);
105184

cypress/integration/plugins/reports-dashboards/04-download.spec.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ describe('Cypress', () => {
2828
});
2929

3030
it('Download from reporting homepage', () => {
31-
cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, {
32-
waitForGetTenant: true,
33-
});
3431
cy.intercept('GET', `${BASE_PATH}/api/reporting/generateReport/*`).as(
3532
'generateReport'
3633
);
37-
34+
cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, {
35+
waitForGetTenant: true,
36+
});
3837
cy.location('pathname', { timeout: TIMEOUT }).should(
3938
'include',
4039
'/reports-dashboards'
@@ -112,6 +111,10 @@ describe('Cypress', () => {
112111
it('Download from Report definition details page', () => {
113112
// create an on-demand report definition
114113

114+
cy.intercept('POST', '/_dashboards/api/reporting/generateReport/*').as(
115+
'generateReport'
116+
);
117+
115118
cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, {
116119
waitForGetTenant: true,
117120
});
@@ -135,8 +138,6 @@ describe('Cypress', () => {
135138

136139
cy.get('#generateReportFromDetailsFileFormat').click({ force: true });
137140

138-
cy.get('.euiToastHeader__title')
139-
.contains('Successfully generated report')
140-
.should('exist');
141+
cy.wait('@generateReport').its('response.statusCode').should('eq', 200);
141142
});
142143
});

0 commit comments

Comments
 (0)