Skip to content

Commit

Permalink
update: click menu
Browse files Browse the repository at this point in the history
  • Loading branch information
VsevolodX committed Apr 16, 2024
1 parent bb8bcdd commit 6625c94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ import MaterialDesignerPage from "../../widgets/MaterialDesignerPage";
When("I Run All Cells", () => {
const { jupyterLiteSession } = new MaterialDesignerPage().designerWidget;
jupyterLiteSession.waitForKernelIdleWithRestart();
jupyterLiteSession.clickMenuTab("Run");
jupyterLiteSession.clickMenuTab("Run All Cells");
jupyterLiteSession.clickMenu("Run", "Run All Cells");
});
19 changes: 8 additions & 11 deletions tests/cypress/support/widgets/JupyterLiteSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const selectors = {
cellInIndex: (index: number) =>
`.jp-Notebook .jp-Cell:nth-child(${index}) .jp-InputArea-editor .CodeMirror`,
menuItem: 'li[role="menuitem"]',
menuItemNew: (tabName: string) => `li[role="menuitem"] > div:contains("${tabName}")`,
runTab: 'li[role="menuitem"] > div:contains("Run")',
runAllCells: 'li[role="menuitem"] > div:contains("Run All Cells")',
};
Expand Down Expand Up @@ -64,17 +65,13 @@ export default class JupyterLiteSession extends Widget {
});
}

clickMenuTab(tabName: string) {
return this.browser
.iframe(selectors.iframe)
.waitForVisible(selectors.menuItem)
.contains(tabName)
.click()
.then(($li) => {
if ($li.find(".lm-Menu").length > 0) {
cy.contains(selectors.menuItem, tabName).should("be.visible").click();
}
});
clickMenu(tabName: string, subItemName?: string) {
const menuTabSelector = selectors.menuItemNew(tabName);
this.browser.iframe(selectors.iframe).clickFirst(menuTabSelector);
if (subItemName) {
const submenuItemSelector = selectors.menuItemNew(subItemName);
this.browser.iframe(selectors.iframe).clickFirst(submenuItemSelector);
}
}

getKernelStatus() {
Expand Down

0 comments on commit 6625c94

Please sign in to comment.