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 5 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
38 changes: 20 additions & 18 deletions tests/pw/.env.example
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# 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]
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
36 changes: 19 additions & 17 deletions tests/pw/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -121,23 +121,25 @@ 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]
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 @@ -651,7 +668,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 @@ -1481,6 +1481,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 @@ -1598,6 +1604,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 element not to be visible
async notToBeVisible(selector: string) {
await expect(this.page.locator(selector)).toBeHidden();
Expand Down
42 changes: 28 additions & 14 deletions tests/pw/pages/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6022,6 +6022,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 @@ -7375,32 +7376,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 @@ -7523,6 +7525,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 @@ -7533,8 +7537,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
102 changes: 93 additions & 9 deletions tests/pw/pages/storeAppearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,102 @@ export class StoreAppearance extends BasePage {
super(page);
}

async disableMapOnStoreSidebar(storeName: string) {
await this.goIfNotThere(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)));
await this.notToBeVisible(singleStoreCustomer.storeMap);
async gotoSingleStore(storeName: string): Promise<void> {
await this.gotoUntilNetworkidle(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)));
}

async disableStoreOpenCloseTimeOnStoreSidebar(storeName: string) {
await this.goto(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)));
await this.notToBeVisible(singleStoreCustomer.storeOpenCloseTime);
// view store map on store sidebar
async viewStoreMapOnStoreSidebar(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (status === 'enable') {
await this.toBeVisible(singleStoreCustomer.storeMap.storeMap);
} else {
await this.notToBeVisible(singleStoreCustomer.storeMap.storeMap);
}
shashwatahalder01 marked this conversation as resolved.
Show resolved Hide resolved
}

async disableVendorInfoOnSingleStorePage(storeName: string) {
await this.goto(data.subUrls.frontend.vendorDetails(helpers.slugify(storeName)));
await this.notToBeVisible(singleStoreCustomer.storeOpenCloseTime);
// view map api source
async viewMapAPISource(api: 'Google Maps' | 'Mapbox', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (api === 'Google Maps') {
await this.multipleElementVisible([singleStoreCustomer.storeMap.storeMap, singleStoreCustomer.storeMap.googleMap]);
} else {
await this.multipleElementVisible([singleStoreCustomer.storeMap.storeMap, singleStoreCustomer.storeMap.mapbox]);
}
}

// set Google reCAPTCHA
async viewGoogleRecaptcha(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (status === 'enable') {
await this.toBeVisible(singleStoreCustomer.googleRecaptcha);
} else {
await this.notToBeVisible(singleStoreCustomer.googleRecaptcha);
}
}

// view store contact form on store sidebar
async viewStoreContactFormOnStoreSidebar(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (status === 'enable') {
await this.toBeVisible(singleStoreCustomer.storeContactForm.storeContactForm);
} else {
await this.notToBeVisible(singleStoreCustomer.storeContactForm.storeContactForm);
}
}

// view store header template
async viewStoreHeaderTemplate(template: 'default' | 'layout1' | 'layout2' | 'layout3', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
await this.toHaveClass(singleStoreCustomer.storeProfile.storeProfileInfoBox, `profile-info-box profile-layout-${template}`);
}

// view store open-close time on store sidebar
async viewStoreOpenCloseTimeOnStoreSidebar(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (status === 'enable') {
await this.toBeVisible(singleStoreCustomer.storeOpenCloseTime);
} else {
await this.notToBeVisible(singleStoreCustomer.storeOpenCloseTime);
}
}

// set banner size
async setBannerSize(bannerSize: { width: string; height: string }): Promise<void> {
await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsStore);
await this.toContainText(selector.vendor.vStoreSettings.bannerHelpText, `${bannerSize.width}x${bannerSize.height}`);
//todo: add more assertion
}

// view store sidebar from theme
async viewStoreSideBarFromTheme(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (status === 'enable') {
await this.toBeVisible(singleStoreCustomer.dokanStoreSideBar);
} else {
await this.notToBeVisible(singleStoreCustomer.dokanStoreSideBar);
// todo: add more assertions
}
}

// view vendor info on single store page
async viewVendorInfoOnSingleStorePage(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
const vendorInfo = [singleStoreCustomer.storeProfile.storeAddress, singleStoreCustomer.storeProfile.storePhone, singleStoreCustomer.storeProfile.storeEmail];
if (status === 'enable') {
await this.multipleElementVisible(vendorInfo);
} else {
await this.multipleElementNotVisible(vendorInfo);
}
}

// view Font Awesome library icons on vendor dashboard
async viewFontAwesomeLibrary(status: 'enable' | 'disable', storeName: string): Promise<void> {
await this.gotoSingleStore(storeName);
if (status === 'enable') {
await this.toExists(singleStoreCustomer.dokanFontAwesomeLibrary);
} else {
await this.notToExists(singleStoreCustomer.dokanFontAwesomeLibrary);
}
}
}
8 changes: 8 additions & 0 deletions tests/pw/tests/e2e/_auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ setup.describe('add & authenticate users', () => {

setup('add vendor1', { tag: ['@lite'] }, async () => {
const [, sellerId] = await apiUtils.createStore(payloads.createStore1, payloads.adminAuth, true);
// add open-close time
await apiUtils.updateStore(sellerId, payloads.storeOpenClose, payloads.adminAuth);
// add review
await apiUtils.createStoreReview(sellerId, { ...payloads.createStoreReview, rating: 5 }, payloads.customerAuth);
shashwatahalder01 marked this conversation as resolved.
Show resolved Hide resolved
helpers.createEnvVar('VENDOR_ID', sellerId);
});

Expand All @@ -43,6 +47,10 @@ setup.describe('add & authenticate users', () => {

setup('add vendor2', { tag: ['@lite'] }, async () => {
const [, sellerId] = await apiUtils.createStore(payloads.createStore2, payloads.adminAuth, true);
// add open-close time
await apiUtils.updateStore(sellerId, payloads.storeOpenClose, payloads.adminAuth);
// add review
await apiUtils.createStoreReview(sellerId, { ...payloads.createStoreReview, rating: 5 }, payloads.customerAuth);
shashwatahalder01 marked this conversation as resolved.
Show resolved Hide resolved
helpers.createEnvVar('VENDOR2_ID', sellerId);
});

Expand Down
Loading
Loading