Skip to content

Commit 9b270c5

Browse files
committed
Add test ensuring the right connect button is displayed
1 parent 8318c8a commit 9b270c5

File tree

3 files changed

+26
-13
lines changed

3 files changed

+26
-13
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ declare global {
7575
}
7676
}
7777

78-
/*
79-
A helper so we can easily find all the tests we're skipping in compass-web.
80-
Reason is there so you can fill it in and have it show up in search results
81-
in a scannable manner. It is not being output at present because the tests will
82-
be logged as pending anyway.
83-
*/
78+
/**
79+
* A helper so we can easily find all the tests we're skipping in compass-web.
80+
* Reason is there so you can fill it in and have it show up in search results
81+
* in a scannable manner. It is not being output at present because the tests will
82+
* be logged as pending anyway.
83+
*/
8484
export function skipForWeb(
8585
test: Mocha.Runnable | Mocha.Context,
8686
// eslint-disable-next-line @typescript-eslint/no-unused-vars

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,9 @@ export const ConenctionToastCancelConnectionButton =
244244
// Connections sidebar
245245
export const ConnectionsTitle = '[data-testid="connections-header"]';
246246
export const SidebarNewConnectionButton = '[data-action="add-new-connection"]';
247-
export const ConnectDropdownButton =
248-
'[data-testid="sidebar-navigation-item-actions-connection-connect-action"] + button';
247+
export const ConnectButton =
248+
'[data-testid="sidebar-navigation-item-actions-connection-connect-action"]';
249+
export const ConnectDropdownButton = `${ConnectButton} [data-testid="lg-split_button-trigger"]`;
249250
export const ConnectInNewWindowButton =
250251
'[data-action="connection-connect-in-new-window"]';
251252
export const ConnectionMenu = '[data-testid="sidebar-navigation-item-actions"]';
@@ -372,9 +373,7 @@ export const sidebarConnectionButton = (connectionName: string): string => {
372373
export const sidebarConnectionDropdownButton = (
373374
connectionName: string
374375
): string => {
375-
return `${sidebarConnection(connectionName)} ${
376-
Multiple.ConnectDropdownButton
377-
}`;
376+
return `${sidebarConnection(connectionName)} ${ConnectDropdownButton}`;
378377
};
379378

380379
export const sidebarConnectionActionButton = (

packages/compass-e2e-tests/tests/connection.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import {
2020
import type { Compass } from '../helpers/compass';
2121
import type { ConnectFormState } from '../helpers/connect-form-state';
2222
import * as Selectors from '../helpers/selectors';
23-
import { DEFAULT_CONNECTION_NAMES } from '../helpers/test-runner-context';
23+
import {
24+
DEFAULT_CONNECTION_NAMES,
25+
isTestingWeb,
26+
} from '../helpers/test-runner-context';
2427

2528
async function disconnect(browser: CompassBrowser) {
2629
try {
@@ -660,6 +663,7 @@ describe('Connect in a new window', () => {
660663

661664
it('can connect in new window', async function (this) {
662665
skipForWeb(this, 'connecting in new window is not supported on web');
666+
663667
const connectionName = DEFAULT_CONNECTION_NAMES[0];
664668
const connectionSelector = Selectors.sidebarConnection(connectionName);
665669
await browser.hover(connectionSelector);
@@ -683,7 +687,17 @@ describe('Connect in a new window', () => {
683687
});
684688
});
685689

686-
// TODO: Add a test for we to ensure the SplitButton isn't visible on Web
690+
it('shows correct connect button', async function (this) {
691+
const connectionName = DEFAULT_CONNECTION_NAMES[0];
692+
const connectionSelector = Selectors.sidebarConnection(connectionName);
693+
await browser.hover(connectionSelector);
694+
695+
const connectionElement = browser.$(connectionSelector);
696+
await connectionElement.$(Selectors.ConnectButton).waitForDisplayed();
697+
await connectionElement.$(Selectors.ConnectDropdownButton).waitForExist({
698+
reverse: isTestingWeb(),
699+
});
700+
});
687701
});
688702

689703
describe('Connection form', function () {

0 commit comments

Comments
 (0)