Skip to content

Commit 2a59e5c

Browse files
authored
chore(e2e): get the chrome version from electron and pass that to remote() COMPASS-7639 (#5539)
get the chrome version from electron and pass that to remote()
1 parent 5444b83 commit 2a59e5c

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

packages/compass-e2e-tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.log
33
fixtures/*.csv
44
fixtures/*.json
5+
electron-versions.json

packages/compass-e2e-tests/helpers/compass.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ async function startCompassElectron(
660660
automationProtocol: 'webdriver' as const,
661661
capabilities: {
662662
browserName: 'chromium',
663-
browserVersion: '120.0.6099.227', // TODO(COMPASS-7639): this must always be the corresponding chromium version for the electron version
663+
browserVersion: process.env.CHROME_VERSION,
664664
// https://chromedriver.chromium.org/capabilities#h.p_ID_106
665665
'goog:chromeOptions': {
666666
binary: maybeWrappedBinary,

packages/compass-e2e-tests/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ async function setup() {
8282
};
8383
compassWeb.stdout.setEncoding('utf8').on('data', listener);
8484
});
85+
} else {
86+
debug('Writing electron-versions.json');
87+
crossSpawn.sync('scripts/write-electron-versions.sh', [], {
88+
stdio: 'inherit',
89+
});
8590
}
8691
}
8792

@@ -151,6 +156,22 @@ async function main() {
151156

152157
const shouldTestCompassWeb = process.argv.includes('--test-compass-web');
153158

159+
if (!shouldTestCompassWeb) {
160+
if (!process.env.CHROME_VERSION) {
161+
// written during setup() if disableStartStop is false
162+
const versionsJSON = await fs.promises.readFile(
163+
'electron-versions.json',
164+
'utf8'
165+
);
166+
const versions = JSON.parse(versionsJSON);
167+
process.env.CHROME_VERSION = versions.chrome;
168+
}
169+
debug(
170+
'Chrome version corresponding to Electron:',
171+
process.env.CHROME_VERSION
172+
);
173+
}
174+
154175
// These are mutually exclusive since compass-web is always going to browse to
155176
// the running webserver.
156177
const shouldTestPackagedApp =
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
echo "const fs = require('fs'); fs.writeFileSync('electron-versions.json', JSON.stringify(process.versions), 'utf8');" | npx electron -i

0 commit comments

Comments
 (0)