Skip to content

Commit

Permalink
chore(e2e): un-skip the readonly tests for multiple connections COMPA…
Browse files Browse the repository at this point in the history
…SS-8005 (#5969)

un-skip the readonly tests for multiple connections
  • Loading branch information
lerouxb authored Jun 25, 2024
1 parent 5d49e65 commit e7b5391
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
2 changes: 2 additions & 0 deletions packages/compass-e2e-tests/helpers/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ export const Multiple = {
SidebarNewConnectionButton: '[data-action="add-new-connection"]',
ConnectionMenu: '[data-testid="sidebar-navigation-item-actions"]',

CreateDatabaseItem:
'[data-testid="sidebar-navigation-item-actions-create-database-action"]',
OpenShellItem:
'[data-testid="sidebar-navigation-item-actions-open-shell-action"]',
ViewPerformanceItem:
Expand Down
47 changes: 31 additions & 16 deletions packages/compass-e2e-tests/tests/read-only.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ describe('readOnly: true / Read-Only Edition', function () {

before(function () {
skipForWeb(this, 'settings modal not available on compass-web');
// TODO(COMPASS-8005): port these once implemented
if (TEST_MULTIPLE_CONNECTIONS) {
this.skip();
}
});

beforeEach(async function () {
Expand All @@ -44,12 +40,24 @@ describe('readOnly: true / Read-Only Edition', function () {
await browser.setFeature('readOnly', true);
await browser.connectWithConnectionString();

let sidebarCreateDatabaseButton = await browser.$(
Selectors.SidebarCreateDatabaseButton
);
let isSidebarCreateDatabaseButtonExisting =
await sidebarCreateDatabaseButton.isExisting();
expect(isSidebarCreateDatabaseButtonExisting).to.be.equal(false);
const connectionName = connectionNameFromString(DEFAULT_CONNECTION_STRING);

if (TEST_MULTIPLE_CONNECTIONS) {
// navigate to the databases tab so that the connection is
// active/highlighted and then the add button and three dot menu will
// display without needing to hover
await browser.navigateToConnectionTab(connectionName, 'Databases');
expect(
await browser.$(Selectors.Multiple.CreateDatabaseItem).isExisting()
).to.be.equal(false);
} else {
const sidebarCreateDatabaseButton = await browser.$(
Selectors.SidebarCreateDatabaseButton
);
const isSidebarCreateDatabaseButtonExisting =
await sidebarCreateDatabaseButton.isExisting();
expect(isSidebarCreateDatabaseButtonExisting).to.be.equal(false);
}

await browser.openSettingsModal();
const settingsModal = await browser.$(Selectors.SettingsModal);
Expand All @@ -62,12 +70,19 @@ describe('readOnly: true / Read-Only Edition', function () {
// wait for the modal to go away
await settingsModal.waitForDisplayed({ reverse: true });

sidebarCreateDatabaseButton = await browser.$(
Selectors.SidebarCreateDatabaseButton
);
isSidebarCreateDatabaseButtonExisting =
await sidebarCreateDatabaseButton.isExisting();
expect(isSidebarCreateDatabaseButtonExisting).to.be.equal(true);
if (TEST_MULTIPLE_CONNECTIONS) {
await browser.navigateToConnectionTab(connectionName, 'Databases');
expect(
await browser.$(Selectors.Multiple.CreateDatabaseItem).isExisting()
).to.be.equal(true);
} else {
const sidebarCreateDatabaseButton = await browser.$(
Selectors.SidebarCreateDatabaseButton
);
const isSidebarCreateDatabaseButtonExisting =
await sidebarCreateDatabaseButton.isExisting();
expect(isSidebarCreateDatabaseButtonExisting).to.be.equal(true);
}
});

it('shows and hides the plus icon on the siderbar to create a collection', async function () {
Expand Down

0 comments on commit e7b5391

Please sign in to comment.