Skip to content

Commit

Permalink
test: add getDashboardTab selector function
Browse files Browse the repository at this point in the history
  • Loading branch information
esasova committed Jul 17, 2024
1 parent 4034f82 commit 425d1ea
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions cypress/commons/actions/generic/Dashboards.js
Original file line number Diff line number Diff line change
@@ -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 });
};
4 changes: 2 additions & 2 deletions cypress/e2e/brewery/ResultsDashboards-DisplayDisabled.cy.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/brewery/Router-RedirectionFromDisabledView.cy.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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');
});
});
4 changes: 2 additions & 2 deletions cypress/e2e/brewery/ScenarioViewDashboard.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 425d1ea

Please sign in to comment.