diff --git a/tests/pw/pages/adminPage.ts b/tests/pw/pages/adminPage.ts index 3d87eaa723..a75896e03a 100644 --- a/tests/pw/pages/adminPage.ts +++ b/tests/pw/pages/adminPage.ts @@ -143,30 +143,4 @@ export class AdminPage extends BasePage { await this.click(selector.admin.dokan.dokanSetupWizard.visitDokanDashboard); await this.toBeVisible(selector.admin.dokan.dashboard.dashboardText); } - - // dokan notice & promotion - - // dokan notice - async dokanPromotion() { - await this.goto(data.subUrls.backend.dokan.dokan); - // dokan promotion elements are visible - const isPromotionVisible = await this.isVisible(selector.admin.dokan.promotion.promotion); - if (isPromotionVisible) { - await this.multipleElementVisible(selector.admin.dokan.promotion); - } else { - console.log('No promotion is ongoing'); - } - } - - // dokan notice - async dokanNotice() { - await this.goto(data.subUrls.backend.dokan.dokan); - - // dokan notice elements are visible - const isPromotionVisible = await this.isVisible(selector.admin.dokan.promotion.promotion); - isPromotionVisible ? await this.notToHaveCount(selector.admin.dokan.notice.noticeDiv1, 0) : await this.notToHaveCount(selector.admin.dokan.notice.noticeDiv, 0); - await this.notToHaveCount(selector.admin.dokan.notice.slider, 0); - await this.notToHaveCount(selector.admin.dokan.notice.sliderPrev, 0); - await this.notToHaveCount(selector.admin.dokan.notice.sliderNext, 0); - } } diff --git a/tests/pw/pages/loginPage.ts b/tests/pw/pages/loginPage.ts index 2c54f3a6c1..e45185c6c2 100644 --- a/tests/pw/pages/loginPage.ts +++ b/tests/pw/pages/loginPage.ts @@ -77,6 +77,7 @@ export class LoginPage extends BasePage { // admin logout async logoutBackend(): Promise { + await this.goIfNotThere(data.subUrls.backend.adminLogin); await this.hover(selector.backend.userMenu); await this.clickAndWaitForResponseAndLoadState(data.subUrls.backend.adminLogout, selector.backend.logout, 302); const loggedInUser = await this.getCurrentUser(); diff --git a/tests/pw/pages/proPromoPage.ts b/tests/pw/pages/noticeAndPromotionPage.ts similarity index 56% rename from tests/pw/pages/proPromoPage.ts rename to tests/pw/pages/noticeAndPromotionPage.ts index 5763f97741..4910fb9ea4 100644 --- a/tests/pw/pages/proPromoPage.ts +++ b/tests/pw/pages/noticeAndPromotionPage.ts @@ -3,13 +3,39 @@ import { AdminPage } from '@pages/adminPage'; import { selector } from '@pages/selectors'; import { data } from '@utils/testData'; -export class ProPromoPage extends AdminPage { +export class NoticeAndPromotionPage extends AdminPage { constructor(page: Page) { super(page); } - // dokan pro promo - async dokanProPromo() { + // dokan notice & promotion + + // dokan notice + async dokanNoticeRenderProperly() { + await this.goto(data.subUrls.backend.dokan.dokan); + + // dokan notice elements are visible + const isPromotionVisible = await this.isVisible(selector.admin.dokan.promotion.promotion); + isPromotionVisible ? await this.notToHaveCount(selector.admin.dokan.notice.noticeDiv1, 0) : await this.notToHaveCount(selector.admin.dokan.notice.noticeDiv, 0); + await this.notToHaveCount(selector.admin.dokan.notice.slider, 0); + await this.notToHaveCount(selector.admin.dokan.notice.sliderPrev, 0); + await this.notToHaveCount(selector.admin.dokan.notice.sliderNext, 0); + } + + // dokan promotion + async dokanPromotionRenderProperly() { + await this.goto(data.subUrls.backend.dokan.dokan); + // dokan promotion elements are visible + const isPromotionVisible = await this.isVisible(selector.admin.dokan.promotion.promotion); + if (isPromotionVisible) { + await this.multipleElementVisible(selector.admin.dokan.promotion); + } else { + console.log('No promotion is ongoing'); + } + } + + // dokan pro promotion + async dokanProPromotionRenderProperly() { // dokan promo banner await this.goIfNotThere(data.subUrls.backend.dokan.dokan); diff --git a/tests/pw/pages/shippingPage.ts b/tests/pw/pages/shippingPage.ts index d0817620d2..56d2c6591a 100644 --- a/tests/pw/pages/shippingPage.ts +++ b/tests/pw/pages/shippingPage.ts @@ -5,7 +5,7 @@ import { data } from '@utils/testData'; import { helpers } from '@utils/helpers'; // import { shipping } from '@utils/interfaces'; -export class shippingPage extends AdminPage { +export class ShippingPage extends AdminPage { constructor(page: Page) { super(page); } diff --git a/tests/pw/tests/e2e/admin.spec.ts b/tests/pw/tests/e2e/admin.spec.ts index 76ddd22d9b..ee05f947b9 100644 --- a/tests/pw/tests/e2e/admin.spec.ts +++ b/tests/pw/tests/e2e/admin.spec.ts @@ -1,95 +1,70 @@ import { test, Page } from '@playwright/test'; import { LoginPage } from '@pages/loginPage'; import { AdminPage } from '@pages/adminPage'; -// import { ApiUtils } from '@utils/apiUtils'; +import { TaxPage } from '@pages/taxPage'; +import { ShippingPage } from '@pages/shippingPage'; import { data } from '@utils/testData'; -// import { payloads } from '@utils/payloads'; - -test.describe('Admin user functionality test', () => { - test.use(data.auth.noAuth); - - let loginPage: LoginPage; - let page: Page; - - test.beforeAll(async ({ browser }) => { - const context = await browser.newContext(); - page = await context.newPage(); - loginPage = new LoginPage(page); - }); - - test.afterAll(async () => { - await page.close(); - }); - - test('admin can login @lite @a', async () => { - await loginPage.adminLogin(data.admin); - }); - - test('admin can logout @lite @a', async () => { - await loginPage.adminLogin(data.admin); - await loginPage.logoutBackend(); - }); -}); test.describe('Admin functionality test', () => { let adminPage: AdminPage; + let taxPage: TaxPage; + let shippingPage: ShippingPage; let aPage: Page; test.beforeAll(async ({ browser }) => { const adminContext = await browser.newContext(data.auth.adminAuth); aPage = await adminContext.newPage(); adminPage = new AdminPage(aPage); + taxPage = new TaxPage(aPage); + shippingPage = new ShippingPage(aPage); }); test.afterAll(async () => { await aPage.close(); }); - // test('admin can add categories @lite', async ( ) => { - // await adminPage.addCategory(data.product.category.randomCategory()); - // }); + test('admin can login @lite @a', async ({ page }) => { + const loginPage = new LoginPage(page); + await loginPage.adminLogin(data.admin); + }); - // test('admin can add attributes @lite', async ( ) => { - // await adminPage.addAttributes(data.product.attribute.randomAttribute()); - // }); + test('admin can logout @lite @a', async ({ page }) => { + const loginPage = new LoginPage(page); + await loginPage.adminLogin(data.admin); + await loginPage.logoutBackend(); + }); // settings // tax settings - // test('admin can set standard tax rate', async ( ) => { - // await adminPage.addStandardTaxRate(data.tax) - // }) - // shipping settings - // test('admin can set flat rate shipping', async ( ) => { - // await adminPage.addShippingMethod(data.shipping.shippingMethods.flatRate); - // }); + test('admin can set standard tax rate @lite @a', async () => { + await taxPage.addStandardTaxRate(data.tax); + }); - // test('admin can set free shipping', async ( ) => { - // await adminPage.addShippingMethod(data.shipping.shippingMethods.freeShipping) - // }) + // shipping settings - // test('admin can set local pickup shipping', async ( ) => { - // await adminPage.addShippingMethod(data.shipping.shippingMethods.localPickup) - // }) + test.skip('admin can set flat rate shipping @lite @a', async () => { + await shippingPage.addShippingMethod(data.shipping.shippingMethods.flatRate); + }); - // test('admin can set table rate shipping', async ( ) => { - // await adminPage.addShippingMethod(data.shipping.shippingMethods.tableRateShipping) - // }) + test.skip('admin can set free shipping @lite @a', async () => { + await shippingPage.addShippingMethod(data.shipping.shippingMethods.freeShipping); + }); - // test('admin can set distance rate shipping', async ( ) => { - // await adminPage.addShippingMethod(data.shipping.shippingMethods.distanceRateShipping) - // }) + test.skip('admin can set local pickup shipping @lite @a', async () => { + await shippingPage.addShippingMethod(data.shipping.shippingMethods.localPickup); + }); - // test('admin can set vendor shipping', async ( ) => { - // await adminPage.addShippingMethod(data.shipping.shippingMethods.vendorShipping) - // }) + test.skip('admin can set table rate shipping @pro @a', async () => { + await shippingPage.addShippingMethod(data.shipping.shippingMethods.tableRateShipping); + }); - test('dokan notice @lite @a', async () => { - await adminPage.dokanNotice(); + test.skip('admin can set distance rate shipping @pro @a', async () => { + await shippingPage.addShippingMethod(data.shipping.shippingMethods.distanceRateShipping); }); - test('dokan promotion @lite @a', async () => { - await adminPage.dokanPromotion(); + test.skip('admin can set vendor shipping @pro @a', async () => { + await shippingPage.addShippingMethod(data.shipping.shippingMethods.vendorShipping); }); }); diff --git a/tests/pw/tests/e2e/noticeAndPromotion.spec.ts b/tests/pw/tests/e2e/noticeAndPromotion.spec.ts new file mode 100644 index 0000000000..e2b4fa4ae5 --- /dev/null +++ b/tests/pw/tests/e2e/noticeAndPromotion.spec.ts @@ -0,0 +1,30 @@ +import { test, Page } from '@playwright/test'; +import { NoticeAndPromotionPage } from '@pages/noticeAndPromotionPage'; +import { data } from '@utils/testData'; + +test.describe('Dokan pro feature promo test', () => { + let admin: NoticeAndPromotionPage; + let aPage: Page; + + test.beforeAll(async ({ browser }) => { + const adminContext = await browser.newContext(data.auth.adminAuth); + aPage = await adminContext.newPage(); + admin = new NoticeAndPromotionPage(aPage); + }); + + test.afterAll(async () => { + await aPage.close(); + }); + + test('dokan notice is rendering properly @lite @exp @a', async () => { + await admin.dokanNoticeRenderProperly(); + }); + + test('dokan promotion is rendering properly @lite @exp @a', async () => { + await admin.dokanPromotionRenderProperly(); + }); + + test('dokan pro features promotions are rendering properly @liteOnly @exp @a', async () => { + await admin.dokanProPromotionRenderProperly(); + }); +}); diff --git a/tests/pw/tests/e2e/proPromo.spec.ts b/tests/pw/tests/e2e/proPromo.spec.ts deleted file mode 100644 index 1149da1326..0000000000 --- a/tests/pw/tests/e2e/proPromo.spec.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { test, request, Page } from '@playwright/test'; -import { ProPromoPage } from '@pages/proPromoPage'; -import { ApiUtils } from '@utils/apiUtils'; -import { data } from '@utils/testData'; -// import { payloads } from '@utils/payloads'; - -test.describe('Dokan pro feature promo test', () => { - let admin: ProPromoPage; - let aPage: Page; - let apiUtils: ApiUtils; - - test.beforeAll(async ({ browser }) => { - const adminContext = await browser.newContext(data.auth.adminAuth); - aPage = await adminContext.newPage(); - admin = new ProPromoPage(aPage); - - apiUtils = new ApiUtils(await request.newContext()); - }); - - test.afterAll(async () => { - await aPage.close(); - await apiUtils.dispose(); - }); - - test('dokan pro features promo @liteOnly @a', async () => { - // await apiUtils.updatePlugin('dokan-pro/dokan-pro', { status:'inactive' }, payloads.adminAuth); - await admin.dokanProPromo(); - // await apiUtils.updatePlugin('dokan-pro/dokan-pro', { status:'active' }, payloads.adminAuth); - }); -}); diff --git a/tests/pw/tests/e2e/productAddons.spec.ts b/tests/pw/tests/e2e/productAddons.spec.ts index 9fae12df14..b11b964e54 100644 --- a/tests/pw/tests/e2e/productAddons.spec.ts +++ b/tests/pw/tests/e2e/productAddons.spec.ts @@ -10,7 +10,6 @@ const { VENDOR_ID } = process.env; test.describe('Product addon functionality test', () => { let vendor: ProductAddonsPage; let vPage: Page; - let addonId: string; let addonName: string; let addonFieldTitle: string; let apiUtils: ApiUtils; @@ -28,7 +27,7 @@ test.describe('Product addon functionality test', () => { vendor = new ProductAddonsPage(vPage); apiUtils = new ApiUtils(await request.newContext()); - [addonId, addonName, addonFieldTitle] = await createVendorProductAddon(); + [, addonName, addonFieldTitle] = await createVendorProductAddon(); }); test.afterAll(async () => { diff --git a/tests/pw/tests/e2e/productAdvertising.spec.ts b/tests/pw/tests/e2e/productAdvertising.spec.ts index 05cc8a2ea9..cf0c01ccf4 100644 --- a/tests/pw/tests/e2e/productAdvertising.spec.ts +++ b/tests/pw/tests/e2e/productAdvertising.spec.ts @@ -11,6 +11,7 @@ test.describe('Product Advertising test', () => { let aPage: Page, vPage: Page; let apiUtils: ApiUtils; let productName: string; + let advertisedProduct: string; test.beforeAll(async ({ browser }) => { const adminContext = await browser.newContext(data.auth.adminAuth); @@ -23,7 +24,7 @@ test.describe('Product Advertising test', () => { apiUtils = new ApiUtils(await request.newContext()); [, , productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); - await apiUtils.createProductAdvertisement(payloads.createProduct(), payloads.vendorAuth); + [, , advertisedProduct] = await apiUtils.createProductAdvertisement(payloads.createProduct(), payloads.vendorAuth); }); test.afterAll(async () => { @@ -32,6 +33,8 @@ test.describe('Product Advertising test', () => { await apiUtils.dispose(); }); + //admin + test('dokan product advertising menu page is rendering properly @pro @exp', async () => { await admin.adminProductAdvertisingRenderProperly(); }); @@ -41,7 +44,7 @@ test.describe('Product Advertising test', () => { }); test('admin can search advertised product @pro @a', async () => { - await admin.searchAdvertisedProduct(productName); + await admin.searchAdvertisedProduct(advertisedProduct); }); test('admin can filter advertised product by stores @pro @a', async () => { @@ -57,28 +60,33 @@ test.describe('Product Advertising test', () => { }); test('admin can delete advertised product @pro @a', async () => { - await admin.updateAdvertisedProduct(productName, 'delete'); + const [, , advertisedProduct] = await apiUtils.createProductAdvertisement(payloads.createProduct(), payloads.vendorAuth); + await admin.updateAdvertisedProduct(advertisedProduct, 'delete'); }); - test('admin can perform product advertising bulk action @pro @a', async () => { - // await apiUtils.createProductAdvertisement(payloads.createProduct(), payloads.vendorAuth); + test.skip('admin can perform product advertising bulk action @pro @a', async () => { + // todo: might cause other tests to fail in parallel await admin.productAdvertisingBulkAction('delete'); }); + // vendor + test('vendor can buy product advertising @pro @v', async () => { //todo: p1_v1 status gets pending review; need to resolve - [, , productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); + const [, , productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); const orderId = await vendor.buyProductAdvertising(productName); await apiUtils.updateOrderStatus(orderId, 'wc-completed', payloads.adminAuth); }); - // test('vendor can buy booking product advertising @pro @v', async ( ) => { // todo: - // const orderId = await vendor.buyProductAdvertising(data.productAdvertisement.advertisedProduct); - // await apiUtils.updateOrderStatus(orderId, 'wc-completed', payloads.adminAuth); - // }); + test.skip('vendor can buy booking product advertising @pro @v', async () => { + // todo: create booking product via api + const orderId = await vendor.buyProductAdvertising(data.productAdvertisement.advertisedProduct); + await apiUtils.updateOrderStatus(orderId, 'wc-completed', payloads.adminAuth); + }); - // test('vendor can buy auction product advertising @pro @v', async ( ) => { // todo: - // const orderId = await vendor.buyProductAdvertising(data.productAdvertisement.advertisedProduct); - // await apiUtils.updateOrderStatus(orderId, 'wc-completed', payloads.adminAuth); - // }); + test.skip('vendor can buy auction product advertising @pro @v', async () => { + // todo: create auction product via api + const orderId = await vendor.buyProductAdvertising(data.productAdvertisement.advertisedProduct); + await apiUtils.updateOrderStatus(orderId, 'wc-completed', payloads.adminAuth); + }); }); diff --git a/tests/pw/tests/e2e/productEnquiry.spec.ts b/tests/pw/tests/e2e/productEnquiry.spec.ts index 5d0f0d3aa5..73cfaaddbc 100644 --- a/tests/pw/tests/e2e/productEnquiry.spec.ts +++ b/tests/pw/tests/e2e/productEnquiry.spec.ts @@ -4,14 +4,14 @@ import { ApiUtils } from '@utils/apiUtils'; import { dbUtils } from '@utils/dbUtils'; import { data } from '@utils/testData'; import { dbData } from '@utils/dbData'; -import { payloads } from '@utils/payloads'; +// import { payloads } from '@utils/payloads'; -const { VENDOR_ID, CUSTOMER_ID } = process.env; +const { VENDOR_ID, CUSTOMER_ID, PRODUCT_ID } = process.env; test.describe('Product Enquiry test', () => { let customer: ProductEnquiryPage; let guest: ProductEnquiryPage; - let cPage: Page, gPage: Page; + let cPage: Page; let apiUtils: ApiUtils; test.beforeAll(async ({ browser }) => { @@ -19,18 +19,13 @@ test.describe('Product Enquiry test', () => { cPage = await customerContext.newPage(); customer = new ProductEnquiryPage(cPage); - const guestContext = await browser.newContext(data.auth.noAuth); - gPage = await guestContext.newPage(); - guest = new ProductEnquiryPage(gPage); - apiUtils = new ApiUtils(await request.newContext()); - const productId = await apiUtils.getProductId(data.predefined.simpleProduct.product1.name, payloads.vendorAuth); - await dbUtils.createAbuseReport(dbData.dokan.createAbuseReport, productId, VENDOR_ID, CUSTOMER_ID); + // const productId = await apiUtils.getProductId(data.predefined.simpleProduct.product1.name, payloads.vendorAuth); //todo: might not needed + await dbUtils.createAbuseReport(dbData.dokan.createAbuseReport, PRODUCT_ID, VENDOR_ID, CUSTOMER_ID); }); test.afterAll(async () => { await cPage.close(); - await gPage.close(); await apiUtils.dispose(); }); @@ -38,7 +33,8 @@ test.describe('Product Enquiry test', () => { await customer.enquireProduct(data.predefined.simpleProduct.product1.name, data.product.enquiry); }); - test('guest customer can enquire product @pro @g', async () => { + test('guest customer can enquire product @pro @g', async ({ page }) => { + guest = new ProductEnquiryPage(page); await guest.enquireProduct(data.predefined.simpleProduct.product1.name, data.product.enquiry); }); }); diff --git a/tests/pw/tests/e2e/productQA.spec.ts b/tests/pw/tests/e2e/productQA.spec.ts index f2444443dd..fb715b7bb6 100644 --- a/tests/pw/tests/e2e/productQA.spec.ts +++ b/tests/pw/tests/e2e/productQA.spec.ts @@ -12,7 +12,7 @@ test.describe('Product QA functionality test', () => { let vendor: ProductQAPage; let customer: ProductQAPage; let guest: ProductQAPage; - let aPage: Page, vPage: Page, cPage: Page, gPage: Page; + let aPage: Page, vPage: Page, cPage: Page; let apiUtils: ApiUtils; let questionId: string; let answerId: string; @@ -22,17 +22,13 @@ test.describe('Product QA functionality test', () => { aPage = await adminContext.newPage(); admin = new ProductQAPage(aPage); - // const vendorContext = await browser.newContext(data.auth.vendorAuth); - // vPage = await vendorContext.newPage(); - // vendor = new ProductQAPage(vPage); + const vendorContext = await browser.newContext(data.auth.vendorAuth); + vPage = await vendorContext.newPage(); + vendor = new ProductQAPage(vPage); - // const customerContext = await browser.newContext(data.auth.customerAuth); - // cPage = await customerContext.newPage(); - // customer = new ProductQAPage(cPage); - - // const guestContext = await browser.newContext(data.auth.noAuth); - // gPage = await guestContext.newPage(); - // guest = new ProductQAPage(gPage); + const customerContext = await browser.newContext(data.auth.customerAuth); + cPage = await customerContext.newPage(); + customer = new ProductQAPage(cPage); apiUtils = new ApiUtils(await request.newContext()); [, questionId] = await apiUtils.createProductQuestion({ ...payloads.createProductQuestion(), product_id: PRODUCT_ID }, payloads.customerAuth); @@ -41,9 +37,8 @@ test.describe('Product QA functionality test', () => { test.afterAll(async () => { await aPage.close(); - // await vPage.close(); - // await cPage.close(); - // await gPage.close(); + await vPage.close(); + await cPage.close(); await apiUtils.dispose(); }); @@ -60,9 +55,9 @@ test.describe('Product QA functionality test', () => { // todo: admin receive notification for new question - // test('unread count decrease after admin viewing a question @pro', async () => { - // await admin.decreaseUnreadQuestionCount(); - // }); + test.skip('unread count decrease after admin viewing a question @pro', async () => { + await admin.decreaseUnreadQuestionCount(); + }); test('admin can filter questions by vendor @pro @a', async () => { await admin.filterQuestions(data.questionAnswers.filter.byVendor, 'by-vendor'); @@ -120,9 +115,9 @@ test.describe('Product QA functionality test', () => { // todo: vendor receive notification for new question - // test('unread count decrease after admin viewing a question @pro @a', async () => { - // await admin.decreaseUnreadQuestionCount(); - // }); + test.skip('unread count decrease after vendor viewing a question @pro @a', async () => { + await admin.decreaseUnreadQuestionCount(); + }); test('vendor can filter questions @pro @v', async () => { await vendor.vendorFilterQuestions(data.predefined.simpleProduct.product1.name); @@ -157,7 +152,8 @@ test.describe('Product QA functionality test', () => { // guest - test('guest customer need to sign-in/signup post question @pro @g', async () => { + test('guest customer need to sign-in/signup post question @pro @g', async ({ page }) => { + guest = new ProductQAPage(page); await guest.postQuestion(data.predefined.simpleProduct.product1.name, data.questionAnswers); }); }); diff --git a/tests/pw/tests/e2e/productReviews.spec.ts b/tests/pw/tests/e2e/productReviews.spec.ts index eac6e3889c..4da88e9dac 100644 --- a/tests/pw/tests/e2e/productReviews.spec.ts +++ b/tests/pw/tests/e2e/productReviews.spec.ts @@ -35,6 +35,7 @@ test.describe('Product Reviews test', () => { }); test('vendor can unApprove product review @pro @v', async () => { + const [, , reviewMessage] = await apiUtils.createProductReview(PRODUCT_ID, payloads.createProductReview(), payloads.vendorAuth); await vendor.updateProductReview('unApprove', reviewMessage); }); @@ -63,7 +64,8 @@ test.describe('Product Reviews test', () => { await vendor.updateProductReview('permanently-delete', reviewMessage); }); - test('vendor can perform product reviews bulk action @pro @v', async () => { + test.skip('vendor can perform product reviews bulk action @pro @v', async () => { + // todo: might cause other tests to fail in parallel await vendor.productReviewsBulkActions('hold'); }); }); diff --git a/tests/pw/tests/e2e/products.spec.ts b/tests/pw/tests/e2e/products.spec.ts index a792f146a6..da1e23df22 100644 --- a/tests/pw/tests/e2e/products.spec.ts +++ b/tests/pw/tests/e2e/products.spec.ts @@ -30,6 +30,8 @@ test.describe('Product functionality test', () => { await apiUtils.dispose(); }); + //admin + test('admin can add product category @lite @a', async () => { await admin.addCategory(data.product.category.randomCategory()); }); @@ -42,17 +44,17 @@ test.describe('Product functionality test', () => { await admin.addSimpleProduct(data.product.simple); }); - // test('admin can add variable product @pro @a', async ( ) => { - // await admin.addVariableProduct(data.product.variable); - // }); + test.skip('admin can add variable product @pro @a', async () => { + await admin.addVariableProduct(data.product.variable); + }); - test('admin can add simple subscription @pro @a', async () => { + test('admin can add simple subscription product @pro @a', async () => { await admin.addSimpleSubscription(data.product.simpleSubscription); }); - // test('admin can add variable subscription @pro @a', async ( ) => { - // await admin.addVariableSubscription(data.product.variableSubscription); - // }); + test.skip('admin can add variable subscription product @pro @a', async () => { + await admin.addVariableSubscription(data.product.variableSubscription); + }); test('admin can add external product @lite @a', async () => { await admin.addExternalProduct(data.product.external); @@ -131,7 +133,7 @@ test.describe('Product functionality test', () => { }); test('vendor can view product @lite @v', async () => { - await vendor.viewProduct(data.predefined.simpleProduct.product1.name); + await vendor.viewProduct(productName); }); test("vendor can't buy own product @pro @v", async () => { @@ -150,9 +152,9 @@ test.describe('Product functionality test', () => { await vendor.addProductDescription(productName, data.product.productInfo.description); }); - // test('vendor can add product quantity discount @pro @v', async ( ) => { - // await vendor.addProductQuantityDiscount(data.predefined.simpleProduct.product1.name, data.product.productInfo.quantityDiscount); - // }); + test.skip('vendor can add product quantity discount @pro @v', async ( ) => { + await vendor.addProductQuantityDiscount(productName, data.product.productInfo.quantityDiscount); + }); test('vendor can add product rma options @pro @v', async () => { await vendor.addProductRmaOptions(productName, data.vendor.rma); diff --git a/tests/pw/utils/apiUtils.ts b/tests/pw/utils/apiUtils.ts index 1637b3c7fc..fac96ce1f4 100644 --- a/tests/pw/utils/apiUtils.ts +++ b/tests/pw/utils/apiUtils.ts @@ -840,12 +840,13 @@ export class ApiUtils { } // create a product advertisement - async createProductAdvertisement(product: object, auth?: auth): Promise<[responseBody, string]> { + async createProductAdvertisement(product: object, auth?: auth): Promise<[responseBody, string, string]> { const [body, productId] = await this.createProduct(product, auth); const sellerId = body.store.id; const [, responseBody] = await this.post(endPoints.createProductAdvertisement, { data: { vendor_id: sellerId, product_id: productId }, headers: payloads.adminAuth }); - const productAdvertisementId = String(responseBody?.id); - return [responseBody, productAdvertisementId]; + const advertisementId = String(responseBody?.id); + const advertisedProduct = responseBody?.product_title; + return [responseBody, advertisementId, advertisedProduct]; } /**