Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(e2e): golden, one test, first run, map 127 COMPASS-8166 #6690

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/compass-e2e-tests/helpers/compass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ async function startCompassElectron(
chromeArgs.push(...opts.extraSpawnArgs);
}

chromeArgs.push('--host-rules=MAP * 127.0.0.1');

// Electron on Windows interprets its arguments in a weird way where
// the second positional argument inserted by webdriverio (about:blank)
// throws it off and won't let it start because it then interprets the first
Expand Down
4 changes: 3 additions & 1 deletion packages/compass-e2e-tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function main() {
const e2eTestGroup = context.testGroup;
const e2eTestFilter = context.testFilter;

const tests = (
let tests = (
await glob(`tests/**/${e2eTestFilter}.{test,spec}.ts`, {
cwd: __dirname,
})
Expand Down Expand Up @@ -82,6 +82,8 @@ async function main() {
}
});

tests = tests.filter((test) => test === 'tests/no-network-traffic.test.ts');

debug('Test files:', tests);

if (tests.length === 0) {
Expand Down
19 changes: 11 additions & 8 deletions packages/compass-e2e-tests/tests/no-network-traffic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('networkTraffic: false / Isolated Edition', function () {
const wrapperFile = path.join(tmpdir, 'wrap.sh');
await fs.writeFile(
wrapperFile,
`#!/bin/bash\nulimit -c 0; exec strace -f -e connect -qqq -o '${outfile}' '${binary}' "$@"\n`
`#!/bin/bash\nulimit -c 0; exec strace -f -e connect -tt -o '${outfile}' '${binary}' "$@"\n`
);
await fs.chmod(wrapperFile, 0o755);
return wrapperFile;
Expand All @@ -67,7 +67,7 @@ describe('networkTraffic: false / Isolated Edition', function () {
wrapBinary,
// TODO(COMPASS-8166): firstRun: true seems to result in network traffic.
// Probably the welcome modal.
firstRun: false,
firstRun: true,
});
const browser = compass.browser;

Expand Down Expand Up @@ -115,12 +115,15 @@ describe('networkTraffic: false / Isolated Edition', function () {
);
}

if (
[...connectTargets].some(
(target) => !/^127.0.0.1:|^\[::1\]:/.test(target)
)
) {
throw new Error(`Connected to unexpected host! ${[...connectTargets]}`);
const unexpectedHosts = [...connectTargets].filter(
(target) => !/^127.0.0.1:|^\[::1\]:/.test(target)
);
if (unexpectedHosts.length > 0) {
throw new Error(
`Connected to unexpected host! ${[
...unexpectedHosts,
]}. Here is the strace log:\n ${straceLog}`
);
}
if (![...connectTargets].some((target) => /:27091$/.test(target))) {
throw new Error(
Expand Down
Loading