Skip to content

Commit d3eccf0

Browse files
authored
Restructure Runs Overview Tests (#1985)
* cherry-pick test * mock
1 parent be02074 commit d3eccf0

4 files changed

Lines changed: 809 additions & 828 deletions

File tree

test/api/qcFlags.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ module.exports = () => {
7474
it('should successfully get non-empty QC flag summary for data pass', async () => {
7575
const response = await request(server).get('/api/qcFlags/summary?dataPassId=1');
7676
expect(response.status).to.be.equal(200);
77+
7778
const { body: { data } } = response;
7879
expect(data).to.be.eql({
7980
106: {

test/public/defaults.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ module.exports.waitForTableTotalRowsCountToEqual = async (page, amount) => {
179179
amount,
180180
);
181181
} catch {
182-
const actualCount = (await page.$$('#totalRowsCount')).innerText;
182+
const element = await page.$$('#totalRowsCount')
183+
const actualCount = element.innerText;
183184
throw new Error(`Expected total rows count ${amount}, but got ${actualCount}`);
184185
}
185186
};
@@ -893,3 +894,26 @@ module.exports.getPeriodInputsSelectors = (popoverSelector) => {
893894
toTimeSelector: `${commonInputsAncestor} > div:nth-child(2) input:nth-child(2)`,
894895
};
895896
};
897+
898+
/**
899+
* Open filtering panel
900+
* @param {puppeteer.page} page page handler
901+
*/
902+
module.exports.openFilteringPanel = async (page) => {
903+
await page.waitForSelector('#reset-filters', { visible: true }).catch(async () => {
904+
await this.pressElement(page, '#openFilterToggle');
905+
})
906+
};
907+
908+
/**
909+
* Reset standard filtering
910+
* Excecution of this function does not change visibility of filtering popover
911+
* @param {puppeteer.page} page page handler
912+
*/
913+
module.exports.resetFilters = async (page) => {
914+
await page.waitForSelector('#reset-filters', { visible: true }).then(() => this.pressElement(page, '#reset-filters')).catch(async () => {
915+
await this.pressElement(page, '#openFilterToggle');
916+
await this.pressElement(page, '#reset-filters');
917+
await this.pressElement(page, '#openFilterToggle');
918+
})
919+
};

test/public/runs/navigationUtils.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,34 @@
1111
* or submit itself to any jurisdiction.
1212
*/
1313

14-
const { waitForNavigation, pressElement, getInnerText, expectUrlParams, waitForTableLength } = require('../defaults.js');
14+
const { waitForNavigation, pressElement, expectUrlParams, waitForTableLength } = require('../defaults.js');
15+
16+
/**
17+
* Navigate to runs overview page
18+
*
19+
* @param {Puppeteer.Page} page page
20+
* @return {Promise<void>} promise
21+
*/
22+
exports.navigateToRunsOverview = async (page) => {
23+
await waitForNavigation(page, () => pressElement(page, 'a#run-overview', true));
24+
};
25+
26+
27+
/**
28+
* Navigate to Runs per LHC period
29+
*
30+
* @param {Puppeteer.Page} page page
31+
* @param {number} lhcPeriodId id of lhc period on LHC Period overview page
32+
* @param {number} expectedRowsCount expected number of rows on runs per data pass page
33+
* @return {Promise<void>} promise
34+
*/
35+
exports.navigateToRunsPerLhcPeriod = async (page, lhcPeriodId, expectedRowsCount, tabPanel='detectorQualities') => {
36+
await waitForNavigation(page, () => pressElement(page, 'a#lhc-period-overview', true));
37+
await waitForNavigation(page, () => pressElement(page, `#row${lhcPeriodId}-associatedRuns a`, true));
38+
await pressElement(page, `#${tabPanel}-tab`, true);
39+
expectUrlParams(page, { page: 'runs-per-lhc-period', lhcPeriodId, panel: tabPanel }, ['pdpBeamType']);
40+
await waitForTableLength(page, expectedRowsCount);
41+
};
1542

1643
/**
1744
* Navigate to Runs per Data Pass page
@@ -32,6 +59,7 @@ exports.navigateToRunsPerDataPass = async (page, lhcPeriodId, dataPassId, expect
3259
await waitForTableLength(page, expectedRowsCount);
3360
};
3461

62+
3563
/**
3664
* Navigate to Runs per Simulation Pass page
3765
*

0 commit comments

Comments
 (0)