Skip to content

Commit 560dcdb

Browse files
committed
Upgrade selenium + fix setWindowWidth in graphic tests
1 parent 7c6218b commit 560dcdb

File tree

241 files changed

+13
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+13
-3
lines changed

scripts/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
web-client:
3-
image: selenium/standalone-firefox:4.25.0-20241024 # https://github.com/SeleniumHQ/docker-selenium to get the latest version
3+
image: selenium/standalone-firefox:4.29.0-20250303 # https://github.com/SeleniumHQ/docker-selenium to get the latest version
44
shm_size: '2gb'
55
ports:
66
- 4444:4444 # http://localhost:4444/ (driver)

test/common/graphic.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const UNREACHABLE_TEST_CLIENT_MESSAGE =
4242

4343
const ANIMATION_DELAY = 200;
4444
const AUTOPLAY_DELAY = 1000;
45+
const WINDOW_WIDTH_CHANGE_DELAY = 50;
4546

4647

4748
/**
@@ -144,19 +145,27 @@ async function fetchTestCase(browserContext, testCaseName) {
144145
}
145146

146147

148+
/**
149+
* Wait for a given delay (to be specified in ms).
150+
*/
151+
async function waitForDelay(delay) {
152+
await new Promise(resolve => setTimeout(resolve, delay));
153+
}
154+
155+
147156
/**
148157
* Wait until the end of the chessboard animations.
149158
*/
150159
const waitForAnimation = exports.waitForAnimation = async function () {
151-
await new Promise(resolve => setTimeout(resolve, ANIMATION_DELAY));
160+
await waitForDelay(ANIMATION_DELAY);
152161
};
153162

154163

155164
/**
156165
* Wait until the given number of moves have been auto-played.
157166
*/
158167
exports.waitForAutoplay = async function (nbMoves) {
159-
await new Promise(resolve => setTimeout(resolve, (nbMoves + 0.5) * AUTOPLAY_DELAY));
168+
await waitForDelay((nbMoves + 0.5) * AUTOPLAY_DELAY);
160169
};
161170

162171

@@ -221,6 +230,7 @@ exports.setSandbox = async function (browserContext, value) {
221230
exports.setWindowWidth = async function (browserContext, width) {
222231
const { height } = await await browserContext.driver.manage().window().getRect();
223232
await browserContext.driver.manage().window().setRect({ width: width, height: height });
233+
await waitForDelay(WINDOW_WIDTH_CHANGE_DELAY); // Empirical delay: without it, selenium may not take the width change into account.
224234
};
225235

226236

3.3 KB
767 Bytes
845 Bytes
309 Bytes
389 Bytes
249 Bytes
274 Bytes
205 Bytes

0 commit comments

Comments
 (0)