Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
0ee2a23
chore(web): add a simple static assets server to compass-web scripts
gribnoysup Jan 21, 2026
31edc7d
chore(e2e): allow multiple test filters to be provided
gribnoysup Jan 21, 2026
2c4775e
chore(e2e): add web extension builder to be used for redirects
gribnoysup Jan 21, 2026
6ceab06
chore(web): allow to build compass-web with some internals exposed
gribnoysup Jan 21, 2026
a2cf177
chore(e2e): rename atlas-cloud-sandbox args to atlas-cloud; remove at…
gribnoysup Jan 21, 2026
7481f97
chore(e2e): don't print args twice in debug log
gribnoysup Jan 21, 2026
9aff781
chore(e2e): change compass-web with atlas tests to run against remote…
gribnoysup Jan 21, 2026
2101b76
Merge remote-tracking branch 'origin/main' into compass-web-with-atla…
gribnoysup Jan 21, 2026
612b57b
chore(e2e): do not use :not selector for hover
gribnoysup Jan 22, 2026
3641221
chore(e2e): use a new element to avoid trying to find a cached one fr…
gribnoysup Jan 22, 2026
a5e8c43
chore(e2e): move atlas sign in and leafygreen helpers to their own br…
gribnoysup Jan 22, 2026
e8883c4
Merge branch 'main' into compass-web-with-atlas-e2e-refactor
gribnoysup Jan 22, 2026
109b2c6
chore(web): use proper response code for unsupported methods; sanitiz…
gribnoysup Jan 23, 2026
003830e
chore(web): remove "sanitize" code as bot is not happy with it anyway
gribnoysup Jan 23, 2026
b0ba327
Merge branch 'main' into compass-web-with-atlas-e2e-refactor
gribnoysup Jan 23, 2026
fd9c6ac
Merge remote-tracking branch 'origin/main' into compass-web-with-atla…
gribnoysup Jan 23, 2026
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
6 changes: 3 additions & 3 deletions .evergreen/functions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -775,8 +775,8 @@ functions:
<<: *compass-env
<<: *compass-e2e-secrets
DEBUG: ${debug|}
COMPASS_E2E_ATLAS_CLOUD_SANDBOX_USERNAME: ${e2e_tests_compass_web_atlas_username}
COMPASS_E2E_ATLAS_CLOUD_SANDBOX_PASSWORD: ${e2e_tests_compass_web_atlas_password}
COMPASS_E2E_ATLAS_CLOUD_USERNAME: ${e2e_tests_compass_web_atlas_username}
COMPASS_E2E_ATLAS_CLOUD_PASSWORD: ${e2e_tests_compass_web_atlas_password}
MCLI_PUBLIC_API_KEY: ${e2e_tests_mcli_public_api_key}
MCLI_PRIVATE_API_KEY: ${e2e_tests_mcli_private_api_key}
MCLI_ORG_ID: ${e2e_tests_mcli_org_id}
Expand All @@ -797,7 +797,7 @@ functions:
# clusters in CI is both pricey and flakey, so we want to limit the
# coverage to reduce those factors (at least for now)
npm run --unsafe-perm --workspace compass-e2e-tests test-ci -- -- web \
--test-atlas-cloud-sandbox \
--test-atlas-cloud \
--test-filter="atlas-cloud/**/*"

test-connectivity:
Expand Down
16 changes: 8 additions & 8 deletions .evergreen/start-atlas-cloud-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ DOCKER_REGISTRY="${DOCKER_REGISTRY:-docker.io}"
# MCLI_ORG_ID Org ID
# MCLI_PROJECT_ID Project ID
#
# COMPASS_E2E_ATLAS_CLOUD_SANDBOX_USERNAME Cloud user you created
# COMPASS_E2E_ATLAS_CLOUD_SANDBOX_PASSWORD Cloud user password
# COMPASS_E2E_ATLAS_CLOUD_USERNAME Cloud user you created
# COMPASS_E2E_ATLAS_CLOUD_PASSWORD Cloud user password
#
# - Source the script followed by running the tests to make sure that some
# variables exported from this script are available for the test env:
#
# (ATLAS_CLOUD_TEST_CLUSTER_NAME="TestCluster" source .evergreen/start-atlas-cloud-cluster.sh \
# && npm run -w compass-e2e-tests test web -- --test-atlas-cloud-sandbox --test-filter="atlas-cloud/**/*")
# && npm run -w compass-e2e-tests test web -- --test-atlas-cloud --test-filter="atlas-cloud/**/*")

_ATLAS_CLOUD_TEST_CLUSTER_NAME=${ATLAS_CLOUD_TEST_CLUSTER_NAME:-""}

Expand Down Expand Up @@ -101,8 +101,8 @@ atlascli dbusers create atlasAdmin \
--password "$ATLAS_TEST_DB_PASSWORD" \
--deleteAfter "$DELETE_AFTER" # so that it's autoremoved if cleaning up failed for some reason

export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_USERNAME="$ATLAS_TEST_DB_USERNAME"
export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DBUSER_PASSWORD="$ATLAS_TEST_DB_PASSWORD"
export COMPASS_E2E_ATLAS_CLOUD_DBUSER_USERNAME="$ATLAS_TEST_DB_USERNAME"
export COMPASS_E2E_ATLAS_CLOUD_DBUSER_PASSWORD="$ATLAS_TEST_DB_PASSWORD"

echo "Creating Atlas deployment \`$ATLAS_CLUSTER_NAME\` to test against..."
(atlascli clusters create $ATLAS_CLUSTER_NAME \
Expand All @@ -117,7 +117,7 @@ atlascli clusters watch $ATLAS_CLUSTER_NAME
echo "Getting connection string for provisioned cluster..."
CONNECTION_STRINGS_JSON="$(atlascli clusters connectionStrings describe $ATLAS_CLUSTER_NAME -o json)"

export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_CLOUD_CONFIG=$(
export COMPASS_E2E_ATLAS_CLOUD_ENVIRONMENT=$(
if [[ "$MCLI_OPS_MANAGER_URL" =~ "-dev" ]]; then
echo "dev"
elif [[ "$MCLI_OPS_MANAGER_URL" =~ "-qa" ]]; then
Expand All @@ -126,7 +126,7 @@ export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_CLOUD_CONFIG=$(
echo "prod"
fi
)
echo "Cloud config: $COMPASS_E2E_ATLAS_CLOUD_SANDBOX_CLOUD_CONFIG"
echo "Cloud environment: $COMPASS_E2E_ATLAS_CLOUD_ENVIRONMENT"

export COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DEFAULT_CONNECTIONS="{\"$ATLAS_CLUSTER_NAME\": $CONNECTION_STRINGS_JSON}"
export COMPASS_E2E_ATLAS_CLOUD_DEFAULT_CONNECTIONS="{\"$ATLAS_CLUSTER_NAME\": $CONNECTION_STRINGS_JSON}"
echo "Cluster connections: $COMPASS_E2E_ATLAS_CLOUD_SANDBOX_DEFAULT_CONNECTIONS"
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 67 additions & 0 deletions packages/compass-e2e-tests/helpers/commands/atlas-cloud/auth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import type { CompassBrowser } from '../../compass-browser';

export async function signInToAtlasCloudAccount(
browser: CompassBrowser,
signInPageUrl: string,
atlasCloudPageUrl: string,
username: string,
password: string
) {
await browser.navigateTo(signInPageUrl);

await browser.waitForLeafygreenEnabled('input[name="username"]');
await browser.$('input[name="username"]').setValue(username);

await browser.waitForLeafygreenEnabled('button=Next');
await browser.$('button=Next').click();

await browser.$('input[name="password"]').waitForEnabled();
await browser.$('input[name="password"]').setValue(password);

await browser.$('button=Login').waitForEnabled();
await browser.$('button=Login').click();

let authenticated = false;

// Atlas Cloud will periodically remind user to enable MFA (which we can't
// enable in e2e CI environment), so to account for that, in parallel to
// waiting for auth to finish, we'll wait for the MFA screen to show up and
// skip it if it appears
const [, authenticationPromiseSettled] = await Promise.allSettled([
(async () => {
const remindMeLaterButton = 'button*=Remind me later';

await browser.waitUntil(
async () => {
return (
authenticated ||
(await browser.$(remindMeLaterButton).isDisplayed())
);
},
// Takes awhile for the redirect to land on this reminder page when it
// happens, so no need to bombard the browser with displayed checks
{ interval: 2000 }
);

if (authenticated) {
return;
}

await browser.clickVisible(remindMeLaterButton);
})(),
browser.waitUntil(
async () => {
const pageUrl = await browser.getUrl();
// We don't check the exact project id, just want to make sure we are in
// logged in part of atlas cloud
return (authenticated = pageUrl.startsWith(`${atlasCloudPageUrl}/v2/`));
},
// See above
{ interval: 2000 }
),
]);

if (authenticationPromiseSettled.status === 'rejected') {
throw authenticationPromiseSettled.reason;
}
}
5 changes: 2 additions & 3 deletions packages/compass-e2e-tests/helpers/commands/connect-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import type { ConnectFormState } from '../connect-form-state';
import Debug from 'debug';
import {
DEFAULT_CONNECTIONS,
isTestingAtlasCloudExternal,
isTestingAtlasCloudSandbox,
isTestingAtlasCloud,
} from '../test-runner-context';
import { getConnectionTitle } from '@mongodb-js/connection-info';
const debug = Debug('compass-e2e-tests');
Expand Down Expand Up @@ -925,7 +924,7 @@ let screenshotCounter = 0;
export async function setupDefaultConnections(browser: CompassBrowser) {
// When running tests against Atlas Cloud, connections can't be added or
// removed from the UI manually, so we skip setup for default connections
if (isTestingAtlasCloudExternal() || isTestingAtlasCloudSandbox()) {
if (isTestingAtlasCloud()) {
return;
}

Expand Down
5 changes: 2 additions & 3 deletions packages/compass-e2e-tests/helpers/commands/connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import * as Selectors from '../selectors';
import Debug from 'debug';
import {
DEFAULT_CONNECTION_NAMES,
isTestingAtlasCloudExternal,
isTestingAtlasCloudSandbox,
isTestingAtlasCloud,
} from '../test-runner-context';

const debug = Debug('compass-e2e-tests');
Expand Down Expand Up @@ -52,7 +51,7 @@ export async function connectWithConnectionString(
// When testing Atlas Cloud, we can't really create a new connection, so just
// assume a connection name was passed (with a fallback to a default one) and
// try to use it
if (isTestingAtlasCloudExternal() || isTestingAtlasCloudSandbox()) {
if (isTestingAtlasCloud()) {
await browser.connectByName(
connectionStringOrName ?? DEFAULT_CONNECTION_NAME_1
);
Expand Down
2 changes: 2 additions & 0 deletions packages/compass-e2e-tests/helpers/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ export * from './get-open-modals';
export * from './is-modal-open';
export * from './is-modal-eventually-open';
export * from './wait-for-open-modal';
export * from './leafygreen';
export * from './atlas-cloud/auth';
22 changes: 22 additions & 0 deletions packages/compass-e2e-tests/helpers/commands/leafygreen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { ChainablePromiseElement } from 'webdriverio';
import type { CompassBrowser } from '../compass-browser';

export const isLeafygreenEnabled = async (
browser: CompassBrowser,
el: string | ChainablePromiseElement
) => {
el = typeof el === 'string' ? browser.$(el) : el;
return (
(await el.getAttribute('aria-disabled')) !== 'true' &&
(await el.isEnabled())
);
};

export const waitForLeafygreenEnabled = async (
browser: CompassBrowser,
el: string | ChainablePromiseElement
) => {
return await browser.waitUntil(async () => {
return await isLeafygreenEnabled(browser, el);
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export async function selectConnectionMenuItem(
// Hover over an arbitrary other element to ensure that the second hover will
// actually be a fresh one. This otherwise breaks if this function is called
// twice in a row.
await browser.hover(`*:not(${selector}, ${selector} *)`);
await browser.hover(Selectors.ConnectionsTitle);

await browser.hover(selector);
return false;
Expand Down
Loading
Loading