From 92a1f80e1602508ed70e2c6e36231de403b29384 Mon Sep 17 00:00:00 2001 From: arbulu89 Date: Thu, 16 May 2024 14:38:45 +0200 Subject: [PATCH] Load initial state only if needed --- test/e2e/cypress/e2e/about.cy.js | 1 + test/e2e/cypress/e2e/clusters_overview.cy.js | 1 + test/e2e/cypress/e2e/databases_overview.cy.js | 1 + .../cypress/e2e/hana_cluster_details.cy.js | 1 + .../cypress/e2e/hana_database_details.cy.js | 1 + test/e2e/cypress/e2e/home.cy.js | 1 + test/e2e/cypress/e2e/host_details.cy.js | 1 + test/e2e/cypress/e2e/hosts_overview.cy.js | 1 + test/e2e/cypress/e2e/sap_system_details.cy.js | 1 + .../cypress/e2e/sap_systems_overview.cy.js | 1 + test/e2e/cypress/e2e/saptune_details.cy.js | 1 + test/e2e/cypress/support/commands.js | 40 ------------------- test/e2e/cypress/support/e2e.js | 3 -- 13 files changed, 11 insertions(+), 43 deletions(-) diff --git a/test/e2e/cypress/e2e/about.cy.js b/test/e2e/cypress/e2e/about.cy.js index d86da21d97..bb83785dda 100644 --- a/test/e2e/cypress/e2e/about.cy.js +++ b/test/e2e/cypress/e2e/about.cy.js @@ -2,6 +2,7 @@ import { getValue } from '../support/common'; describe('User account page', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit('/about'); cy.url().should('include', '/about'); }); diff --git a/test/e2e/cypress/e2e/clusters_overview.cy.js b/test/e2e/cypress/e2e/clusters_overview.cy.js index 93664fb720..aae4add33a 100644 --- a/test/e2e/cypress/e2e/clusters_overview.cy.js +++ b/test/e2e/cypress/e2e/clusters_overview.cy.js @@ -15,6 +15,7 @@ const clusterTags = { context('Clusters Overview', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit('/clusters'); cy.url().should('include', '/clusters'); }); diff --git a/test/e2e/cypress/e2e/databases_overview.cy.js b/test/e2e/cypress/e2e/databases_overview.cy.js index c29829e411..c279ffc146 100644 --- a/test/e2e/cypress/e2e/databases_overview.cy.js +++ b/test/e2e/cypress/e2e/databases_overview.cy.js @@ -1,5 +1,6 @@ context('Databases Overview', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit('/databases'); cy.url().should('include', '/databases'); }); diff --git a/test/e2e/cypress/e2e/hana_cluster_details.cy.js b/test/e2e/cypress/e2e/hana_cluster_details.cy.js index 668d11cc38..c3f6f9f6fe 100644 --- a/test/e2e/cypress/e2e/hana_cluster_details.cy.js +++ b/test/e2e/cypress/e2e/hana_cluster_details.cy.js @@ -17,6 +17,7 @@ context('HANA cluster details', () => { const catalog = catalogFactory.build(); before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.intercept(lastExecutionURL, { body: lastExecution, }).as('lastExecution'); diff --git a/test/e2e/cypress/e2e/hana_database_details.cy.js b/test/e2e/cypress/e2e/hana_database_details.cy.js index ac588a1fc8..4ea5e38792 100644 --- a/test/e2e/cypress/e2e/hana_database_details.cy.js +++ b/test/e2e/cypress/e2e/hana_database_details.cy.js @@ -7,6 +7,7 @@ import { context('HANA database details', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit(`/databases/${selectedDatabase.Id}`); cy.url().should('include', `/databases/${selectedDatabase.Id}`); }); diff --git a/test/e2e/cypress/e2e/home.cy.js b/test/e2e/cypress/e2e/home.cy.js index a47f20cf22..48746422b6 100644 --- a/test/e2e/cypress/e2e/home.cy.js +++ b/test/e2e/cypress/e2e/home.cy.js @@ -1,5 +1,6 @@ context('Homepage', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit('/'); cy.url().should('include', '/'); }); diff --git a/test/e2e/cypress/e2e/host_details.cy.js b/test/e2e/cypress/e2e/host_details.cy.js index 889a7c9006..9d73887c61 100644 --- a/test/e2e/cypress/e2e/host_details.cy.js +++ b/test/e2e/cypress/e2e/host_details.cy.js @@ -6,6 +6,7 @@ import { context('Host Details', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.task('startAgentHeartbeat', [selectedHost.agentId]); cy.visit('/hosts'); diff --git a/test/e2e/cypress/e2e/hosts_overview.cy.js b/test/e2e/cypress/e2e/hosts_overview.cy.js index 3d90ee24dd..0281e875e0 100644 --- a/test/e2e/cypress/e2e/hosts_overview.cy.js +++ b/test/e2e/cypress/e2e/hosts_overview.cy.js @@ -7,6 +7,7 @@ const availableHosts1stPage = availableHosts.slice(0, 10); context('Hosts Overview', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit('/hosts'); cy.url().should('include', '/hosts'); }); diff --git a/test/e2e/cypress/e2e/sap_system_details.cy.js b/test/e2e/cypress/e2e/sap_system_details.cy.js index fa81c7c364..4b7f3a9672 100644 --- a/test/e2e/cypress/e2e/sap_system_details.cy.js +++ b/test/e2e/cypress/e2e/sap_system_details.cy.js @@ -6,6 +6,7 @@ import { context('SAP system details', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit(`/sap_systems/${selectedSystem.Id}`); cy.url().should('include', `/sap_systems/${selectedSystem.Id}`); }); diff --git a/test/e2e/cypress/e2e/sap_systems_overview.cy.js b/test/e2e/cypress/e2e/sap_systems_overview.cy.js index 0ca5f43d71..6194c3d63e 100644 --- a/test/e2e/cypress/e2e/sap_systems_overview.cy.js +++ b/test/e2e/cypress/e2e/sap_systems_overview.cy.js @@ -8,6 +8,7 @@ import { context('SAP Systems Overview', () => { before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit('/sap_systems'); cy.url().should('include', '/sap_systems'); }); diff --git a/test/e2e/cypress/e2e/saptune_details.cy.js b/test/e2e/cypress/e2e/saptune_details.cy.js index 1aea44d100..3670edf04c 100644 --- a/test/e2e/cypress/e2e/saptune_details.cy.js +++ b/test/e2e/cypress/e2e/saptune_details.cy.js @@ -16,6 +16,7 @@ describe('Saptune Details page', () => { const saptuneStagingStatusSelector = ':nth-child(11)'; before(() => { + cy.loadScenario('healthy-27-node-SAP-cluster'); cy.visit(`hosts/${hostID}/saptune`); }); diff --git a/test/e2e/cypress/support/commands.js b/test/e2e/cypress/support/commands.js index 0412c44804..4a80ac7831 100644 --- a/test/e2e/cypress/support/commands.js +++ b/test/e2e/cypress/support/commands.js @@ -62,18 +62,6 @@ Cypress.Commands.add('apiLogin', () => { }); }); -Cypress.Commands.add('acceptEula', () => { - apiLogin().then(({ accessToken }) => { - cy.request({ - url: '/api/v1/accept_eula', - method: 'POST', - auth: { - bearer: accessToken, - }, - body: {}, - }); - }); -}); Cypress.Commands.add('updateApiKeyExpiration', (apiKeyExpiration) => { apiLogin().then(({ accessToken }) => { @@ -177,34 +165,6 @@ Cypress.Commands.add('resetFilterSelection', (filterName) => { }); }); -Cypress.Commands.add('setMockRunnerExpectedResult', (result) => { - const [webAPIHost, webAPIPort] = [ - Cypress.env('web_api_host'), - Cypress.env('web_api_port'), - ]; - - const requestResultBody = JSON.stringify({ - expected_results: result, - }); - - const headers = { - 'Content-Type': 'application/json;charset=UTF-8', - }; - - apiLogin().then(({ accessToken }) => { - const url = `http://${webAPIHost}:${webAPIPort}/api/mockrunner/expected_result`; - cy.request({ - method: 'POST', - url: url, - body: requestResultBody, - headers: headers, - auth: { - bearer: accessToken, - }, - }); - }); -}); - Cypress.Commands.add('requestChecksExecution', (clusterId) => { const [webAPIHost, webAPIPort] = [ Cypress.env('web_api_host'), diff --git a/test/e2e/cypress/support/e2e.js b/test/e2e/cypress/support/e2e.js index 8552e480aa..2b07239bcc 100644 --- a/test/e2e/cypress/support/e2e.js +++ b/test/e2e/cypress/support/e2e.js @@ -23,8 +23,5 @@ import './commands'; // before(() => { - if (!Cypress.env('REAL_CLUSTER_TESTS')) { - cy.loadScenario('healthy-27-node-SAP-cluster'); - } cy.initiateSession(); });