Skip to content

Commit

Permalink
Fixing flaky tests - TC: SALEOR_32 and TC: SALEOR_33 (#4847)
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowee authored May 8, 2024
1 parent 434b169 commit be40ffd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-singers-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

Fixing flaky tests - TC: SALEOR_32 and TC: SALEOR_33
13 changes: 9 additions & 4 deletions playwright/pages/shippingRatesPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import { AddPostalCodeDialog } from "@pages/dialogs/addPostalCodeDialog";
import { AssignProductsDialog } from "@pages/dialogs/assignProductsDialog";
import { RightSideDetailsPage } from "@pages/pageElements/rightSideDetailsSection";
import type { Page } from "@playwright/test";
import { expect } from "@playwright/test";

export class ShippingRatesPage {
readonly page: Page;

export class ShippingRatesPage extends BasePage {
readonly basePage: BasePage;

readonly rightSideDetailsPage: RightSideDetailsPage;
Expand Down Expand Up @@ -35,8 +34,10 @@ export class ShippingRatesPage {
readonly excludedProductsRows = page.getByTestId("excluded-products-rows"),
readonly includePostalCodesRadioButton = page.getByTestId("INCLUDE"),
readonly assignedPostalCodesRows = page.getByTestId("assigned-postal-codes-rows"),
readonly assignDialogProductList = page.getByTestId("assign-product-list"),
readonly assignDialogProductRow = page.getByTestId("product-row"),
) {
this.page = page;
super(page);
this.basePage = new BasePage(page);
this.assignProductsDialog = new AssignProductsDialog(page);
this.addPostalCodeDialog = new AddPostalCodeDialog(page);
Expand All @@ -46,7 +47,11 @@ export class ShippingRatesPage {
async addExcludedProduct(name: string) {
await this.assignProductButton.click();
await this.assignProductsDialog.searchForProductInDialog(name);
await this.waitForDOMToFullyLoad();
await this.assignDialogProductList.waitFor({ state: "visible" });
await this.assignDialogProductRow.filter({ hasText: name }).waitFor({ state: "visible" });
await this.assignProductsDialog.selectProduct(name);
await expect(this.assignProductsDialog.assignAndSaveButton).toBeEnabled();
await this.assignProductsDialog.assignAndSaveButton.click();
await this.assignProductsDialog.assignAndSaveButton.waitFor({
state: "hidden",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ const ShippingMethodProductsAddDialog: React.FC<ShippingMethodProductsAddDialogP
height={450}
>
<ResponsiveTable key="table">
<TableBody>
<TableBody data-test-id="assign-product-list">
{renderCollection(
products,
(product, productIndex) => {
Expand Down

0 comments on commit be40ffd

Please sign in to comment.