Skip to content

Commit

Permalink
Fix even more random tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboulais committed May 2, 2024
1 parent 5499bf6 commit 3d9fda4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
4 changes: 2 additions & 2 deletions test/public/lhcFills/detail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {
pressElement,
goToPage,
checkMismatchingUrlParam,
getPopoverContent, waitForTimeout,
getPopoverContent, waitForTimeout, waitForNavigation,
} = require('../defaults.js');
const { expect } = require('chai');

Expand Down Expand Up @@ -185,7 +185,7 @@ module.exports = () => {
it('should successfully expose a button to create a new log related to the displayed fill', async () => {
await goToPage(page, 'lhc-fill-details', { queryParameters: { fillNumber: 6 } });

await pressElement(page, '#create-log');
await waitForNavigation(page, () => pressElement(page, '#create-log'));

expect(await checkMismatchingUrlParam(page, { page: 'log-create', lhcFillNumbers: '6' })).to.eql({});

Expand Down
2 changes: 1 addition & 1 deletion test/public/logs/create.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ module.exports = () => {

await waitForNavigation(page, () => pressElement(page, '#parent-log-details'));

expect(await checkMismatchingUrlParam(page, { ['log-details']: '1' }));
expect(await checkMismatchingUrlParam(page, { ['log-details']: '1' })).to.eql({});
});

it('Should successfully display the autofilled runs, environments and lhcFills when replying', async () => {
Expand Down
4 changes: 2 additions & 2 deletions test/public/qcFlags/forDataPassCreation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ module.exports = () => {
},
});

await pressElement(page, 'h2:nth-of-type(2)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
expect(await checkMismatchingUrlParam(page, { page: 'runs-per-data-pass', dataPassId: '1' })).to.be.eql({});
});

Expand All @@ -88,7 +88,7 @@ module.exports = () => {
},
});

await pressElement(page, 'h2:nth-of-type(3)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(3)'));
expect(await checkMismatchingUrlParam(page, { page: 'run-detail', runNumber: '106' })).to.be.eql({});
});

Expand Down
2 changes: 1 addition & 1 deletion test/public/qcFlags/forDataPassOverview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await pressElement(page, 'h2:nth-of-type(2)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
expect(await checkMismatchingUrlParam(page, { page: 'runs-per-data-pass', dataPassId: '1' })).to.be.eql({});
});

Expand Down
4 changes: 2 additions & 2 deletions test/public/qcFlags/forSimulationPassCreation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await pressElement(page, 'h2:nth-of-type(2)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
expect(await checkMismatchingUrlParam(page, { page: 'runs-per-simulation-pass', simulationPassId: '1' })).to.be.eql({});
});

Expand All @@ -82,7 +82,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await pressElement(page, 'h2:nth-of-type(3)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(3)'));
expect(await checkMismatchingUrlParam(page, { page: 'run-detail', runNumber: '106' })).to.be.eql({});
});

Expand Down
5 changes: 3 additions & 2 deletions test/public/qcFlags/forSimulationPassOverview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const {

const { expect } = chai;
const dateAndTime = require('date-and-time');
const { waitForNavigation } = require('../defaults.js');

module.exports = () => {
let page;
Expand Down Expand Up @@ -71,7 +72,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await pressElement(page, 'h2:nth-of-type(2)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(2)'));
expect(await checkMismatchingUrlParam(page, { page: 'runs-per-simulation-pass', simulationPassId: '1' })).to.be.eql({});
});

Expand All @@ -82,7 +83,7 @@ module.exports = () => {
dplDetectorId: 1,
} });

await pressElement(page, 'h2:nth-of-type(3)');
await waitForNavigation(page, () => pressElement(page, 'h2:nth-of-type(3)'));
expect(await checkMismatchingUrlParam(page, { page: 'run-detail', runNumber: '106' })).to.be.eql({});
});

Expand Down
5 changes: 2 additions & 3 deletions test/public/runs/detail.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

const chai = require('chai');
const { defaultBefore, defaultAfter, expectInnerText, pressElement, getFirstRow } = require('../defaults');
const { reloadPage, goToPage, fillInput, checkMismatchingUrlParam, getPopoverContent, waitForTimeout } = require('../defaults.js');
const { reloadPage, goToPage, fillInput, checkMismatchingUrlParam, getPopoverContent, waitForTimeout, waitForNavigation } = require('../defaults.js');

Check failure on line 16 in test/public/runs/detail.test.js

View workflow job for this annotation

GitHub Actions / linter

This line has a length of 150. Maximum allowed is 145
const { RunCalibrationStatus } = require('../../../lib/domain/enums/RunCalibrationStatus.js');
const { getRun } = require('../../../lib/server/services/run/getRun.js');

Expand Down Expand Up @@ -429,8 +429,7 @@ module.exports = () => {
it('should successfully expose a button to create a new log related to the displayed environment', async () => {
await goToPage(page, 'run-detail', { queryParameters: { id: 106 } });

await pressElement(page, '#create-log');

await waitForNavigation(page, () => pressElement(page, '#create-log'));
expect(await checkMismatchingUrlParam(page, { page: 'log-create', runNumbers: '106', lhcFillNumbers: '1' })).to.eql({});

await page.waitForSelector('input#environments');
Expand Down
9 changes: 4 additions & 5 deletions test/public/runs/runsPerSimulationPass.overview.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const { waitForDownload } = require('../../utilities/waitForDownload');

const { expect } = chai;
const dateAndTime = require('date-and-time');
const { waitForNavigation } = require('../defaults.js');

const DETECTORS = [
'CPV',
Expand Down Expand Up @@ -161,10 +162,8 @@ module.exports = () => {
const runNumberLinkCellSelector = 'tbody tr:first-of-type a';
const expectedRunNumber = await getInnerText(await page.$(runNumberLinkCellSelector));

await pressElement(page, runNumberLinkCellSelector);

expect(await checkMismatchingUrlParam(page, { page: 'run-detail', runNumber: expectedRunNumber }))
.to.be.eql({});
await waitForNavigation(page, () => pressElement(page, runNumberLinkCellSelector));
expect(await checkMismatchingUrlParam(page, { page: 'run-detail', runNumber: expectedRunNumber })).to.be.eql({});
});

it('should successfully export runs', async () => {
Expand Down Expand Up @@ -207,6 +206,6 @@ module.exports = () => {
{ runNumber: 54, runQuality: 'good' },
{ runNumber: 49, runQuality: 'good' },
]),
fs.unlinkSync(path.resolve(downloadPath, targetFileName));
fs.unlinkSync(path.resolve(downloadPath, targetFileName));

Check failure on line 209 in test/public/runs/runsPerSimulationPass.overview.test.js

View workflow job for this annotation

GitHub Actions / linter

Expected indentation of 8 spaces but found 12
});
};

0 comments on commit 3d9fda4

Please sign in to comment.