Skip to content

Commit

Permalink
Add Booking products tests (#2438)
Browse files Browse the repository at this point in the history
* Add booking product details test

* Add booking product tests

* Fix mix-max flaky issue

* Update product name & id reference

* update tags test

* Fix failed tests

* Fix flaky tests

* Fix commission tests

* Update commission test logic

* Add new tests & update feature map
  • Loading branch information
shashwatahalder01 authored Nov 18, 2024
1 parent ad5fc7f commit 329da76
Show file tree
Hide file tree
Showing 17 changed files with 1,787 additions and 292 deletions.
68 changes: 68 additions & 0 deletions tests/pw/feature-map/feature-map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1324,5 +1324,73 @@
vendor can delete booking resource: true
vendor can add booking for guest customer: true
vendor can add booking for existing customer: true
vendor can update booking product title: true
vendor can add booking product accommodation booking option: true
vendor can update booking product accommodation booking option: true
vendor can remove booking product accommodation booking option: true
vendor can update booking product category (single): true
vendor can add booking product category (multiple): true
vendor can remove booking product category (multiple): true
vendor can add multi-step booking product category (last category): true
vendor can add multi-step booking product category (any category): true
vendor can't add multi-step booking product category (any category): true
vendor can add booking product tags: true
vendor can remove booking product tags: true
vendor can create booking product tags: true
vendor can add booking product cover image: true
vendor can update booking product cover image: true
vendor can remove booking product cover image: true
vendor can add booking product gallery image: true
vendor can update booking product gallery image: true
vendor can remove booking product gallery image: true
vendor can add booking product short description: true
vendor can update booking product short description: true
vendor can remove booking product short description: true
vendor can update booking product description: true
vendor can add booking product virtual option: true
vendor can remove booking product virtual option: true
vendor can add booking product inventory options (SKU): true
vendor can update booking product inventory options (SKU): true
vendor can remove booking product inventory options (SKU): true
vendor can add booking product inventory options (stock status): true
vendor can add booking product inventory options (stock management): true
vendor can update booking product inventory options (stock management): true
vendor can remove booking product inventory options (stock management): true
vendor can add booking product inventory options (allow single quantity): true
vendor can remove booking product inventory options (allow single quantity): true
vendor can add booking product other options (product status): true
vendor can add booking product other options (visibility): true
vendor can add booking product shipping: true
vendor can update booking product shipping: true
vendor can remove booking product shipping: true
vendor can add booking product tax: true
vendor can add booking product tax (with tax class): true
vendor can add booking product duration: true
vendor can update booking product duration: true
vendor can add booking product basic options: true
vendor can add booking product availability: true
vendor can update booking product availability: true
vendor can add booking product costs: true
vendor can update booking product costs: true
vendor can remove booking product costs: true
vendor can add booking product extra options (persons): true
vendor can add booking product extra options (person type): true
vendor can update booking product extra options (person type): true
vendor can remove booking product extra options (person type): true
vendor can add booking product extra options (resource): true
vendor can update booking product extra options (resource): true
vendor can remove booking product extra options (resource): true
vendor can add booking product attribute: true
vendor can't add already added booking product attribute: true
vendor can create booking product attribute term: true
vendor can remove booking product attribute: true
vendor can remove booking product attribute term: true
vendor can add booking product geolocation (individual): true
vendor can update booking product geolocation (individual): true
vendor can remove booking product geolocation (individual): true
vendor can add booking product addon: true
vendor can import booking product addon: true
vendor can export booking product addon: true
vendor can remove booking product addon: true
customer:
customer can buy bookable product: true
23 changes: 18 additions & 5 deletions tests/pw/pages/commissionPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,22 @@ export class CommissionPage extends AdminPage {

// add commission
async addCommission(commission: commission) {
await this.selectByValue(setupWizardAdmin.commissionType, commission.commissionType);
if (commission.commissionType === 'fixed') {
await this.selectByValue(setupWizardAdmin.commissionType, commission.commissionType);

await this.clearAndType(setupWizardAdmin.percentage, commission.commissionPercentage);
await this.clearAndType(setupWizardAdmin.fixed, commission.commissionFixed);
} else {
await this.selectByValueAndWaitForResponse(data.subUrls.api.dokan.multistepCategories, setupWizardAdmin.commissionType, commission.commissionType);

if (commission.commissionCategory.allCategory) {
await this.clearAndType(setupWizardAdmin.categoryPercentage(commission.commissionCategory.category), commission.commissionPercentage);
await this.clearAndType(setupWizardAdmin.categoryFixed(commission.commissionCategory.category), commission.commissionFixed);
} else {
const categoryExpanded = await this.isVisible(setupWizardAdmin.expandedCategories);
if (!categoryExpanded) await this.clickIfVisible(setupWizardAdmin.expandCategories);
if (!categoryExpanded) {
await this.click(setupWizardAdmin.expandCategories);
}
await this.clearAndType(setupWizardAdmin.categoryPercentageById(commission.commissionCategory.category), commission.commissionPercentage);
await this.clearAndType(setupWizardAdmin.categoryFixedById(commission.commissionCategory.category), commission.commissionFixed);
}
Expand All @@ -45,7 +50,9 @@ export class CommissionPage extends AdminPage {
await this.toHaveValue(settingsAdmin.selling.categoryFixed(commission.commissionCategory.category), commission.commissionFixed);
} else {
const categoryExpanded = await this.isVisible(setupWizardAdmin.expandedCategories);
if (!categoryExpanded) await this.clickIfVisible(setupWizardAdmin.expandCategories);
if (!categoryExpanded) {
await this.click(setupWizardAdmin.expandCategories);
}
await this.toHaveValue(settingsAdmin.selling.categoryPercentageById(commission.commissionCategory.category), commission.commissionPercentage);
await this.toHaveValue(settingsAdmin.selling.categoryFixedById(commission.commissionCategory.category), commission.commissionFixed);
}
Expand Down Expand Up @@ -80,7 +87,13 @@ export class CommissionPage extends AdminPage {

// assert values
await this.goToDokanSettings();
await this.click(settingsAdmin.menus.sellingOptions);

if (commission.commissionType === 'fixed') {
await this.click(settingsAdmin.menus.sellingOptions);
} else {
await this.clickAndAcceptAndWaitForResponse(data.subUrls.api.dokan.multistepCategories, settingsAdmin.menus.sellingOptions);
}

await this.assertCommission(commission);
}

Expand All @@ -104,12 +117,12 @@ export class CommissionPage extends AdminPage {
// set commission for vendor
async setCommissionForVendor(sellerId: string, commission: commission) {
await this.goto(data.subUrls.backend.dokan.vendorDetailsEdit(sellerId));
// await this.click(vendors.editVendor.editVendorIcon);

await this.selectByValue(vendors.editVendor.commissionType, commission.commissionType);

// add commission
await this.addCommission(commission);
await this.wait(1); // todo: resolve in future; test failed for fixed commission

await this.clickAndWaitForResponse(data.subUrls.api.dokan.stores, vendors.editVendor.saveChanges);
await this.click(vendors.editVendor.closeUpdateSuccessModal);
Expand Down
2 changes: 2 additions & 0 deletions tests/pw/pages/customerPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ export class CustomerPage extends BasePage {
await this.clearAndType(customerDashboard.bankIban, customerInfo.bankIban);
}

// check if terms and conditions is visible
await this.clickIfVisible(customerDashboard.termsAndConditions);
// purchase subscription pack if enabled
const subscriptionPackIsVisible = await this.isVisible(customerDashboard.subscriptionPack);
if (subscriptionPackIsVisible) await this.selectByLabel(selector.vendor.vRegistration.subscriptionPack, data.predefined.vendorSubscription.nonRecurring);
await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.becomeVendor, customerDashboard.becomeAVendor, 302);
Expand Down
Loading

0 comments on commit 329da76

Please sign in to comment.