From 5bb56cd1954d512d343da701298bf9db307189ad Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Tue, 25 Feb 2025 11:22:32 -0800 Subject: [PATCH 1/2] updated edit reports test to match gitfram Signed-off-by: sumukhswamy --- .../reports-dashboards/02-edit.spec.js | 91 +++++++++++++++++-- .../reports-dashboards/04-download.spec.js | 15 ++- 2 files changed, 92 insertions(+), 14 deletions(-) diff --git a/cypress/integration/plugins/reports-dashboards/02-edit.spec.js b/cypress/integration/plugins/reports-dashboards/02-edit.spec.js index 152094d61..65df06bd0 100644 --- a/cypress/integration/plugins/reports-dashboards/02-edit.spec.js +++ b/cypress/integration/plugins/reports-dashboards/02-edit.spec.js @@ -17,6 +17,24 @@ describe('Cypress', () => { cy.wait(12500); + cy.intercept( + 'GET', + `${BASE_PATH}/api/reporting/getReportSource/dashboard` + ).as('dashboard'); + + cy.intercept( + 'GET', + `${BASE_PATH}/api/reporting/getReportSource/visualization` + ).as('visualization'); + + cy.intercept('GET', `${BASE_PATH}/api/reporting/getReportSource/search`).as( + 'search' + ); + + cy.intercept('GET', `${BASE_PATH}/api/observability/notebooks/`).as( + 'notebook' + ); + cy.get('#reportDefinitionDetailsLink').first().click({ force: true }); cy.get('#editReportDefinitionButton').should('exist'); @@ -26,14 +44,23 @@ describe('Cypress', () => { cy.url().should('include', 'edit'); cy.wait(1000); + cy.wait('@dashboard'); + cy.wait('@visualization'); + cy.wait('@search'); + cy.wait('@notebook'); // update the report name - cy.get('#reportSettingsName').type(' update name'); + cy.get('#reportSettingsName').type('{selectall}{backspace} update name'); // update report description - cy.get('#reportSettingsDescription').type(' update description'); + cy.get('#reportSettingsDescription').type( + '{selectall}{backspace} update description' + ); - cy.get('#editReportDefinitionButton').click({ force: true }); + cy.get('#editReportDefinitionButton') + .contains('Save Changes') + .trigger('mouseover') + .click({ force: true }); cy.wait(12500); @@ -52,6 +79,24 @@ describe('Cypress', () => { cy.wait(12500); + cy.intercept( + 'GET', + `${BASE_PATH}/api/reporting/getReportSource/dashboard` + ).as('dashboard'); + + cy.intercept( + 'GET', + `${BASE_PATH}/api/reporting/getReportSource/visualization` + ).as('visualization'); + + cy.intercept('GET', `${BASE_PATH}/api/reporting/getReportSource/search`).as( + 'search' + ); + + cy.intercept('GET', `${BASE_PATH}/api/observability/notebooks/`).as( + 'notebook' + ); + cy.get('#reportDefinitionDetailsLink').first().click(); cy.get('#editReportDefinitionButton').should('exist'); @@ -61,12 +106,20 @@ describe('Cypress', () => { cy.url().should('include', 'edit'); cy.wait(1000); + + cy.wait('@dashboard'); + cy.wait('@visualization'); + cy.wait('@search'); + cy.wait('@notebook'); cy.get('#reportDefinitionTriggerTypes > div:nth-child(2)').click({ force: true, }); cy.get('#Schedule').check({ force: true }); - cy.get('#editReportDefinitionButton').click({ force: true }); + cy.get('#editReportDefinitionButton') + .contains('Save Changes') + .trigger('mouseover') + .click({ force: true }); cy.wait(12500); @@ -85,6 +138,24 @@ describe('Cypress', () => { cy.wait(12500); + cy.intercept( + 'GET', + `${BASE_PATH}/api/reporting/getReportSource/dashboard` + ).as('dashboard'); + + cy.intercept( + 'GET', + `${BASE_PATH}/api/reporting/getReportSource/visualization` + ).as('visualization'); + + cy.intercept('GET', `${BASE_PATH}/api/reporting/getReportSource/search`).as( + 'search' + ); + + cy.intercept('GET', `${BASE_PATH}/api/observability/notebooks/`).as( + 'notebook' + ); + cy.get('#reportDefinitionDetailsLink').first().click(); cy.get('#editReportDefinitionButton').should('exist'); @@ -95,15 +166,23 @@ describe('Cypress', () => { cy.wait(1000); + cy.wait('@dashboard'); + cy.wait('@visualization'); + cy.wait('@search'); + cy.wait('@notebook'); + cy.get('#reportDefinitionTriggerTypes > div:nth-child(1)').click({ force: true, }); - cy.get('#editReportDefinitionButton').click({ force: true }); + cy.get('#editReportDefinitionButton') + .contains('Save Changes') + .trigger('mouseover') + .click({ force: true }); cy.wait(12500); // check that re-direct to home page cy.get('#reportDefinitionDetailsLink').should('exist'); }); -}); +}); \ No newline at end of file diff --git a/cypress/integration/plugins/reports-dashboards/04-download.spec.js b/cypress/integration/plugins/reports-dashboards/04-download.spec.js index 64fcea9d0..71471d171 100644 --- a/cypress/integration/plugins/reports-dashboards/04-download.spec.js +++ b/cypress/integration/plugins/reports-dashboards/04-download.spec.js @@ -28,13 +28,12 @@ describe('Cypress', () => { }); it('Download from reporting homepage', () => { - cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, { - waitForGetTenant: true, - }); cy.intercept('GET', `${BASE_PATH}/api/reporting/generateReport/*`).as( 'generateReport' ); - + cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, { + waitForGetTenant: true, + }); cy.location('pathname', { timeout: TIMEOUT }).should( 'include', '/reports-dashboards' @@ -112,6 +111,8 @@ describe('Cypress', () => { it('Download from Report definition details page', () => { // create an on-demand report definition + cy.intercept('POST', '/_dashboards/api/reporting/generateReport/*').as('generateReport'); + cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, { waitForGetTenant: true, }); @@ -135,8 +136,6 @@ describe('Cypress', () => { cy.get('#generateReportFromDetailsFileFormat').click({ force: true }); - cy.get('.euiToastHeader__title') - .contains('Successfully generated report') - .should('exist'); + cy.wait('@generateReport').its('response.statusCode').should('eq', 200); }); -}); +}); \ No newline at end of file From 3e148a497acf8dc49625a3576f9d3062d4ebb8ca Mon Sep 17 00:00:00 2001 From: sumukhswamy Date: Tue, 25 Feb 2025 11:22:46 -0800 Subject: [PATCH 2/2] updated edit reports test to match gitfram Signed-off-by: sumukhswamy --- .../integration/plugins/reports-dashboards/02-edit.spec.js | 2 +- .../plugins/reports-dashboards/04-download.spec.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cypress/integration/plugins/reports-dashboards/02-edit.spec.js b/cypress/integration/plugins/reports-dashboards/02-edit.spec.js index 65df06bd0..53ced4565 100644 --- a/cypress/integration/plugins/reports-dashboards/02-edit.spec.js +++ b/cypress/integration/plugins/reports-dashboards/02-edit.spec.js @@ -185,4 +185,4 @@ describe('Cypress', () => { // check that re-direct to home page cy.get('#reportDefinitionDetailsLink').should('exist'); }); -}); \ No newline at end of file +}); diff --git a/cypress/integration/plugins/reports-dashboards/04-download.spec.js b/cypress/integration/plugins/reports-dashboards/04-download.spec.js index 71471d171..f7b99dbde 100644 --- a/cypress/integration/plugins/reports-dashboards/04-download.spec.js +++ b/cypress/integration/plugins/reports-dashboards/04-download.spec.js @@ -111,7 +111,9 @@ describe('Cypress', () => { it('Download from Report definition details page', () => { // create an on-demand report definition - cy.intercept('POST', '/_dashboards/api/reporting/generateReport/*').as('generateReport'); + cy.intercept('POST', '/_dashboards/api/reporting/generateReport/*').as( + 'generateReport' + ); cy.visit(`${BASE_PATH}/app/reports-dashboards#/`, { waitForGetTenant: true, @@ -138,4 +140,4 @@ describe('Cypress', () => { cy.wait('@generateReport').its('response.statusCode').should('eq', 200); }); -}); \ No newline at end of file +});