From 562f328660744bcd664fc90a034e3aa3030ffe71 Mon Sep 17 00:00:00 2001 From: shashwata Date: Thu, 14 Nov 2024 13:24:13 +0600 Subject: [PATCH] Fix test data issue --- tests/pw/pages/commissionPage.ts | 2 +- tests/pw/pages/settingsPage.ts | 3 +- tests/pw/tests/e2e/coupons.spec.ts | 1 - tests/pw/tests/e2e/vendorSettings.spec.ts | 2 +- tests/pw/utils/dbData.ts | 2 +- tests/pw/utils/testData.ts | 78 +++++++++++++++++++++-- 6 files changed, 79 insertions(+), 9 deletions(-) diff --git a/tests/pw/pages/commissionPage.ts b/tests/pw/pages/commissionPage.ts index 5d15956850..49efd3325a 100644 --- a/tests/pw/pages/commissionPage.ts +++ b/tests/pw/pages/commissionPage.ts @@ -95,7 +95,7 @@ export class CommissionPage extends AdminPage { await this.addCommission(commission); // save settings - await this.clickAndWaitForResponseAndLoadState(data.subUrls.ajax, settingsAdmin.selling.sellingOptionsSaveChanges); + await this.clickAndWaitForResponseAndLoadState(data.subUrls.ajax, settingsAdmin.saveChanges); // assert values await this.assertCommission(commission); diff --git a/tests/pw/pages/settingsPage.ts b/tests/pw/pages/settingsPage.ts index 8538fa5ed6..1b7644bb1d 100644 --- a/tests/pw/pages/settingsPage.ts +++ b/tests/pw/pages/settingsPage.ts @@ -143,7 +143,8 @@ export class SettingsPage extends AdminPage { await this.clickAndWaitForResponseAndLoadState(data.subUrls.ajax, settingsAdmin.saveChanges); await this.toHaveValue(settingsAdmin.selling.percentage, selling.commission.commissionPercentage); await this.toHaveValue(settingsAdmin.selling.percentage, selling.commission.commissionFixed); - + } + // Admin Set Dokan Withdraw Settings async setDokanWithdrawSettings(withdraw: dokanSettings['withdraw']) { await this.goToDokanSettings(); diff --git a/tests/pw/tests/e2e/coupons.spec.ts b/tests/pw/tests/e2e/coupons.spec.ts index 97d6759077..6ad915c23f 100644 --- a/tests/pw/tests/e2e/coupons.spec.ts +++ b/tests/pw/tests/e2e/coupons.spec.ts @@ -51,7 +51,6 @@ test.describe('Coupons test', () => { }); test('vendor can view marketPlace coupons', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { - test.skip(true, 'Has dokan issues'); await vendor.viewMarketPlaceCoupons(marketplaceCouponCode); }); diff --git a/tests/pw/tests/e2e/vendorSettings.spec.ts b/tests/pw/tests/e2e/vendorSettings.spec.ts index 507fba7581..0dec1a08fd 100644 --- a/tests/pw/tests/e2e/vendorSettings.spec.ts +++ b/tests/pw/tests/e2e/vendorSettings.spec.ts @@ -90,7 +90,7 @@ test.describe('Vendor settings test', () => { test('vendor can set catalog settings', { tag: ['@lite', '@vendor'] }, async () => { await vendor.setStoreSettings(data.vendor.vendorInfo, 'catalog'); - + // disable catalog await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { catalog_mode_hide_add_to_cart_button: 'off', catalog_mode_hide_product_price: 'off' }); }); diff --git a/tests/pw/utils/dbData.ts b/tests/pw/utils/dbData.ts index bedce54b48..255572094c 100644 --- a/tests/pw/utils/dbData.ts +++ b/tests/pw/utils/dbData.ts @@ -1,4 +1,4 @@ -const { BASE_URL, GMAP, MAPBOX, LICENSE_KEY, TALKJS_APP_ID, TALKJS_APP_SECRET, PRINTFUL_APP_ID, PRINTFUL_APP_SECRET } = process.env; +const { BASE_URL, GMAP, MAPBOX, LICENSE_KEY, CATEGORY_ID, TALKJS_APP_ID, TALKJS_APP_SECRET, PRINTFUL_APP_ID, PRINTFUL_APP_SECRET } = process.env; export const dbData = { dokan: { diff --git a/tests/pw/utils/testData.ts b/tests/pw/utils/testData.ts index a4fb1168c2..d47258af03 100644 --- a/tests/pw/utils/testData.ts +++ b/tests/pw/utils/testData.ts @@ -23,6 +23,7 @@ const { GMAP, MAPBOX, LICENSE_KEY, + CATEGORY_ID, VONAGE_API_KEY, VONAGE_API_SECRET, FB_APP_ID, @@ -570,6 +571,16 @@ export const data = { minimumProductQuantity: '1', maximumProductQuantity: '20', }, + + commission: { + commissionType: 'fixed', // 'fixed','category_based' [category commission will only be applicable to dokan subscription product] + commissionPercentage: '2', + commissionFixed: '2', + commissionCategory: { + allCategory: true, // true for all category, false for specific category + category: 'All Categories', + }, + }, }, }, @@ -853,6 +864,39 @@ export const data = { }, }, + // commission [for all dokan setup wizard, dokan selling settings, dokan subscription product] + commission: { + fixed: { + commissionType: 'fixed', // 'fixed','category_based' + commissionPercentage: '10', + commissionFixed: '10', + commissionCategory: { + allCategory: true, // true for all category, false for specific category + category: 'All Categories', + }, + }, + + allCategory: { + commissionType: 'category_based', // 'fixed','category_based' + commissionPercentage: '5', + commissionFixed: '5', + commissionCategory: { + allCategory: true, // true for all category, false for specific category + category: 'All Categories', + }, + }, + + specficCategory: { + commissionType: 'category_based', // 'fixed','category_based' + commissionPercentage: '2', + commissionFixed: '2', + commissionCategory: { + allCategory: false, // true for all category, false for specific category + category: CATEGORY_ID, + }, + }, + }, + // Dokan Setup Wizard dokanSetupWizard: { vendorStoreURL: 'store', @@ -861,8 +905,15 @@ export const data = { mapApiSource: 'google_maps', // 'google_maps', 'mapbox' googleMapApiKey: GMAP, sellingProductTypes: 'sell_both', // 'physical', 'digital', 'sell_both', - commissionType: 'percentage', // 'flat','percentage' 'combine', - adminCommission: '10', + commission: { + commissionType: 'fixed', // 'fixed','category_based' + commissionPercentage: '10', + commissionFixed: '0', + commissionCategory: { + allCategory: true, // true for all category, false for specific category + category: 'All Categories', + }, + }, minimumWithdrawLimit: '5', }, @@ -1128,6 +1179,7 @@ export const data = { dummyDataImport: 'dokan/v1/dummy-data/import', refunds: 'dokan/v1/refunds', modules: 'dokan/v1/admin/modules', + multistepCategories: 'dokan/v1/products/multistep-categories', storeReviews: 'dokan/v1/store-reviews', productAdvertising: 'dokan/v1/product_adv', wholesaleRegister: 'dokan/v1/wholesale/register', @@ -1240,6 +1292,17 @@ export const data = { // address fields enable flag (on vendor registration) addressFieldsEnabled: false, + // commission + commission: { + commissionType: 'fixed', // 'fixed','category_based' + commissionPercentage: '5', + commissionFixed: '5', + commissionCategory: { + allCategory: true, // true for all category, false for specific category + category: 'All Categories', + }, + }, + // subscription pack vendorSubscriptionPack: 'Dokan_Subscription_Non_recurring', @@ -2071,8 +2134,15 @@ export const data = { // selling options settings selling: { settingTitle: 'Selling Option Settings', - commissionType: 'percentage', // 'flat', 'percentage', 'combine' - adminCommission: '10', + commission: { + commissionType: 'fixed', // 'fixed','category_based' + commissionPercentage: '10', + commissionFixed: '10', + commissionCategory: { + allCategory: true, // true for all category, false for specific category + category: 'All Categories', + }, + }, shippingFeeRecipient: 'seller', // 'seller', 'admin' productTaxFeeRecipient: 'seller', // 'seller', 'admin' shippingTaxFeeRecipient: 'seller', // 'seller', 'admin'