Skip to content

Commit

Permalink
chore: stable ui5-menu tests (#7849)
Browse files Browse the repository at this point in the history
* chore: stable ui5-menu tests

* chore: remove only keyword

---------

Co-authored-by: Nayden Naydenov <[email protected]>
  • Loading branch information
nnaydenow and Nayden Naydenov authored Nov 15, 2023
1 parent bd9cd2b commit e344a02
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions packages/main/test/specs/Menu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,30 @@ describe("Menu interaction", () => {
openButton.click();

const staticAreaItemClassName = await browser.getStaticAreaItemClassName("#menu");
const popover = await browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
const staticAreaItem = await browser.$(`.${staticAreaItemClassName}`);
const popover = staticAreaItem.shadow$("ui5-responsive-popover");
const listItems = await popover.$("ui5-list").$$("ui5-li");
const submenuList = await staticAreaItem.shadow$(".ui5-menu-submenus");

listItems[3].click(); // open sub-menu

assert.ok(await browser.$(`.${staticAreaItemClassName}`).shadow$(".ui5-menu-submenus").$("ui5-menu"),
"The second level sub-menu is being created"); // new ui5-menu element is created for the sub-menu
await submenuList.$("ui5-menu").waitForExist({
timeout: 1000,
timeoutMsg: "The second level sub-menu is should be created"
})

assert.ok(await submenuList.$("ui5-menu"), "The second level sub-menu is being created"); // new ui5-menu element is created for the sub-menu

await browser.keys("ArrowLeft"); // back to main menu
await browser.keys("ArrowDown"); // go to the next menu item (close sub-menu)

assert.strictEqual(await browser.$(`.${staticAreaItemClassName}`).shadow$(".ui5-menu-submenus").$$("ui5-menu").length, 0,
await submenuList.$("ui5-menu").waitForExist({
reverse: true,
timeout: 1000,
timeoutMsg: "The second level sub-menu is should be destroyed"
})

assert.strictEqual(await submenuList.$$("ui5-menu").length, 0,
"The second level sub-menu is being destroyed"); // sub-menu ui5-menu element is destroyed
});

Expand Down

0 comments on commit e344a02

Please sign in to comment.