diff --git a/cypress/commons/actions/generic/Dashboards.js b/cypress/commons/actions/generic/Dashboards.js new file mode 100644 index 000000000..914e122c5 --- /dev/null +++ b/cypress/commons/actions/generic/Dashboards.js @@ -0,0 +1,7 @@ +// Copyright (c) Cosmo Tech. +// Licensed under the MIT license. +import { GENERIC_SELECTORS } from '../../constants/generic/IdConstants'; + +export const getDashboardsTab = (timeout = 5) => { + return cy.get(GENERIC_SELECTORS.dashboards.tabName, { timeout: timeout * 1000 }); +}; diff --git a/cypress/e2e/brewery/ResultsDashboards-DisplayDisabled.cy.js b/cypress/e2e/brewery/ResultsDashboards-DisplayDisabled.cy.js index 08c2b25c1..1a96e3e83 100644 --- a/cypress/e2e/brewery/ResultsDashboards-DisplayDisabled.cy.js +++ b/cypress/e2e/brewery/ResultsDashboards-DisplayDisabled.cy.js @@ -1,7 +1,7 @@ // Copyright (c) Cosmo Tech. // Licensed under the MIT license. import { Login, ScenarioParameters, Scenarios } from '../../commons/actions'; -import { GENERIC_SELECTORS } from '../../commons/constants/generic/IdConstants'; +import { getDashboardsTab } from '../../commons/actions/generic/Dashboards'; import { stub } from '../../commons/services/stubbing'; import { WORKSPACE_WITHOUT_DASHBOARDS } from '../../fixtures/stubbing/ScenarioViewDashboard/workspace'; import { DEFAULT_SCENARIOS_LIST } from '../../fixtures/stubbing/default'; @@ -31,7 +31,7 @@ describe('results display is disabled', () => { }); it('can launch a scenario and show Display of results is disabled dashboard', () => { - cy.get(GENERIC_SELECTORS.dashboards.tabName).should('not.exist'); + getDashboardsTab().should('not.exist'); ScenarioParameters.launch({ scenarioId, runOptions, saveAndLaunch: true }); ScenarioParameters.waitForScenarioRunEnd(); Scenarios.getDashboardAccordionLogsDownloadButton().should('be.visible'); diff --git a/cypress/e2e/brewery/Router-RedirectionFromDisabledView.cy.js b/cypress/e2e/brewery/Router-RedirectionFromDisabledView.cy.js index 656938280..687e83233 100644 --- a/cypress/e2e/brewery/Router-RedirectionFromDisabledView.cy.js +++ b/cypress/e2e/brewery/Router-RedirectionFromDisabledView.cy.js @@ -1,7 +1,7 @@ // Copyright (c) Cosmo Tech. // Licensed under the MIT license. import { DatasetManager, InstanceVisualization, Login } from '../../commons/actions'; -import { GENERIC_SELECTORS } from '../../commons/constants/generic/IdConstants'; +import { getDashboardsTab } from '../../commons/actions/generic/Dashboards'; import { stub } from '../../commons/services/stubbing'; import { routeUtils as route } from '../../commons/utils'; import { @@ -54,6 +54,6 @@ describe('redirection from disabled view', () => { expectedURL: `${WORKSPACE_WITHOUT_DASHBOARDS.id}/scenario/${scenarioId}`, isPowerBiEnabled: false, }); - cy.get(GENERIC_SELECTORS.dashboards.tabName).should('not.exist'); + getDashboardsTab().should('not.exist'); }); }); diff --git a/cypress/e2e/brewery/ScenarioViewDashboard.cy.js b/cypress/e2e/brewery/ScenarioViewDashboard.cy.js index 5d7b11ff0..37c0bdb3f 100644 --- a/cypress/e2e/brewery/ScenarioViewDashboard.cy.js +++ b/cypress/e2e/brewery/ScenarioViewDashboard.cy.js @@ -2,7 +2,7 @@ // Licensed under the MIT license. import { Login, Scenarios, ScenarioParameters } from '../../commons/actions'; import { BreweryParameters } from '../../commons/actions/brewery'; -import { GENERIC_SELECTORS } from '../../commons/constants/generic/IdConstants'; +import { getDashboardsTab } from '../../commons/actions/generic/Dashboards'; import { stub } from '../../commons/services/stubbing'; import { DEFAULT_SCENARIOS_LIST } from '../../fixtures/stubbing/default'; @@ -30,7 +30,7 @@ describe('Scenario view PowerBI report', () => { it('can correctly show "out of sync" dashboard warning & "logs download" button', () => { // check Dashboard view tab to ensure dashboard config exists - cy.get(GENERIC_SELECTORS.dashboards.tabName).should('be.visible'); + getDashboardsTab().should('be.visible'); ScenarioParameters.expandParametersAccordion();