From b04023c64a5324545323c6d772c9d05a0bf7e887 Mon Sep 17 00:00:00 2001 From: Aftabul Islam Date: Tue, 21 Nov 2023 10:47:03 +0600 Subject: [PATCH 01/17] feat: short form of days added. (#1989) --- includes/functions.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 16d77ec608..d39da0a525 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -2996,11 +2996,13 @@ function dokan_get_jed_locale_data( $domain, $language_dir = null ) { * * @since 2.8.2 * - * @param string|null days + * @param string|null $days + * @maram string/null $form * * @return string|array */ -function dokan_get_translated_days( $day = '' ) { +function dokan_get_translated_days( $day = '', $form = 'long' ) { + $all_days = [ 'sunday' => __( 'Sunday', 'dokan-lite' ), 'monday' => __( 'Monday', 'dokan-lite' ), @@ -3011,6 +3013,18 @@ function dokan_get_translated_days( $day = '' ) { 'saturday' => __( 'Saturday', 'dokan-lite' ), ]; + if ( 'short' === $form ) { + $all_days = [ + 'sunday' => __( 'Sun', 'dokan-lite' ), + 'monday' => __( 'Mon', 'dokan-lite' ), + 'tuesday' => __( 'Tue', 'dokan-lite' ), + 'wednesday' => __( 'Wed', 'dokan-lite' ), + 'thursday' => __( 'Thu', 'dokan-lite' ), + 'friday' => __( 'Fri', 'dokan-lite' ), + 'saturday' => __( 'Sat', 'dokan-lite' ), + ]; + } + $week_starts_on = get_option( 'start_of_week', 0 ); $day_keys = array_keys( $all_days ); From 0f7f23f5bfad6e68986f52968b10ccd07d3aac0f Mon Sep 17 00:00:00 2001 From: Aftabul Islam Date: Tue, 21 Nov 2023 10:47:40 +0600 Subject: [PATCH 02/17] Successful product duplication message added (#2022) * feat: product duplication message added. * fix: phpcs issue fix --- includes/template-tags.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/template-tags.php b/includes/template-tags.php index beed9b99e5..ad81fec13a 100755 --- a/includes/template-tags.php +++ b/includes/template-tags.php @@ -161,7 +161,14 @@ function dokan_product_dashboard_errors() { ) ); break; - + case 'product_duplicated': + dokan_get_template_part( + 'global/dokan-success', '', [ + 'deleted' => false, + 'message' => __( 'Product successfully duplicated', 'dokan-lite' ), + ] + ); + break; case 'error': dokan_get_template_part( 'global/dokan-error', '', array( @@ -975,7 +982,7 @@ function dokan_get_seller_registration_form_data() { 'lname' => isset( $_POST['lname'] ) ? sanitize_text_field( wp_unslash( $_POST['lname'] ) ) : '', 'username' => isset( $_POST['username'] ) ? sanitize_user( wp_unslash( $_POST['username'] ) ) : '', 'email' => isset( $_POST['email'] ) ? sanitize_email( wp_unslash( $_POST['email'] ) ) : '', - 'phone' => isset( $_POST['phone'] ) ? dokan_sanitize_phone_number( wp_unslash( $_POST['phone'] ) ) : '', + 'phone' => isset( $_POST['phone'] ) ? dokan_sanitize_phone_number( wp_unslash( $_POST['phone'] ) ) : '', // phpcs:ignore 'password' => isset( $_POST['password'] ) ? wp_unslash( $_POST['password'] ) : '', // phpcs:ignore 'shopname' => isset( $_POST['shopname'] ) ? sanitize_text_field( wp_unslash( $_POST['shopname'] ) ) : '', 'shopurl' => isset( $_POST['shopurl'] ) ? sanitize_title( wp_unslash( $_POST['shopurl'] ) ) : '', From 4809084555ac1ce8b33861e7e07e9d5e2fa074b3 Mon Sep 17 00:00:00 2001 From: Aftabul Islam Date: Tue, 21 Nov 2023 10:48:47 +0600 Subject: [PATCH 03/17] fix: Empty address save for vendor issue fix. (#2052) --- includes/Vendor/Vendor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/Vendor/Vendor.php b/includes/Vendor/Vendor.php index 8cb4257f60..6ffad23b29 100644 --- a/includes/Vendor/Vendor.php +++ b/includes/Vendor/Vendor.php @@ -249,6 +249,7 @@ public function popluate_store_data() { $shop_info = get_user_meta( $this->id, 'dokan_profile_settings', true ); $shop_info = is_array( $shop_info ) ? $shop_info : array(); $shop_info = wp_parse_args( $shop_info, $defaults ); + $shop_info['address'] = empty( $shop_info['address'] ) ? []: $shop_info['address']; // Empty vendor address save issue fix $this->shop_data = apply_filters( 'dokan_vendor_shop_data', $shop_info, $this ); } From 472d17cdb4b43dc93d23cc115337855ad3ddb282 Mon Sep 17 00:00:00 2001 From: Shazahanul Islam Shohag Date: Tue, 21 Nov 2023 10:51:34 +0600 Subject: [PATCH 04/17] fix: Regenerate button typo (#2072) --- src/admin/components/PasswordGenerator.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/admin/components/PasswordGenerator.vue b/src/admin/components/PasswordGenerator.vue index f31edae8aa..c94da53a9f 100644 --- a/src/admin/components/PasswordGenerator.vue +++ b/src/admin/components/PasswordGenerator.vue @@ -33,7 +33,7 @@ export default { regenrateTitle: { type: String, - default: 'Regenrate' + default: 'Regenerate' }, length: { @@ -87,4 +87,4 @@ export default { } } } - \ No newline at end of file + From 321ea9a53976dafc2bd20f9cb847b09451909568 Mon Sep 17 00:00:00 2001 From: Shazahanul Islam Shohag Date: Tue, 21 Nov 2023 10:52:59 +0600 Subject: [PATCH 05/17] update: Remove minimum input length restriction (#2073) --- assets/src/js/product-editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/src/js/product-editor.js b/assets/src/js/product-editor.js index 9a19f6a90e..dce29dc460 100755 --- a/assets/src/js/product-editor.js +++ b/assets/src/js/product-editor.js @@ -221,7 +221,7 @@ if ( ! $found ) data.unshift( tag ); }, - minimumInputLength: 2, + minimumInputLength: 0, maximumSelectionLength: dokan.maximum_tags_select_length !== undefined ? dokan.maximum_tags_select_length : -1, ajax: { url: dokan.ajaxurl, From 86c55f437d0fcbef73a74e53f93136e54d924b09 Mon Sep 17 00:00:00 2001 From: shashwata Halder Date: Wed, 22 Nov 2023 14:22:47 +0600 Subject: [PATCH 06/17] update: update test suite for WooCommerce 8.3 Cart and Checkout Blocks (#2090) * add zod api json validation * update test workflow * fix deprecated function * add pro plugin status * removed test.only * add visual tests * add new api endpoints tests * remove log line * update lint * update test config * fix failed tests * update yml * update yml * fix some minor issues * fix lint * update: add tests for announcement notice endpoints * update: add withdraw charge api test * update: update test suite for woocommerce 8.3Cart and Checkout Blocks --- tests/pw/pages/announcementsPage.ts | 4 ++-- tests/pw/pages/customerPage.ts | 10 ++++----- tests/pw/pages/proPromoPage.ts | 9 ++++++-- tests/pw/pages/selectors.ts | 28 ++++++++++++------------ tests/pw/tests/api/announcements.spec.ts | 25 ++++++++++----------- tests/pw/tests/api/rankMath.spec.ts | 3 +-- tests/pw/tests/api/withdraws.spec.ts | 14 ++++++++++++ tests/pw/tests/e2e/_auth.setup.spec.ts | 1 - tests/pw/tests/e2e/announcements.spec.ts | 8 ++++--- tests/pw/utils/apiEndPoints.ts | 2 ++ tests/pw/utils/dbData.ts | 18 +++++++++++++++ tests/pw/utils/payloads.ts | 5 +++++ tests/pw/utils/testData.ts | 1 + 13 files changed, 86 insertions(+), 42 deletions(-) diff --git a/tests/pw/pages/announcementsPage.ts b/tests/pw/pages/announcementsPage.ts index 03942db0e7..2e75fe7d44 100644 --- a/tests/pw/pages/announcementsPage.ts +++ b/tests/pw/pages/announcementsPage.ts @@ -87,13 +87,13 @@ export class AnnouncementsPage extends AdminPage { case 'restore': await this.clickAndWaitForResponse(data.subUrls.api.dokan.announcements, selector.admin.dokan.announcements.navTabs.trash); - await this.hover(selector.admin.dokan.announcements.announcementCell(announcementTitle)); + await this.hover(selector.admin.dokan.announcements.announcementCellPublished(announcementTitle)); await this.clickAndWaitForResponse(data.subUrls.api.dokan.announcements, selector.admin.dokan.announcements.announcementRestore(announcementTitle)); break; case 'permanently-delete': await this.clickAndWaitForResponse(data.subUrls.api.dokan.announcements, selector.admin.dokan.announcements.navTabs.trash); - await this.hover(selector.admin.dokan.announcements.announcementCell(announcementTitle)); + await this.hover(selector.admin.dokan.announcements.announcementCellPublished(announcementTitle)); await this.clickAndWaitForResponse(data.subUrls.api.dokan.announcements, selector.admin.dokan.announcements.announcementPermanentlyDelete(announcementTitle)); break; diff --git a/tests/pw/pages/customerPage.ts b/tests/pw/pages/customerPage.ts index 215f7ee6c7..9ddd89573c 100644 --- a/tests/pw/pages/customerPage.ts +++ b/tests/pw/pages/customerPage.ts @@ -250,13 +250,13 @@ export class CustomerPage extends BasePage { // clear cart async clearCart(): Promise { await this.goToCart(); - const cartProductIsVisible = await this.isVisible(selector.customer.cCart.firstProductCrossIcon); + const cartProductIsVisible = await this.isVisible(selector.customer.cCart.removeFirstItem); if (cartProductIsVisible) { - await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.cart, selector.customer.cCart.firstProductCrossIcon); - await this.toContainText(selector.customer.cWooSelector.wooCommerceSuccessMessage, 'removed. Undo?'); + await this.clickAndWaitForResponseAndLoadState(data.subUrls.api.wc.store, selector.customer.cCart.removeFirstItem, 207); + // await this.toContainText(selector.customer.cWooSelector.wooCommerceSuccessMessage, 'removed. Undo?'); //todo: remove in future await this.clearCart(); } else { - await this.toContainText(selector.customer.cCart.cartEmptyMessage, 'Your cart is currently empty.'); + await this.toContainText(selector.customer.cCart.cartEmptyMessage, 'Your cart is currently empty!'); } } @@ -323,7 +323,7 @@ export class CustomerPage extends BasePage { default: break; } - + await this.focusOnLocator(selector.customer.cCheckout.placeOrder); await this.clickAndWaitForResponseAndLoadState(data.subUrls.frontend.orderReceived, selector.customer.cCheckout.placeOrder); await this.toBeVisible(selector.customer.cOrderReceived.orderReceivedSuccessMessage); diff --git a/tests/pw/pages/proPromoPage.ts b/tests/pw/pages/proPromoPage.ts index c150c6d2b7..5763f97741 100644 --- a/tests/pw/pages/proPromoPage.ts +++ b/tests/pw/pages/proPromoPage.ts @@ -13,8 +13,13 @@ export class ProPromoPage extends AdminPage { // dokan promo banner await this.goIfNotThere(data.subUrls.backend.dokan.dokan); - // promo banner elements are visible - await this.multipleElementVisible(selector.admin.dokan.promoBanner); + const isProPromotionVisible = await this.isVisible(selector.admin.dokan.promoBanner.promoBanner); + if (isProPromotionVisible) { + // promo banner elements are visible + await this.multipleElementVisible(selector.admin.dokan.promoBanner); + } else { + console.log('No Pro promotion exists'); + } // dokan lite modules await this.goIfNotThere(data.subUrls.backend.dokan.liteModules); diff --git a/tests/pw/pages/selectors.ts b/tests/pw/pages/selectors.ts index b20370967f..f5617dfb4f 100644 --- a/tests/pw/pages/selectors.ts +++ b/tests/pw/pages/selectors.ts @@ -186,7 +186,7 @@ export const selector = { // dokan promotion promotion: { promotion: '.dokan-notice-slides .dokan-promotion', - joinTheSale: '//a[contains(text(),"Join the Sale! →")]', + message: '.dokan-promotion .dokan-message', }, // dokan notice @@ -1145,8 +1145,8 @@ export const selector = { announcementStatusScheduled: (title: string) => `//a[contains(text(),'${title}')]/../../..//td[@class="column status"]//span[@class="future"]`, announcementEdit: (title: string) => `//a[contains(text(),'${title}')]/../..//span[@class="edit"]`, announcementDelete: (title: string) => `//strong[contains(text(),'${title}')]/../..//span[@class="trash"]`, - announcementPermanentlyDelete: (title: string) => `//a[contains(text(),'${title}')]/../..//span[@class="delete"]`, - announcementRestore: (title: string) => `//a[contains(text(),'${title}')]/../..//span[@class="restore"]`, + announcementPermanentlyDelete: (title: string) => `//strong[contains(text(),'${title}')]/../..//span[@class="delete"]`, + announcementRestore: (title: string) => `//strong[contains(text(),'${title}')]/../..//span[@class="restore"]`, // add announcement addAnnouncement: { @@ -6924,7 +6924,7 @@ export const selector = { cartPageHeader: 'h1.entry-title', // Edit Cart - cartItem: (productName: string) => `//td[@class='product-name']//a[contains(text(),'${productName}')]`, + cartItem: (productName: string) => `//tr[@class='wc-block-cart-items__row']//a[@class= 'wc-block-components-product-name' and contains(text(),'${productName}')]`, removeItem: (productName: string) => `//a[contains(text(),'${productName}')]/../..//a[@class='remove']`, quantity: (productName: string) => `//a[contains(text(),'${productName}')]/../..//input[@class='input-text qty text']`, couponCode: '#coupon_code', @@ -6944,12 +6944,12 @@ export const selector = { vendorShippingMethod: (shippingMethod: string) => `//label[contains(text(),'${shippingMethod}')]/..//input`, // For Unique Shipping Method // Proceed to Checkout - proceedToCheckout: '.checkout-button.button.wc-forward', + proceedToCheckout: '.checkout-button.button.wc-forward, .wp-block-woocommerce-proceed-to-checkout-block a', // Remove All Item productCrossIcon: '.product-remove a', - firstProductCrossIcon: '(//td[@class="product-remove"]//a)[1]', - cartEmptyMessage: '.cart-empty.woocommerce-info', + removeFirstItem: '(//button[@class="wc-block-cart-item__remove-link"])[1]', + cartEmptyMessage: '.wp-block-woocommerce-empty-cart-block .wc-block-cart__empty-cart__title', }, cWholesale: { @@ -7028,9 +7028,9 @@ export const selector = { vendorShippingMethod: (shippingMethod: string) => `//label[contains(text(),'${shippingMethod}')]/..//input`, // For Unique Shipping Method // Payment Methods - directBankTransfer: '.payment_method_bacs label', - checkPayments: '.payment_method_cheque label', - cashOnDelivery: '.payment_method_cod label', + directBankTransfer: '.payment_method_bacs label, label[for="radio-control-wc-payment-method-options-bacs"]', + checkPayments: '.payment_method_cheque label, label[for="radio-control-wc-payment-method-options-cheque"]', + cashOnDelivery: '.payment_method_cod label, label[for="radio-control-wc-payment-method-options-cod"]', paypalAdaptive: '.payment_method_dokan_paypal_adaptive label', stripeConnect: '.wc_payment_method.payment_method_dokan-stripe-connect label[for="payment_method_dokan-stripe-connect"]', wireCardCreditCard: '.payment_method_dokan-moip-connect label', @@ -7038,7 +7038,7 @@ export const selector = { stripeExpress: '.wc_payment_method.payment_method_dokan_stripe_express label', // Place Order - placeOrder: '#place_order', + placeOrder: '#place_order, div.wc-block-checkout__actions_row button.wc-block-components-checkout-place-order-button', }, cPayWithStripe: { @@ -7211,9 +7211,9 @@ export const selector = { }, cWooSelector: { - wooCommerceSuccessMessage: 'div.woocommerce .woocommerce-message', - wooCommerceError: '.woocommerce .woocommerce-error', - wooCommerceInfo: '.woocommerce .woocommerce-info', + wooCommerceSuccessMessage: '.woocommerce .is-success', + wooCommerceError: '.woocommerce .is-error', + wooCommerceInfo: '.woocommerce .is-info', }, }, }; diff --git a/tests/pw/tests/api/announcements.spec.ts b/tests/pw/tests/api/announcements.spec.ts index dfee9ee83b..4f9844de60 100644 --- a/tests/pw/tests/api/announcements.spec.ts +++ b/tests/pw/tests/api/announcements.spec.ts @@ -14,10 +14,12 @@ import { payloads } from '@utils/payloads'; test.describe('announcements api test', () => { let apiUtils: ApiUtils; let announcementId: string; + let announcementNoticeId: string; test.beforeAll(async ({ request }) => { apiUtils = new ApiUtils(request); [, announcementId] = await apiUtils.createAnnouncement(payloads.createAnnouncement()); + announcementNoticeId = await apiUtils.getAnnouncementNoticeId(payloads.vendorAuth); }); test('get all announcements @pro', async () => { @@ -32,25 +34,25 @@ test.describe('announcements api test', () => { expect(responseBody).toBeTruthy(); }); - test('create a announcement @pro', async () => { + test('create an announcement @pro', async () => { const [response, responseBody] = await apiUtils.post(endPoints.createAnnouncement, { data: payloads.createAnnouncement() }); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); }); - test('update a announcement @pro', async () => { + test('update an announcement @pro', async () => { const [response, responseBody] = await apiUtils.post(endPoints.updateAnnouncement(announcementId), { data: payloads.updateAnnouncement }); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); }); - test('delete a announcement @pro', async () => { + test('trash an announcement @pro', async () => { const [response, responseBody] = await apiUtils.delete(endPoints.deleteAnnouncement(announcementId)); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); }); - test('restore a deleted announcement @pro', async () => { + test('restore a trashed announcement @pro', async () => { const [response, responseBody] = await apiUtils.put(endPoints.restoreDeletedAnnouncement(announcementId)); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); @@ -68,24 +70,21 @@ test.describe('announcements api test', () => { // announcement notice - test.skip('get single announcement notice @pro', async () => { - const [response, responseBody] = await apiUtils.get(endPoints.getSingleAnnouncementNotice(noticeId), { headers: payloads.vendorAuth }); + test('get single announcement notice @pro', async () => { + const [response, responseBody] = await apiUtils.get(endPoints.getSingleAnnouncementNotice(announcementNoticeId), { headers: payloads.vendorAuth }); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); - console.log(responseBody); }); - test.skip('update a announcement notice @pro', async () => { - const [response, responseBody] = await apiUtils.post(endPoints.updateAnnouncementNotice(noticeId), { data: payloads.updateAnnouncementNotice, headers: payloads.vendorAuth }); + test('update an announcement notice @pro', async () => { + const [response, responseBody] = await apiUtils.post(endPoints.updateAnnouncementNotice(announcementNoticeId), { data: payloads.updateAnnouncementNotice, headers: payloads.vendorAuth }); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); - console.log(responseBody); }); - test.skip('delete a announcement notice @pro', async () => { - const [response, responseBody] = await apiUtils.delete(endPoints.deleteAnnouncementNotice(noticeId), { headers: payloads.vendorAuth }); + test('delete an announcement notice @pro', async () => { + const [response, responseBody] = await apiUtils.delete(endPoints.deleteAnnouncementNotice(announcementNoticeId), { headers: payloads.vendorAuth }); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); - console.log(responseBody); }); }); diff --git a/tests/pw/tests/api/rankMath.spec.ts b/tests/pw/tests/api/rankMath.spec.ts index dbf58c8502..e137fe8e35 100644 --- a/tests/pw/tests/api/rankMath.spec.ts +++ b/tests/pw/tests/api/rankMath.spec.ts @@ -14,8 +14,7 @@ test.describe.skip('rank math api test', () => { [, productId] = await apiUtils.createProduct(payloads.createProduct()); }); - test('rank math @pro', async () => { - test.skip(!!process.env.CI, 'feature not merged yet!'); + test.skip('rank math @pro', async () => { const [response, responseBody] = await apiUtils.post(endPoints.rankMath(productId), { data: {} }); expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); diff --git a/tests/pw/tests/api/withdraws.spec.ts b/tests/pw/tests/api/withdraws.spec.ts index 92caee6593..a94740fad9 100644 --- a/tests/pw/tests/api/withdraws.spec.ts +++ b/tests/pw/tests/api/withdraws.spec.ts @@ -84,4 +84,18 @@ test.describe('withdraw api test', () => { expect(response.ok()).toBeTruthy(); expect(responseBody).toBeTruthy(); }); + + test('get all withdraw method charges @lite', async () => { + test.skip(true, 'feature not merged yet'); + const [response, responseBody] = await apiUtils.get(endPoints.getAllWithdrawMethodCharges); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + }); + + test('get withdraw charge details @lite', async () => { + test.skip(true, 'feature not merged yet'); + const [response, responseBody] = await apiUtils.get(endPoints.getWithdrawCharge, { params: payloads.withdrawCharge }); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + }); }); diff --git a/tests/pw/tests/e2e/_auth.setup.spec.ts b/tests/pw/tests/e2e/_auth.setup.spec.ts index aafa624f7b..549406d79a 100644 --- a/tests/pw/tests/e2e/_auth.setup.spec.ts +++ b/tests/pw/tests/e2e/_auth.setup.spec.ts @@ -42,7 +42,6 @@ setup.describe('authenticate users & set permalink', () => { await apiUtils.updateCustomer(sellerId, payloads.updateAddress, payloads.adminAuth); console.log('VENDOR2_ID:', sellerId); (global as any).VENDOR2_ID = sellerId; - // helpers.writeEnvJson('VENDOR2_ID', sellerId); }); setup('authenticate customer @lite', async ({ page }) => { diff --git a/tests/pw/tests/e2e/announcements.spec.ts b/tests/pw/tests/e2e/announcements.spec.ts index c0d6498bc7..2f7f634a1b 100644 --- a/tests/pw/tests/e2e/announcements.spec.ts +++ b/tests/pw/tests/e2e/announcements.spec.ts @@ -27,7 +27,7 @@ test.describe('Announcements test', () => { await admin.adminAnnouncementsRenderProperly(); }); - test('admin can add announcement @pro', async () => { + test('admin can send announcement @pro', async () => { await admin.addAnnouncement({ ...data.announcement, title: data.announcement.randomTitle() }); }); @@ -44,12 +44,14 @@ test.describe('Announcements test', () => { }); test('admin can restore announcement @pro', async () => { - const [, , announcementTitle] = await apiUtils.createAnnouncement({ ...payloads.createAnnouncement(), status: 'trash' }, payloads.adminAuth); + const [, announcementId, announcementTitle] = await apiUtils.createAnnouncement(payloads.createAnnouncement(), payloads.adminAuth); + await apiUtils.deleteAnnouncement(announcementId,payloads.adminAuth); await admin.updateAnnouncement(announcementTitle, 'restore'); }); test('admin can permanently delete announcement @pro', async () => { - const [, , announcementTitle] = await apiUtils.createAnnouncement({ ...payloads.createAnnouncement(), status: 'trash' }, payloads.adminAuth); + const [, announcementId, announcementTitle] = await apiUtils.createAnnouncement(payloads.createAnnouncement(), payloads.adminAuth); + await apiUtils.deleteAnnouncement(announcementId,payloads.adminAuth); await admin.updateAnnouncement(announcementTitle, 'permanently-delete'); }); diff --git a/tests/pw/utils/apiEndPoints.ts b/tests/pw/utils/apiEndPoints.ts index c370373424..d262b95319 100644 --- a/tests/pw/utils/apiEndPoints.ts +++ b/tests/pw/utils/apiEndPoints.ts @@ -85,6 +85,8 @@ export const endPoints = { updateWithdraw: (withdrawId: string) => `${SERVER_URL}/dokan/v1/withdraw/${withdrawId}`, cancelWithdraw: (withdrawId: string) => `${SERVER_URL}/dokan/v1/withdraw/${withdrawId}`, updateBatchWithdraws: `${SERVER_URL}/dokan/v1/withdraw/batch`, // method: approved, pending, delete, cancelled + getAllWithdrawMethodCharges: `${SERVER_URL}/dokan/v1/withdraw/charges`, + getWithdrawCharge: `${SERVER_URL}/dokan/v1/withdraw/charge`, // store settings getSettings: `${SERVER_URL}/dokan/v1/settings`, diff --git a/tests/pw/utils/dbData.ts b/tests/pw/utils/dbData.ts index 8cfac1a723..5da23db02c 100644 --- a/tests/pw/utils/dbData.ts +++ b/tests/pw/utils/dbData.ts @@ -109,6 +109,24 @@ export const dbData = { }, withdraw_method_name: 'Bksh', withdraw_method_type: 'Phone', + withdraw_charges: { + paypal: { + fixed: '0', + percentage: '0', + }, + bank: { + fixed: '0', + percentage: '0', + }, + skrill: { + fixed: '0', + percentage: '0', + }, + dokan_custom: { + fixed: '0', + percentage: '0', + }, + }, withdraw_limit: '5', withdraw_order_status: { 'wc-completed': 'wc-completed', diff --git a/tests/pw/utils/payloads.ts b/tests/pw/utils/payloads.ts index 1a1284e44c..aa5cdd9ad2 100644 --- a/tests/pw/utils/payloads.ts +++ b/tests/pw/utils/payloads.ts @@ -765,6 +765,11 @@ export const payloads = { method: 'paypal', }, + withdrawCharge: { + method: 'paypal', + amount: '100', + }, + // settings updateSettings: { diff --git a/tests/pw/utils/testData.ts b/tests/pw/utils/testData.ts index 35cdf6491c..d764759b42 100644 --- a/tests/pw/utils/testData.ts +++ b/tests/pw/utils/testData.ts @@ -897,6 +897,7 @@ export const data = { wc: { wcProducts: 'wc/v3/products', + store: 'wc/store' }, }, }, From a882f437171fef79ea306f0f7b1d3b5ea975469d Mon Sep 17 00:00:00 2001 From: Nurul Umbhiya Date: Tue, 28 Nov 2023 20:27:55 +0600 Subject: [PATCH 07/17] =?UTF-8?q?=F0=9F=90=9B=20fix(dokan.php):=20rename?= =?UTF-8?q?=20add=5Fhpos=5Fsupport()=20to=20declare=5Fwoocommerce=5Ffeatur?= =?UTF-8?q?e=5Fcompatibility()=20for=20better=20clarity=20and=20semantics?= =?UTF-8?q?=20=E2=9C=A8=20feat(dokan.php):=20add=20declaration=20of=20comp?= =?UTF-8?q?atibility=20for=20'cart=5Fcheckout=5Fblocks'=20feature=20in=20W?= =?UTF-8?q?ooCommerce=20to=20improve=20compatibility=20with=20newer=20vers?= =?UTF-8?q?ions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dokan.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dokan.php b/dokan.php index 1c0704b39f..120c5713d2 100755 --- a/dokan.php +++ b/dokan.php @@ -111,7 +111,7 @@ private function __construct() { register_activation_hook( __FILE__, [ $this, 'activate' ] ); register_deactivation_hook( __FILE__, [ $this, 'deactivate' ] ); - add_action( 'before_woocommerce_init', [ $this, 'add_hpos_support' ] ); + add_action( 'before_woocommerce_init', [ $this, 'declare_woocommerce_feature_compatibility' ] ); add_action( 'woocommerce_loaded', [ $this, 'init_plugin' ] ); add_action( 'woocommerce_flush_rewrite_rules', [ $this, 'flush_rewrite_rules' ] ); @@ -287,9 +287,10 @@ private function define( $name, $value ) { * * @return void */ - public function add_hpos_support() { + public function declare_woocommerce_feature_compatibility() { if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, false ); } } From 535045a4cc91be5f9b365b98a4c289b520501306 Mon Sep 17 00:00:00 2001 From: Nurul Umbhiya Date: Thu, 30 Nov 2023 08:57:54 +0600 Subject: [PATCH 08/17] =?UTF-8?q?=F0=9F=90=9B=20fix(Hooks.php):=20add=20co?= =?UTF-8?q?ndition=20to=20check=20if=20the=20current=20screen=20is=20the?= =?UTF-8?q?=20order=20admin=20screen=20before=20executing=20the=20admin=5F?= =?UTF-8?q?shop=5Forder=5Fscripts=20function=20to=20prevent=20unnecessary?= =?UTF-8?q?=20execution=20on=20other=20screens,=20fixes=20https://github.c?= =?UTF-8?q?om/getdokan/client-issue/issues/51?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/Order/Admin/Hooks.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/Order/Admin/Hooks.php b/includes/Order/Admin/Hooks.php index da8ca2c0a9..fafaa010d5 100644 --- a/includes/Order/Admin/Hooks.php +++ b/includes/Order/Admin/Hooks.php @@ -211,6 +211,10 @@ public function admin_shop_order_row_classes( $classes, $class, $post_id ) { * @return void */ public function admin_shop_order_scripts() { + $current_screen = get_current_screen(); + if ( $current_screen && OrderUtil::get_order_admin_screen() !== $current_screen->base ) { + return; + } ?>