diff --git a/.changeset/green-peas-turn.md b/.changeset/green-peas-turn.md new file mode 100644 index 00000000000..eef2632b4e2 --- /dev/null +++ b/.changeset/green-peas-turn.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Modify menu tests to ensure the first item in the list is visible before proceeding. diff --git a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts index 8faa2b463b8..6e1092f8f8f 100644 --- a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts +++ b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts @@ -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 }); @@ -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 }); @@ -54,6 +57,5 @@ export class AddNavigationMenuItemDialog extends BasePage { async clickSaveButton() { await this.saveButton.click(); - await this.waitForDOMToFullyLoad(); } }