diff --git a/.changeset/thin-drinks-kneel.md b/.changeset/thin-drinks-kneel.md new file mode 100644 index 00000000000..8c7c5d97400 --- /dev/null +++ b/.changeset/thin-drinks-kneel.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Add explicit waits for draft order shipping carrier button interaction diff --git a/playwright/pages/draftOrdersPage.ts b/playwright/pages/draftOrdersPage.ts index 39ac3bac584..2b139d32bea 100644 --- a/playwright/pages/draftOrdersPage.ts +++ b/playwright/pages/draftOrdersPage.ts @@ -60,7 +60,9 @@ export class DraftOrdersPage extends BasePage { } async clickAddShippingCarrierButton() { + await this.addShippingCarrierLink.scrollIntoViewIfNeeded(); await this.addShippingCarrierLink.click(); + await this.waitForDOMToFullyLoad(); } diff --git a/playwright/tests/orders.spec.ts b/playwright/tests/orders.spec.ts index 5ce96be6b99..6a36ce1b320 100644 --- a/playwright/tests/orders.spec.ts +++ b/playwright/tests/orders.spec.ts @@ -251,9 +251,15 @@ test("TC: SALEOR_84 Create draft order @e2e @draft", async () => { await draftOrdersPage.expectSuccessBanner(); await draftOrdersPage.addressDialog.clickConfirmButton(); await draftOrdersPage.expectSuccessBanner(); + + await draftOrdersPage.addShippingCarrierLink.waitFor({ state: "visible" }); + // Ensure the button is in viewport before clicking + await draftOrdersPage.addShippingCarrierLink.scrollIntoViewIfNeeded(); + + await expect(draftOrdersPage.addShippingCarrierLink).toBeVisible(); await draftOrdersPage.clickAddShippingCarrierButton(); + await draftOrdersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod(); - //await draftOrdersPage.expectSuccessBanner(); await draftOrdersPage.clickFinalizeButton(); await draftOrdersPage.expectSuccessBanner({ message: "finalized" }); });