-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract and fix selectCollectionMenuItem
- Loading branch information
Showing
6 changed files
with
98 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
packages/compass-e2e-tests/helpers/commands/sidebar-collection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import type { CompassBrowser } from '../compass-browser'; | ||
import * as Selectors from '../selectors'; | ||
|
||
export async function selectCollectionMenuItem( | ||
browser: CompassBrowser, | ||
connectionName: string, | ||
databaseName: string, | ||
collectionName: string, | ||
actionName: string | ||
) { | ||
const connectionId = await browser.getConnectionIdByName(connectionName); | ||
|
||
// search for the view in the sidebar | ||
await browser.clickVisible(Selectors.SidebarFilterInput); | ||
await browser.setValueVisible( | ||
Selectors.SidebarFilterInput, | ||
`^(${databaseName}|${collectionName})$` | ||
); | ||
|
||
const collectionSelector = Selectors.sidebarCollection( | ||
connectionId, | ||
databaseName, | ||
collectionName | ||
); | ||
|
||
// scroll to the collection if necessary | ||
await browser.scrollToVirtualItem( | ||
Selectors.SidebarNavigationTree, | ||
collectionSelector, | ||
'tree' | ||
); | ||
|
||
const collectionElement = await browser.$(collectionSelector); | ||
await collectionElement.waitForDisplayed(); | ||
|
||
// hover over the collection | ||
await browser.hover(collectionSelector); | ||
|
||
// click the show collections button | ||
// NOTE: This assumes it is currently closed | ||
await browser.clickVisible( | ||
`${collectionSelector} ${Selectors.SidebarNavigationItemShowActionsButton}` | ||
); | ||
|
||
const actionSelector = `[role="menuitem"][data-action="${actionName}"]`; | ||
|
||
const actionButton = await browser.$(actionSelector); | ||
|
||
// click the action | ||
await browser.clickVisible(actionSelector); | ||
|
||
// make sure the menu closed | ||
await actionButton.waitForDisplayed({ reverse: true }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.