diff --git a/tests/pw/feature-map/feature-map.yml b/tests/pw/feature-map/feature-map.yml index c5f124377..8a089a562 100644 --- a/tests/pw/feature-map/feature-map.yml +++ b/tests/pw/feature-map/feature-map.yml @@ -455,7 +455,7 @@ features: vendor: vendor can view store settings menu page [lite]: true - vendor can view Shipstation settings menu page: true + vendor can view ShipStation settings menu page: true vendor can view social profile settings menu page: true vendor can view rma settings menu page: true vendor can view store seo settings menu page: true @@ -665,18 +665,28 @@ - page: 'Auction Integration' features: admin: + admin can enable auction integration module: false + admin can disable auction integration module: false + admin can enable auction for newly added vendor: false + admin can disable auction for specific vendor: false admin can add auction product: true + admin can view auctions activity: false + admin can filter auctions activity: false + admin can export auctions activity: false + admin can view auctions winners: false + admin can filter auctions winners: false + admin can export auctions winners: false vendor: vendor can view auction menu page: true + vendor can search auction product: true + vendor can filter auction product by date: false + vendor can reset auction product filter: false + vendor can't bid own product: true vendor can add auction product: true - vendor can edit auction product: true vendor can view auction product: true - vendor can't bid own product: true - vendor can search auction product: true + vendor can duplicate auction product: false vendor can permanently delete auction product: true - vendor can view auction activity page: true - vendor can filter auction activity: true - vendor can search auction activity: true + vendor can edit auction product: true vendor can update auction product title: true vendor can update auction product category (single): true vendor can add auction product category (multiple): true @@ -725,14 +735,22 @@ vendor can import auction product addon: true vendor can export auction product addon: true vendor can remove auction product addon: true - + vendor can view auction activity page: true + vendor can filter auctions activity by date: false + vendor can reset auctions activity filter: false + vendor can search auctions activity (auction): false + vendor can search auctions activity (name): false + vendor can search auctions activity (email): false customer: customer can bid auction product: true + customer can buy auction product after win: false customer can buy auction product with buy it now price: true - page: 'Color Scheme Customizer' features: admin: + admin can enable color scheme customizer module: false + admin can disable color scheme customizer module: false admin can switch predefined color palette: true admin can add custom color palette: true admin can update custom color palette: true @@ -740,6 +758,8 @@ - page: 'Delivery Time' features: admin: + admin can enable delivery time module: false + admin can disable delivery time module: false admin can update delivery time on order details: false vendor: vendor can view delivery time menu page: true @@ -755,11 +775,15 @@ - page: 'Elementor' features: admin: + admin can enable Elementor module: false + admin can disable Elementor module: false no test is written for elementor module (out of scope): false - page: 'EU Compliance Fields' features: admin: + admin can enable eu compliance fields module: false + admin can disable eu compliance fields module: false admin can enable EU compliance fields for vendors: true admin can enable EU compliance fields on vendor registration: true admin can enable EU compliance fields for customers: true @@ -800,6 +824,9 @@ - page: 'Follow Store' features: + admin: + admin can enable follow store module: false + admin can disable follow store module: false vendor: vendor can view followers menu page: true vendor can view followers: true @@ -814,7 +841,9 @@ - page: 'Geolocation' features: admin: - # admin can set Dokan geolocation settings [duplicate]: true + admin can enable geolocation module: false + admin can disable geolocation module: false + # admin can set Dokan geolocation settings [duplicate]: false admin can set map location position (top): true admin can set map location position (left): true admin can set map location position (right): true @@ -849,6 +878,8 @@ - page: 'Live Chat' features: admin: + admin can enable live chat module: false + admin can disable live chat module: false # admin can set Dokan live chat settings [duplicate]: true admin can enable chat button on vendor page: true admin can disable chat button on vendor page: true @@ -864,8 +895,10 @@ - page: 'Live Search' features: - # admin: - # admin can set Dokan live search settings [duplicate]: true + admin: + admin can enable live search module: false + admin can disable live search module: false + # admin can set Dokan live search settings [duplicate]: true customer: customer can search product using live search (suggestion box): true customer can search product with category using live search (suggestion box): true @@ -875,10 +908,15 @@ - page: 'MangoPay' features: admin: + admin can enable Mangopay module: false + admin can disable Mangopay module: false admin can add Mangopay payment method: true - page: 'Min Max Quantities' features: + admin: + admin can enable min max quantities module: false + admin can disable min max quantities module: false vendor: vendor can add product min-max options: true vendor can set min-max settings: true @@ -886,11 +924,15 @@ - page: 'PayPal Marketplace' features: admin: + admin can enable PayPal Marketplace module: false + admin can disable PayPal Marketplace module: false admin can add Paypal Marketplace payment method: true - page: 'Printful' features: - # admin: + admin: + admin can enable Printful module: false + admin can disable Printful module: false # admin can set Dokan Printful settings: true [duplicate]: true vendor: vendor can view printful menu page: true @@ -906,6 +948,9 @@ - page: 'Product Addon' features: + admin: + admin can enable product addon module: false + admin can disable product addon module: false vendor: vendor can view product addons menu page: true vendor can add global product addon: true @@ -924,6 +969,8 @@ - page: 'Product Advertising' features: admin: + admin can enable product advertising module: false + admin can disable product advertising module: false # admin can set Dokan product advertising settings [duplicate]: true admin can set product advertising slot: false admin can set product advertising expiry days: false @@ -955,6 +1002,9 @@ - page: 'Product Enquiry' features: + admin: + admin can enable product enquiry module: false + admin can disable product enquiry module: false customer: customer can enquire product: true guest: @@ -963,6 +1013,8 @@ - page: 'Product Q&A' features: admin: + admin can enable product Q&A module: false + admin can disable product Q&A module: false admin can view product QA menu page: true admin can view product question details: true admin can filter questions by vendor: true @@ -991,6 +1043,9 @@ - page: 'Product Subscription' features: + admin: + admin can enable product subscription module: false + admin can disable product subscription module: false vendor: vendor can view user subscriptions menu page: true vendor can view product subscription details: true @@ -1009,16 +1064,22 @@ - page: 'Rank Math SEO' features: admin: + admin can enable Rank Math SEO module: false + admin can disable Rank Math SEO module: false no test is written for rank math seo module: false - page: 'Razorpay' features: admin: + admin can enable Razorpay module: false + admin can disable Razorpay module: false admin can add Razorpay payment method: true - page: 'Report Abuse' features: admin: + admin can enable report abuse module: false + admin can disable report abuse module: false admin can view abuse reports menu page: true admin can view abuse report details: true admin can filter abuse reports by abuse reason: true @@ -1033,44 +1094,48 @@ - page: 'Request for Quotation' features: + admin: + admin can enable RFQ module: false + admin can disable RFQ module: false quote rules: - admin: - admin can view quote rules menu page: true - admin can add quote rule: true - admin can edit quote rule: true - admin can trash quote rule: true - admin can restore quote rule: true - admin can permanently delete quote rule: true - admin can perform bulk action on quote rules: true - quotes: - admin: - admin can view quotes menu page: true - admin can add quote: true - admin can edit quote: true - admin can trash quote: true - admin can restore quote: true - admin can permanently delete quote: true - admin can approve quote: true - admin can convert quote to order: true - admin can perform quote bulk actions: true - vendor: - vendor can view request quotes menu page: true - vendor can view request quote details: true - vendor can update quote request: true - vendor can approve quote request: true - vendor can convert quote request to order: true - customer: - customer can view request for quote menu page: true - customer can view requested quote page: true - customer can view requested quote details: true - customer can update quote request: true - customer can pay for order converted from quote request: true - customer can quote product: true - guest: - guest customer can quote product: true + admin can view quote rules menu page: true + admin can add quote rule: true + admin can edit quote rule: true + admin can trash quote rule: true + admin can restore quote rule: true + admin can permanently delete quote rule: true + admin can perform bulk action on quote rules: true + quote requests: + admin can view quotes menu page: true + admin can add quote: true + admin can edit quote: true + admin can trash quote: true + admin can restore quote: true + admin can permanently delete quote: true + admin can approve quote: true + admin can convert quote to order: true + admin can perform quote bulk actions: true + vendor: + vendor can view request quotes menu page: true + vendor can view request quote details: true + vendor can update quote request: true + vendor can approve quote request: true + vendor can convert quote request to order: true + customer: + customer can view request for quote menu page: true + customer can view requested quote page: true + customer can view requested quote details: true + customer can update quote request: true + customer can pay for order converted from quote request: true + customer can quote product: true + guest: + guest customer can quote product: true - page: 'Return and Warranty Request' features: + admin: + admin can enable RMA module: false + admin can disable RMA module: false vendor: vendor can view return request menu page: true vendor can view return request details: true @@ -1086,6 +1151,8 @@ - page: 'Seller Badge' features: admin: + admin can enable seller badge module: false + admin can disable seller badge module: false admin can view seller badge menu page: true admin can preview seller badge: true admin can view seller badge details: true @@ -1106,15 +1173,20 @@ - page: 'ShipStation Integration' features: + admin: + admin can enable ShipStation Integration module: false + admin can disable ShipStation Integration module: false vendor: - # vendor can view Shipstation settings menu page: true - vendor can generate shipStation credentials: false - vendor can revoke shipStation credentials: false - vendor can set shipStation settings: true + # vendor can view ShipStation settings menu page: true + vendor can generate ShipStation credentials: true + vendor can revoke ShipStation credentials: true + vendor can set ShipStation settings: true - page: 'Single Product Multiple Vendor (SPMV)' features: admin: + admin can enable SPMV module: false + admin can disable SPMV module: false admin can assign SPMV product to other vendor: true vendor: vendor can view SPMV menu page: true @@ -1135,6 +1207,8 @@ - page: 'Store Reviews' features: admin: + admin can enable store reviews module: false + admin can disable store reviews module: false admin can view store reviews menu page: true admin can view store review: true admin can edit store review: true @@ -1153,6 +1227,8 @@ - page: 'Store Support' features: admin: + admin can enable store support module: false + admin can disable store support module: false admin can view store support menu page: true unread count decrease after admin viewing a support ticket: true admin can view support ticket details: true @@ -1197,16 +1273,22 @@ - page: 'Stripe Connect' features: admin: + admin can enable stripe connect module: false + admin can disable stripe connect module: false admin can add stripe payment method: true - page: 'Stripe Express' features: admin: + admin can enable stripe express module: false + admin can disable stripe express module: false admin can add Strip Express payment method: true - page: 'Table Rate Shipping' features: admin: + admin can enable table rate shipping module: false + admin can disable table rate shipping module: false admin can add vendor table rate shipping method: true admin can add vendor distance rate shipping method: true vendor: @@ -1215,11 +1297,17 @@ - page: 'Vendor Analytics' features: + admin: + admin can enable vendor analytics module: false + admin can disable vendor analytics module: false vendor: vendor can view analytics menu page: true - page: 'Vendor Product Importer and Exporter' features: + admin: + admin can enable product importer and exporter module: false + admin can disable product importer and exporter module: false vendor: vendor can view tools menu page: true vendor can export product as xml: true @@ -1229,6 +1317,9 @@ - page: 'Vendor Staff Manager' features: + admin: + admin can enable vendor staff manager module: false + admin can disable vendor staff manager module: false vendor: vendor can view staff menu page: true vendor can add new staff: true @@ -1241,6 +1332,8 @@ - page: 'Vendor Subscription' features: admin: + admin can enable vendor subscription module: false + admin can disable vendor subscription module: false admin can view subscriptions menu page: true admin can filter subscribed vendors by vendor: true admin can filter subscribed vendors by subscription pack: true @@ -1261,6 +1354,8 @@ - page: 'Vendor Verification' features: admin: + admin can enable vendor verification module: false + admin can disable vendor verification module: false admin can change verified icon: true admin can add vendor verification method: true admin can edit vendor verification method: true @@ -1300,6 +1395,8 @@ - page: 'Wholesale' features: admin: + admin can enable wholesale module: false + admin can disable wholesale module: false admin can view wholesale customers menu page: true admin can search wholesale customer: true admin can disable customer's wholesale capability: true @@ -1322,6 +1419,8 @@ - page: 'WooCommerce Booking Integration' features: admin: + admin can enable woocommerce booking integration module: false + admin can disable woocommerce booking integration module: false admin can add booking product: true vendor: vendor can view booking menu page: true diff --git a/tests/pw/package.json b/tests/pw/package.json index a30b0a7f4..f7b2cc3e4 100644 --- a/tests/pw/package.json +++ b/tests/pw/package.json @@ -13,6 +13,7 @@ "site:reset": "NO_SETUP=false npm run site:setup && npm run env:setup", "site:setup": "npx playwright test --project=local_site_setup --config=e2e.config.ts", "env:setup": "npx playwright test --project=e2e_setup --config=e2e.config.ts", + "auth:setup": "NO_SETUP=true npx playwright test --project=auth_setup --config=e2e.config.ts", "test:api": "npx playwright test --project=api_tests --config=api.config.ts", "test:e2e": "npx playwright test --project=e2e_tests --config=e2e.config.ts", "test:api:pro": "DOKAN_PRO=true npx playwright test --project=api_tests --config=api.config.ts", diff --git a/tests/pw/pages/selectors.ts b/tests/pw/pages/selectors.ts index 3e7dbf3bf..221dbdc57 100644 --- a/tests/pw/pages/selectors.ts +++ b/tests/pw/pages/selectors.ts @@ -6545,7 +6545,18 @@ export const selector = { shipStationText: '.dokan-settings-content h1', visitStore: '//a[normalize-space()="Visit Store"]', - authenticationKey: '//label[normalize-space()="Authentication Key"]/..//code', + generateCredentials: 'button#dokan-shipstation-generate-credentials-btn', + generateSuccessMessage: '//div[@id="swal2-html-container" and normalize-space()="API credentials generated successfully."]', + revokeCredentials: 'button#dokan-shipstation-revoke-credentials-btn', + confirmRevoke: 'button.swal2-confirm', + revokeSuccessMessage: '//div[@id="swal2-html-container" and normalize-space()="API credentials revoked successfully."]', + + credentials: { + authenticationKey: '//label[normalize-space()="Authentication Key"]/..//code', + consumerKey: '//label[normalize-space()="Consumer Key"]/..//code', + consumerSecret: '//label[normalize-space()="Consumer Secret"]/..//code', + }, + selectedStatus: '//label[@for="dokan-shipstation-export-statuses"]/..//li[@class="select2-selection__choice"]', exportOrderStatusesInput: '//label[normalize-space()="Export Order Statuses"]/..//span[@class="select2-selection select2-selection--multiple"]//input[@class="select2-search__field"]', shippedOrderStatusDropdown: '.select2-selection__arrow', @@ -6553,8 +6564,7 @@ export const selector = { result: '.select2-results__option.select2-results__option--highlighted', saveChanges: '#dokan-store-shipstation-form-submit', - saveSuccessMessage: '#swal2-html-container', - successOk: '.swal2-confirm', + saveSuccessMessage: '//div[@id="swal2-html-container" and normalize-space()="Settings saved successfully."]', }, // social profile settings diff --git a/tests/pw/pages/shipstationPage.ts b/tests/pw/pages/shipstationPage.ts new file mode 100644 index 000000000..b6051810f --- /dev/null +++ b/tests/pw/pages/shipstationPage.ts @@ -0,0 +1,35 @@ +import { Page } from '@playwright/test'; +import { VendorPage } from '@pages/vendorPage'; +import { selector } from '@pages/selectors'; +import { data } from '@utils/testData'; + +// selectors +const settingsShipStation = selector.vendor.vShipStationSettings; + +export class ShipStationPage extends VendorPage { + constructor(page: Page) { + super(page); + } + + // generate shipStation credentials + async generateShipStationCredentials() { + await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipStation); + await this.clickAndAcceptAndWaitForResponse(data.subUrls.api.dokan.shipStation, settingsShipStation.generateCredentials, 201); + await this.toBeVisible(settingsShipStation.generateSuccessMessage); + + await this.toBeVisible(settingsShipStation.revokeCredentials); + await this.multipleElementVisible(settingsShipStation.credentials); + } + + // revoke shipStation credentials + async revokeShipStationCredentials() { + await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipStation); + + await this.click(settingsShipStation.revokeCredentials); + await this.clickAndAcceptAndWaitForResponse(data.subUrls.api.dokan.shipStation, settingsShipStation.confirmRevoke); + await this.toBeVisible(settingsShipStation.revokeSuccessMessage); + + await this.toBeVisible(settingsShipStation.generateCredentials); + await this.multipleElementNotVisible(settingsShipStation.credentials); + } +} diff --git a/tests/pw/pages/vendorAuctionsPage.ts b/tests/pw/pages/vendorAuctionsPage.ts index ec9bf05de..3f8ec4d34 100644 --- a/tests/pw/pages/vendorAuctionsPage.ts +++ b/tests/pw/pages/vendorAuctionsPage.ts @@ -235,10 +235,6 @@ export class AuctionsPage extends VendorPage { await this.removeAttribute(auctionProductsVendor.auction.auctionEndDate, 'readonly'); await this.clearAndType(auctionProductsVendor.auction.auctionStartDate, generalOption.startDate); await this.clearAndType(auctionProductsVendor.auction.auctionEndDate, generalOption.endDate); - await this.check(auctionProductsVendor.auction.enableAutomaticRelisting); - await this.clearAndType(auctionProductsVendor.auction.relistIfFailAfterNHours, generalOption.relistIfFailAfterNHours); - await this.clearAndType(auctionProductsVendor.auction.relistIfNotPaidAfterNHours, generalOption.relistIfNotPaidAfterNHours); - await this.clearAndType(auctionProductsVendor.auction.relistAuctionDurationInH, generalOption.relistAuctionDurationInH); await this.saveProduct(); @@ -251,6 +247,18 @@ export class AuctionsPage extends VendorPage { await this.toHaveValue(auctionProductsVendor.auction.buyItNowPrice, buyItNowPrice); await this.toHaveValue(auctionProductsVendor.auction.auctionStartDate, generalOption.startDate); await this.toHaveValue(auctionProductsVendor.auction.auctionEndDate, generalOption.endDate); + } + + // add product Relist option + async addProductRelistingOption(productName: string, generalOption: product['auction']) { + await this.goToAuctionProductEditById(productName); + await this.check(auctionProductsVendor.auction.enableAutomaticRelisting); + await this.clearAndType(auctionProductsVendor.auction.relistIfFailAfterNHours, generalOption.relistIfFailAfterNHours); + await this.clearAndType(auctionProductsVendor.auction.relistIfNotPaidAfterNHours, generalOption.relistIfNotPaidAfterNHours); + await this.clearAndType(auctionProductsVendor.auction.relistAuctionDurationInH, generalOption.relistAuctionDurationInH); + + await this.saveProduct(); + await this.toBeChecked(auctionProductsVendor.auction.enableAutomaticRelisting); await this.toHaveValue(auctionProductsVendor.auction.relistIfFailAfterNHours, generalOption.relistIfFailAfterNHours); await this.toHaveValue(auctionProductsVendor.auction.relistIfNotPaidAfterNHours, generalOption.relistIfNotPaidAfterNHours); diff --git a/tests/pw/pages/vendorSettingsPage.ts b/tests/pw/pages/vendorSettingsPage.ts index 6c08fcedb..35bd30384 100644 --- a/tests/pw/pages/vendorSettingsPage.ts +++ b/tests/pw/pages/vendorSettingsPage.ts @@ -70,9 +70,9 @@ export class VendorSettingsPage extends VendorPage { await this.toBeVisible(settingsVendor.updateSettings); } - // vendor shipstation render properly - async vendorShipstationSettingsRenderProperly() { - await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipstation); + // vendor ShipStation render properly + async vendorShipStationSettingsRenderProperly() { + await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipStation); // shipStation text is visible await this.toBeVisible(settingsShipStation.shipStationText); @@ -80,8 +80,13 @@ export class VendorSettingsPage extends VendorPage { // visit store link is visible await this.toBeVisible(settingsShipStation.visitStore); - // authentication key is visible - await this.toBeVisible(settingsShipStation.authenticationKey); + const isCredentialsGenerated = await this.isVisible(settingsShipStation.revokeCredentials); + + if (isCredentialsGenerated) { + await this.multipleElementVisible(settingsShipStation.credentials); + } else { + await this.toBeVisible(settingsShipStation.generateCredentials); + } // export order statuses is visible await this.toBeVisible(settingsShipStation.exportOrderStatusesInput); @@ -438,26 +443,27 @@ export class VendorSettingsPage extends VendorPage { await this.clearAndType(settingsVendor.minMax.maximumAmountToPlaceAnOrder, minMax.maximumAmount); } - // vendor set Shipstation settings + // vendor set ShipStation settings async setShipStation(shipStation: vendor['shipStation']): Promise { - await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipstation); + await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipStation); + // export order statuses const allStatus = await this.getMultipleElementTexts(settingsShipStation.selectedStatus); - const statusIsSelected = allStatus.includes('×' + shipStation.status); + const statusIsSelected = allStatus.includes(`×${shipStation.status}`); if (!statusIsSelected) { await this.clearAndType(settingsShipStation.exportOrderStatusesInput, shipStation.status); await this.toContainText(settingsShipStation.result, shipStation.status); await this.press(data.key.enter); } - // await this.click(settingsShipStation.shippedOrderStatusDropdown); - // await this.clearAndType(settingsShipStation.shippedOrderStatusInput, shipStation.status);// todo: need to fix -> locator issue - // await this.toContainText(settingsShipStation.result, shipStation.status); - // await this.press(data.key.enter); + // shipped order status + await this.click(settingsShipStation.shippedOrderStatusDropdown); + await this.clearAndType(settingsShipStation.shippedOrderStatusInput, shipStation.status); + await this.toContainText(settingsShipStation.result, shipStation.status); + await this.press(data.key.enter); - await this.clickAndAcceptAndWaitForResponse(data.subUrls.ajax, settingsShipStation.saveChanges); - await this.toContainText(settingsShipStation.saveSuccessMessage, 'Your changes has been updated!'); - await this.click(settingsShipStation.successOk); + await this.clickAndAcceptAndWaitForResponse(data.subUrls.api.dokan.shipStation, settingsShipStation.saveChanges, 201); + await this.toBeVisible(settingsShipStation.saveSuccessMessage); } // vendor set social profile settings diff --git a/tests/pw/pages/vendorShippingPage.ts b/tests/pw/pages/vendorShippingPage.ts index 17bc97a41..6198cf5ce 100644 --- a/tests/pw/pages/vendorShippingPage.ts +++ b/tests/pw/pages/vendorShippingPage.ts @@ -18,7 +18,7 @@ export class VendorShippingPage extends VendorPage { async vendorShippingSettingsRenderProperly() { await this.goIfNotThere(data.subUrls.frontend.vDashboard.settingsShipping); - // shipstation text is visible + // ShipStation text is visible await this.toBeVisible(vendorShipping.shippingSettingsText); // visit store link is visible diff --git a/tests/pw/tests/api/shipstation.spec.ts b/tests/pw/tests/api/shipstation.spec.ts new file mode 100644 index 000000000..f035765a4 --- /dev/null +++ b/tests/pw/tests/api/shipstation.spec.ts @@ -0,0 +1,69 @@ +//COVERAGE_TAG: GET /dokan/v1/shipstation/credentials/(?P[\d]+) +//COVERAGE_TAG: POST /dokan/v1/shipstation/credentials/create +//COVERAGE_TAG: DELETE /dokan/v1/shipstation/credentials/(?P[\d]+) +//COVERAGE_TAG: GET /dokan/v1/shipstation/order-statuses +//COVERAGE_TAG: POST /dokan/v1/shipstation/order-statuses/(?P[\d]+) +//COVERAGE_TAG: DELETE /dokan/v1/shipstation/order-statuses/(?P[\d]+) + +import { test, expect, request } from '@playwright/test'; +import { ApiUtils } from '@utils/apiUtils'; +import { endPoints } from '@utils/apiEndPoints'; +import { payloads } from '@utils/payloads'; +import { schemas } from '@utils/schemas'; + +const { VENDOR_ID } = process.env; + +test.describe('ShipStation api test', () => { + test.skip(true, 'remove after pr is merged'); + let apiUtils: ApiUtils; + + test.beforeAll(async () => { + apiUtils = new ApiUtils(await request.newContext()); + }); + + test.afterAll(async () => { + await apiUtils.dispose(); + }); + + test('create ShipStation credential', { tag: ['@pro'] }, async () => { + const [response, responseBody] = await apiUtils.post(endPoints.createShipStationCredential, { data: { vendor_id: VENDOR_ID } }); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationCredentialSchema); + }); + + test('get ShipStation credential', { tag: ['@pro'] }, async () => { + const [response, responseBody] = await apiUtils.get(endPoints.getShipStationCredential(VENDOR_ID)); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationCredentialSchema); + }); + + test('delete ShipStation credential', { tag: ['@pro'] }, async () => { + const [response, responseBody] = await apiUtils.delete(endPoints.deleteShipStationCredential(VENDOR_ID)); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationCredentialSchema); + }); + + test('create ShipStation order status settings', { tag: ['@pro'] }, async () => { + const [response, responseBody] = await apiUtils.post(endPoints.createShipStationOrderStatusSettings, { data: { ...payloads.shipStationOrderStatusSettings, vendor_id: VENDOR_ID } }); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationOrderStatusSettingSchema); + }); + + test('get ShipStation order status settings', { tag: ['@pro'] }, async () => { + const [response, responseBody] = await apiUtils.get(endPoints.getShipStationOrderStatusSettings(VENDOR_ID)); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationOrderStatusSettingSchema); + }); + + test('delete ShipStation order status settings', { tag: ['@pro'] }, async () => { + const [response, responseBody] = await apiUtils.delete(endPoints.deleteShipStationOrderStatusSettings(VENDOR_ID)); + expect(response.ok()).toBeTruthy(); + expect(responseBody).toBeTruthy(); + expect(responseBody).toMatchSchema(schemas.shipStationSchema.shipStationOrderStatusSettingSchema); + }); +}); diff --git a/tests/pw/tests/e2e/productsDetailsAuction.spec.ts b/tests/pw/tests/e2e/productsDetailsAuction.spec.ts index 4d8a8d119..17e75f50d 100644 --- a/tests/pw/tests/e2e/productsDetailsAuction.spec.ts +++ b/tests/pw/tests/e2e/productsDetailsAuction.spec.ts @@ -184,6 +184,15 @@ test.describe('Auction Product details functionality test', () => { await vendor.addProductGeneralOption(productIdBasic, { ...data.product.auction, itemCondition: 'used', auctionType: 'reverse' }); }); + test('vendor can enable product relist options', { tag: ['@pro', '@vendor'] }, async () => { + await vendor.addProductRelistingOption(productIdBasic, data.product.auction); + }); + + test('vendor can update product relist options', { tag: ['@pro', '@vendor'] }, async () => { + test.skip(true, 'not implemented yet'); + await vendor.addProductRelistingOption(productIdFull, { ...data.product.auction, relistIfFailAfterNHours: '5', relistIfNotPaidAfterNHours: '6', relistAuctionDurationInH: '7' }); + }); + // product inventory options test('vendor can add auction product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { diff --git a/tests/pw/tests/e2e/shipstation.spec.ts b/tests/pw/tests/e2e/shipstation.spec.ts new file mode 100644 index 000000000..32d3bc57b --- /dev/null +++ b/tests/pw/tests/e2e/shipstation.spec.ts @@ -0,0 +1,29 @@ +import { test, Page } from '@playwright/test'; +import { ShipStationPage } from '@pages/shipStationPage'; +import { data } from '@utils/testData'; + +test.describe('ShipStation test', () => { + test.skip(true, 'remove after pr is merged'); + let vendor: ShipStationPage; + let vPage: Page; + + test.beforeAll(async ({ browser }) => { + const vendorContext = await browser.newContext(data.auth.vendorAuth); + vPage = await vendorContext.newPage(); + vendor = new ShipStationPage(vPage); + }); + + test.afterAll(async () => { + await vPage.close(); + }); + + // vendor + + test('vendor can generate ShipStation credentials', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { + await vendor.generateShipStationCredentials(); + }); + + test('vendor can revoke ShipStation credentials', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { + await vendor.revokeShipStationCredentials(); + }); +}); diff --git a/tests/pw/tests/e2e/vendorSettings.spec.ts b/tests/pw/tests/e2e/vendorSettings.spec.ts index 0dec1a08f..bbde7ca5e 100644 --- a/tests/pw/tests/e2e/vendorSettings.spec.ts +++ b/tests/pw/tests/e2e/vendorSettings.spec.ts @@ -34,8 +34,8 @@ test.describe('Vendor settings test', () => { await vendor.vendorStoreSettingsRenderProperly(); }); - test('vendor can view Shipstation settings menu page', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { - await vendor.vendorShipstationSettingsRenderProperly(); + test('vendor can view ShipStation settings menu page', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { + await vendor.vendorShipStationSettingsRenderProperly(); }); test('vendor can view social profile settings menu page', { tag: ['@pro', '@exploratory', '@vendor'] }, async () => { @@ -113,11 +113,12 @@ test.describe('Vendor settings test', () => { test('vendor can set min-max settings', { tag: ['@pro', '@vendor'] }, async () => { await vendor.setStoreSettings(data.vendor.vendorInfo, 'min-max'); + // disable min-max await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { enable_min_max_quantity: 'off', enable_min_max_amount: 'off' }); }); - test('vendor can set shipStation settings', { tag: ['@pro', '@vendor'] }, async () => { + test('vendor can set ShipStation settings', { tag: ['@pro', '@vendor'] }, async () => { await vendor.setShipStation(data.vendor.shipStation); }); diff --git a/tests/pw/utils/apiEndPoints.ts b/tests/pw/utils/apiEndPoints.ts index e3b962ca1..a6b8f444d 100644 --- a/tests/pw/utils/apiEndPoints.ts +++ b/tests/pw/utils/apiEndPoints.ts @@ -365,7 +365,7 @@ export const endPoints = { updateVerificationRequest: (requestId: string) => `${SERVER_URL}/dokan/v1/verification-requests/${requestId}`, deleteVerificationRequest: (requestId: string) => `${SERVER_URL}/dokan/v1/verification-requests/${requestId}`, - //commission + // commission getCommission: `${SERVER_URL}/dokan/v1/commission`, // shipping status @@ -375,6 +375,14 @@ export const endPoints = { getSingleShipment: (orderId: string, shipmentId: string) => `${SERVER_URL}/dokan/v1/shipping-status/orders/${orderId}/shipment/${shipmentId}`, updateShipment: (orderId: string, shipmentId: string) => `${SERVER_URL}/dokan/v1/shipping-status/orders/${orderId}/shipment/${shipmentId}`, + // ShipStation + getShipStationCredential: (vendorId: string) => `${SERVER_URL}/dokan/v1/shipstation/credentials/${vendorId}`, + createShipStationCredential: `${SERVER_URL}/dokan/v1/shipstation/credentials/create`, + deleteShipStationCredential: (vendorId: string) => `${SERVER_URL}/dokan/v1/shipstation/credentials/${vendorId}`, + getShipStationOrderStatusSettings: (vendorId: string) => `${SERVER_URL}/dokan/v1/shipstation/order-statuses/${vendorId}`, + createShipStationOrderStatusSettings: `${SERVER_URL}/dokan/v1/shipstation/order-statuses`, + deleteShipStationOrderStatusSettings: (vendorId: string) => `${SERVER_URL}/dokan/v1/shipstation/order-statuses/${vendorId}`, + wc: { // coupons getAllCoupons: `${SERVER_URL}/wc/v3/coupons`, diff --git a/tests/pw/utils/apiUtils.ts b/tests/pw/utils/apiUtils.ts index fc05a15b2..84d3e99fe 100644 --- a/tests/pw/utils/apiUtils.ts +++ b/tests/pw/utils/apiUtils.ts @@ -1533,6 +1533,30 @@ export class ApiUtils { return [responseBody, orderId, shipmentId]; } + /** + * ShipStation api methods + */ + + async createShipStationCredential(vendorId: string, auth?: auth): Promise { + const [, responseBody] = await this.post(endPoints.createShipStationCredential, { data: { vendor_id: vendorId }, headers: auth }); + return responseBody; + } + + async deleteShipStationCredential(vendorId: string, auth?: auth): Promise { + const [, responseBody] = await this.delete(endPoints.deleteShipStationCredential(vendorId), { headers: auth }); + return responseBody; + } + + async createShipStationOrderStatusSettings(payload: object, auth?: auth): Promise { + const [, responseBody] = await this.post(endPoints.createShipStationOrderStatusSettings, { data: payload, headers: auth }); + return responseBody; + } + + async deleteShipStationOrderStatusSettings(vendorId: string, auth?: auth): Promise { + const [, responseBody] = await this.delete(endPoints.deleteShipStationOrderStatusSettings(vendorId), { headers: auth }); + return responseBody; + } + /** * wp api methods */ diff --git a/tests/pw/utils/payloads.ts b/tests/pw/utils/payloads.ts index 7c0e52e8d..4016105b5 100644 --- a/tests/pw/utils/payloads.ts +++ b/tests/pw/utils/payloads.ts @@ -3575,7 +3575,7 @@ export const payloads = { reportAbuse: 'report_abuse', rma: 'rma', sellerVacation: 'seller_vacation', - shipstation: 'shipstation', + shipStation: 'shipstation', auction: 'auction', spmv: 'spmv', storeReviews: 'store_reviews', @@ -4872,6 +4872,18 @@ export const payloads = { }, ], + // ShipStation + + createCredential: { + vendor_id: '', + }, + + shipStationOrderStatusSettings: { + vendor_id: '', + export_statuses: ['wc-pending', 'wc-processing', 'wc-on-hold', 'wc-completed', 'wc-cancelled'], + shipped_status: 'wc-completed', + }, + // shortcodes // dokan dashboard shortcode diff --git a/tests/pw/utils/schemas.ts b/tests/pw/utils/schemas.ts index 9ec47f474..6af4cee46 100644 --- a/tests/pw/utils/schemas.ts +++ b/tests/pw/utils/schemas.ts @@ -2954,4 +2954,19 @@ export const schemas = { shipmentSchema: shipmentSchema, shipmentsSchema: z.array(shipmentSchema), }, + + // ShipStation schema + shipStationSchema: { + shipStationCredentialSchema: z.object({ + key_id: z.string().or(z.number()), + consumer_key: z.string(), + consumer_secret: z.string(), + }), + + shipStationOrderStatusSettingSchema: z.object({ + vendor_id: z.string().or(z.number()), + export_statuses: z.array(z.string()), + shipped_status: z.string(), + }), + }, }; diff --git a/tests/pw/utils/testData.ts b/tests/pw/utils/testData.ts index 4b22809c0..a66f123b0 100644 --- a/tests/pw/utils/testData.ts +++ b/tests/pw/utils/testData.ts @@ -1204,7 +1204,7 @@ export const data = { settingsVerification: 'dashboard/settings/verification', settingsDeliveryTime: 'dashboard/settings/delivery-time', settingsShipping: 'dashboard/settings/shipping', - settingsShipstation: 'dashboard/settings/shipstation', + settingsShipStation: 'dashboard/settings/shipstation', settingsSocialProfile: 'dashboard/settings/social', settingsRma: 'dashboard/settings/rma', settingsSeo: 'dashboard/settings/seo', @@ -1246,6 +1246,7 @@ export const data = { productQuestionsBulkActions: 'dokan/v1/product-questions/bulk_action', productAnswers: 'dokan/v1/product-answers', subscriptions: 'dokan/v1/subscription', + shipStation: 'dokan/v1/shipstation', verifications: 'dokan/v1/verification-requests', verificationMethods: 'dokan/v1/verification-methods', },