Skip to content

Commit

Permalink
test: refactor scenario run stubbing and dataset manager selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
esasova authored and csm-thu committed Apr 26, 2024
1 parent 81e321e commit 366912f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cypress/commons/actions/generic/DatasetManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ export const getDatasetOverviewPlaceholderApiLink = () => cy.get(SELECTORS.overv

export const getIndicatorCard = (kpiId) => cy.get(SELECTORS.overview.indicators.cardByKpiId.replace('$KPI_ID', kpiId));
export const getKpiLoading = (parent) => parent.find(SELECTORS.overview.indicators.kpiLoading);
export const getKpiValue = (parent) => parent.find(SELECTORS.overview.indicators.kpiValue);
export const getKpiValue = (parent, timeout) =>
parent.find(SELECTORS.overview.indicators.kpiValue, timeout ? { timeout: timeout * 1000 } : undefined);
export const getKpiError = (parent) => parent.find(SELECTORS.overview.indicators.kpiError);
export const getKpiUnknownState = (parent) => parent.find(SELECTORS.overview.indicators.kpiUnknownState);

Expand Down
11 changes: 7 additions & 4 deletions cypress/commons/utils/apiUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright (c) Cosmo Tech.
// Licensed under the MIT license.
import { POLLING_START_DELAY } from '../../../src/services/config/FunctionalConstants';
import utils from '../../commons/TestUtils';
import { DEFAULT_DATASET, SCENARIO_EXAMPLE, SCENARIO_RUN_EXAMPLE } from '../../fixtures/stubbing/default';
import { API_ENDPOINT, API_REGEX, AUTH_QUERY_URL, URL_POWERBI, URL_ROOT } from '../constants/generic/TestConstants';
Expand Down Expand Up @@ -137,11 +138,13 @@ const interceptLaunchScenario = (stubbingOptions) => {
stub.patchScenario(scenarioId, { state: 'Running', lastRun: scenarioLastRun });

setTimeout(() => {
stub.patchScenario(scenarioId, { state: 'DataIngestionInProgress' });
setTimeout(() => {
stub.patchScenario(scenarioId, { state: finalStatus });
}, dataIngestionDuration);
}, runDuration);
stub.patchScenario(scenarioId, { state: 'DataIngestionInProgress' });
setTimeout(() => {
stub.patchScenario(scenarioId, { state: finalStatus });
}, dataIngestionDuration);
}, runDuration);
}, POLLING_START_DELAY);

req.reply(scenarioRun);
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/brewery/DatasetManager_e2e.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('End-to-end test of the dataset manager view', () => {
DatasetManager.getAllReuploadDatasetButtons().click();
DatasetManager.getConfirmDatasetRefreshButton().click();
DatasetManager.getAllReuploadDatasetInputs().attachFile(NINE_CUSTOMERS_DATASET_ZIP_FILE_PATH);
DatasetManager.getKpiValue(DatasetManager.getIndicatorCard('satisfaction_links_count')).should('have.text', 16);
DatasetManager.getKpiValue(DatasetManager.getIndicatorCard('satisfaction_links_count'), 10).should('have.text', 16);

DatasetManager.getAllDeleteDatasetButtons().click();
DatasetManager.getDeleteDatasetDialogBody().contains(fileDatasetName);
Expand Down

0 comments on commit 366912f

Please sign in to comment.