From 9d0992ea92b7979d03fd2cdbb46e351102df283e Mon Sep 17 00:00:00 2001 From: shashwata Date: Sun, 18 Feb 2024 23:02:15 +0600 Subject: [PATCH 1/2] update some tests --- tests/pw/pages/basePage.ts | 1 - tests/pw/pages/reportsPage.ts | 2 +- tests/pw/tests/e2e/_localSite.install.ts | 7 +++---- tests/pw/tests/e2e/abuseReports.spec.ts | 14 ++++---------- tests/pw/tests/e2e/orders.spec.ts | 10 +++++----- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/tests/pw/pages/basePage.ts b/tests/pw/pages/basePage.ts index 99cb765037..e269523018 100644 --- a/tests/pw/pages/basePage.ts +++ b/tests/pw/pages/basePage.ts @@ -1056,7 +1056,6 @@ export class BasePage { // get last matching locator lastLocator(selector: string): Locator { - // todo: update all selector parameter to both selector or locator const locator = this.page.locator(selector); return locator.last(); } diff --git a/tests/pw/pages/reportsPage.ts b/tests/pw/pages/reportsPage.ts index 89d628306d..696c5df1da 100644 --- a/tests/pw/pages/reportsPage.ts +++ b/tests/pw/pages/reportsPage.ts @@ -66,7 +66,7 @@ export class ReportsPage extends AdminPage { await this.clearInputField(reportsAdmin.allLogs.search); await this.typeAndWaitForResponseAndLoadState(data.subUrls.api.dokan.logs, reportsAdmin.allLogs.search, orderId); await this.notToBeVisible(selector.admin.dokan.loader); - await this.wait(1); // todo: resolve this + await this.wait(2); // todo: resolve this await this.toBeVisible(reportsAdmin.allLogs.orderIdCell(orderId)); const count = (await this.getElementText(reportsAdmin.allLogs.numberOfRowsFound))?.split(' ')[0]; expect(Number(count)).toBe(1); diff --git a/tests/pw/tests/e2e/_localSite.install.ts b/tests/pw/tests/e2e/_localSite.install.ts index d998894792..4ee62b21c9 100644 --- a/tests/pw/tests/e2e/_localSite.install.ts +++ b/tests/pw/tests/e2e/_localSite.install.ts @@ -11,7 +11,7 @@ import { dbData } from '@utils/dbData'; test.describe('setup local site', () => { test.skip(!!process.env.CI, 'skip site setup on CI'); - // test('download wordpress to desired folder', async ({ page }) => { + test('download wordpress to desired folder', async ({ page }) => {}); // todo: /* @@ -24,8 +24,7 @@ test.describe('setup local site', () => { // }); - // test('delete database or all tables ', async ({ page }) => { - // }); + test('delete database or all tables', async ({ page }) => {}); test('admin setup WP', async ({ page }) => { const loginPage = new LoginPage(page); @@ -40,7 +39,7 @@ test.describe('setup local site', () => { // await dbUtils.updateWpOptionTable(dbData.dokan.optionName.dokanActiveModules, dbData.dokan.modules, 'serialize'); }); - // test('install and activate theme', async ({ request }) => {} + test('install and activate theme', async ({ request }) => {}); // todo: skip global setup for local_setup diff --git a/tests/pw/tests/e2e/abuseReports.spec.ts b/tests/pw/tests/e2e/abuseReports.spec.ts index 7dd3f2b648..da1adc1bbf 100644 --- a/tests/pw/tests/e2e/abuseReports.spec.ts +++ b/tests/pw/tests/e2e/abuseReports.spec.ts @@ -11,8 +11,7 @@ const { VENDOR_ID, CUSTOMER_ID } = process.env; test.describe('Abuse report test', () => { let admin: AbuseReportsPage; let customer: AbuseReportsPage; - let guest: AbuseReportsPage; - let aPage: Page, cPage: Page, gPage: Page; + let aPage: Page, cPage: Page; let apiUtils: ApiUtils; test.beforeAll(async ({ browser }) => { @@ -24,10 +23,6 @@ test.describe('Abuse report test', () => { cPage = await customerContext.newPage(); customer = new AbuseReportsPage(cPage); - const guestContext = await browser.newContext(data.auth.noAuth); - gPage = await guestContext.newPage(); - guest = new AbuseReportsPage(gPage); - apiUtils = new ApiUtils(await request.newContext()); const productId = await apiUtils.getProductId(data.predefined.simpleProduct.product1.name, payloads.vendorAuth); await dbUtils.createAbuseReport(dbData.dokan.createAbuseReport, productId, VENDOR_ID, CUSTOMER_ID); @@ -72,13 +67,12 @@ test.describe('Abuse report test', () => { }); test('guest customer can report product @pro @g', async ({ page }) => { - guest = new AbuseReportsPage(page); //todo: apply guest user like this where every test need seperate guest user + const guest = new AbuseReportsPage(page); await guest.reportProduct(data.predefined.simpleProduct.product1.name, data.product.report); }); - test.skip('guest customer need to log-in to report product @pro @g', async ({ page }) => { - // todo: might cause other tests to fail in parallel - guest = new AbuseReportsPage(page); + test('guest customer need to log-in to report product @pro @g', async ({ page }) => { + const guest = new AbuseReportsPage(page); await dbUtils.setDokanSettings(dbData.dokan.optionName.productReportAbuse, { ...dbData.dokan.productReportAbuseSettings, reported_by_logged_in_users_only: 'on' }); await guest.reportProduct(data.predefined.simpleProduct.product1.name, data.product.report); await dbUtils.setDokanSettings(dbData.dokan.optionName.productReportAbuse, dbData.dokan.productReportAbuseSettings); diff --git a/tests/pw/tests/e2e/orders.spec.ts b/tests/pw/tests/e2e/orders.spec.ts index 62fada22d9..0b54d49082 100644 --- a/tests/pw/tests/e2e/orders.spec.ts +++ b/tests/pw/tests/e2e/orders.spec.ts @@ -86,11 +86,11 @@ test.describe('Order functionality test', () => { await vendor.addShipment(orderId, data.orderShipmentDetails); }); - // test.skip('vendor can add downloadable product permission to order @lite @v', async ( ) => { - // const [,, downloadableProductName] = await apiUtils.createProduct(payloads.createDownloadableProduct(), payloads.vendorAuth); - // await vendor.addDownloadableProduct(orderId, downloadableProductName); - // await vendor.removeDownloadableProduct(orderId, downloadableProductName); - // }); + test.skip('vendor can add downloadable product permission to order @lite @v', async () => { + const [, , downloadableProductName] = await apiUtils.createProduct(payloads.createDownloadableProduct(), payloads.vendorAuth); + await vendor.addDownloadableProduct(orderId, downloadableProductName); + await vendor.removeDownloadableProduct(orderId, downloadableProductName); + }); test('vendor can perform order bulk action @lite @v', async () => { await vendor.orderBulkAction('completed', orderId); From a399f255b27a7e121f31289434574a4a1ebe0f9c Mon Sep 17 00:00:00 2001 From: shashwata Date: Sun, 18 Feb 2024 23:02:40 +0600 Subject: [PATCH 2/2] fix some skipped tests --- tests/pw/tests/e2e/myOrders.spec.ts | 2 +- tests/pw/tests/e2e/productAdvertising.spec.ts | 2 +- tests/pw/tests/e2e/products.spec.ts | 2 +- tests/pw/tests/e2e/vendorBooking.spec.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/pw/tests/e2e/myOrders.spec.ts b/tests/pw/tests/e2e/myOrders.spec.ts index 0ac4b510bf..e6e79f7bb4 100644 --- a/tests/pw/tests/e2e/myOrders.spec.ts +++ b/tests/pw/tests/e2e/myOrders.spec.ts @@ -48,7 +48,7 @@ test.describe('My orders functionality test', () => { await customer.cancelPendingOrder(orderId); }); - test.skip('customer can order again @lite @c', async () => { + test('customer can order again @lite @c', async () => { const [, , orderId] = await apiUtils.createOrderWithStatus(PRODUCT_ID, { ...payloads.createOrder, customer_id: CUSTOMER_ID }, data.order.orderStatus.completed, payloads.vendorAuth); await customer.orderAgain(orderId); }); diff --git a/tests/pw/tests/e2e/productAdvertising.spec.ts b/tests/pw/tests/e2e/productAdvertising.spec.ts index 71b05540c7..cf0c01ccf4 100644 --- a/tests/pw/tests/e2e/productAdvertising.spec.ts +++ b/tests/pw/tests/e2e/productAdvertising.spec.ts @@ -71,7 +71,7 @@ test.describe('Product Advertising test', () => { // vendor - test.skip('vendor can buy product advertising @pro @v', async () => { + test('vendor can buy product advertising @pro @v', async () => { //todo: p1_v1 status gets pending review; need to resolve const [, , productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); const orderId = await vendor.buyProductAdvertising(productName); diff --git a/tests/pw/tests/e2e/products.spec.ts b/tests/pw/tests/e2e/products.spec.ts index c70266d1cb..e067f42b52 100644 --- a/tests/pw/tests/e2e/products.spec.ts +++ b/tests/pw/tests/e2e/products.spec.ts @@ -96,7 +96,7 @@ test.describe('Product functionality test', () => { await vendor.vendorAddVirtualProduct(data.product.virtual, false); }); - test.skip('vendor can add product category @lite @v', async () => { + test('vendor can add product category @lite @v', async () => { await vendor.vendorAddProductCategory(data.predefined.simpleProduct.product1.name, data.product.category.unCategorized); }); diff --git a/tests/pw/tests/e2e/vendorBooking.spec.ts b/tests/pw/tests/e2e/vendorBooking.spec.ts index b51e86547d..56fecf24c0 100644 --- a/tests/pw/tests/e2e/vendorBooking.spec.ts +++ b/tests/pw/tests/e2e/vendorBooking.spec.ts @@ -76,7 +76,7 @@ test.describe('Booking Product test', () => { await vendor.filterBookingProducts('by-other', 'featured'); }); - test.skip('vendor can view booking product @pro @v', async () => { + test('vendor can view booking product @pro @v', async () => { await vendor.viewBookingProduct(bookableProductName); });