Skip to content

Commit ce961a6

Browse files
committed
Add test ensuring the right connect button is displayed
1 parent fd0569d commit ce961a6

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ const packageCompassAsync = promisify(packageCompass);
6565
// should we test compass-web (true) or compass electron (false)?
6666
export const TEST_COMPASS_WEB = isTestingWeb();
6767

68-
/*
69-
A helper so we can easily find all the tests we're skipping in compass-web.
70-
Reason is there so you can fill it in and have it show up in search results
71-
in a scannable manner. It is not being output at present because the tests will
72-
be logged as pending anyway.
73-
*/
68+
/**
69+
* A helper so we can easily find all the tests we're skipping in compass-web.
70+
* Reason is there so you can fill it in and have it show up in search results
71+
* in a scannable manner. It is not being output at present because the tests will
72+
* be logged as pending anyway.
73+
*/
7474
export function skipForWeb(
7575
test: Mocha.Runnable | Mocha.Context,
7676
// eslint-disable-next-line @typescript-eslint/no-unused-vars

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,8 @@ export const Multiple = {
283283
ConnectionsTitle: '[data-testid="connections-header"]',
284284
ConnectButton: '[data-action="connection-connect"]',
285285
ConnectInNewWindowButton: '[data-action="connection-connect-in-new-window"]',
286-
ConnectDropdownButton: '[aria-label="see more connection options"]',
286+
ConnectDropdownButton:
287+
'[data-testid="sidebar-navigation-item-actions-connection-connect-action"] + button',
287288
SidebarNewConnectionButton: '[data-action="add-new-connection"]',
288289
ConnectionMenu: '[data-testid="sidebar-navigation-item-actions"]',
289290
CreateDatabaseButton:

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

Lines changed: 21 additions & 1 deletion
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 {
@@ -662,6 +665,7 @@ describe('Connect in a new window', () => {
662665

663666
it('can connect in new window', async function (this) {
664667
skipForWeb(this, 'connecting in new window is not supported on web');
668+
665669
const connectionName = DEFAULT_CONNECTION_NAMES[0];
666670
const connectionSelector = Selectors.sidebarConnection(connectionName);
667671
await browser.hover(connectionSelector);
@@ -685,6 +689,22 @@ describe('Connect in a new window', () => {
685689
});
686690
});
687691

692+
it('shows correct connect button', async function (this) {
693+
const connectionName = DEFAULT_CONNECTION_NAMES[0];
694+
const connectionSelector = Selectors.sidebarConnection(connectionName);
695+
await browser.hover(connectionSelector);
696+
697+
const connectionElement = browser.$(connectionSelector);
698+
await connectionElement
699+
.$(Selectors.Multiple.ConnectButton)
700+
.waitForDisplayed();
701+
await connectionElement
702+
.$(Selectors.Multiple.ConnectDropdownButton)
703+
.waitForExist({
704+
reverse: isTestingWeb(),
705+
});
706+
});
707+
688708
// TODO: Add a test for we to ensure the SplitButton isn't visible on Web
689709
});
690710

0 commit comments

Comments
 (0)