Skip to content

Commit d105e2d

Browse files
committed
Bump to Chrome 141
1 parent 7788726 commit d105e2d

5 files changed

Lines changed: 26 additions & 9 deletions

File tree

docker-compose-wsl2.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ services:
44
# On Windows, run with COMPOSE_CONVERT_WINDOWS_PATHS=1
55

66
chrome:
7-
image: selenium/node-chrome:110.0
7+
image: selenium/node-chrome:141.0
88
depends_on:
99
- selenium-hub
1010
- webchat
@@ -20,7 +20,7 @@ services:
2020
- ./__tests__/setup/local/:/home/seluser/Downloads
2121

2222
selenium-hub:
23-
image: selenium/hub:4.8.1
23+
image: selenium/hub:4.36.0
2424
container_name: selenium-hub
2525
environment:
2626
GRID_TIMEOUT: '300'

packages/test/harness/src/host/common/host/windowSize.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
module.exports = webDriver =>
1+
module.exports = (/** @type import('selenium-webdriver').WebDriver */ webDriver) =>
22
async function windowSize(width, height, element) {
33
const rect = await webDriver.manage().window().getRect();
44

55
height = +height || rect.height;
66
width = +width || rect.width;
77

8-
await webDriver.manage().window().setRect({ height, width });
8+
// TODO: [P2] We cannot run --headless mode reliably, setting window size will mess things up.
9+
// Look at /packages/test/harness/src/host/jest/allocateWebDriver.js.
10+
// await webDriver.manage().window().setRect({ height, width });
911

1012
/* istanbul ignore next */
1113
element &&

packages/test/harness/src/host/common/takeStabilizedScreenshot.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1+
const { By } = require('selenium-webdriver');
2+
13
const until = require('./until');
24

35
const TIME_FOR_STABILIZED_SCREENSHOT = 5000; // Time (in ms) to wait for a stabilized screenshot.
46

57
// Keep taking screenshot until 2 consecutive screenshots are the same.
6-
module.exports = async function takeStabilizedScreenshot(webDriver) {
8+
module.exports = async function takeStabilizedScreenshot(
9+
/** @type import('selenium-webdriver').WebDriver */ webDriver
10+
) {
711
let lastScreenshot;
812

913
const screenshot = await until(async () => {
10-
const screenshot = await webDriver.takeScreenshot();
14+
// TODO: [P1] --headless is not quite working.
15+
// Headless is supposed to be chrome-less (no window border).
16+
// After we set webDriver.manage().window().size(1024, 768), webDriver.takeScreenshot() is not returning a 1024x768 image.
17+
// See /packages/test/harness/src/host/jest/allocateWebDriver.js.
18+
const element = await webDriver.findElement(By.id('webchat'));
19+
const screenshot = await element.takeScreenshot();
1120

1221
if (lastScreenshot === screenshot) {
1322
return screenshot;

packages/test/harness/src/host/jest-server/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ async function prepareSession(sessionId) {
126126
await sendWebDriverCommand(sessionId, 'url', { url: 'about:blank' });
127127

128128
// It may have set a different window size.
129-
await sendWebDriverCommand(sessionId, 'window/rect', { height: 640, width: 360 });
129+
// TODO: [P2] We cannot run --headless mode reliably, setting window size will mess things up.
130+
// Look at /packages/test/harness/src/host/jest/allocateWebDriver.js.
131+
// await sendWebDriverCommand(sessionId, 'window/rect', { height: 640, width: 360 });
130132

131133
// Last test may have moved the mouse cursor.
132134
await sendWebDriverCommand(sessionId, 'actions', {

packages/test/harness/src/host/jest/allocateWebDriver.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ module.exports = async function allocateWebDriver({ webDriverURL }) {
1010

1111
const builder = new Builder().forBrowser('chrome').setChromeOptions(
1212
new ChromeOptions()
13-
.addArguments('--headless') // More info at https://github.com/SeleniumHQ/selenium/commit/5a97adf9864a346fdd8914cdb1b601c05dd837ac
14-
.addArguments('--single-process')
13+
// TODO: [P1] --headless is not quite working.
14+
// Headless is supposed to be chrome-less (no window border).
15+
// After we set webDriver.manage().window().size(1024, 768), webDriver.takeScreenshot() is not returning a 1024x768 image.
16+
.addArguments('--headless') // WebDriver deprecated .headless(), more info at https://github.com/SeleniumHQ/selenium/commit/5a97adf9864a346fdd8914cdb1b601c05dd837ac
17+
.addArguments('--window-size=1920,1080')
18+
// .addArguments('--single-process') // --single-process works on 124 but fail silently on >= 133.
1519
.setAcceptInsecureCerts(true) // We are accessing https://webchat2/ which has a self-signed certificate.
1620
.setLoggingPrefs(preferences)
1721
);

0 commit comments

Comments
 (0)