Skip to content

Commit 6eb7796

Browse files
committed
comments
1 parent 40b6447 commit 6eb7796

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

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

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -810,32 +810,34 @@ export async function startBrowser(
810810
// Navigate to a 404 page to set cookies
811811
await browser.navigateTo(`https://${TEST_ATLAS_CLOUD_EXTERNAL_URL}/404`);
812812

813-
const cookiesFile = process.env.COOKIES_FILE;
813+
const cookiesFile = process.env.TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE;
814814
if (!cookiesFile) {
815815
throw new Error(
816-
'ATLAS_DOMAIN is set but COOKIES_FILE is not. Please set COOKIES_FILE to the path of the cookies file.'
816+
'TEST_ATLAS_CLOUD_EXTERNAL_URL is set but TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE is not. Please set TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE to the path of the cookies file.'
817817
);
818818
}
819819
const cookies: StoredAtlasCloudCookies = JSON.parse(
820820
await fs.readFile(cookiesFile, 'utf8')
821821
);
822822

823-
for (const cookie of cookies) {
824-
if (
825-
cookie.name.includes('mmsa-') ||
826-
cookie.name.includes('mdb-sat') ||
827-
cookie.name.includes('mdb-srt')
828-
) {
829-
await browser.setCookies({
823+
// These are the relevant cookies for auth:
824+
// https://github.com/10gen/mms/blob/6d27992a6ab9ab31471c8bcdaa4e347aa39f4013/server/src/features/com/xgen/svc/cukes/helpers/Client.java#L122-L130
825+
await browser.setCookies(
826+
cookies
827+
.filter((cookie) => {
828+
cookie.name.includes('mmsa-') ||
829+
cookie.name.includes('mdb-sat') ||
830+
cookie.name.includes('mdb-srt');
831+
})
832+
.map((cookie) => ({
830833
name: cookie.name,
831834
value: cookie.value,
832835
domain: cookie.domain,
833836
path: cookie.path,
834837
secure: cookie.secure,
835838
httpOnly: cookie.httpOnly,
836-
});
837-
}
838-
}
839+
}))
840+
);
839841

840842
await browser.navigateTo(
841843
`https://${TEST_ATLAS_CLOUD_EXTERNAL_URL}/v2/${TEST_ATLAS_CLOUD_EXTERNAL_GROUP_ID}#/explorer`

0 commit comments

Comments
 (0)