Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry clicking on dropdown and wait for first item #5398

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions .changeset/green-peas-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Modify menu tests to ensure the first item in the list is visible before proceeding.
12 changes: 7 additions & 5 deletions playwright/pages/dialogs/addNavigationMenuItemDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export class AddNavigationMenuItemDialog extends BasePage {
}

async selectLinkTypeOption(linkType: string) {
await this.menuLinkType.click();
await this.waitForDOMToFullyLoad();
await expect(async () => {
await this.menuLinkType.click();
await this.menuLinkOptions.first().waitFor({ state: "visible" });
}).toPass();

// Ensure the link type option is visible and select it
const linkTypeOption = this.menuLinkOptions.filter({ hasText: linkType });
Expand All @@ -34,8 +36,9 @@ export class AddNavigationMenuItemDialog extends BasePage {
}

async selectLinkTypeValue(optionName: string) {
await this.menuLinkValue.click();
await this.waitForDOMToFullyLoad();
await expect(async () => {
await this.menuLinkValue.click();
}).toPass();

// Ensure the option is present and select it
const option = this.menuLinkOptions.filter({ hasText: optionName });
Expand All @@ -54,6 +57,5 @@ export class AddNavigationMenuItemDialog extends BasePage {

async clickSaveButton() {
await this.saveButton.click();
await this.waitForDOMToFullyLoad();
}
}
Loading