Skip to content

Commit 1327653

Browse files
Bump the dev-dependencies group with 3 updates (#1399)
* Bump the dev-dependencies group with 3 updates Bumps the dev-dependencies group with 3 updates: [chai](https://github.com/chaijs/chai), [mocha](https://github.com/mochajs/mocha) and [puppeteer](https://github.com/puppeteer/puppeteer). Updates `chai` from 4.3.4 to 4.4.1 - [Release notes](https://github.com/chaijs/chai/releases) - [Changelog](https://github.com/chaijs/chai/blob/main/History.md) - [Commits](chaijs/chai@v4.3.4...v4.4.1) Updates `mocha` from 10.2.0 to 10.3.0 - [Release notes](https://github.com/mochajs/mocha/releases) - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md) - [Commits](mochajs/mocha@v10.2.0...v10.3.0) Updates `puppeteer` from 21.6.1 to 22.0.0 - [Release notes](https://github.com/puppeteer/puppeteer/releases) - [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json) - [Commits](puppeteer/puppeteer@puppeteer-v21.6.1...puppeteer-v22.0.0) --- updated-dependencies: - dependency-name: chai dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: mocha dependency-type: direct:development update-type: version-update:semver-minor dependency-group: dev-dependencies - dependency-name: puppeteer dependency-type: direct:development update-type: version-update:semver-major dependency-group: dev-dependencies ... Signed-off-by: dependabot[bot] <support@github.com> * Polyfill pupeteer waitForTimeout * Polyfill more * Minor fix --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: martinboulais <31805063+martinboulais@users.noreply.github.com>
1 parent 1a12f50 commit 1327653

21 files changed

Lines changed: 637 additions & 572 deletions

package-lock.json

Lines changed: 325 additions & 285 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
],
4040
"devDependencies": {
4141
"@types/d3": "7.4.0",
42-
"chai": "4.3.4",
42+
"chai": "4.4.1",
4343
"eslint": "8.56.0",
4444
"js-yaml": "4.1.0",
45-
"mocha": "10.2.0",
45+
"mocha": "10.3.0",
4646
"nodemon": "3.0.1",
4747
"nyc": "15.1.0",
48-
"puppeteer": "21.6.1",
48+
"puppeteer": "22.0.0",
4949
"puppeteer-to-istanbul": "1.4.0",
5050
"sequelize-cli": "6.6.0",
5151
"sinon": "17.0.1",

test/public/dataPasses/overviewPerLhcPeriod.test.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const {
1818
goToPage,
1919
getAllDataFields,
2020
fillInput,
21+
waitForTimeout,
2122
} = require('../defaults');
2223

2324
const { expect } = chai;
@@ -84,7 +85,7 @@ module.exports = () => {
8485

8586
it('Should display the correct items counter at the bottom of the page', async () => {
8687
await goToPage(page, 'data-passes-per-lhc-period-overview', { queryParameters: { lhcPeriodId: 2 } });
87-
await page.waitForTimeout(100);
88+
await waitForTimeout(100);
8889

8990
expect(await page.$eval('#firstRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(1);
9091
expect(await page.$eval('#lastRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(2);
@@ -93,23 +94,23 @@ module.exports = () => {
9394

9495
it('can set how many data passes is available per page', async () => {
9596
await goToPage(page, 'data-passes-per-lhc-period-overview', { queryParameters: { lhcPeriodId: 2 } });
96-
await page.waitForTimeout(500);
97+
await waitForTimeout(500);
9798
// Expect the amount selector to currently be set to 10 (because of the defined page height)
9899
const amountSelectorButton = await page.$('.dropup button');
99100
const amountSelectorButtonText = await amountSelectorButton.evaluate((element) => element.innerText);
100-
await page.waitForTimeout(300);
101+
await waitForTimeout(300);
101102
expect(amountSelectorButtonText.trim().endsWith('9')).to.be.true;
102103

103104
// Expect the dropdown options to be visible when it is selected
104105
await amountSelectorButton.evaluate((button) => button.click());
105-
await page.waitForTimeout(100);
106+
await waitForTimeout(100);
106107
const amountSelectorDropdown = await page.$('.dropup');
107108
expect(Boolean(amountSelectorDropdown)).to.be.true;
108109

109110
// Expect the amount of visible lhcfills to reduce when the first option (5) is selected
110111
const menuItem = await page.$('.dropup .menu-item');
111112
await menuItem.evaluate((button) => button.click());
112-
await page.waitForTimeout(100);
113+
await waitForTimeout(100);
113114

114115
const tableRows = await page.$$('table tr');
115116
expect(tableRows.length - 1).to.equal(2);
@@ -121,22 +122,22 @@ module.exports = () => {
121122
el.value = '1111';
122123
el.dispatchEvent(new Event('input'));
123124
});
124-
await page.waitForTimeout(100);
125+
await waitForTimeout(100);
125126
expect(Boolean(await page.$('.dropup input:invalid'))).to.be.true;
126127
});
127128

128129
it('can sort by name column in ascending and descending manners', async () => {
129130
await goToPage(page, 'data-passes-per-lhc-period-overview', { queryParameters: { lhcPeriodId: 2 } });
130131
// Expect a sorting preview to appear when hovering over a column header
131132
await page.hover('th#name');
132-
await page.waitForTimeout(100);
133+
await waitForTimeout(100);
133134
const sortingPreviewIndicator = await page.$('#name-sort-preview');
134135
expect(Boolean(sortingPreviewIndicator)).to.be.true;
135136

136137
// Sort by name in an ascending manner
137138
const nameHeader = await page.$('th#name');
138139
await nameHeader.evaluate((button) => button.click());
139-
await page.waitForTimeout(300);
140+
await waitForTimeout(300);
140141

141142
// Expect the names to be in alphabetical order
142143
const firstNames = await getAllDataFields(page, 'name');
@@ -147,14 +148,14 @@ module.exports = () => {
147148
await goToPage(page, 'data-passes-per-lhc-period-overview', { queryParameters: { lhcPeriodId: 2 } });
148149
// Expect a sorting preview to appear when hovering over a column header
149150
await page.hover('th#reconstructedEventsCount');
150-
await page.waitForTimeout(100);
151+
await waitForTimeout(100);
151152
const sortingPreviewIndicator = await page.$('#reconstructedEventsCount-sort-preview');
152153
expect(Boolean(sortingPreviewIndicator)).to.be.true;
153154

154155
// Sort by year in an ascending manner
155156
const reconstructedEventsCountHeader = await page.$('th#reconstructedEventsCount');
156157
await reconstructedEventsCountHeader.evaluate((button) => button.click());
157-
await page.waitForTimeout(300);
158+
await waitForTimeout(300);
158159

159160
// Expect the year to be in order
160161
const firstReconstructedEventsCounts = await getAllDataFields(page, 'reconstructedEventsCount');
@@ -165,14 +166,14 @@ module.exports = () => {
165166
await goToPage(page, 'data-passes-per-lhc-period-overview', { queryParameters: { lhcPeriodId: 2 } });
166167
// Expect a sorting preview to appear when hovering over a column header
167168
await page.hover('th#outputSize');
168-
await page.waitForTimeout(100);
169+
await waitForTimeout(100);
169170
const sortingPreviewIndicator = await page.$('#outputSize-sort-preview');
170171
expect(Boolean(sortingPreviewIndicator)).to.be.true;
171172

172173
// Sort by avgCenterOfMassEnergy in an ascending manner
173174
const outputSizeHeader = await page.$('th#outputSize');
174175
await outputSizeHeader.evaluate((button) => button.click());
175-
await page.waitForTimeout(300);
176+
await waitForTimeout(300);
176177

177178
// Expect the avgCenterOfMassEnergy to be in order
178179
const firstOutputSize = await getAllDataFields(page, 'outputSize');
@@ -181,22 +182,22 @@ module.exports = () => {
181182

182183
it('should successfuly apply data pass name filter', async () => {
183184
await goToPage(page, 'data-passes-per-lhc-period-overview', { queryParameters: { lhcPeriodId: 2 } });
184-
await page.waitForTimeout(100);
185+
await waitForTimeout(100);
185186
const filterToggleButton = await page.$('#openFilterToggle');
186187
expect(filterToggleButton).to.not.be.null;
187188

188189
await filterToggleButton.evaluate((button) => button.click());
189190
await fillInput(page, 'div.flex-row.items-baseline:nth-of-type(2) input[type=text]', 'LHC22b_apass1');
190191

191-
await page.waitForTimeout(100);
192+
await waitForTimeout(100);
192193

193194
let allDataPassesNames = await getAllDataFields(page, 'name');
194195
expect(allDataPassesNames).to.has.all.deep.members(['LHC22b_apass1']);
195196

196197
const resetFiltersButton = await page.$('#reset-filters');
197198
expect(resetFiltersButton).to.not.be.null;
198199
await resetFiltersButton.evaluate((button) => button.click());
199-
await page.waitForTimeout(100);
200+
await waitForTimeout(100);
200201

201202
allDataPassesNames = await getAllDataFields(page, 'name');
202203
expect(allDataPassesNames).to.has.all.deep.members(['LHC22b_apass1', 'LHC22b_apass2']);

test/public/defaults.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ module.exports.defaultAfter = async (page, browser) => {
8686
return [page, browser];
8787
};
8888

89+
/**
90+
* Resolves after a given timeout (temporary replacement for puppeteer Page.waitForTimeout)
91+
*
92+
* @deprecated use an appropriate waitForSelector instead
93+
*
94+
* @param {number} timeout the timeout to wait (in ms)
95+
* @return {Promise<void>} resolves once the timeout has been elapsed
96+
*/
97+
const waitForTimeout = (timeout) => new Promise((res) => setTimeout(res, timeout));
98+
99+
/**
100+
* @deprecated
101+
*/
102+
module.exports.waitForTimeout = waitForTimeout;
103+
89104
/**
90105
* Waits till selector is visible and then clicks element.
91106
* @param {Object} page Puppeteer page object.
@@ -115,22 +130,22 @@ module.exports.reloadPage = (puppeteerPage) => goTo(puppeteerPage, puppeteerPage
115130
/**
116131
* Navigates to a specific URL and waits until everything is loaded.
117132
*
118-
* @param {Page} puppeteerPage puppeteer page object
133+
* @param {puppeteer.Page} page puppeteer page object
119134
* @param {string} url the URL to navigate to
120135
* @param {object} [options] navigation options
121136
* @param {boolean} [options.authenticate] if true, the navigation request will be authenticated with a token and test user information
122137
* @param {number} [options.redrawDuration] the estimated time to wait for the page to redraw
123138
* @returns {Promise} resolves with the navigation response
124139
*/
125-
const goTo = async (puppeteerPage, url, options) => {
140+
const goTo = async (page, url, options) => {
126141
const { authenticate = true, redrawDuration = 20 } = options ?? {};
127142

128143
if (authenticate) {
129-
url = authenticateUrl(url, testToken);
144+
url = authenticateUrl(url);
130145
}
131146

132-
const response = await puppeteerPage.goto(url, { waitUntil: 'networkidle0' });
133-
await puppeteerPage.waitForTimeout(redrawDuration);
147+
const response = await page.goto(url, { waitUntil: 'networkidle0' });
148+
await waitForTimeout(redrawDuration);
134149
return response;
135150
};
136151

@@ -164,7 +179,7 @@ module.exports.waitForNetworkIdleAndRedraw = async (page, options) => {
164179
const { redrawDuration = 20 } = options ?? {};
165180

166181
await page.waitForNetworkIdle();
167-
await page.waitForTimeout(redrawDuration);
182+
await waitForTimeout(redrawDuration);
168183
};
169184

170185
/**

test/public/envs/overview.test.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {
2121
checkColumnBalloon,
2222
checkEnvironmentStatusColor,
2323
} = require('../defaults');
24-
const { waitForNetworkIdleAndRedraw } = require('../defaults.js');
24+
const { waitForNetworkIdleAndRedraw, waitForTimeout } = require('../defaults.js');
2525

2626
const { expect } = chai;
2727

@@ -95,7 +95,7 @@ module.exports = () => {
9595

9696
it('Should display the correct items counter at the bottom of the page', async () => {
9797
await goToPage(page, 'env-overview');
98-
await page.waitForTimeout(100);
98+
await waitForTimeout(100);
9999

100100
expect(await page.$eval('#firstRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(1);
101101
expect(await page.$eval('#lastRowIndex', (element) => parseInt(element.innerText, 10))).to.equal(10);
@@ -104,15 +104,15 @@ module.exports = () => {
104104

105105
it('Should have balloon on runs column', async () => {
106106
await goToPage(page, 'env-overview');
107-
await page.waitForTimeout(100);
107+
await waitForTimeout(100);
108108

109109
await checkColumnBalloon(page, 1, 2);
110110
await checkColumnBalloon(page, 1, 6);
111111
});
112112

113113
it('Should have correct status color in the overview page', async () => {
114114
await goToPage(page, 'env-overview');
115-
await page.waitForTimeout(100);
115+
await waitForTimeout(100);
116116

117117
await checkEnvironmentStatusColor(page, 1, 4);
118118
await checkEnvironmentStatusColor(page, 2, 4);
@@ -121,24 +121,24 @@ module.exports = () => {
121121
});
122122

123123
it('can set how many environments are available per page', async () => {
124-
await page.waitForTimeout(300);
124+
await waitForTimeout(300);
125125
// Expect the amount selector to currently be set to 10 (because of the defined page height)
126126
const amountSelectorId = '#amountSelector';
127127
const amountSelectorButton = await page.$(`${amountSelectorId} button`);
128128
const amountSelectorButtonText = await page.evaluate((element) => element.innerText, amountSelectorButton);
129-
await page.waitForTimeout(300);
129+
await waitForTimeout(300);
130130
expect(amountSelectorButtonText.trim().endsWith('10')).to.be.true;
131131

132132
// Expect the dropdown options to be visible when it is selected
133133
await amountSelectorButton.evaluate((button) => button.click());
134-
await page.waitForTimeout(100);
134+
await waitForTimeout(100);
135135
const amountSelectorDropdown = await page.$(`${amountSelectorId} .dropup-menu`);
136136
expect(Boolean(amountSelectorDropdown)).to.be.true;
137137

138138
// Expect the amount of visible environments to reduce when the first option (5) is selected
139139
const menuItem = await page.$(`${amountSelectorId} .dropup-menu .menu-item`);
140140
await menuItem.evaluate((button) => button.click());
141-
await page.waitForTimeout(100);
141+
await waitForTimeout(100);
142142

143143
const tableRows = await page.$$('table tr');
144144
expect(tableRows.length - 1).to.equal(5);
@@ -150,7 +150,7 @@ module.exports = () => {
150150
el.value = '1111';
151151
el.dispatchEvent(new Event('input'));
152152
});
153-
await page.waitForTimeout(100);
153+
await waitForTimeout(100);
154154
expect(Boolean(await page.$(`${amountSelectorId} input:invalid`))).to.be.true;
155155
});
156156

@@ -162,7 +162,7 @@ module.exports = () => {
162162
// eslint-disable-next-line no-undef
163163
model.envs.overviewModel.pagination.itemsPerPage = 1;
164164
});
165-
await page.waitForTimeout(100);
165+
await waitForTimeout(100);
166166

167167
// Expect the page five button to now be visible, but no more than that
168168
const pageFiveButton = await page.$('#page5');
@@ -172,7 +172,7 @@ module.exports = () => {
172172

173173
// Expect the page one button to have fallen away when clicking on page five button
174174
await pressElement(page, '#page5');
175-
await page.waitForTimeout(100);
175+
await waitForTimeout(100);
176176
const pageOneButton = await page.$('#page1');
177177
expect(Boolean(pageOneButton)).to.be.false;
178178
});

test/public/flps/detail.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
const chai = require('chai');
1515
const { defaultBefore, defaultAfter, expectInnerText, pressElement, goToPage } = require('../defaults');
16+
const { waitForTimeout } = require('../defaults.js');
1617

1718
const { expect } = chai;
1819

@@ -35,7 +36,7 @@ module.exports = () => {
3536

3637
it('can navigate to the main panel', async () => {
3738
await pressElement(page, '#main-tab');
38-
await page.waitForTimeout(100);
39+
await waitForTimeout(100);
3940
const redirectedUrl = await page.url();
4041
expect(String(redirectedUrl).startsWith(`${url}/?page=flp-detail&id=1&panel=main`)).to.be.true;
4142
});
@@ -71,7 +72,7 @@ module.exports = () => {
7172
// We expect the associated run to be clickable with a valid link
7273
const runLink = await page.$('#Flp-run a');
7374
await runLink.click();
74-
await page.waitForTimeout(1000);
75+
await waitForTimeout(1000);
7576

7677
// We expect the link to navigate to the correct run detail page
7778
const redirectedUrl = await page.url();

0 commit comments

Comments
 (0)