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

chore(e2e): enable e2e tests to run directly against Atlas #6381

Merged
merged 7 commits into from
Oct 22, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
comments
syn-zhu committed Oct 22, 2024
commit 6eb7796b92bb6172a09767b8c28feff2dd6cad72
26 changes: 14 additions & 12 deletions packages/compass-e2e-tests/helpers/compass.ts
Original file line number Diff line number Diff line change
@@ -810,32 +810,34 @@ export async function startBrowser(
// Navigate to a 404 page to set cookies
await browser.navigateTo(`https://${TEST_ATLAS_CLOUD_EXTERNAL_URL}/404`);

const cookiesFile = process.env.COOKIES_FILE;
const cookiesFile = process.env.TEST_ATLAS_CLOUD_EXTERNAL_COOKIES_FILE;
if (!cookiesFile) {
throw new Error(
'ATLAS_DOMAIN is set but COOKIES_FILE is not. Please set COOKIES_FILE to the path of the cookies file.'
'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.'
);
}
const cookies: StoredAtlasCloudCookies = JSON.parse(
await fs.readFile(cookiesFile, 'utf8')
);

for (const cookie of cookies) {
if (
cookie.name.includes('mmsa-') ||
cookie.name.includes('mdb-sat') ||
cookie.name.includes('mdb-srt')
) {
await browser.setCookies({
// These are the relevant cookies for auth:
// https://github.com/10gen/mms/blob/6d27992a6ab9ab31471c8bcdaa4e347aa39f4013/server/src/features/com/xgen/svc/cukes/helpers/Client.java#L122-L130
await browser.setCookies(
cookies
.filter((cookie) => {
cookie.name.includes('mmsa-') ||
cookie.name.includes('mdb-sat') ||
cookie.name.includes('mdb-srt');
})
.map((cookie) => ({
name: cookie.name,
value: cookie.value,
domain: cookie.domain,
path: cookie.path,
secure: cookie.secure,
httpOnly: cookie.httpOnly,
});
}
}
}))
);

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