From 32e661a21210c41f67c6297b005b5db0cef6d7bf Mon Sep 17 00:00:00 2001 From: Anna Szczech Date: Fri, 7 Feb 2025 09:05:03 +0100 Subject: [PATCH 1/5] add wait for first item --- .changeset/green-peas-turn.md | 5 +++++ playwright/pages/dialogs/addNavigationMenuItemDialog.ts | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/green-peas-turn.md 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..7a6892ded0d 100644 --- a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts +++ b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts @@ -17,6 +17,7 @@ export class AddNavigationMenuItemDialog extends BasePage { async selectLinkTypeOption(linkType: string) { await this.menuLinkType.click(); await this.waitForDOMToFullyLoad(); + await this.menuLinkOptions.first().waitFor({ state: "visible" }); // Ensure the link type option is visible and select it const linkTypeOption = this.menuLinkOptions.filter({ hasText: linkType }); From 3634fb7c5a93ca4a3dce675ac05478e1fa626a9d Mon Sep 17 00:00:00 2001 From: Anna Szczech Date: Fri, 7 Feb 2025 09:07:12 +0100 Subject: [PATCH 2/5] do not overwrite comment with results --- .github/actions/flaky-tests-report/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/flaky-tests-report/action.yml b/.github/actions/flaky-tests-report/action.yml index b15046a42cf..e03003bb8d7 100644 --- a/.github/actions/flaky-tests-report/action.yml +++ b/.github/actions/flaky-tests-report/action.yml @@ -35,7 +35,7 @@ runs: report-path: ctrf-reports/merged-report.json summary-report: true pull-request: true - overwrite-comment: true + overwrite-comment: false failed-report: true env: GITHUB_TOKEN: ${{ inputs.github_token }} From 56c8b5a4786c7bf0e5f86162e0806cbc415581d9 Mon Sep 17 00:00:00 2001 From: Anna Szczech Date: Fri, 7 Feb 2025 11:59:38 +0100 Subject: [PATCH 3/5] use expect.toPass block --- playwright/pages/dialogs/addNavigationMenuItemDialog.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts index 7a6892ded0d..66cdd8c6816 100644 --- a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts +++ b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts @@ -15,9 +15,11 @@ export class AddNavigationMenuItemDialog extends BasePage { } async selectLinkTypeOption(linkType: string) { - await this.menuLinkType.click(); - await this.waitForDOMToFullyLoad(); - await this.menuLinkOptions.first().waitFor({ state: "visible" }); + await expect(async () => { + await this.menuLinkType.click(); + await this.waitForDOMToFullyLoad(); + 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 }); From cb2043bd31aeec66fdf14ac050f1b40d4a1c2f01 Mon Sep 17 00:00:00 2001 From: Anna Szczech Date: Fri, 7 Feb 2025 13:57:49 +0100 Subject: [PATCH 4/5] restore overwrite comment to true --- .github/actions/flaky-tests-report/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/flaky-tests-report/action.yml b/.github/actions/flaky-tests-report/action.yml index e03003bb8d7..b15046a42cf 100644 --- a/.github/actions/flaky-tests-report/action.yml +++ b/.github/actions/flaky-tests-report/action.yml @@ -35,7 +35,7 @@ runs: report-path: ctrf-reports/merged-report.json summary-report: true pull-request: true - overwrite-comment: false + overwrite-comment: true failed-report: true env: GITHUB_TOKEN: ${{ inputs.github_token }} From 52605447e4168b45fb4aa07b1afc762913801971 Mon Sep 17 00:00:00 2001 From: Anna Szczech Date: Tue, 11 Feb 2025 08:04:31 +0100 Subject: [PATCH 5/5] remove waitForDOMToFullyLoad --- playwright/pages/dialogs/addNavigationMenuItemDialog.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts index 66cdd8c6816..6e1092f8f8f 100644 --- a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts +++ b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts @@ -17,7 +17,6 @@ export class AddNavigationMenuItemDialog extends BasePage { async selectLinkTypeOption(linkType: string) { await expect(async () => { await this.menuLinkType.click(); - await this.waitForDOMToFullyLoad(); await this.menuLinkOptions.first().waitFor({ state: "visible" }); }).toPass(); @@ -37,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 }); @@ -57,6 +57,5 @@ export class AddNavigationMenuItemDialog extends BasePage { async clickSaveButton() { await this.saveButton.click(); - await this.waitForDOMToFullyLoad(); } }