Skip to content

Commit 9446537

Browse files
committed
add naviagtion util
1 parent 867bf0b commit 9446537

4 files changed

Lines changed: 26 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"sequelize": "sequelize-cli",
1111
"start:dev": "nodemon --ignore 'lib/public/**/*.js' lib/main.js",
1212
"start:prod": "node lib/main.js",
13-
"test": "mocha --exit --timeout 0",
13+
"test": "mocha --exit --timeout 0 --grep 'Runs Per Simulation Pass Overview Page'",
1414
"test:subset": "nyc -- mocha --exit --timeout 0 test/scripts/test-${TEST_TYPE}.js && nyc report --report-dir=/usr/src/app/coverage/${TEST_TYPE} --reporter=json",
1515
"test:subset-local": "mocha --exit --timeout 0 --reporter test/scripts/parallel-local/custom-mocha-reporter.js test/scripts/test-${TEST_TYPE}.js",
1616
"docker-run": "docker compose -f docker-compose.yml -f docker-compose.dev.yml up --build",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,23 @@ exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expect
1919
expectUrlParams(page, { page: 'runs-per-data-pass', dataPassId, pdpBeamType });
2020
await waitForTableLength(page, expectedRowsCount);
2121
};
22+
23+
/**
24+
* Navigate to Runs per Simulation Pass page
25+
*
26+
* @param {Puppeteer.Page} page page
27+
* @param {number} lhcPeriodId id of lhc period on LHC Period overview page
28+
* @param {number} simulationPassId id of data pass on Data Passes per LHC Period page
29+
* @param {number} expectedRowsCount expected number of rows on runs per data pass page
30+
* @return {Promise<void>} promise
31+
*/
32+
exports.navigateToRunsPerSimulationPass = async (page, lhcPeriodId, simulationPassId, expectedRowsCount) => {
33+
await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true));
34+
const pdpBeamType = await getInnerText(await page.waitForSelector(`#row${lhcPeriodId}-beamTypes`));
35+
await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedDataPasses a`, true));
36+
expectUrlParams(page, { page: 'simulation-passes-per-lhc-period-overview', lhcPeriodId });
37+
await page.waitForSelector('th#description');
38+
await waitForNavigation(page, () => pressElement(page, `#row${simulationPassId}-associatedRuns a`, true));
39+
expectUrlParams(page, { page: 'runs-per-simulation-pass', dataPassId: simulationPassId, pdpBeamType });
40+
await waitForTableLength(page, expectedRowsCount);
41+
};

test/public/runs/runsPerDataPass.overview.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const {
3939
const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js');
4040
const DataPassRepository = require('../../../lib/database/repositories/DataPassRepository.js');
4141
const { BkpRoles } = require('../../../lib/domain/enums/BkpRoles.js');
42-
const { navigateToRunsPerDataPass } = require('./dataPassesUtilities.js');
42+
const { navigateToRunsPerDataPass } = require('./navigationUtils.js');
4343

4444
const { expect } = chai;
4545

test/public/runs/runsPerSimulationPass.overview.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ const {
3030
expectUrlParams,
3131
testTableSortingByColumn,
3232
waitForTableLength,
33+
expectColumnValues,
3334
} = require('../defaults.js');
3435

3536
const { expect } = chai;
3637
const { qcFlagService } = require('../../../lib/server/services/qualityControlFlag/QcFlagService');
3738
const { resetDatabaseContent } = require('../../utilities/resetDatabaseContent.js');
39+
const { navigateToRunsPerSimulationPass } = require('./navigationUtils.js');
3840

3941
const DETECTORS = [
4042
'CPV',
@@ -192,6 +194,7 @@ module.exports = () => {
192194

193195

194196
it('should successfully apply detectors notBadFraction filters', async () => {
197+
await navigateToRunsPerSimulationPass(page, 2, 1, 3);
195198
await pressElement(page, '#openFilterToggle', true);
196199

197200
await page.waitForSelector('#detectorsQc-for-1-notBadFraction-operator');
@@ -202,6 +205,7 @@ module.exports = () => {
202205
await pressElement(page, '#openFilterToggle', true);
203206
await pressElement(page, '#reset-filters', true);
204207
await expectColumnValues(page, 'runNumber', ['107', '106', '105']);
208+
await navigateToRunsPerSimulationPass(page, 1, 2, 3);
205209
});
206210

207211
it('should successfully export runs', async () => {

0 commit comments

Comments
 (0)