diff --git a/tests/pw/feature-map/feature-map.yml b/tests/pw/feature-map/feature-map.yml index 9d0642af45..22dadc5420 100644 --- a/tests/pw/feature-map/feature-map.yml +++ b/tests/pw/feature-map/feature-map.yml @@ -286,7 +286,7 @@ features: customer: customer can view single store page [lite]: true - customer can view store open-close time on single store [lite]: false + customer can view store open-close time on single store [lite]: true customer can search product on single store [lite]: true customer can sort products on single store [lite]: true customer can view store terms and conditions [lite]: true @@ -308,9 +308,9 @@ customer can search store [lite]: true customer can filter stores by category: true customer can filter stores by location: true - customer can filter stores by ratings: false + customer can filter stores by ratings: true customer can filter featured stores: true - customer can filter open now stores: false + customer can filter open now stores: true customer can view stores on map: true customer can go to single store from store list [lite]: true @@ -1298,8 +1298,8 @@ - page: 'Store Reviews' features: admin: - admin can enable store reviews module: false - admin can disable store reviews module: false + admin can enable store reviews module: true + admin can disable store reviews module: true admin can view store reviews menu page: true admin can view store review: true admin can edit store review: true diff --git a/tests/pw/pages/basePage.ts b/tests/pw/pages/basePage.ts index 948e21662c..0b9eb7fbf8 100644 --- a/tests/pw/pages/basePage.ts +++ b/tests/pw/pages/basePage.ts @@ -1598,6 +1598,14 @@ export class BasePage { .toBe(200); } + // assert two element to have same count + async toHaveEqualCount(selector1: string, selector2: string, options?: { timeout?: number; intervals?: number[] }) { + await this.toPass(async () => { + const [selector1Count, selector2Count] = await Promise.all([await this.getElementCount(selector1), await this.getElementCount(selector2)]); + expect(selector1Count).toBe(selector2Count); + }, options); + } + // assert element not to be visible async notToBeVisible(selector: string) { await expect(this.page.locator(selector)).toBeHidden(); diff --git a/tests/pw/pages/selectors.ts b/tests/pw/pages/selectors.ts index 9d09061295..b536bdd386 100644 --- a/tests/pw/pages/selectors.ts +++ b/tests/pw/pages/selectors.ts @@ -800,6 +800,7 @@ export const selector = { // Store Reviews storeReviews: { + storeReviewsDiv: 'div.dokan-store-reviews', storeReviewsText: '.dokan-store-reviews h1', // Nav Tabs @@ -7466,10 +7467,10 @@ export const selector = { // Pagination pagination: '.dokan-pagination', - // Review - review: { + // Reviews + reviews: { close: 'button.icon-close', - noReviewsFound: '//span[normalize-space()="No Reviews found"]', + noReviewsFound: '//span[normalize-space()="No Reviews Found"]', write: '//button[normalize-space()="Write a Review"]', // write: '.add-review-btn', edit: '.edit-review-btn', diff --git a/tests/pw/pages/storeListingPage.ts b/tests/pw/pages/storeListingPage.ts index 0c818ebdfb..b08ab2f58e 100644 --- a/tests/pw/pages/storeListingPage.ts +++ b/tests/pw/pages/storeListingPage.ts @@ -137,6 +137,19 @@ export class StoreListingPage extends CustomerPage { await this.clickAndWaitForResponse(data.subUrls.frontend.storeListing, storeList.filters.filterDetails.apply); await this.notToHaveCount(storeList.storeCard.storeCardDiv, 0); + + switch (filterBy) { + case 'featured': + await this.toHaveEqualCount(storeList.storeCard.storeCardDiv, storeList.storeCard.featuredLabel); + break; + + case 'open-now': + await this.toHaveEqualCount(storeList.storeCard.storeCardDiv, storeList.storeCard.openCloseStatus); + break; + + default: + break; + } } // stores on map diff --git a/tests/pw/pages/storeReviewsPage.ts b/tests/pw/pages/storeReviewsPage.ts index 0706664ca2..65d3a0ce8f 100644 --- a/tests/pw/pages/storeReviewsPage.ts +++ b/tests/pw/pages/storeReviewsPage.ts @@ -6,8 +6,9 @@ import { data } from '@utils/testData'; import { storeReview } from '@utils/interfaces'; // selectors +const dokanAdmin = selector.admin.dokan; const storeReviewsAdmin = selector.admin.dokan.storeReviews; -const storeReviewsCustomer = selector.customer.cSingleStore.review; +const storeReviewsCustomer = selector.customer.cSingleStore.reviews; export class StoreReviewsPage extends AdminPage { constructor(page: Page) { @@ -16,6 +17,29 @@ export class StoreReviewsPage extends AdminPage { // store reviews + // enable store reviews + async enableStoreReviewsModule(storeName: string) { + await this.goto(data.subUrls.backend.dokan.dokan); + await this.toBeVisible(dokanAdmin.menus.storeReviews); + + await this.goIfNotThere(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)), 'networkidle'); + await this.toBeVisible(selector.customer.cSingleStore.storeTabs.reviews); + } + + // disable store reviews + async disableStoreReviewsModule(storeName: string) { + await this.goto(data.subUrls.backend.dokan.dokan, { waitUntil: 'domcontentloaded' }, true); + await this.notToBeVisible(dokanAdmin.menus.storeReviews); + + // no reviews table is visible + await this.goIfNotThere(data.subUrls.backend.dokan.storeReviews); + await this.notToBeVisible(dokanAdmin.storeReviews.storeReviewsDiv); + + // reviews is visible + await this.goIfNotThere(data.subUrls.frontend.storeReviews(helpers.slugify(storeName))); + await this.toBeVisible(selector.customer.cSingleStore.reviews.noReviewsFound); + } + // store reviews render properly async adminStoreReviewsRenderProperly() { await this.goIfNotThere(data.subUrls.backend.dokan.storeReviews); diff --git a/tests/pw/tests/api/modules.spec.ts b/tests/pw/tests/api/modules.spec.ts index d5522df733..c4caa8a082 100644 --- a/tests/pw/tests/api/modules.spec.ts +++ b/tests/pw/tests/api/modules.spec.ts @@ -18,7 +18,7 @@ test.describe('modules api test', () => { }); test.afterAll(async () => { - await apiUtils.activateModules([randomModule]); + await apiUtils.activateModules(randomModule); await apiUtils.dispose(); }); diff --git a/tests/pw/tests/e2e/modules.spec.ts b/tests/pw/tests/e2e/modules.spec.ts index 8848c3ba64..5d63815d9e 100644 --- a/tests/pw/tests/e2e/modules.spec.ts +++ b/tests/pw/tests/e2e/modules.spec.ts @@ -41,7 +41,7 @@ test.describe('Modules test', () => { }); test('admin can activate module', { tag: ['@pro', '@admin'] }, async () => { - await apiUtils.deactivateModules([payloads.moduleIds.auction], payloads.adminAuth); + await apiUtils.deactivateModules(payloads.moduleIds.auction, payloads.adminAuth); await admin.activateDeactivateModule(data.modules.modulesName.auctionIntegration); }); diff --git a/tests/pw/tests/e2e/singleStore.spec.ts b/tests/pw/tests/e2e/singleStore.spec.ts index 78b3cd50eb..5d869639e1 100644 --- a/tests/pw/tests/e2e/singleStore.spec.ts +++ b/tests/pw/tests/e2e/singleStore.spec.ts @@ -23,7 +23,6 @@ test.describe('Single store functionality test', () => { }); test.skip('customer can view store open-close time on single store', { tag: ['@lite', '@customer'] }, async () => { - // todo: pre: need store open close time await customer.storeOpenCloseTime(data.predefined.vendorStores.vendor1); }); diff --git a/tests/pw/tests/e2e/storeReviews.spec.ts b/tests/pw/tests/e2e/storeReviews.spec.ts index 83d67b2525..f1b4f37665 100644 --- a/tests/pw/tests/e2e/storeReviews.spec.ts +++ b/tests/pw/tests/e2e/storeReviews.spec.ts @@ -35,6 +35,7 @@ test.describe('Store Reviews test', () => { }); test.afterAll(async () => { + await apiUtils.activateModules(payloads.moduleIds.storeReviews, payloads.adminAuth); await aPage.close(); await vPage.close(); await cPage.close(); @@ -43,6 +44,10 @@ test.describe('Store Reviews test', () => { //admin + test('admin can enable store reviews module', { tag: ['@pro', '@exploratory', '@admin'] }, async () => { + await admin.enableStoreReviewsModule(data.predefined.vendorStores.vendor1); + }); + test('admin can view store reviews menu page', { tag: ['@pro', '@exploratory', '@admin'] }, async () => { await admin.adminStoreReviewsRenderProperly(); }); @@ -95,4 +100,9 @@ test.describe('Store Reviews test', () => { test("vendor can't review own store", { tag: ['@pro', '@vendor'] }, async () => { await vendor.cantReviewOwnStore(data.predefined.vendorStores.vendor1); }); + + test('admin can disable store reviews module', { tag: ['@pro', '@exploratory', '@admin'] }, async () => { + await apiUtils.deactivateModules(payloads.moduleIds.storeReviews, payloads.adminAuth); + await admin.disableStoreReviewsModule(data.predefined.vendorStores.vendor1); + }); }); diff --git a/tests/pw/tests/e2e/storelisting.spec.ts b/tests/pw/tests/e2e/storelisting.spec.ts index b61454c97b..eb2ab4bf76 100644 --- a/tests/pw/tests/e2e/storelisting.spec.ts +++ b/tests/pw/tests/e2e/storelisting.spec.ts @@ -42,20 +42,19 @@ test.describe('Store list functionality test', () => { await customer.filterStores('by-location', 'New York, NY, USA'); }); - test.skip('customer can filter stores by ratings', { tag: ['@pro', '@customer'] }, async () => { - await customer.filterStores('by-ratings', '1'); + test('customer can filter stores by ratings', { tag: ['@pro', '@customer'] }, async () => { + await customer.filterStores('by-ratings', '5'); }); test('customer can filter featured stores', { tag: ['@pro', '@customer'] }, async () => { await customer.filterStores('featured'); }); - test.skip('customer can filter open now stores', { tag: ['@pro', '@customer'] }, async () => { + test('customer can filter open now stores', { tag: ['@pro', '@customer'] }, async () => { await customer.filterStores('open-now'); }); test('customer can view stores on map', { tag: ['@pro', '@customer'] }, async () => { - // test.skip(true, '@todo fix this test'); await customer.storeOnMap(); }); diff --git a/tests/pw/utils/apiUtils.ts b/tests/pw/utils/apiUtils.ts index 84d3e99fe6..13fb66ca80 100644 --- a/tests/pw/utils/apiUtils.ts +++ b/tests/pw/utils/apiUtils.ts @@ -864,13 +864,19 @@ export class ApiUtils { } // get activate modules - async activateModules(moduleIds: string[], auth?: auth): Promise<[APIResponse, responseBody]> { + async activateModules(moduleIds: string | string[], auth?: auth): Promise<[APIResponse, responseBody]> { + if (!Array.isArray(moduleIds)) { + moduleIds = [moduleIds]; + } const [response, responseBody] = await this.put(endPoints.activateModule, { data: { module: moduleIds }, headers: auth }); return [response, responseBody]; } // get deactivated modules - async deactivateModules(moduleIds: string[], auth?: auth): Promise<[APIResponse, responseBody]> { + async deactivateModules(moduleIds: string | string[], auth?: auth): Promise<[APIResponse, responseBody]> { + if (!Array.isArray(moduleIds)) { + moduleIds = [moduleIds]; + } const [response, responseBody] = await this.put(endPoints.deactivateModule, { data: { module: moduleIds }, headers: auth }); return [response, responseBody]; } diff --git a/tests/pw/utils/interfaces.ts b/tests/pw/utils/interfaces.ts index 0a219466a6..7e2d615641 100644 --- a/tests/pw/utils/interfaces.ts +++ b/tests/pw/utils/interfaces.ts @@ -1514,7 +1514,7 @@ export interface modules { modulesName: { auctionIntegration: string; - colorSchemeCustomize: string; + colorSchemeCustomizer: string; deliveryTime: string; elementor: string; eUComplianceFields: string; diff --git a/tests/pw/utils/payloads.ts b/tests/pw/utils/payloads.ts index 4016105b53..f53b3fa258 100644 --- a/tests/pw/utils/payloads.ts +++ b/tests/pw/utils/payloads.ts @@ -3558,8 +3558,9 @@ export const payloads = { // module moduleIds: { + auction: 'auction', booking: 'booking', - colorSchemeCustomize: 'color_scheme_customizer', + colorSchemeCustomizer: 'color_scheme_customizer', deliveryTime: 'delivery_time', elementor: 'elementor', exportImport: 'export_import', @@ -3568,41 +3569,41 @@ export const payloads = { germanized: 'germanized', liveChat: 'live_chat', liveSearch: 'live_search', + mangopay: 'mangopay', moip: 'moip', + orderMinMax: 'order_min_max', paypalMarketplace: 'paypal_marketplace', + printful: 'printful', productAddon: 'product_addon', + productAdvertising: 'product_advertising', productEnquiry: 'product_enquiry', + productSubscription: 'product_subscription', + rankMath: 'rank_math', reportAbuse: 'report_abuse', + requestForQuotation: 'request_for_quotation', rma: 'rma', + sellerBadge: 'seller_badge', sellerVacation: 'seller_vacation', shipStation: 'shipstation', - auction: 'auction', spmv: 'spmv', storeReviews: 'store_reviews', storeSupport: 'store_support', stripe: 'stripe', - productAdvertising: 'product_advertising', - productSubscription: 'product_subscription', + stripeExpress: 'stripe_express', + tableRateShipping: 'table_rate_shipping', vendorAnalytics: 'vendor_analytics', vendorStaff: 'vendor_staff', - vsp: 'vsp', vendorVerification: 'vendor_verification', + vsp: 'vsp', wholesale: 'wholesale', - rankMath: 'rank_math', - tableRateShipping: 'table_rate_shipping', - mangopay: 'mangopay', - orderMinMax: 'order_min_max', - sellerBadge: 'seller_badge', - stripeExpress: 'stripe_express', - requestForQuotation: 'request_for_quotation', }, deactivateModule: { - module: ['booking'], + module: 'booking', }, activateModule: { - module: ['booking'], + module: 'booking', }, // announcement diff --git a/tests/pw/utils/testData.ts b/tests/pw/utils/testData.ts index c6144ef024..ad4135ea55 100644 --- a/tests/pw/utils/testData.ts +++ b/tests/pw/utils/testData.ts @@ -2093,7 +2093,7 @@ export const data = { modulesName: { auctionIntegration: 'Auction Integration', - colorSchemeCustomize: 'Color Scheme Customize', + colorSchemeCustomizer: 'Color Scheme Customize', deliveryTime: 'Delivery Time', elementor: 'Elementor', eUComplianceFields: 'EU Compliance Fields',