diff --git a/.changeset/dull-pens-matter.md b/.changeset/dull-pens-matter.md new file mode 100644 index 00000000000..7adf0538892 --- /dev/null +++ b/.changeset/dull-pens-matter.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Tests for shipping methods now wait to content load to start test diff --git a/playwright/data/e2eTestData.ts b/playwright/data/e2eTestData.ts index 542426ce5bb..4ac031967bc 100644 --- a/playwright/data/e2eTestData.ts +++ b/playwright/data/e2eTestData.ts @@ -521,6 +521,7 @@ export const SHIPPING_METHODS = { shippingMethodWithoutRates: { id: "U2hpcHBpbmdab25lOjIzOTA%3D", info: "Shipping method that is used to add rates", + name: "Shipping method that is used to add rates", }, shippingMethodToBeUpdated: { id: "U2hpcHBpbmdab25lOjIzOTI=", diff --git a/playwright/pages/shippingMethodsPage.ts b/playwright/pages/shippingMethodsPage.ts index 703bc5a0e6e..3159209c6e3 100644 --- a/playwright/pages/shippingMethodsPage.ts +++ b/playwright/pages/shippingMethodsPage.ts @@ -71,22 +71,15 @@ export class ShippingMethodsPage extends BasePage { }); } - async gotoExistingShippingMethod(shippingMethodId: string) { + async gotoExistingShippingMethod(shippingMethodId: string, shippingMethodName: string) { const existingShippingMethodUrl = `${URL_LIST.shippingMethods}${shippingMethodId}`; await console.log(`Navigates to existing shipping method page: ${existingShippingMethodUrl}`); await this.page.goto(existingShippingMethodUrl); - - const channels = await this.rightSideDetailsPage.channelSection - .locator('[data-test-id*="selected-option-"]') - .all(); - - for (const channel of channels) { - await channel.waitFor({ - state: "visible", - timeout: 60000, - }); - } + await this.page.getByText(shippingMethodName).first().waitFor({ + state: "visible", + timeout: 60000, + }); } async gotoExistingShippingRate(shippingMethodId: string, shippingRateId: string) { diff --git a/playwright/tests/shippingMethods.spec.ts b/playwright/tests/shippingMethods.spec.ts index 19d2288aa73..0c3c2ac09f7 100644 --- a/playwright/tests/shippingMethods.spec.ts +++ b/playwright/tests/shippingMethods.spec.ts @@ -32,6 +32,7 @@ test("TC: SALEOR_31 Create basic shipping method @shipping-method @e2e", async ( test("TC: SALEOR_32 Add price rate to shipping method - with excluded zip codes and excluded product @shipping-method @e2e", async () => { await shippingMethodsPage.gotoExistingShippingMethod( SHIPPING_METHODS.shippingMethodWithoutRates.id, + SHIPPING_METHODS.shippingMethodWithoutRates.name, ); await shippingMethodsPage.clickAddPriceRateButton(); await shippingMethodsPage.rightSideDetailsPage.selectTaxIndex(1); @@ -53,6 +54,7 @@ test("TC: SALEOR_32 Add price rate to shipping method - with excluded zip codes test("TC: SALEOR_33 Add weight rate to shipping method - with included zip codes and excluded product @shipping-method @e2e", async () => { await shippingMethodsPage.gotoExistingShippingMethod( SHIPPING_METHODS.shippingMethodWithoutRates.id, + SHIPPING_METHODS.shippingMethodWithoutRates.name, ); await shippingMethodsPage.clickAddWeightRateButton(); await shippingMethodsPage.rightSideDetailsPage.selectTaxIndex(1); @@ -74,6 +76,7 @@ test("TC: SALEOR_33 Add weight rate to shipping method - with included zip codes test("TC: SALEOR_34 Delete a single shipping rate from the shipping zone details page @shipping-method @e2e", async () => { await shippingMethodsPage.gotoExistingShippingMethod( SHIPPING_METHODS.shippingMethodWithRatesToBeDeleted.id, + SHIPPING_METHODS.shippingMethodWithRatesToBeDeleted.name, ); await expect(shippingMethodsPage.pageHeader).toBeVisible(); @@ -134,7 +137,9 @@ test("TC: SALEOR_37 Update a shipping method @shipping-method @e2e", async () => await shippingMethodsPage.gotoExistingShippingMethod( SHIPPING_METHODS.shippingMethodToBeUpdated.id, + SHIPPING_METHODS.shippingMethodToBeUpdated.name, ); + await shippingMethodsPage.rightSideDetailsPage.clickChannelsSelectShippingPage(); await shippingMethodsPage.rightSideDetailsPage.selectSingleChannelShippingPage(); await shippingMethodsPage.rightSideDetailsPage.clickWarehouseSelectShippingPage();