From 5e557d593456437c22252960f3aa1be7baa1c199 Mon Sep 17 00:00:00 2001 From: shashwata Date: Wed, 20 Nov 2024 00:13:43 +0600 Subject: [PATCH 1/3] Add geolocation map tests --- tests/pw/feature-map/feature-map.yml | 10 +++++---- tests/pw/pages/geolocationPage.ts | 28 ++++++++++++++++++++++++ tests/pw/pages/noticeAndPromotionPage.ts | 2 +- tests/pw/pages/selectors.ts | 5 +++++ tests/pw/tests/e2e/geolocation.spec.ts | 15 +++++++++++++ tests/pw/tests/e2e/plugin.spec.ts | 4 ++-- tests/pw/utils/dbData.ts | 2 +- 7 files changed, 58 insertions(+), 8 deletions(-) diff --git a/tests/pw/feature-map/feature-map.yml b/tests/pw/feature-map/feature-map.yml index 8ab3067c0..385d9e697 100644 --- a/tests/pw/feature-map/feature-map.yml +++ b/tests/pw/feature-map/feature-map.yml @@ -814,7 +814,7 @@ - page: 'Geolocation' features: admin: - # admin can set Dokan geolocation settings [duplicate]: false + # admin can set Dokan geolocation settings [duplicate]: true admin can set map location position (top): true admin can set map location position (left): true admin can set map location position (right): true @@ -825,17 +825,19 @@ admin can disable filters before location map: true admin can enable product location tab on single product page: true admin can disable product location tab on single product page: true - admin can set map radius search unit and distance: false + admin can set map radius search unit and distance (km): true + admin can set map radius search unit and distance (miles): true admin can set map zoom level: false admin can set map default location: false admin can add geolocation widget (product location) widget: false admin can add geolocation widget (store location) widget: false admin can add geolocation widget (geolocation filter form) widget: false - # admin can add geolocation filters shortcode [duplicate]: false + # admin can add geolocation filters shortcode [duplicate]: true # vendor: # vendor can add location to store [duplicate]: false # vendor can add location to product [duplicate]: false - # customer: + customer: + customer can slide map radius bar: true # customer can view map on shop page [duplicate]: false # customer can view map on store list page [duplicate]: false # customer can view map on single product page [duplicate]: false diff --git a/tests/pw/pages/geolocationPage.ts b/tests/pw/pages/geolocationPage.ts index b34d88ae9..31b1b52ba 100644 --- a/tests/pw/pages/geolocationPage.ts +++ b/tests/pw/pages/geolocationPage.ts @@ -97,4 +97,32 @@ export class GeolocationPage extends AdminPage { break; } } + + // view map radius unit and distance + async viewMapRadiusSearchUnitAndDistance(unit: 'km' | 'miles', distance: { min: string; max: string }): Promise { + await this.gotoUntilNetworkidle(data.subUrls.frontend.shop); + + switch (unit) { + case 'km': + await this.toContainText(selector.customer.cShop.radiusSearch.radiusUnit, `Radius ${distance.max}km`); + break; + + case 'miles': + await this.toContainText(selector.customer.cShop.radiusSearch.radiusUnit, `Radius ${distance.max}miles`); + break; + + default: + break; + } + } + + async slideMapRadiusBar(slideUnit: string): Promise { + await this.gotoUntilNetworkidle(data.subUrls.frontend.shop); + await this.focus(selector.customer.cShop.radiusSearch.slider); + await this.setAttributeValue(selector.customer.cShop.radiusSearch.slider, 'value', '0'); + for (let i = 0; i < Number(slideUnit); i++) { + await this.press('ArrowRight'); + } + await this.toHaveValue(selector.customer.cShop.radiusSearch.slider, slideUnit); + } } diff --git a/tests/pw/pages/noticeAndPromotionPage.ts b/tests/pw/pages/noticeAndPromotionPage.ts index 6a836457c..d37193ca5 100644 --- a/tests/pw/pages/noticeAndPromotionPage.ts +++ b/tests/pw/pages/noticeAndPromotionPage.ts @@ -91,7 +91,7 @@ export class NoticeAndPromotionPage extends AdminPage { await this.notToBeVisible(selector.admin.dokan.diagnostic.noticeDiv); } - // allow diagnostic tracking + // disallow diagnostic tracking async disallowDiagnosticTracking() { await this.goIfNotThere(data.subUrls.backend.adminDashboard, 'networkidle'); await this.clickAndWaitForLoadState(selector.admin.dokan.diagnostic.disallowCollectData); diff --git a/tests/pw/pages/selectors.ts b/tests/pw/pages/selectors.ts index 0726386a5..3e7dbf3bf 100644 --- a/tests/pw/pages/selectors.ts +++ b/tests/pw/pages/selectors.ts @@ -7010,6 +7010,11 @@ export const selector = { }, }, + radiusSearch: { + radiusUnit: 'span.dokan-range-slider-value', + slider: 'input.dokan-range-slider', + }, + // Filter filters: { filterDiv: 'form.dokan-geolocation-location-filters', diff --git a/tests/pw/tests/e2e/geolocation.spec.ts b/tests/pw/tests/e2e/geolocation.spec.ts index bf0df53e6..8b2af3822 100644 --- a/tests/pw/tests/e2e/geolocation.spec.ts +++ b/tests/pw/tests/e2e/geolocation.spec.ts @@ -14,6 +14,10 @@ test.describe('Geolocation test', () => { admin = new GeolocationPage(aPage); }); + test.beforeEach(async () => { + await dbUtils.setOptionValue(dbData.dokan.optionName.geolocation, dbData.dokan.geolocationSettings); + }); + test.afterAll(async () => { await dbUtils.setOptionValue(dbData.dokan.optionName.geolocation, dbData.dokan.geolocationSettings); await aPage.close(); @@ -46,4 +50,15 @@ test.describe('Geolocation test', () => { await admin.viewProductLocationTab(data.predefined.simpleProduct.product1.name, status as 'enable' | 'disable'); }); }); + + ['km', 'miles'].forEach((unit: string) => { + test(`admin can set map radius search unit and distance ${unit} `, { tag: ['@pro', '@admin'] }, async () => { + await dbUtils.updateOptionValue(dbData.dokan.optionName.geolocation, { distance_unit: unit, distance_min: '0', distance_max: '10' }); + await admin.viewMapRadiusSearchUnitAndDistance(unit as 'km' | 'miles', { min: '0', max: '10' }); + }); + }); + + test('customer can slide map radius bar', { tag: ['@pro', '@customer'] }, async () => { + await admin.slideMapRadiusBar('5'); + }); }); diff --git a/tests/pw/tests/e2e/plugin.spec.ts b/tests/pw/tests/e2e/plugin.spec.ts index 31e78fd3e..20069ea65 100644 --- a/tests/pw/tests/e2e/plugin.spec.ts +++ b/tests/pw/tests/e2e/plugin.spec.ts @@ -63,11 +63,11 @@ test.describe.skip('Plugin functionality test', () => { }); test.skip('admin can delete Dokan pro plugin', { tag: ['@pro', '@admin', '@serial'] }, async () => { - await admin.activatePlugin(data.plugin.pluginName.dokanLite); + // await admin.deletePlugin(data.plugin.pluginName.dokanLite); }); test.skip('admin can delete Dokan plugin', { tag: ['@lite', '@admin', '@serial'] }, async () => { - await admin.activatePlugin(data.plugin.pluginName.dokanLite); + // await admin.deletePlugin(data.plugin.pluginName.dokanLite); }); //todo: replace (one zip with another) plugin test diff --git a/tests/pw/utils/dbData.ts b/tests/pw/utils/dbData.ts index a60b983ef..4ea204278 100644 --- a/tests/pw/utils/dbData.ts +++ b/tests/pw/utils/dbData.ts @@ -1043,7 +1043,7 @@ export const dbData = { show_location_map_pages: 'all', // all, store_listing, shop show_filters_before_locations_map: 'on', // on, off show_product_location_in_wc_tab: 'on', // on, off - distance_unit: 'km', + distance_unit: 'km', // km, miles distance_min: '0', distance_max: '10', map_zoom: '11', From ce89945e0705189600f75adad7018caef803e4b4 Mon Sep 17 00:00:00 2001 From: shashwata Date: Wed, 20 Nov 2024 17:22:38 +0600 Subject: [PATCH 2/3] Update feature map --- tests/pw/feature-map/feature-map.yml | 7 +++++-- tests/pw/tests/e2e/commission.spec.ts | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/pw/feature-map/feature-map.yml b/tests/pw/feature-map/feature-map.yml index 385d9e697..91798abec 100644 --- a/tests/pw/feature-map/feature-map.yml +++ b/tests/pw/feature-map/feature-map.yml @@ -827,8 +827,8 @@ admin can disable product location tab on single product page: true admin can set map radius search unit and distance (km): true admin can set map radius search unit and distance (miles): true - admin can set map zoom level: false - admin can set map default location: false + # admin can set map zoom level: false + # admin can set map default location: false admin can add geolocation widget (product location) widget: false admin can add geolocation widget (store location) widget: false admin can add geolocation widget (geolocation filter form) widget: false @@ -1107,6 +1107,9 @@ - page: 'ShipStation Integration' features: vendor: + # vendor can view Shipstation settings menu page: true + vendor can generate shipStation credentials: false + vendor can revoke shipStation credentials: false vendor can set shipStation settings: true - page: 'Single Product Multiple Vendor (SPMV)' diff --git a/tests/pw/tests/e2e/commission.spec.ts b/tests/pw/tests/e2e/commission.spec.ts index 055e8b170..bb3a23469 100644 --- a/tests/pw/tests/e2e/commission.spec.ts +++ b/tests/pw/tests/e2e/commission.spec.ts @@ -101,4 +101,7 @@ test.describe('Commission test', () => { const [, , orderId] = await apiUtils.createOrderWithStatus(PRODUCT_ID, payloads.createOrder, data.order.orderStatus.onhold, payloads.vendorAuth); await admin.viewCommissionMetaBox(orderId); }); + + // todo: admin can view commission on product list, order list, and order details, sub order details on parent order + // todo: vendor can view earning on product list, product details, order list, and order details }); From 1ad9093a18b454ac0b0c493bd4470d00b74fd7e7 Mon Sep 17 00:00:00 2001 From: shashwata Date: Fri, 22 Nov 2024 00:19:46 +0600 Subject: [PATCH 3/3] fix coverage map --- tests/pw/feature-map/feature-map.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/pw/feature-map/feature-map.yml b/tests/pw/feature-map/feature-map.yml index 91798abec..c5f124377 100644 --- a/tests/pw/feature-map/feature-map.yml +++ b/tests/pw/feature-map/feature-map.yml @@ -827,16 +827,16 @@ admin can disable product location tab on single product page: true admin can set map radius search unit and distance (km): true admin can set map radius search unit and distance (miles): true - # admin can set map zoom level: false - # admin can set map default location: false - admin can add geolocation widget (product location) widget: false - admin can add geolocation widget (store location) widget: false - admin can add geolocation widget (geolocation filter form) widget: false + # admin can set map zoom level: false + # admin can set map default location: false + # admin can add geolocation widget (product location) widget: false + # admin can add geolocation widget (store location) widget: false + # admin can add geolocation widget (geolocation filter form) widget: false # admin can add geolocation filters shortcode [duplicate]: true - # vendor: + # vendor: # vendor can add location to store [duplicate]: false # vendor can add location to product [duplicate]: false - customer: + customer: customer can slide map radius bar: true # customer can view map on shop page [duplicate]: false # customer can view map on store list page [duplicate]: false