diff --git a/.changeset/cool-doors-drum.md b/.changeset/cool-doors-drum.md new file mode 100644 index 00000000000..53dd3178b9d --- /dev/null +++ b/.changeset/cool-doors-drum.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +You can now run e2e tests without flakiness diff --git a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts index 37dd1d43628..0a0fafce93b 100644 --- a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts +++ b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts @@ -45,5 +45,6 @@ export class AddNavigationMenuItemDialog extends BasePage{ } async clickSaveButton() { await this.saveButton.click(); + await this.waitForDOMToFullyLoad(); } } diff --git a/playwright/pages/dialogs/deleteDialog.ts b/playwright/pages/dialogs/deleteDialog.ts index 587c6b6d71f..5e6d469bbb1 100644 --- a/playwright/pages/dialogs/deleteDialog.ts +++ b/playwright/pages/dialogs/deleteDialog.ts @@ -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() { diff --git a/playwright/pages/navigationDetailsPage.ts b/playwright/pages/navigationDetailsPage.ts index e04c0857742..e08bbe371d7 100644 --- a/playwright/pages/navigationDetailsPage.ts +++ b/playwright/pages/navigationDetailsPage.ts @@ -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(); } diff --git a/playwright/pages/vouchersPage.ts b/playwright/pages/vouchersPage.ts index e858fd38ced..4128d819f5b 100644 --- a/playwright/pages/vouchersPage.ts +++ b/playwright/pages/vouchersPage.ts @@ -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}`; diff --git a/playwright/tests/categories.spec.ts b/playwright/tests/categories.spec.ts index 5d0daac09fe..adb3fe5c5f6 100644 --- a/playwright/tests/categories.spec.ts +++ b/playwright/tests/categories.spec.ts @@ -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, diff --git a/playwright/tests/collections.spec.ts b/playwright/tests/collections.spec.ts index a734f70a1de..7d0c2f69d89 100644 --- a/playwright/tests/collections.spec.ts +++ b/playwright/tests/collections.spec.ts @@ -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, diff --git a/playwright/tests/pageTypes.spec.ts b/playwright/tests/pageTypes.spec.ts index 3b69a43c94f..3471c415c5a 100644 --- a/playwright/tests/pageTypes.spec.ts +++ b/playwright/tests/pageTypes.spec.ts @@ -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); }); @@ -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); }); @@ -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(); await pageTypePage.checkPageTypesOnList(rowsToBeDeleted); await pageTypePage.clickBulkDeleteButton(); await pageTypePage.deletePageTypeDialog.waitForDOMToFullyLoad(); diff --git a/playwright/tests/product.spec.ts b/playwright/tests/product.spec.ts index ae0a080b1bb..0b9f1a8a8ad 100644 --- a/playwright/tests/product.spec.ts +++ b/playwright/tests/product.spec.ts @@ -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(); @@ -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`, @@ -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(); @@ -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( @@ -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(); diff --git a/playwright/tests/singlePermissions/readonlyAppAccess.spec.ts b/playwright/tests/singlePermissions/readonlyAppAccess.spec.ts index 57b88a33db6..41c8aae5862 100644 --- a/playwright/tests/singlePermissions/readonlyAppAccess.spec.ts +++ b/playwright/tests/singlePermissions/readonlyAppAccess.spec.ts @@ -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()); diff --git a/playwright/tests/vouchers.spec.ts b/playwright/tests/vouchers.spec.ts index db90a51db7a..95e397240ce 100644 --- a/playwright/tests/vouchers.spec.ts +++ b/playwright/tests/vouchers.spec.ts @@ -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,