Skip to content

Commit

Permalink
cherry picking 345eeb0 (#5005)
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowee authored Jul 3, 2024
1 parent f5dc06d commit 1b7126b
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/cool-doors-drum.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

You can now run e2e tests without flakiness
1 change: 1 addition & 0 deletions playwright/pages/dialogs/addNavigationMenuItemDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ export class AddNavigationMenuItemDialog extends BasePage{
}
async clickSaveButton() {
await this.saveButton.click();
await this.waitForDOMToFullyLoad();
}
}
4 changes: 1 addition & 3 deletions playwright/pages/dialogs/deleteDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ export class DeleteDialog extends BasePage {
}

async clickDeleteButton() {
await this.waitForNetworkIdleAfterAction(async () => {
await this.deleteButton.first().click();
});
await this.deleteButton.first().click();
await this.deleteButton.waitFor({ state: "hidden" });
}
async clickConfirmDeletionCheckbox() {
Expand Down
6 changes: 4 additions & 2 deletions playwright/pages/navigationDetailsPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ async clickEditMenuItemButton(name:string) {
}
async clickCreateNewMenuItem() {
await this.createMenuItemButton.click();
}
async clickSaveButton() {
await this.waitForDOMToFullyLoad();
}

async clickSaveButton() {
await this.saveButton.click();
await this.waitForDOMToFullyLoad();
}
Expand Down
1 change: 1 addition & 0 deletions playwright/pages/vouchersPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export class VouchersPage extends BasePage {

async gotoVouchersListPage() {
await this.page.goto(URL_LIST.vouchers);
await this.waitForDOMToFullyLoad();
}
async gotoExistingVoucherPage(voucherId: string) {
const existingVoucherUrl = `${URL_LIST.vouchers}${voucherId}`;
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/categories.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ test("TC: SALEOR_104 Bulk delete categories @e2e @category", async () => {
);
await categoriesPage.clickBulkDeleteButton();
await categoriesPage.deleteCategoriesDialog.clickDeleteButton();
await categoriesPage.waitForGrid();
await categoriesPage.gotoCategoryListView();
expect(
await categoriesPage.findRowIndexBasedOnText(
CATEGORIES.categoriesToBeBulkDeleted.names,
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/collections.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ test("TC: SALEOR_114 Bulk delete collections @collections @e2e", async () => {
);
await collectionsPage.clickBulkDeleteButton();
await collectionsPage.deleteCollectionDialog.clickDeleteButton();
await collectionsPage.waitForGrid();
await collectionsPage.gotoCollectionsListView();
expect(
await collectionsPage.findRowIndexBasedOnText(
COLLECTIONS.collectionsToBeBulkDeleted.names,
Expand Down
4 changes: 2 additions & 2 deletions playwright/tests/pageTypes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ test("TC: SALEOR_187 As an admin user I can create page type @e2e @page-type", a
await pageTypePage.expectSuccessBanner();
await expect(pageTypePage.nameInput).toHaveValue(pageTypeName);
await pageTypePage.gotoPageTypeListPage();
await expect(pageTypePage.pageTypeList).toBeVisible({timeout:60000});
await expect(pageTypePage.pageTypeList).toContainText(pageTypeName);

Check failure on line 21 in playwright/tests/pageTypes.spec.ts

View workflow job for this annotation

GitHub Actions / run-tests-on-release / run-pw-tests (2/2)

[chromium] › pageTypes.spec.ts:9:5 › TC: SALEOR_187 As an admin user I can create page type @e2e @page-type

1) [chromium] › pageTypes.spec.ts:9:5 › TC: SALEOR_187 As an admin user I can create page type @e2e @page-type Error: Timed out 5000ms waiting for expect(locator).toContainText(expected) Locator: getByTestId('page-types-list') Expected string: "e2e-page-type-69677" Received string: "‌" Call log: - expect.toContainText with timeout 5000ms - waiting for getByTestId('page-types-list') - locator resolved to <tbody class="MuiTableBody-root" data-test-id="page-typ…>…</tbody> - unexpected value "‌" 19 | await expect(pageTypePage.nameInput).toHaveValue(pageTypeName); 20 | await pageTypePage.gotoPageTypeListPage(); > 21 | await expect(pageTypePage.pageTypeList).toContainText(pageTypeName); | ^ 22 | }); 23 | 24 | test("TC: SALEOR_188 As an admin user I can update page type@e2e @page-type", async ({ at /home/runner/work/saleor-dashboard/saleor-dashboard/playwright/tests/pageTypes.spec.ts:21:43
});

Expand Down Expand Up @@ -52,7 +51,7 @@ test("TC: SALEOR_189 As an admin user I can delete page type with assigned conte
await pageTypePage.deletePageTypeDialog.waitForDOMToFullyLoad();
await pageTypePage.clickConfirmRemovalButton();
await pageTypePage.expectSuccessBanner();
await pageTypePage.gotoPageTypeListPage();
await pageTypePage.gotoPageTypeListPage();
await expect(pageTypePage.pageTypeList).not.toContainText(pageType.name);
});

Expand All @@ -65,6 +64,7 @@ test("TC: SALEOR_190 As an admin user I can delete several page types@e2e @page-
const pageTypeNames = PAGE_TYPES.pageTypesToBeBulkDeleted.names;

await pageTypePage.gotoPageTypeListPage();
await expect(pageTypePage.pageTypeList).toBeVisible();

Check failure on line 67 in playwright/tests/pageTypes.spec.ts

View workflow job for this annotation

GitHub Actions / run-tests-on-release / run-pw-tests (2/2)

[chromium] › pageTypes.spec.ts:58:5 › TC: SALEOR_190 As an admin user I can delete several page types@e2e @page-type

2) [chromium] › pageTypes.spec.ts:58:5 › TC: SALEOR_190 As an admin user I can delete several page types@e2e @page-type Error: Timed out 5000ms waiting for expect(locator).toBeVisible() Locator: getByTestId('page-types-list') Expected: visible Received: hidden Call log: - expect.toBeVisible with timeout 5000ms - waiting for getByTestId('page-types-list') 65 | 66 | await pageTypePage.gotoPageTypeListPage(); > 67 | await expect(pageTypePage.pageTypeList).toBeVisible(); | ^ 68 | await pageTypePage.checkPageTypesOnList(rowsToBeDeleted); 69 | await pageTypePage.clickBulkDeleteButton(); 70 | await pageTypePage.deletePageTypeDialog.waitForDOMToFullyLoad(); at /home/runner/work/saleor-dashboard/saleor-dashboard/playwright/tests/pageTypes.spec.ts:67:43
await pageTypePage.checkPageTypesOnList(rowsToBeDeleted);
await pageTypePage.clickBulkDeleteButton();
await pageTypePage.deletePageTypeDialog.waitForDOMToFullyLoad();
Expand Down
13 changes: 4 additions & 9 deletions playwright/tests/product.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ test.beforeEach(({ page, request }) => {

test("TC: SALEOR_3 Create basic product with variants @e2e @product", async () => {
await productPage.gotoProductListPage();
await productPage.waitForDOMToFullyLoad();
await productPage.clickCreateProductButton();
await productCreateDialog.selectProductTypeWithVariants();
await productCreateDialog.clickConfirmButton();
Expand Down Expand Up @@ -104,14 +103,12 @@ test("TC: SALEOR_27 Create full info variant - via edit variant page @e2e @produ

test("TC: SALEOR_44 As an admin I should be able to delete a several products @basic-regression @product @e2e", async () => {
await productPage.gotoProductListPage();
await productPage.waitForDOMToFullyLoad();
await productPage.checkListRowsBasedOnContainingText(
PRODUCTS.productsToBeBulkDeleted.names,
);
await productPage.checkListRowsBasedOnContainingText(PRODUCTS.productsToBeBulkDeleted.names);
await productPage.clickBulkDeleteButton();
await productPage.deleteProductDialog.clickDeleteButton();
await productPage.expectSuccessBanner();
await productPage.waitForGrid();
await productPage.gotoProductListPage();

expect(
await productPage.findRowIndexBasedOnText(PRODUCTS.productsToBeBulkDeleted.names),
`Given products: ${PRODUCTS.productsToBeBulkDeleted.names} should be deleted from the list`,
Expand Down Expand Up @@ -176,7 +173,6 @@ test("TC: SALEOR_46 As an admin, I should be able to update a product by uploadi
});
test("TC: SALEOR_56 As an admin, I should be able to export products from single channel as CSV file @basic-regression @product @e2e", async () => {
await productPage.gotoProductListPage();
await productPage.waitForDOMToFullyLoad();
await productPage.clickCogShowMoreButtonButton();
await productPage.clickExportButton();
await productPage.exportProductsDialog.clickChannelsAccordion();
Expand All @@ -193,7 +189,6 @@ test("TC: SALEOR_56 As an admin, I should be able to export products from single

test("TC: SALEOR_57 As an admin, I should be able to search products on list view @basic-regression @product @e2e", async () => {
await productPage.gotoProductListPage();
await productPage.waitForDOMToFullyLoad();
await productPage.searchAndFindRowIndexes(PRODUCTS.productToAddVariants.name);
await productPage.checkListRowsBasedOnContainingText([PRODUCTS.productToAddVariants.name]);
expect(
Expand All @@ -204,7 +199,7 @@ test("TC: SALEOR_57 As an admin, I should be able to search products on list vie

test("TC: SALEOR_58 As an admin I should be able use pagination on product list view @basic-regression @product @e2e", async () => {
await productPage.gotoProductListPage();
await productPage.waitForDOMToFullyLoad();

const firstPageProductName = await productPage.getGridCellText(0, 0);
await productPage.clickNextPageButton();
await productPage.waitForGrid();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ for (const permission of permissionList) {
appsPage.upcomingAppsList,
];
for (const appList of appLists) {
await appsPage.waitForDOMToFullyLoad();
await expect(appList).toBeVisible();
}
await appsPage.waitForNetworkIdleAfterAction(() => appsPage.installedAppRow.first().click());
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/vouchers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ test("TC: SALEOR_93 Bulk delete voucher @vouchers @e2e", async () => {
vouchersPage.deleteVoucherDialog.clickDeleteButton(),
);
await vouchersPage.expectSuccessBanner();
await vouchersPage.waitForGrid();
await vouchersPage.gotoVouchersListPage();
await expect(
await vouchersPage.findRowIndexBasedOnText(
VOUCHERS.vouchers.voucherToBeBulkDeleted.names,
Expand Down

0 comments on commit 1b7126b

Please sign in to comment.