Skip to content

Commit

Permalink
Add E2E tests for shortcode, commission, geolocation (#2441)
Browse files Browse the repository at this point in the history
* Add dokan tracking tests

* Add commission meta box test

* Update feature map

* Update config file

* Update feature map

* Add vendor filters test

* Add a shortcode test

* Fix commission tests

* Add geolocation tests
  • Loading branch information
shashwatahalder01 authored Nov 19, 2024
1 parent 329da76 commit 3d3c9d3
Show file tree
Hide file tree
Showing 26 changed files with 443 additions and 88 deletions.
2 changes: 1 addition & 1 deletion tests/pw/api.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { CI, BASE_URL, NO_SETUP, ADMIN, ADMIN_PASSWORD, DOKAN_PRO } = process.env

export default defineConfig({
/* test directory */
testDir: './tests/api',
testDir: 'tests/api',
/* Include tests based on the pattern */
grep: [/@lite/, /@pro/],
/* Exclude tests based on the pattern */
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const { CI, NON_HEADLESS, BASE_URL, SLOWMO, NO_SETUP, DOKAN_PRO } = process.env;

export default defineConfig({
/* test directory */
testDir: './tests/e2e',
testDir: 'tests/e2e',
/* Include tests based on the pattern */
grep: [/@lite/, /@liteOnly/, /@pro/],
/* Exclude tests based on the pattern */
Expand Down
102 changes: 58 additions & 44 deletions tests/pw/feature-map/feature-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
features:
admin:
admin can install Dokan plugin [lite]: false
admin can activate Dokan plugin [lite]: false
admin can deactivate Dokan plugin [lite]: false
admin can deactivate Dokan plugin with deactivate reason [lite]: false
admin can delete Dokan plugin [lite]: false
admin can activate Dokan plugin [lite]: true
admin can deactivate Dokan plugin [lite]: true
admin can deactivate Dokan plugin with deactivate reason [lite]: true
admin can delete Dokan plugin [lite]: true
admin can install Dokan pro plugin: false
admin can activate Dokan pro plugin: false
admin can deactivate Dokan pro plugin: false
admin can deactivate Dokan pro plugin with deactivate reason: false
admin can delete Dokan pro plugin: false
admin can activate Dokan pro plugin: true
admin can deactivate Dokan pro plugin: true
admin can deactivate Dokan pro plugin with deactivate reason: true
admin can delete Dokan pro plugin: true

- page: 'Tax'
features:
Expand Down Expand Up @@ -314,12 +314,12 @@
customer can view stores on map: true
customer can go to single store from store list [lite]: true

- page: 'Stores'
- page: 'Vendors'
features:
admin:
admin can view vendors menu page [lite]: true
admin can filter vendors by pending status: false
admin can filter vendors by approved status: false
admin can filter vendors by status (pending): true
admin can filter vendors by status (approved): true
admin can search vendors [lite]: true
admin can view vendor details: true
admin can disable vendor's selling capability [lite]: true
Expand Down Expand Up @@ -347,6 +347,7 @@
admin can set commission to Dokan subscription product (fixed): true
admin can set commission to Dokan subscription product (category based): true
admin can set commission to Dokan subscription product (specific category based): true
admin can view commission meta-box on order details [lite]: true

- page: 'Withdraw'
features:
Expand All @@ -357,7 +358,7 @@
admin can filter withdrawal requests by cancelled status: true
admin can filter withdrawal requests by vendor [lite]: true
admin can filter withdrawal requests by payment methods [lite]: true
admin can filter withdrawal requests by date: false
# admin can filter withdrawal requests by date: false
admin can clear withdrawal request filters: false
admin can export withdrawal requests [lite]: true
admin can add note to withdrawal request [lite]: true
Expand All @@ -379,7 +380,7 @@
admin:
admin can view reverse withdrawal menu page [lite]: true
admin can filter reverse withdrawal by store [lite]: true
admin can filter reverse withdrawal by date [lite]: false
# admin can filter reverse withdrawal by date [lite]: false
admin can clear reverse withdrawal filters: true
admin can add reverse withdrawal [lite]: true
vendor:
Expand Down Expand Up @@ -412,6 +413,13 @@
customer can contact vendor [lite]: true
customer can navigate to Dokan privacy policy [lite]: true

- page: 'Diagnostic Notice'
features:
admin:
admin can view Dokan diagnostic notice [lite]: true
admin can allow Dokan diagnostic tracking [lite]: true
admin can disallow Dokan diagnostic tracking [lite]: true

- page: 'Notice And Promotion'
features:
admin:
Expand All @@ -428,7 +436,7 @@
- page: 'Shortcode'
features:
admin:
admin can create page with Dokan shortcode: false
admin can create page with Dokan shortcode: true
vendor:
vendor can view Dokan dashboard (shortcode): true
vendor can view Dokan subscription packs (shortcode): true
Expand All @@ -438,7 +446,7 @@
customer can view top rated products (shortcode): true
customer can view customer migration form (shortcode): true
customer can view geolocation filter form (shortcode): true
customer can view advertised products (shortcode): false
customer can view advertised products (shortcode): true
customer can view stores (shortcode): true
customer can view my orders (shortcode): true
customer can view request for quote (shortcode): true
Expand All @@ -460,7 +468,7 @@
vendor can set vacation settings: true
vendor can set discount settings: true
vendor can set biography settings: true
vendor can set live chat settings: false
vendor can set live chat settings: true
vendor can set store support settings: true
vendor can set social profile settings: true
vendor can set rma settings (no warranty): true
Expand Down Expand Up @@ -534,7 +542,7 @@
- page: 'coupons'
features:
admin:
admin can add marketplace coupon: false
admin can add marketplace coupon: true
vendor:
vendor can view coupons menu page: true
vendor can view marketPlace coupons: true
Expand Down Expand Up @@ -597,7 +605,7 @@
admin can trash announcement: true
admin can restore announcement: true
admin can permanently delete announcement: true
admin can perform bulk action on announcements: false
admin can perform bulk action on announcements: true
vendor:
vendor can view announcements menu page: true
vendor can view announcement details: true
Expand Down Expand Up @@ -638,10 +646,10 @@
features:
admin:
admin can view license menu page: true
admin can't activate license with incorrect key: false
admin can activate license: false
admin can't activate license with incorrect key: true
admin can activate license: true
admin can refresh license: true
admin can deactivate license: false
admin can deactivate license: true

- page: 'Modules'
features:
Expand Down Expand Up @@ -720,7 +728,7 @@

customer:
customer can bid auction product: true
customer can buy auction product with buy it now price: false
customer can buy auction product with buy it now price: true

- page: 'Color Scheme Customizer'
features:
Expand Down Expand Up @@ -807,10 +815,16 @@
features:
admin:
# admin can set Dokan geolocation settings [duplicate]: false
admin can set map location position: false
admin can set where to display store map: false
admin can enable filters before location map: false
admin can enable product location tab on single product page: false
admin can set map location position (top): true
admin can set map location position (left): true
admin can set map location position (right): true
admin can set map display page (all): true
admin can set map display page (store_listing): true
admin can set map display page (shop): true
admin can enable filters before location map: true
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 zoom level: false
admin can set map default location: false
Expand All @@ -825,8 +839,8 @@
# 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
# customer can view product location on map [duplicate]: false
# customer can view store location on map [duplicate]: false
# customer can view product location [duplicate]: false
# customer can view store location [duplicate]: false
# customer can use filters on shop page [duplicate]: false
# customer can use filters on store list page [duplicate]: false

Expand Down Expand Up @@ -870,7 +884,7 @@
- page: 'PayPal Marketplace'
features:
admin:
admin can add Paypal Marketplace payment method: false
admin can add Paypal Marketplace payment method: true

- page: 'Printful'
features:
Expand Down Expand Up @@ -928,7 +942,7 @@
# admin can filter advertised product by calendar: false
admin can expire advertised product: true
admin can delete advertised product: true
admin can perform bulk action on product advertisements: false
admin can perform bulk action on product advertisements: true
vendor:
vendor can buy product advertising (product list page): true
vendor can buy product advertising (product edit page): false
Expand Down Expand Up @@ -977,18 +991,18 @@
features:
vendor:
vendor can view user subscriptions menu page: true
vendor can view product subscription details: false
vendor can filter user subscriptions by customer: false
vendor can filter user subscriptions by date: false
vendor can view user subscription: false
vendor can view product subscription details: true
vendor can filter user subscriptions by customer: true
vendor can filter user subscriptions by date: true
vendor can view user subscription: true
customer:
customer can view product subscription details: false
customer can cancel subscription: false
customer can reactivate subscription: false
customer can change address of subscription: false
customer can change payment of subscription: false
customer can renew subscription: false
customer can buy product subscription: false
customer can view product subscription details: true
customer can cancel subscription: true
customer can reactivate subscription: true
customer can change address of subscription: true
customer can change payment of subscription: true
customer can renew subscription: true
customer can buy product subscription: true

- page: 'Rank Math SEO'
features:
Expand Down Expand Up @@ -1076,8 +1090,8 @@
admin can search seller badge: true
admin can create seller badge: true
admin can edit seller badge: true
admin can filter vendors by seller badge: false
admin can view seller badge vendors: false
admin can filter vendors by seller badge: true
admin can view seller badge vendors: true
admin can view seller badges acquired by vendor: true
admin can update seller badge status: true
admin can delete seller badge: true
Expand Down Expand Up @@ -1227,7 +1241,7 @@
admin can filter subscribed vendors by subscription pack: true
admin can cancel subscription (immediately): true
admin can cancel subscription (end of the current period): true
admin can reactive recurring subscription (has active period ): false
admin can reactive recurring subscription (has active period): false
admin can perform bulk action on subscribed vendors: true
admin can assign non recurring subscription pack to vendor: true
vendor:
Expand Down
8 changes: 4 additions & 4 deletions tests/pw/pages/adminPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,20 +117,20 @@ export class AdminPage extends BasePage {
if (DOKAN_PRO) {
await this.selectByValue(setupWizardAdmin.sellingProductTypes, dokanSetupWizard.sellingProductTypes);
}
await this.click(setupWizardAdmin.continue);
await this.clickAndAcceptAndWaitForResponseAndLoadState(data.subUrls.backend.dokan.setupWizardStore, setupWizardAdmin.continue, 302);
// await this.click(setupWizardAdmin.skipThisStep)

// Selling
await this.enableSwitcherSetupWizard(setupWizardAdmin.newVendorEnableSelling);
await this.enableSwitcherSetupWizard(setupWizardAdmin.orderStatusChange);
await this.click(setupWizardAdmin.continue);
await this.clickAndAcceptAndWaitForResponseAndLoadState(data.subUrls.backend.dokan.setupWizardSelling, setupWizardAdmin.continue, 302);
// await this.click(setupWizardAdmin.skipThisStep)

// Commission
await this.selectByValue(setupWizardAdmin.commissionType, dokanSetupWizard.commission.commissionType);
await this.clearAndType(setupWizardAdmin.percentage, dokanSetupWizard.commission.commissionPercentage);
await this.clearAndType(setupWizardAdmin.fixed, dokanSetupWizard.commission.commissionFixed);
await this.click(setupWizardAdmin.continue);
await this.clickAndAcceptAndWaitForResponseAndLoadState(data.subUrls.backend.dokan.setupWizardCommission, setupWizardAdmin.continue, 302);

// Withdraw
await this.enableSwitcherSetupWizard(setupWizardAdmin.payPal);
Expand All @@ -144,7 +144,7 @@ export class AdminPage extends BasePage {
await this.clearAndType(setupWizardAdmin.minimumWithdrawLimit, dokanSetupWizard.minimumWithdrawLimit);
await this.enableSwitcherSetupWizard(setupWizardAdmin.orderStatusForWithdrawCompleted);
await this.enableSwitcherSetupWizard(setupWizardAdmin.orderStatusForWithdrawProcessing);
await this.click(setupWizardAdmin.continue);
await this.clickAndAcceptAndWaitForResponseAndLoadState(data.subUrls.backend.dokan.setupWizardWithdraw, setupWizardAdmin.continue, 302);

// Recommended
await this.disableSwitcherSetupWizard(setupWizardAdmin.wooCommerceConversionTracking);
Expand Down
10 changes: 8 additions & 2 deletions tests/pw/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,19 @@ export class BasePage {
}

// goto subUrl
async goto(subPath: string, options: { referer?: string; timeout?: number; waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit' } | undefined = { waitUntil: 'domcontentloaded' }): Promise<void> {
async goto(subPath: string, options: { referer?: string; timeout?: number; waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit' } | undefined = { waitUntil: 'domcontentloaded' }, force = false): Promise<void> {
await this.page.goto(subPath, options);
if (force) {
await this.reload();
}
}

// goto subUrl until networkidle
async gotoUntilNetworkidle(subPath: string, options: { referer?: string; timeout?: number; waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit' } | undefined = { waitUntil: 'networkidle' }): Promise<void> {
async gotoUntilNetworkidle(subPath: string, options: { referer?: string; timeout?: number; waitUntil?: 'load' | 'domcontentloaded' | 'networkidle' | 'commit' } | undefined = { waitUntil: 'networkidle' }, force = false): Promise<void> {
await this.goto(subPath, options);
if (force) {
await this.reload();
}
}

// go forward
Expand Down
Loading

0 comments on commit 3d3c9d3

Please sign in to comment.