Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appearance settings tests #2458

Merged
merged 22 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/e2e_api_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ env:
CUSTOMER2: customer2
USER_PASSWORD: 01dokan01
GMAP: ${{secrets.GMAP}}
MAPBOX: ${{secrets.MAPBOX}}
shashwatahalder01 marked this conversation as resolved.
Show resolved Hide resolved
BASE_URL: http://localhost:9999
CI: true
FORCE_COLOR: 1
Expand Down
39 changes: 21 additions & 18 deletions tests/pw/.env.example
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# Plugin Configuration
ADMIN=John_Doe [Admin username]
ADMIN_PASSWORD=AdminPass123 [Password for the admin account]
VENDOR=David_Johnson [Vendor username]
VENDOR2=jhonathon_Smith [Vendor username]
CUSTOMER=Michael_Williams [Customer username]
USER_PASSWORD=Passw0rd123 [Password for all other users]
DOKAN_PRO=true [Dokan pro active status]
LICENSE_KEY=licence_key [Dokan License key]
GMAP=map_key [Google Maps API key]
TALKJS_APP_ID=talkjs_app_id [TalkJS App ID]
TALKJS_APP_SECRET=talkjs_app_secret [TalkJS App Secret]
VONAGE_API_KEY=vonage_key [Vonage SMS API key]
VONAGE_API_SECRET=vonage_secret [Vonage SMS API secret]
FB_APP_ID=facebook_app_id [Facebook App ID]
FB_APP_SECRET=facebook_app_secret [Facebook App secret]
PRINTFUL_APP_ID=printful_app_id [Printful App ID]
PRINTFUL_APP_SECRET=printful_app_secret [Printful App secret]
# Plugin Configuration
ADMIN=John_Doe [Admin username]
ADMIN_PASSWORD=AdminPass123 [Password for the admin account]
VENDOR=David_Johnson [Vendor username]
VENDOR2=jhonathon_Smith [Vendor username]
CUSTOMER=Michael_Williams [Customer username]
USER_PASSWORD=Passw0rd123 [Password for all other users]
DOKAN_PRO=true [Dokan pro active status]
LICENSE_KEY=license_key [Dokan License key]
GMAP=map_key [Google Maps API key]
MAPBOX=mapbox_key [Mapbox Maps API key]
TALKJS_APP_ID=talkjs_app_id [TalkJS App ID]
TALKJS_APP_SECRET=talkjs_app_secret [TalkJS App Secret]
VONAGE_API_KEY=vonage_key [Vonage SMS API key]
VONAGE_API_SECRET=vonage_secret [Vonage SMS API secret]
FB_APP_ID=facebook_app_id [Facebook App ID]
FB_APP_SECRET=facebook_app_secret [Facebook App secret]
PRINTFUL_APP_ID=printful_app_id [Printful App ID]
PRINTFUL_APP_SECRET=printful_app_secret [Printful App secret]
RECAPTCHA_SITE_KEY=recaptcha_site_key [reCAPTCHA site key]
RECAPTCHA_SECRET_KEY=recaptcha_secret_key [reCAPTCHA secret key]

# Playwright Configuration
BASE_URL=https://example.com [Base URL of the test site]
Expand Down
71 changes: 37 additions & 34 deletions tests/pw/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@

## :bookmark: Table of contents

- [Pre-requisites :pushpin:](#pre-requisites)
- [Install Node](#install-node)
- [Install NVM](#install-nvm)
- [Install Docker](#install-docker)
- [Pre-requisites :pushpin:](#pre-requisites)
- [Install Node](#install-node)
- [Install NVM](#install-nvm)
- [Install Docker](#install-docker)

<br/>

- [Prep for tests :construction:](#prep-for-tests)
- [Build Dokan plugin](#build-dokan-plugin)
- [Install Dependencies](#install-dependencies)
- [Start Wordpress Environment](#start-wordpress-environment)
- [Create Env file](#create-env-file)
- [Prep for tests :construction:](#prep-for-tests)
- [Build Dokan plugin](#build-dokan-plugin)
- [Install Dependencies](#install-dependencies)
- [Start Wordpress Environment](#start-wordpress-environment)
- [Create Env file](#create-env-file)

<br/>

- [Running tests :test_tube: ](#running-tests)
- [How to run test projects](#how-to-run-test-projects)
- [How to run tests](#how-to-run-tests)
- [How to skip tests](#how-to-skip-tests)
- [How to debug tests](#how-to-debug-tests)
- [How to serve reports](#how-to-serve-reports)
- [Running tests :test_tube: ](#running-tests)
- [How to run test projects](#how-to-run-test-projects)
- [How to run tests](#how-to-run-tests)
- [How to skip tests](#how-to-skip-tests)
- [How to debug tests](#how-to-debug-tests)
- [How to serve reports](#how-to-serve-reports)

<br/>

- [Contributing to Dokan-e2e-api-test](#Contributing-to-dokan-e2e-api-test)
- [How to wright tests](#how-to-run-tests)
- [Contributing to Dokan-e2e-api-test](#Contributing-to-dokan-e2e-api-test)
- [How to wright tests](#how-to-run-tests)

<br/>

Expand Down Expand Up @@ -121,23 +121,26 @@ Create .env file according to .env.example file

```
# Plugin Configuration
ADMIN=John_Doe [Admin username]
ADMIN_PASSWORD=AdminPass123 [Password for the admin account]
VENDOR=David_Johnson [Vendor username]
VENDOR2=Johnathon_Smith [Vendor username]
CUSTOMER=Michael_Williams [Customer username]
USER_PASSWORD=Passw0rd123 [Password for all other users]
DOKAN_PRO=true [Dokan pro active status]
LICENSE_KEY=licence_key [Dokan License key]
GMAP=map_key [Google Maps API key]
TALKJS_APP_ID=talkjs_app_id [TalkJS App ID]
TALKJS_APP_SECRET=talkjs_app_secret [TalkJS App Secret]
VONAGE_API_KEY=vonage_key [Vonage SMS API key]
VONAGE_API_SECRET=vonage_secret [Vonage SMS API secret]
FB_APP_ID=facebook_app_id [Facebook App ID]
FB_APP_SECRET=facebook_app_secret [Facebook App secret]
PRINTFUL_APP_ID=printful_app_id [Printful App ID]
PRINTFUL_APP_SECRET=printful_app_secret [Printful App secret]
ADMIN=John_Doe [Admin username]
ADMIN_PASSWORD=AdminPass123 [Password for the admin account]
VENDOR=David_Johnson [Vendor username]
VENDOR2=Johnathon_Smith [Vendor username]
CUSTOMER=Michael_Williams [Customer username]
USER_PASSWORD=Passw0rd123 [Password for all other users]
DOKAN_PRO=true [Dokan pro active status]
LICENSE_KEY=license_key [Dokan License key]
GMAP=map_key [Google Maps API key]
MAPBOX=mapbox_key [Mapbox Maps API key]
TALKJS_APP_ID=talkjs_app_id [TalkJS App ID]
TALKJS_APP_SECRET=talkjs_app_secret [TalkJS App Secret]
VONAGE_API_KEY=vonage_key [Vonage SMS API key]
VONAGE_API_SECRET=vonage_secret [Vonage SMS API secret]
FB_APP_ID=facebook_app_id [Facebook App ID]
FB_APP_SECRET=facebook_app_secret [Facebook App secret]
PRINTFUL_APP_ID=printful_app_id [Printful App ID]
PRINTFUL_APP_SECRET=printful_app_secret [Printful App secret]
RECAPTCHA_SITE_KEY=recaptcha_site_key [reCAPTCHA site key]
RECAPTCHA_SECRET_KEY=recaptcha_secret_key [reCAPTCHA secret key]

# Playwright Configuration
BASE_URL=https://example.com [Base URL of the test site]
Expand Down
27 changes: 22 additions & 5 deletions tests/pw/feature-map/feature-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,27 @@

- page: 'Store Appearance'
features:
customer:
store map is disabled on store sidebar [lite]: true
store open-close time is disabled store sidebar [lite]: true
vendor info is disabled on single store page [lite]: false
admin:
admin can enable store map on store sidebar [lite]: true
admin can disable store map on store sidebar [lite]: true
admin can set map api source (Google Maps) [lite]: true
admin can set map api source (Mapbox) [lite]: true
admin can enable Google reCAPTCHA validation [lite]: true
admin can disable Google reCAPTCHA validation [lite]: true
admin can enable store contact form on store sidebar [lite]: true
admin can disable store contact form on store sidebar [lite]: true
admin can set store header template (default) [lite]: true
admin can set store header template (layout1) [lite]: true
admin can set store header template (layout2) [lite]: true
admin can set store header template (layout3) [lite]: true
admin can enable store open-close time on store sidebar [lite]: true
admin can disable store open-close time on store sidebar [lite]: true
admin can enable store sidebar from theme [lite]: true
admin can disable store sidebar from theme [lite]: true
admin can enable vendor info on single store page [lite]: true
admin can disable vendor info on single store page [lite]: true
admin can enable Dokan FontAwesome library [lite]: true
admin can disable Dokan FontAwesome library [lite]: true

- page: 'Store List'
features:
Expand Down Expand Up @@ -660,7 +677,7 @@
admin can refresh license: true
admin can deactivate license: true

- page: 'Feature lock'
- page: 'Feature Lock'
features:
admin:
admin can view license expiration notice: false
Expand Down
12 changes: 12 additions & 0 deletions tests/pw/pages/basePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,12 @@ export class BasePage {
return visibleSelectors;
}

// assert element to exists
async toExists(selector: string) {
const exists = await this.isLocatorExists(selector);
expect(exists).toBe(true);
}

// assert value to be equal
toBeEqual(received: any, expected: any) {
expect(received).toEqual(expected);
Expand Down Expand Up @@ -1604,6 +1610,12 @@ export class BasePage {
.toBe(200);
}

// assert element not to exists
async notToExists(selector: string) {
const exists = await this.isLocatorExists(selector);
expect(exists).toBe(false);
}

// assert two element to have same count
async toHaveEqualCount(selector1: string, selector2: string, options?: { timeout?: number; intervals?: number[] }) {
await this.toPass(async () => {
Expand Down
50 changes: 32 additions & 18 deletions tests/pw/pages/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1447,10 +1447,10 @@ export const selector = {
popup: {
dokanUpgradePopup: '#dokan-upgrade-popup',
closeDokanUpgradePopup: '#dokan-upgrade-popup .close',
upgradeToProText: '.upgrade-text',
upgradeToPro: '.upgrade-button',
proCard: '.promo-card',
alreadyUpdated: '.already-updated',
upgradeToProText: 'div.modal-content p.upgrade-text',
upgradeToPro: 'div.modal-content a.upgrade-button',
proCard: 'div.modal-content div.promo-card',
alreadyUpdated: 'div.modal-content a.already-updated',
},

// modules
Expand Down Expand Up @@ -6087,6 +6087,7 @@ export const selector = {

// banner and profile picture
banner: '.dokan-banner .dokan-banner-drag',
bannerHelpText: 'div.dokan-banner p.help-block',
bannerImage: '//div[@class="image-wrap"]//img[@class="dokan-banner-img"]',
uploadedBanner: 'div#dokan-profile-picture-wrapper div.gravatar-wrap',
removeBannerImage: '.close.dokan-remove-banner-image',
Expand Down Expand Up @@ -7440,32 +7441,33 @@ export const selector = {

// Store Profile Summary
storeProfile: {
storeProfileInfoBox: 'div.profile-info-box',
storeProfileSummary: '.dokan-single-store .profile-info-summery',

storeBanner: '.profile-info-img',
storeBanner: 'div.profile-info-img',

profileInfoHead: '.profile-info-head',
profileImage: '.profile-img.profile-img-circle',
storeName: '.profile-info-head .store-name',
profileInfoHead: 'div.profile-info-head',
profileImage: 'div.profile-img.profile-img-circle',
storeName: 'div.profile-info-head h1.store-name',
verifiedIcon: '//div[@data-original-title="Verified"]',
verifiedIconByIcon: (icon: string) => `//div[@data-original-title="Verified"]//i[@class="${icon}"]`,

profileInfo: '.profile-info',
storeInfo: '.dokan-store-info',
storeAddress: '.dokan-store-address',
storePhone: '.dokan-store-phone',
storeEmail: '.dokan-store-email',
// storeRating: '.dokan-store-rating',
// storeOpenClose: '.dokan-store-open-close',
storeSocial: '.store-social',

profileInfo: 'div.profile-info',
storeInfo: 'ul.dokan-store-info',
storeAddress: 'li.dokan-store-address',
storePhone: 'li.dokan-store-phone',
storeEmail: 'li.dokan-store-email',
// storeRating: 'li.dokan-store-rating',
// storeOpenClose: 'li.dokan-store-open-close',
euComplianceData: {
companyName: 'li.dokan-company-name',
companyId: 'li.dokan-company-id-number',
vatNumber: 'li.dokan-vat-number',
bankName: 'li.dokan-bank-name',
bankIban: 'li.dokan-bank-iban',
},

storeSocial: 'ul.store-social',
},

// Store open close time
Expand Down Expand Up @@ -7588,6 +7590,8 @@ export const selector = {
coupon: (code: string) => `//span[@class="coupon-code"]//strong[normalize-space()="${code}"]`,
},

dokanStoreSideBar: 'div.dokan-store-sidebar div.dokan-widget-area',

storeContactForm: {
storeContactForm: 'form#dokan-form-contact-seller',
name: 'form#dokan-form-contact-seller input[placeholder="Your Name"]',
Expand All @@ -7598,8 +7602,18 @@ export const selector = {
privacyPolicy: 'div.dokan-privacy-policy-text p',
privacyPolicyLink: 'a.dokan-privacy-policy-link',
},
storeMap: 'div#dokan-store-location',

storeMap: {
storeMap: 'div#dokan-store-location',
googleMap: '//div[@id="dokan-store-location"]//a[contains(@href,"https://maps.google.com/")]',
mapbox: '//div[@id="dokan-store-location"]//a[@href="https://www.mapbox.com/"]',
},

storeOpenCloseTime: 'div.dokan-store-open-close',

googleRecaptcha: '//iframe[@title="reCAPTCHA"]',

dokanFontAwesomeLibrary: 'link#dokan-fontawesome-css',
},

cMyOrders: {
Expand Down
Loading
Loading