Skip to content

Commit

Permalink
throw if we didn't find exactly one connection
Browse files Browse the repository at this point in the history
  • Loading branch information
lerouxb committed Jul 18, 2024
1 parent a180d44 commit 78c3235
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/compass-e2e-tests/helpers/commands/sidebar-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ export async function getConnectionIdByName(
connectionName: string
): Promise<string> {
// NOTE: this is only supported for multiple connections
const connections = await browser.$$(
Selectors.sidebarConnection(connectionName)
);

if (connections.length !== 1) {
throw new Error(
`Found ${connections.length} connections named ${connectionName}.`
);
}

return await browser
.$(Selectors.sidebarConnection(connectionName))
.getAttribute('data-connection-id');
Expand Down

0 comments on commit 78c3235

Please sign in to comment.