Skip to content
Merged
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
36 changes: 23 additions & 13 deletions packages/compass-e2e-tests/helpers/commands/connect-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,8 @@ export async function saveConnection(
.waitForDisplayed({ reverse: true });
}

let screenshotCounter = 0;
Copy link

Copilot AI Nov 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module-level screenshotCounter variable will persist across multiple test runs within the same process, potentially causing confusion in screenshot filenames. Consider resetting this counter at appropriate test lifecycle points or including a timestamp in the filename instead.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the exact point of the counter 😆


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
Expand Down Expand Up @@ -953,20 +955,28 @@ export async function setupDefaultConnections(browser: CompassBrowser) {
whereas we do have some tests that try and use those. We can easily change
this in future if needed, though.
*/
for (const connectionInfo of DEFAULT_CONNECTIONS) {
const connectionName = getConnectionTitle(connectionInfo);
if (await browser.removeConnection(connectionName)) {
debug('Removing existing connection so we do not create a duplicate', {
connectionName,
});

try {
for (const connectionInfo of DEFAULT_CONNECTIONS) {
const connectionName = getConnectionTitle(connectionInfo);
if (await browser.removeConnection(connectionName)) {
debug('Removing existing connection so we do not create a duplicate', {
connectionName,
});
}
}
}

for (const connectionInfo of DEFAULT_CONNECTIONS) {
await browser.saveConnection({
connectionString: connectionInfo.connectionOptions.connectionString,
connectionName: connectionInfo.favorite?.name,
connectionColor: connectionInfo.favorite?.color,
});
for (const connectionInfo of DEFAULT_CONNECTIONS) {
await browser.saveConnection({
connectionString: connectionInfo.connectionOptions.connectionString,
connectionName: connectionInfo.favorite?.name,
connectionColor: connectionInfo.favorite?.color,
});
}
} catch (err) {
await browser.screenshot(
`screenshot-connection-form-setup-default-connections-${screenshotCounter++}.png`
);
throw err;
}
}
Loading