diff --git a/packages/compass-e2e-tests/helpers/compass.ts b/packages/compass-e2e-tests/helpers/compass.ts index 0395fd8e6fc..768bf0184cd 100644 --- a/packages/compass-e2e-tests/helpers/compass.ts +++ b/packages/compass-e2e-tests/helpers/compass.ts @@ -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 diff --git a/packages/compass-e2e-tests/index.ts b/packages/compass-e2e-tests/index.ts index 86a31aec1a1..ca85da3f946 100644 --- a/packages/compass-e2e-tests/index.ts +++ b/packages/compass-e2e-tests/index.ts @@ -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, }) @@ -82,6 +82,12 @@ async function main() { } }); + tests = tests.filter( + (test) => + test === 'tests/collection-indexes-tab.test.ts' || + test === 'tests/no-network-traffic.test.ts' + ); + debug('Test files:', tests); if (tests.length === 0) { diff --git a/packages/compass-e2e-tests/tests/no-network-traffic.test.ts b/packages/compass-e2e-tests/tests/no-network-traffic.test.ts index b913d6fc13c..371a7d32e2e 100644 --- a/packages/compass-e2e-tests/tests/no-network-traffic.test.ts +++ b/packages/compass-e2e-tests/tests/no-network-traffic.test.ts @@ -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; @@ -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; @@ -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(