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' }, }, },