From 480ab5d1295e88d850bfab7dbc1ca46d3b2fdad5 Mon Sep 17 00:00:00 2001 From: shashwata Date: Fri, 15 Nov 2024 16:31:22 +0600 Subject: [PATCH] Update product name & id reference --- tests/pw/pages/vendorAuctionsPage.ts | 1 + tests/pw/tests/e2e/productsDetails.spec.ts | 232 +++++++++--------- .../tests/e2e/productsDetailsAuction.spec.ts | 133 +++++----- .../tests/e2e/productsDetailsBookings.spec.ts | 177 ++++++------- 4 files changed, 276 insertions(+), 267 deletions(-) diff --git a/tests/pw/pages/vendorAuctionsPage.ts b/tests/pw/pages/vendorAuctionsPage.ts index b03aca0d78..5b20c44ecc 100644 --- a/tests/pw/pages/vendorAuctionsPage.ts +++ b/tests/pw/pages/vendorAuctionsPage.ts @@ -585,6 +585,7 @@ export class AuctionsPage extends VendorPage { await this.toBeVisible(productsVendor.attribute.savedAttribute(attribute.attributeName)); } + // can't add already added attribute async cantAddAlreadyAddedAttribute(productName: string, attributeName: string): Promise { await this.goToAuctionProductEditById(productName); await this.toBeVisible(productsVendor.attribute.savedAttribute(attributeName)); diff --git a/tests/pw/tests/e2e/productsDetails.spec.ts b/tests/pw/tests/e2e/productsDetails.spec.ts index b28cb694b4..142b766623 100644 --- a/tests/pw/tests/e2e/productsDetails.spec.ts +++ b/tests/pw/tests/e2e/productsDetails.spec.ts @@ -16,8 +16,8 @@ test.describe('Product details functionality test', () => { let apiUtils: ApiUtils; let productResponseBody: responseBody; let productId: string; - let productName: string; // has all fields - let productName1: string; // has only required fields + let productNameFull: string; // has all fields + let productNameBasic: string; // has only required fields test.beforeAll(async ({ browser }) => { const vendorContext = await browser.newContext(data.auth.vendorAuth); @@ -26,11 +26,11 @@ test.describe('Product details functionality test', () => { apiUtils = new ApiUtils(await request.newContext()); // product with only required fields - [, , productName1] = await apiUtils.createProduct(payloads.createProductRequiredFields(), payloads.vendorAuth); + [, , productNameBasic] = await apiUtils.createProduct(payloads.createProductRequiredFields(), payloads.vendorAuth); // product with all fields // const [, , mediaUrl] = await apiUtils.uploadMedia(data.image.avatar, payloads.mimeTypes.png, payloads.vendorAuth); - // [productResponseBody, productId, productName] = await apiUtils.createProductWc({ ...payloads.createProductAllFields(), images: [{ src: mediaUrl }, { src: mediaUrl }] }, payloads.vendorAuth); // todo: mediaUrl is not working on git action - [productResponseBody, productId, productName] = await apiUtils.createProductWc(payloads.createProductAllFields(), payloads.vendorAuth); + // [productResponseBody, productId, productNameFull] = await apiUtils.createProductWc({ ...payloads.createProductAllFields(), images: [{ src: mediaUrl }, { src: mediaUrl }] }, payloads.vendorAuth); // todo: mediaUrl is not working on git action + [productResponseBody, productId, productNameFull] = await apiUtils.createProductWc(payloads.createProductAllFields(), payloads.vendorAuth); await apiUtils.updateProduct( productId, { @@ -54,260 +54,260 @@ test.describe('Product details functionality test', () => { // product title test('vendor can update product title', { tag: ['@lite', '@vendor'] }, async () => { - const [, , productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); - await vendor.addProductTitle(productName, data.product.productInfo.title); + const [, , productNameFull] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); + await vendor.addProductTitle(productNameFull, data.product.productInfo.title); }); // product permalink test('vendor can update product permalink', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductPermalink(productName, data.product.productInfo.permalink); + await vendor.addProductPermalink(productNameFull, data.product.productInfo.permalink); }); // product price test('vendor can add product price', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addPrice(productName1, data.product.productInfo.price()); + await vendor.addPrice(productNameBasic, data.product.productInfo.price()); }); test('vendor can update product price', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addPrice(productName, data.product.productInfo.price()); + await vendor.addPrice(productNameFull, data.product.productInfo.price()); }); test('vendor can remove product price', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.removePrice(productName); + await vendor.removePrice(productNameFull); }); // product discount price test('vendor can add product discount price', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addDiscount(productName1, data.product.productInfo.discount); + await vendor.addDiscount(productNameBasic, data.product.productInfo.discount); }); test('vendor can add product discount price (with schedule)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addDiscount(productName1, data.product.productInfo.discount, true); + await vendor.addDiscount(productNameBasic, data.product.productInfo.discount, true); }); test('vendor can update product discount price', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addDiscount(productName, { ...data.product.productInfo.discount, regularPrice: productResponseBody.price }); + await vendor.addDiscount(productNameFull, { ...data.product.productInfo.discount, regularPrice: productResponseBody.price }); }); test('vendor can update product discount price (with schedule)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addDiscount(productName, { ...data.product.productInfo.discount, regularPrice: productResponseBody.price }, true, true); + await vendor.addDiscount(productNameFull, { ...data.product.productInfo.discount, regularPrice: productResponseBody.price }, true, true); }); test("vendor can't add product discount price higher than price", { tag: ['@lite', '@vendor'] }, async () => { - await vendor.cantAddGreaterDiscount(productName, { ...data.product.productInfo.discount, regularPrice: productResponseBody.price }); + await vendor.cantAddGreaterDiscount(productNameFull, { ...data.product.productInfo.discount, regularPrice: productResponseBody.price }); }); test('vendor can remove product discount price', { tag: ['@lite', '@vendor'] }, async () => { - const [, , productName] = await apiUtils.createProduct({ ...payloads.createDiscountProduct(), date_on_sale_from: '', date_on_sale_to: '' }, payloads.vendorAuth); - await vendor.removeDiscount(productName); + const [, , productNameFull] = await apiUtils.createProduct({ ...payloads.createDiscountProduct(), date_on_sale_from: '', date_on_sale_to: '' }, payloads.vendorAuth); + await vendor.removeDiscount(productNameFull); }); test('vendor can remove product discount schedule', { tag: ['@lite', '@vendor'] }, async () => { - const [, , productName] = await apiUtils.createProduct(payloads.createDiscountProduct(), payloads.vendorAuth); - await vendor.removeDiscount(productName, true); + const [, , productNameFull] = await apiUtils.createProduct(payloads.createDiscountProduct(), payloads.vendorAuth); + await vendor.removeDiscount(productNameFull, true); }); // product category test('vendor can update product category (single)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductCategory(productName, [data.product.category.clothings]); + await vendor.addProductCategory(productNameFull, [data.product.category.clothings]); }); test('vendor can add product category (multiple)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'multiple' }); - await vendor.addProductCategory(productName1, data.product.category.categories, true); + await vendor.addProductCategory(productNameBasic, data.product.category.categories, true); }); test('vendor can remove product category (multiple)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'multiple' }); const uncategorizedId = await apiUtils.getCategoryId('Uncategorized', payloads.adminAuth); - const [, , productName] = await apiUtils.createProduct({ ...payloads.createProduct(), categories: [{ id: uncategorizedId }, { id: CATEGORY_ID }] }, payloads.vendorAuth); // need multiple categories - await vendor.removeProductCategory(productName, [data.product.category.clothings]); + const [, , productNameFull] = await apiUtils.createProduct({ ...payloads.createProduct(), categories: [{ id: uncategorizedId }, { id: CATEGORY_ID }] }, payloads.vendorAuth); // need multiple categories + await vendor.removeProductCategory(productNameFull, [data.product.category.clothings]); }); test('vendor can add multi-step product category (last category)', { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'single' }); - await vendor.addProductCategory(productName1, [data.product.category.multistepCategories.at(-1)!]); + await vendor.addProductCategory(productNameBasic, [data.product.category.multistepCategories.at(-1)!]); }); test('vendor can add multi-step product category (any category)', { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { dokan_any_category_selection: 'on' }); - await vendor.addProductCategory(productName, [data.product.category.multistepCategories.at(-2)!]); + await vendor.addProductCategory(productNameFull, [data.product.category.multistepCategories.at(-2)!]); }); test("vendor can't add multi-step product category (any category)", { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { dokan_any_category_selection: 'off' }); - await vendor.cantAddCategory(productName, data.product.category.multistepCategories.at(-2)!); + await vendor.cantAddCategory(productNameFull, data.product.category.multistepCategories.at(-2)!); }); // product tags test('vendor can add product tags', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductTags(productName1, data.product.productInfo.tags.tags); + await vendor.addProductTags(productNameBasic, data.product.productInfo.tags.tags); }); test('vendor can remove product tags', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.removeProductTags(productName, data.product.productInfo.tags.tags); + await vendor.removeProductTags(productNameFull, data.product.productInfo.tags.tags); }); test('vendor can create product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTags(productName, data.product.productInfo.tags.randomTags); + await vendor.addProductTags(productNameFull, data.product.productInfo.tags.randomTags); }); // product cover image test('vendor can add product cover image', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductCoverImage(productName1, data.product.productInfo.images.cover); + await vendor.addProductCoverImage(productNameBasic, data.product.productInfo.images.cover); }); test('vendor can update product cover image', { tag: ['@lite', '@vendor'] }, async () => { // todo: need a product with cover image - await vendor.addProductCoverImage(productName, data.product.productInfo.images.cover); - await vendor.addProductCoverImage(productName, data.product.productInfo.images.cover, true); + await vendor.addProductCoverImage(productNameFull, data.product.productInfo.images.cover); + await vendor.addProductCoverImage(productNameFull, data.product.productInfo.images.cover, true); }); test('vendor can remove product cover image', { tag: ['@lite', '@vendor'] }, async () => { // todo: need a product with cover image - await vendor.addProductCoverImage(productName, data.product.productInfo.images.cover, true); - await vendor.removeProductCoverImage(productName); + await vendor.addProductCoverImage(productNameFull, data.product.productInfo.images.cover, true); + await vendor.removeProductCoverImage(productNameFull); }); // product gallery image test('vendor can add product gallery image', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductGalleryImages(productName1, data.product.productInfo.images.gallery); + await vendor.addProductGalleryImages(productNameBasic, data.product.productInfo.images.gallery); }); test('vendor can update product gallery image', { tag: ['@lite', '@vendor'] }, async () => { // todo: need a product with gallery images - await vendor.addProductGalleryImages(productName, data.product.productInfo.images.gallery); - await vendor.addProductGalleryImages(productName, data.product.productInfo.images.gallery, true); + await vendor.addProductGalleryImages(productNameFull, data.product.productInfo.images.gallery); + await vendor.addProductGalleryImages(productNameFull, data.product.productInfo.images.gallery, true); }); test('vendor can remove product gallery image', { tag: ['@lite', '@vendor'] }, async () => { // todo: need a product with gallery images - await vendor.addProductGalleryImages(productName, data.product.productInfo.images.gallery, true); - await vendor.removeProductGalleryImages(productName); + await vendor.addProductGalleryImages(productNameFull, data.product.productInfo.images.gallery, true); + await vendor.removeProductGalleryImages(productNameFull); }); // product short description test('vendor can add product short description', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productName1, data.product.productInfo.description.shortDescription); + await vendor.addProductShortDescription(productNameBasic, data.product.productInfo.description.shortDescription); }); test('vendor can update product short description', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productName, data.product.productInfo.description.shortDescription); + await vendor.addProductShortDescription(productNameFull, data.product.productInfo.description.shortDescription); }); test('vendor can remove product short description', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productName, ''); + await vendor.addProductShortDescription(productNameFull, ''); }); // product description test('vendor can update product description', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductDescription(productName, data.product.productInfo.description.description); + await vendor.addProductDescription(productNameFull, data.product.productInfo.description.description); }); // product downloadable options test('vendor can add product downloadable options', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductDownloadableOptions(productName1, data.product.productInfo.downloadableOptions); + await vendor.addProductDownloadableOptions(productNameBasic, data.product.productInfo.downloadableOptions); }); test('vendor can update product downloadable options', { tag: ['@lite', '@vendor'] }, async () => { // todo: need a product with downloadable file - await vendor.addProductDownloadableOptions(productName, data.product.productInfo.downloadableOptions); + await vendor.addProductDownloadableOptions(productNameFull, data.product.productInfo.downloadableOptions); }); test('vendor can remove product downloadable file', { tag: ['@lite', '@vendor'] }, async () => { // todo: need a product with downloadable file - await vendor.addProductDownloadableOptions(productName, data.product.productInfo.downloadableOptions); - await vendor.removeDownloadableFile(productName, { ...data.product.productInfo.downloadableOptions, downloadLimit: '', downloadExpiry: '' }); + await vendor.addProductDownloadableOptions(productNameFull, data.product.productInfo.downloadableOptions); + await vendor.removeDownloadableFile(productNameFull, { ...data.product.productInfo.downloadableOptions, downloadLimit: '', downloadExpiry: '' }); }); // product virtual options test('vendor can add product virtual option', { tag: ['@lite', '@vendor'] }, async () => { - const [, , productName] = await apiUtils.createProduct(payloads.createProductRequiredFields(), payloads.vendorAuth); - await vendor.addProductVirtualOption(productName, true); + const [, , productNameFull] = await apiUtils.createProduct(payloads.createProductRequiredFields(), payloads.vendorAuth); + await vendor.addProductVirtualOption(productNameFull, true); }); test('vendor can remove product virtual option', { tag: ['@lite', '@vendor'] }, async () => { - const [, , productName] = await apiUtils.createProduct({ ...payloads.createProductRequiredFields(), virtual: true }, payloads.vendorAuth); - await vendor.addProductVirtualOption(productName, false); + const [, , productNameFull] = await apiUtils.createProduct({ ...payloads.createProductRequiredFields(), virtual: true }, payloads.vendorAuth); + await vendor.addProductVirtualOption(productNameFull, false); }); // product inventory options test('vendor can add product inventory options (SKU)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'sku'); + await vendor.addProductInventory(productNameBasic, data.product.productInfo.inventory(), 'sku'); }); test('vendor can update product inventory options (SKU)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName, data.product.productInfo.inventory(), 'sku'); + await vendor.addProductInventory(productNameFull, data.product.productInfo.inventory(), 'sku'); }); test('vendor can remove product inventory options (SKU)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName, { ...data.product.productInfo.inventory(), sku: '' }, 'sku'); + await vendor.addProductInventory(productNameFull, { ...data.product.productInfo.inventory(), sku: '' }, 'sku'); }); test('vendor can add product inventory options (stock status)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-status'); + await vendor.addProductInventory(productNameBasic, data.product.productInfo.inventory(), 'stock-status'); }); test('vendor can add product inventory options (stock management)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-management'); + await vendor.addProductInventory(productNameBasic, data.product.productInfo.inventory(), 'stock-management'); }); test('vendor can update product inventory options (stock management)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-management'); + await vendor.addProductInventory(productNameBasic, data.product.productInfo.inventory(), 'stock-management'); }); test('vendor can remove product inventory options (stock management)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.removeProductInventory(productName); + await vendor.removeProductInventory(productNameFull); }); test('vendor can add product inventory options (allow single quantity)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'one-quantity'); + await vendor.addProductInventory(productNameBasic, data.product.productInfo.inventory(), 'one-quantity'); }); test('vendor can remove product inventory options (allow single quantity)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductInventory(productName, { ...data.product.productInfo.inventory(), oneQuantity: false }, 'one-quantity'); + await vendor.addProductInventory(productNameFull, { ...data.product.productInfo.inventory(), oneQuantity: false }, 'one-quantity'); }); // product other options test('vendor can add product other options (product status)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName1, data.product.productInfo.otherOptions, 'status'); + await vendor.addProductOtherOptions(productNameBasic, data.product.productInfo.otherOptions, 'status'); }); test('vendor can add product other options (visibility)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName1, data.product.productInfo.otherOptions, 'visibility'); + await vendor.addProductOtherOptions(productNameBasic, data.product.productInfo.otherOptions, 'visibility'); }); test('vendor can add product other options (purchase note)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName1, data.product.productInfo.otherOptions, 'purchaseNote'); + await vendor.addProductOtherOptions(productNameBasic, data.product.productInfo.otherOptions, 'purchaseNote'); }); test('vendor can update product other options (purchase note)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName, data.product.productInfo.otherOptions, 'purchaseNote'); + await vendor.addProductOtherOptions(productNameFull, data.product.productInfo.otherOptions, 'purchaseNote'); }); test('vendor can remove product other options (purchase note)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName, { ...data.product.productInfo.otherOptions, purchaseNote: '' }, 'purchaseNote'); + await vendor.addProductOtherOptions(productNameFull, { ...data.product.productInfo.otherOptions, purchaseNote: '' }, 'purchaseNote'); }); test('vendor can add product other options (product review)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName1, data.product.productInfo.otherOptions, 'reviews'); + await vendor.addProductOtherOptions(productNameBasic, data.product.productInfo.otherOptions, 'reviews'); }); test('vendor can remove product other options (product review)', { tag: ['@lite', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productName, { ...data.product.productInfo.otherOptions, enableReview: false }, 'reviews'); + await vendor.addProductOtherOptions(productNameFull, { ...data.product.productInfo.otherOptions, enableReview: false }, 'reviews'); }); // catalog mode @@ -316,137 +316,137 @@ test.describe('Product details functionality test', () => { test('vendor can add product catalog mode', { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { catalog_mode_hide_add_to_cart_button: 'on' }); - await vendor.addProductCatalogMode(productName1); + await vendor.addProductCatalogMode(productNameBasic); }); test('vendor can add product catalog mode (with price hidden)', { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { catalog_mode_hide_add_to_cart_button: 'on', catalog_mode_hide_product_price: 'on' }); - await vendor.addProductCatalogMode(productName1, true); + await vendor.addProductCatalogMode(productNameBasic, true); }); test('vendor can remove product catalog mode', { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { catalog_mode_hide_add_to_cart_button: 'on', catalog_mode_hide_product_price: 'on' }); - await vendor.removeProductCatalogMode(productName); + await vendor.removeProductCatalogMode(productNameFull); }); test('vendor can remove product catalog mode (price hidden option)', { tag: ['@lite', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { catalog_mode_hide_add_to_cart_button: 'on', catalog_mode_hide_product_price: 'on' }); - await vendor.removeProductCatalogMode(productName, true); + await vendor.removeProductCatalogMode(productNameFull, true); }); // shipping and tax test('vendor can add product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShipping(productName1, data.product.productInfo.shipping); + await vendor.addProductShipping(productNameBasic, data.product.productInfo.shipping); }); test('vendor can update product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShipping(productName, data.product.productInfo.shipping); + await vendor.addProductShipping(productNameFull, data.product.productInfo.shipping); }); test('vendor can remove product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductShipping(productName); + await vendor.removeProductShipping(productNameFull); }); test('vendor can add product tax', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTax(productName1, data.product.productInfo.tax); + await vendor.addProductTax(productNameBasic, data.product.productInfo.tax); }); test('vendor can add product tax (with tax class)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTax(productName1, data.product.productInfo.tax, true); + await vendor.addProductTax(productNameBasic, data.product.productInfo.tax, true); }); // linked products test('vendor can add product linked products (up-sells)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductLinkedProducts(productName1, data.product.productInfo.linkedProducts, 'up-sells'); + await vendor.addProductLinkedProducts(productNameBasic, data.product.productInfo.linkedProducts, 'up-sells'); }); test('vendor can add product linked products (cross-sells)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductLinkedProducts(productName1, data.product.productInfo.linkedProducts, 'cross-sells'); + await vendor.addProductLinkedProducts(productNameBasic, data.product.productInfo.linkedProducts, 'cross-sells'); }); test('vendor can remove product linked products (up-sells)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductLinkedProducts(productName, data.product.productInfo.linkedProducts, 'up-sells'); + await vendor.removeProductLinkedProducts(productNameFull, data.product.productInfo.linkedProducts, 'up-sells'); }); test('vendor can remove product linked products (cross-sells)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductLinkedProducts(productName, data.product.productInfo.linkedProducts, 'cross-sells'); + await vendor.removeProductLinkedProducts(productNameFull, data.product.productInfo.linkedProducts, 'cross-sells'); }); // attribute test('vendor can add product attribute', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductAttribute(productName1, data.product.productInfo.attribute); + await vendor.addProductAttribute(productNameBasic, data.product.productInfo.attribute); }); test("vendor can't add already added product attribute", { tag: ['@pro', '@vendor'] }, async () => { - await vendor.cantAddAlreadyAddedAttribute(productName, data.product.productInfo.attribute.attributeName); + await vendor.cantAddAlreadyAddedAttribute(productNameFull, data.product.productInfo.attribute.attributeName); }); // todo: refactor below tests test('vendor can create product attribute term', { tag: ['@pro', '@vendor'] }, async () => { const [, , , attributeName] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); - const [, , productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); - await vendor.addProductAttribute(productName, { ...data.product.productInfo.attribute, attributeName: attributeName }, true); + const [, , productNameFull] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth); + await vendor.addProductAttribute(productNameFull, { ...data.product.productInfo.attribute, attributeName: attributeName }, true); }); test('vendor can remove product attribute', { tag: ['@pro', '@vendor'] }, async () => { const [, attributeId, , attributeName, attributeTerm] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const attributes = { id: attributeId, name: attributeName, options: [attributeTerm] }; - const [, , productName] = await apiUtils.createProduct({ ...payloads.createProduct(), attributes: [attributes] }, payloads.vendorAuth); - await vendor.removeProductAttribute(productName, attributeName); + const [, , productNameFull] = await apiUtils.createProduct({ ...payloads.createProduct(), attributes: [attributes] }, payloads.vendorAuth); + await vendor.removeProductAttribute(productNameFull, attributeName); }); test('vendor can remove product attribute term', { tag: ['@pro', '@vendor'] }, async () => { const [, attributeId, , attributeName, attributeTerm] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const [, , , , attributeTerm2] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const attributes = { id: attributeId, name: attributeName, options: [attributeTerm, attributeTerm2] }; - const [, , productName] = await apiUtils.createProduct({ ...payloads.createProduct(), attributes: [attributes] }, payloads.vendorAuth); - await vendor.removeProductAttributeTerm(productName, attributeName, attributeTerm2); + const [, , productNameFull] = await apiUtils.createProduct({ ...payloads.createProduct(), attributes: [attributes] }, payloads.vendorAuth); + await vendor.removeProductAttributeTerm(productNameFull, attributeName, attributeTerm2); }); // discount options test('vendor can add product bulk discount options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductBulkDiscountOptions(productName1, data.product.productInfo.quantityDiscount); + await vendor.addProductBulkDiscountOptions(productNameBasic, data.product.productInfo.quantityDiscount); }); test('vendor can update product bulk discount options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductBulkDiscountOptions(productName, data.product.productInfo.quantityDiscount); + await vendor.addProductBulkDiscountOptions(productNameFull, data.product.productInfo.quantityDiscount); }); test('vendor can remove product bulk discount options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductBulkDiscountOptions(productName); + await vendor.removeProductBulkDiscountOptions(productNameFull); }); // geolocation test('vendor can add product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeolocation(productName1, data.product.productInfo.geolocation); + await vendor.addProductGeolocation(productNameBasic, data.product.productInfo.geolocation); }); test('vendor can update product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeolocation(productName, data.product.productInfo.geolocation); + await vendor.addProductGeolocation(productNameFull, data.product.productInfo.geolocation); }); test('vendor can remove product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductGeolocation(productName); + await vendor.removeProductGeolocation(productNameFull); }); // EU compliance options // todo: duplicate test from euCompliance test.skip('vendor can add product EU compliance data', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductEuCompliance(productName1, data.product.productInfo.euCompliance); + await vendor.addProductEuCompliance(productNameBasic, data.product.productInfo.euCompliance); }); test.skip('vendor can update product EU compliance data', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductEuCompliance(productName, data.product.productInfo.euCompliance); + await vendor.addProductEuCompliance(productNameFull, data.product.productInfo.euCompliance); }); test.skip('vendor can remove product EU compliance data', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductEuCompliance(productName, { ...data.product.productInfo.euCompliance, productUnits: '', basePriceUnits: '', freeShipping: false, regularUnitPrice: '', saleUnitPrice: '', optionalMiniDescription: '' }); + await vendor.addProductEuCompliance(productNameFull, { ...data.product.productInfo.euCompliance, productUnits: '', basePriceUnits: '', freeShipping: false, regularUnitPrice: '', saleUnitPrice: '', optionalMiniDescription: '' }); }); // addon @@ -454,78 +454,78 @@ test.describe('Product details functionality test', () => { test('vendor can add product addon', { tag: ['@pro', '@vendor'] }, async () => { test.slow(); - await vendor.addProductAddon(productName1, data.product.productInfo.addon); + await vendor.addProductAddon(productNameBasic, data.product.productInfo.addon); }); test('vendor can import product addon', { tag: ['@pro', '@vendor'] }, async () => { const addon = payloads.createProductAddon(); - await vendor.importAddon(productName1, serialize([addon]), addon.name); + await vendor.importAddon(productNameBasic, serialize([addon]), addon.name); }); test('vendor can export product addon', { tag: ['@pro', '@vendor'] }, async () => { - const [responseBody, , productName] = await apiUtils.createProductWithAddon(payloads.createProduct(), [payloads.createProductAddon()], payloads.vendorAuth); - await vendor.exportAddon(productName, serialize(apiUtils.getMetaDataValue(responseBody.meta_data, '_product_addons'))); + const [responseBody, , productNameFull] = await apiUtils.createProductWithAddon(payloads.createProduct(), [payloads.createProductAddon()], payloads.vendorAuth); + await vendor.exportAddon(productNameFull, serialize(apiUtils.getMetaDataValue(responseBody.meta_data, '_product_addons'))); }); test('vendor can remove product addon', { tag: ['@pro', '@vendor'] }, async () => { - const [, , productName, addonNames] = await apiUtils.createProductWithAddon(payloads.createProduct(), [payloads.createProductAddon()], payloads.vendorAuth); - await vendor.removeAddon(productName, addonNames[0] as string); + const [, , productNameFull, addonNames] = await apiUtils.createProductWithAddon(payloads.createProduct(), [payloads.createProductAddon()], payloads.vendorAuth); + await vendor.removeAddon(productNameFull, addonNames[0] as string); }); // rma options test('vendor can add product rma options (no warranty)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductRmaOptions(productName1, { ...data.vendor.rma, type: 'no_warranty' }); + await vendor.addProductRmaOptions(productNameBasic, { ...data.vendor.rma, type: 'no_warranty' }); }); test('vendor can add product rma options (warranty included limited)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductRmaOptions(productName1, data.vendor.rma); + await vendor.addProductRmaOptions(productNameBasic, data.vendor.rma); }); test('vendor can add product rma options (warranty included lifetime)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductRmaOptions(productName1, { ...data.vendor.rma, length: 'lifetime' }); + await vendor.addProductRmaOptions(productNameBasic, { ...data.vendor.rma, length: 'lifetime' }); }); test('vendor can add product rma options (warranty as addon)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductRmaOptions(productName1, { ...data.vendor.rma, type: 'addon_warranty' }); + await vendor.addProductRmaOptions(productNameBasic, { ...data.vendor.rma, type: 'addon_warranty' }); }); //todo: add update rma options tests test('vendor can remove product rma options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductRmaOptions(productName); + await vendor.removeProductRmaOptions(productNameFull); }); // wholesale options test('vendor can add product wholesale options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductWholesaleOptions(productName1, data.product.productInfo.wholesaleOption); + await vendor.addProductWholesaleOptions(productNameBasic, data.product.productInfo.wholesaleOption); }); test('vendor can update product wholesale options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductWholesaleOptions(productName, data.product.productInfo.wholesaleOption); + await vendor.addProductWholesaleOptions(productNameFull, data.product.productInfo.wholesaleOption); }); test('vendor can remove product wholesale options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductWholesaleOptions(productName); + await vendor.removeProductWholesaleOptions(productNameFull); }); // mix-max options test('vendor can add product min-max options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductMinMaxOptions(productName1, data.product.productInfo.minMax); + await vendor.addProductMinMaxOptions(productNameBasic, data.product.productInfo.minMax); }); test('vendor can update product min-max options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductMinMaxOptions(productName, data.product.productInfo.minMax); + await vendor.addProductMinMaxOptions(productNameFull, data.product.productInfo.minMax); }); test("vendor can't add product min limit grater than max limit", { tag: ['@pro', '@vendor'] }, async () => { - await vendor.cantAddGreaterMin(productName, { minimumProductQuantity: '100', maximumProductQuantity: '50' }); + await vendor.cantAddGreaterMin(productNameFull, { minimumProductQuantity: '100', maximumProductQuantity: '50' }); }); test('vendor can remove product min-max options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductMinMaxOptions(productName, { minimumProductQuantity: '', maximumProductQuantity: '' }); + await vendor.removeProductMinMaxOptions(productNameFull, { minimumProductQuantity: '', maximumProductQuantity: '' }); }); // todo: advertising diff --git a/tests/pw/tests/e2e/productsDetailsAuction.spec.ts b/tests/pw/tests/e2e/productsDetailsAuction.spec.ts index 45867f858f..f21f9889a2 100644 --- a/tests/pw/tests/e2e/productsDetailsAuction.spec.ts +++ b/tests/pw/tests/e2e/productsDetailsAuction.spec.ts @@ -13,8 +13,8 @@ test.describe('Auction Product details functionality test', () => { let vendor: AuctionsPage; let vPage: Page; let apiUtils: ApiUtils; - let productId: string; // has all fields - let productId1: string; // has only required fields + let productIdFull: string; // has all fields + let productIdBasic: string; // has only required fields test.beforeAll(async ({ browser }) => { const vendorContext = await browser.newContext(data.auth.vendorAuth); @@ -24,10 +24,10 @@ test.describe('Auction Product details functionality test', () => { apiUtils = new ApiUtils(await request.newContext()); // product with only required fields - [, productId1] = await apiUtils.createProduct(payloads.createAuctionProductRequiredFields(), payloads.vendorAuth); + [, productIdBasic] = await apiUtils.createProduct(payloads.createAuctionProductRequiredFields(), payloads.vendorAuth); // product with all fields - [, productId] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth); //todo: need to add all fields + [, productIdFull] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth); //todo: need to add all fields }); test.afterAll(async () => { @@ -41,263 +41,264 @@ test.describe('Auction Product details functionality test', () => { // product title test('vendor can update auction product title', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth); - await vendor.addProductTitle(productId, data.product.productInfo.title); + const [, productIdFull] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth); + await vendor.addProductTitle(productIdFull, data.product.productInfo.title); }); // product category test('vendor can update auction product category (single)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCategory(productId, [data.product.category.clothings]); + await vendor.addProductCategory(productIdFull, [data.product.category.clothings]); }); test('vendor can add auction product category (multiple)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'multiple' }); - await vendor.addProductCategory(productId1, data.product.category.categories, true); + await vendor.addProductCategory(productIdBasic, data.product.category.categories, true); }); test('vendor can remove auction product category (multiple)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'multiple' }); const uncategorizedId = await apiUtils.getCategoryId('Uncategorized', payloads.adminAuth); - const [, productId] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), categories: [{ id: uncategorizedId }, { id: CATEGORY_ID }] }, payloads.vendorAuth); // need multiple categories - await vendor.removeProductCategory(productId, [data.product.category.clothings]); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), categories: [{ id: uncategorizedId }, { id: CATEGORY_ID }] }, payloads.vendorAuth); // need multiple categories + await vendor.removeProductCategory(productIdFull, [data.product.category.clothings]); }); test('vendor can add multi-step auction product category (last category)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'single' }); - await vendor.addProductCategory(productId1, [data.product.category.multistepCategories.at(-1)!]); + await vendor.addProductCategory(productIdBasic, [data.product.category.multistepCategories.at(-1)!]); }); test('vendor can add multi-step auction product category (any category)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { dokan_any_category_selection: 'on' }); - await vendor.addProductCategory(productId, [data.product.category.multistepCategories.at(-2)!]); + await vendor.addProductCategory(productIdFull, [data.product.category.multistepCategories.at(-2)!]); }); test("vendor can't add multi-step product category (any category)", { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { dokan_any_category_selection: 'off' }); - await vendor.cantAddCategory(productId, data.product.category.multistepCategories.at(-2)!); + await vendor.cantAddCategory(productIdFull, data.product.category.multistepCategories.at(-2)!); }); // product tags test('vendor can add auction product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTags(productId1, data.product.productInfo.tags.tags); + await vendor.addProductTags(productIdBasic, data.product.productInfo.tags.tags); }); test('vendor can remove auction product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductTags(productId, data.product.productInfo.tags.tags); + await vendor.removeProductTags(productIdFull, data.product.productInfo.tags.tags); }); test('vendor can create auction product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTags(productId, data.product.productInfo.tags.randomTags, true); + await vendor.addProductTags(productIdFull, data.product.productInfo.tags.randomTags, true); }); // product cover image test('vendor can add auction product cover image', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCoverImage(productId1, data.product.productInfo.images.cover); + await vendor.addProductCoverImage(productIdBasic, data.product.productInfo.images.cover); }); test('vendor can update auction product cover image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with cover image - await vendor.addProductCoverImage(productId, data.product.productInfo.images.cover); - await vendor.addProductCoverImage(productId, data.product.productInfo.images.cover, true); + await vendor.addProductCoverImage(productIdFull, data.product.productInfo.images.cover); + await vendor.addProductCoverImage(productIdFull, data.product.productInfo.images.cover, true); }); test('vendor can remove auction product cover image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with cover image - await vendor.addProductCoverImage(productId, data.product.productInfo.images.cover, true); - await vendor.removeProductCoverImage(productId); + await vendor.addProductCoverImage(productIdFull, data.product.productInfo.images.cover, true); + await vendor.removeProductCoverImage(productIdFull); }); // product gallery image test('vendor can add auction product gallery image', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGalleryImages(productId1, data.product.productInfo.images.gallery); + await vendor.addProductGalleryImages(productIdBasic, data.product.productInfo.images.gallery); }); test('vendor can update auction product gallery image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with gallery images - await vendor.addProductGalleryImages(productId, data.product.productInfo.images.gallery); - await vendor.addProductGalleryImages(productId, data.product.productInfo.images.gallery, true); + await vendor.addProductGalleryImages(productIdFull, data.product.productInfo.images.gallery); + await vendor.addProductGalleryImages(productIdFull, data.product.productInfo.images.gallery, true); }); test('vendor can remove auction product gallery image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with gallery images - await vendor.addProductGalleryImages(productId, data.product.productInfo.images.gallery, true); - await vendor.removeProductGalleryImages(productId); + await vendor.addProductGalleryImages(productIdFull, data.product.productInfo.images.gallery, true); + await vendor.removeProductGalleryImages(productIdFull); }); // product short description test('vendor can add auction product short description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productId1, data.product.productInfo.description.shortDescription); + await vendor.addProductShortDescription(productIdBasic, data.product.productInfo.description.shortDescription); }); test('vendor can update auction product short description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productId, data.product.productInfo.description.shortDescription); + await vendor.addProductShortDescription(productIdFull, data.product.productInfo.description.shortDescription); }); test('vendor can remove auction product short description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productId, ''); + await vendor.addProductShortDescription(productIdFull, ''); }); // product description test('vendor can update auction product description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductDescription(productId, data.product.productInfo.description.description); + await vendor.addProductDescription(productIdFull, data.product.productInfo.description.description); }); // product downloadable options test.skip('vendor can add auction product downloadable options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductDownloadableOptions(productId1, data.product.productInfo.downloadableOptions); + await vendor.addProductDownloadableOptions(productIdBasic, data.product.productInfo.downloadableOptions); }); test.skip('vendor can update auction product downloadable options', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with downloadable file - await vendor.addProductDownloadableOptions(productId, data.product.productInfo.downloadableOptions); + await vendor.addProductDownloadableOptions(productIdFull, data.product.productInfo.downloadableOptions); }); test.skip('vendor can remove auction product downloadable file', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with downloadable file test.skip(true, 'Has Dokan Issue download limit & expiry doesnt reset'); - await vendor.addProductDownloadableOptions(productId, data.product.productInfo.downloadableOptions); - await vendor.removeDownloadableFile(productId, { ...data.product.productInfo.downloadableOptions, downloadLimit: '', downloadExpiry: '' }); + await vendor.addProductDownloadableOptions(productIdFull, data.product.productInfo.downloadableOptions); + await vendor.removeDownloadableFile(productIdFull, { ...data.product.productInfo.downloadableOptions, downloadLimit: '', downloadExpiry: '' }); }); // product virtual options test('vendor can add product virtual option', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId] = await apiUtils.createProduct(payloads.createAuctionProductRequiredFields(), payloads.vendorAuth); - await vendor.addProductVirtualOption(productId, true); + const [, productIdFull] = await apiUtils.createProduct(payloads.createAuctionProductRequiredFields(), payloads.vendorAuth); + await vendor.addProductVirtualOption(productIdFull, true); }); test('vendor can remove product virtual option', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId] = await apiUtils.createProduct({ ...payloads.createAuctionProductRequiredFields(), virtual: true }, payloads.vendorAuth); - await vendor.addProductVirtualOption(productId, false); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createAuctionProductRequiredFields(), virtual: true }, payloads.vendorAuth); + await vendor.addProductVirtualOption(productIdFull, false); }); test('vendor can update product general options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeneralOption(productId1, { ...data.product.auction, itemCondition: 'used', auctionType: 'reverse' }); + await vendor.addProductGeneralOption(productIdBasic, { ...data.product.auction, itemCondition: 'used', auctionType: 'reverse' }); }); // product inventory options test('vendor can add auction product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productId1, data.product.productInfo.inventory()); + await vendor.addProductInventory(productIdBasic, data.product.productInfo.inventory()); }); test('vendor can update auction product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productId, data.product.productInfo.inventory()); + await vendor.addProductInventory(productIdFull, data.product.productInfo.inventory()); }); test('vendor can remove auction product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productId, { ...data.product.productInfo.inventory(), sku: '' }); + await vendor.addProductInventory(productIdFull, { ...data.product.productInfo.inventory(), sku: '' }); }); // product other options test('vendor can add auction product other options (product status)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productId1, data.product.productInfo.otherOptions, 'status'); + await vendor.addProductOtherOptions(productIdBasic, data.product.productInfo.otherOptions, 'status'); }); test('vendor can add auction product other options (visibility)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productId1, data.product.productInfo.otherOptions, 'visibility'); + await vendor.addProductOtherOptions(productIdBasic, data.product.productInfo.otherOptions, 'visibility'); }); // shipping and tax test('vendor can add auction product shipping', { tag: ['@pro', '@vendor'] }, async () => { test.skip(true, 'has dokan issue, php notice'); - await vendor.addProductShipping(productId1, data.product.productInfo.shipping); + await vendor.addProductShipping(productIdBasic, data.product.productInfo.shipping); }); test('vendor can update auction product shipping', { tag: ['@pro', '@vendor'] }, async () => { test.skip(true, 'has dokan issue, php notice'); - await vendor.addProductShipping(productId, data.product.productInfo.shipping); + await vendor.addProductShipping(productIdFull, data.product.productInfo.shipping); }); test('vendor can remove auction product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductShipping(productId); + await vendor.removeProductShipping(productIdFull); }); test('vendor can add auction product tax', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTax(productId1, data.product.productInfo.tax); + await vendor.addProductTax(productIdBasic, data.product.productInfo.tax); }); test('vendor can add auction product tax (with tax class)', { tag: ['@pro', '@vendor'] }, async () => { test.skip(true, 'Has Dokan Issue'); - await vendor.addProductTax(productId1, data.product.productInfo.tax, true); + await vendor.addProductTax(productIdBasic, data.product.productInfo.tax, true); }); // attribute test('vendor can add auction product attribute', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductAttribute(productId1, data.product.productInfo.attribute); + await vendor.addProductAttribute(productIdBasic, data.product.productInfo.attribute); }); test("vendor can't add already added auction product attribute", { tag: ['@pro', '@vendor'] }, async () => { - await vendor.cantAddAlreadyAddedAttribute(productId, data.product.productInfo.attribute.attributeName); + await vendor.cantAddAlreadyAddedAttribute(productIdFull, data.product.productInfo.attribute.attributeName); }); // todo: refactor below tests + test('vendor can create auction product attribute term', { tag: ['@pro', '@vendor'] }, async () => { const [, , , attributeName] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); - const [, productId] = await apiUtils.createProduct(payloads.createAuctionProductRequiredFields(), payloads.vendorAuth); - await vendor.addProductAttribute(productId, { ...data.product.productInfo.attribute, attributeName: attributeName }, true); + const [, productIdFull] = await apiUtils.createProduct(payloads.createAuctionProductRequiredFields(), payloads.vendorAuth); + await vendor.addProductAttribute(productIdFull, { ...data.product.productInfo.attribute, attributeName: attributeName }, true); }); test('vendor can remove auction product attribute', { tag: ['@pro', '@vendor'] }, async () => { const [, attributeId, , attributeName, attributeTerm] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const attributes = { id: attributeId, name: attributeName, options: [attributeTerm] }; - const [, productId] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); - await vendor.removeProductAttribute(productId, attributeName); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); + await vendor.removeProductAttribute(productIdFull, attributeName); }); test('vendor can remove auction product attribute term', { tag: ['@pro', '@vendor'] }, async () => { const [, attributeId, , attributeName, attributeTerm] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const [, , , , attributeTerm2] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const attributes = { id: attributeId, name: attributeName, options: [attributeTerm, attributeTerm2] }; - const [, productId] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); - await vendor.removeProductAttributeTerm(productId, attributeName, attributeTerm2); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); + await vendor.removeProductAttributeTerm(productIdFull, attributeName, attributeTerm2); }); // geolocation test('vendor can add auction product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeolocation(productId1, data.product.productInfo.geolocation); + await vendor.addProductGeolocation(productIdBasic, data.product.productInfo.geolocation); }); test('vendor can update auction product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeolocation(productId, data.product.productInfo.geolocation); + await vendor.addProductGeolocation(productIdFull, data.product.productInfo.geolocation); }); test('vendor can remove auction product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductGeolocation(productId); + await vendor.removeProductGeolocation(productIdFull); }); // addon test('vendor can add product addon', { tag: ['@pro', '@vendor'] }, async () => { test.slow(); - await vendor.addProductAddon(productId1, data.product.productInfo.addon); + await vendor.addProductAddon(productIdBasic, data.product.productInfo.addon); }); // todo: add update product addon test in all product edit test files test('vendor can import auction product addon', { tag: ['@pro', '@vendor'] }, async () => { const addon = payloads.createProductAddon(); - await vendor.importAddon(productId1, serialize([addon]), addon.name); + await vendor.importAddon(productIdBasic, serialize([addon]), addon.name); }); test('vendor can export auction product addon', { tag: ['@pro', '@vendor'] }, async () => { - const [responseBody, productId] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); - await vendor.exportAddon(productId, serialize(apiUtils.getMetaDataValue(responseBody.meta_data, '_product_addons'))); + const [responseBody, productIdFull] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); + await vendor.exportAddon(productIdFull, serialize(apiUtils.getMetaDataValue(responseBody.meta_data, '_product_addons'))); }); test('vendor can remove auction product addon', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId, , addonNames] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); - await vendor.removeAddon(productId, addonNames[0] as string); + const [, productIdFull, , addonNames] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); + await vendor.removeAddon(productIdFull, addonNames[0] as string); }); }); diff --git a/tests/pw/tests/e2e/productsDetailsBookings.spec.ts b/tests/pw/tests/e2e/productsDetailsBookings.spec.ts index 75c62ca8ae..1496b709c4 100644 --- a/tests/pw/tests/e2e/productsDetailsBookings.spec.ts +++ b/tests/pw/tests/e2e/productsDetailsBookings.spec.ts @@ -13,10 +13,8 @@ test.describe('Booking Product details functionality test', () => { let vendor: BookingPage; let vPage: Page; let apiUtils: ApiUtils; - let productName: string; // has all fields - let productId: string; // has all fields - let productName1: string; // has only required fields - let productId1: string; // has only required fields + let productIdFull: string; // has all fields + let productIdBasic: string; // has only required fields test.beforeAll(async ({ browser }) => { const vendorContext = await browser.newContext(data.auth.vendorAuth); @@ -26,10 +24,10 @@ test.describe('Booking Product details functionality test', () => { apiUtils = new ApiUtils(await request.newContext()); // product with only required fields - [, productId1, productName1] = await apiUtils.createBookableProduct(payloads.createBookableProductRequiredFields(), payloads.vendorAuth); + [, productIdBasic] = await apiUtils.createBookableProduct(payloads.createBookableProductRequiredFields(), payloads.vendorAuth); // product with all fields - [, productId, productName] = await apiUtils.createBookableProduct(payloads.createBookableProduct(), payloads.vendorAuth); //todo: need to add all fields + [, productIdFull] = await apiUtils.createBookableProduct(payloads.createBookableProduct(), payloads.vendorAuth); //todo: need to add all fields }); test.afterAll(async () => { @@ -43,216 +41,220 @@ test.describe('Booking Product details functionality test', () => { // product title test('vendor can update booking product title', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId] = await apiUtils.createBookableProduct(payloads.createBookableProduct(), payloads.vendorAuth); - await vendor.addProductTitle(productId, data.product.productInfo.title); + const [, productIdFull] = await apiUtils.createBookableProduct(payloads.createBookableProduct(), payloads.vendorAuth); + await vendor.addProductTitle(productIdFull, data.product.productInfo.title); }); // product category test('vendor can update booking product category (single)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCategory(productId, [data.product.category.clothings]); + await vendor.addProductCategory(productIdFull, [data.product.category.clothings]); }); test('vendor can add booking product category (multiple)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'multiple' }); - await vendor.addProductCategory(productId1, data.product.category.categories, true); + await vendor.addProductCategory(productIdBasic, data.product.category.categories, true); }); test('vendor can remove booking product category (multiple)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'multiple' }); const uncategorizedId = await apiUtils.getCategoryId('Uncategorized', payloads.adminAuth); - const [, productId] = await apiUtils.createProduct({ ...payloads.createBookableProduct(), categories: [{ id: uncategorizedId }, { id: CATEGORY_ID }] }, payloads.vendorAuth); // need multiple categories - await vendor.removeProductCategory(productId, [data.product.category.clothings]); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createBookableProduct(), categories: [{ id: uncategorizedId }, { id: CATEGORY_ID }] }, payloads.vendorAuth); // need multiple categories + await vendor.removeProductCategory(productIdFull, [data.product.category.clothings]); }); test('vendor can add multi-step booking product category (last category)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { product_category_style: 'single' }); - await vendor.addProductCategory(productId1, [data.product.category.multistepCategories.at(-1)!]); + await vendor.addProductCategory(productIdBasic, [data.product.category.multistepCategories.at(-1)!]); }); test('vendor can add multi-step booking product category (any category)', { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { dokan_any_category_selection: 'on' }); - await vendor.addProductCategory(productId, [data.product.category.multistepCategories.at(-2)!]); + await vendor.addProductCategory(productIdFull, [data.product.category.multistepCategories.at(-2)!]); }); test("vendor can't add multi-step product category (any category)", { tag: ['@pro', '@vendor'] }, async () => { await dbUtils.updateOptionValue(dbData.dokan.optionName.selling, { dokan_any_category_selection: 'off' }); - await vendor.cantAddCategory(productId, data.product.category.multistepCategories.at(-2)!); + await vendor.cantAddCategory(productIdFull, data.product.category.multistepCategories.at(-2)!); }); // product tags test('vendor can add booking product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTags(productId1, data.product.productInfo.tags.tags); + await vendor.addProductTags(productIdBasic, data.product.productInfo.tags.tags); }); test('vendor can remove booking product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductTags(productId, data.product.productInfo.tags.tags); + await vendor.removeProductTags(productIdFull, data.product.productInfo.tags.tags); }); test('vendor can create booking product tags', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTags(productId, data.product.productInfo.tags.randomTags); + await vendor.addProductTags(productIdFull, data.product.productInfo.tags.randomTags); }); // product cover image test('vendor can add booking product cover image', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCoverImage(productId1, data.product.productInfo.images.cover); + await vendor.addProductCoverImage(productIdBasic, data.product.productInfo.images.cover); }); test('vendor can update booking product cover image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with cover image - await vendor.addProductCoverImage(productId, data.product.productInfo.images.cover); - await vendor.addProductCoverImage(productId, data.product.productInfo.images.cover, true); + await vendor.addProductCoverImage(productIdFull, data.product.productInfo.images.cover); + await vendor.addProductCoverImage(productIdFull, data.product.productInfo.images.cover, true); }); test('vendor can remove booking product cover image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with cover image - await vendor.addProductCoverImage(productId, data.product.productInfo.images.cover, true); - await vendor.removeProductCoverImage(productId); + await vendor.addProductCoverImage(productIdFull, data.product.productInfo.images.cover, true); + await vendor.removeProductCoverImage(productIdFull); }); // product gallery image test('vendor can add booking product gallery image', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGalleryImages(productId1, data.product.productInfo.images.gallery); + await vendor.addProductGalleryImages(productIdBasic, data.product.productInfo.images.gallery); }); test('vendor can update booking product gallery image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with gallery images - await vendor.addProductGalleryImages(productId, data.product.productInfo.images.gallery); - await vendor.addProductGalleryImages(productId, data.product.productInfo.images.gallery, true); + await vendor.addProductGalleryImages(productIdFull, data.product.productInfo.images.gallery); + await vendor.addProductGalleryImages(productIdFull, data.product.productInfo.images.gallery, true); }); test('vendor can remove booking product gallery image', { tag: ['@pro', '@vendor'] }, async () => { // todo: need a product with gallery images - await vendor.addProductGalleryImages(productId, data.product.productInfo.images.gallery, true); - await vendor.removeProductGalleryImages(productName); + await vendor.addProductGalleryImages(productIdFull, data.product.productInfo.images.gallery, true); + await vendor.removeProductGalleryImages(productIdFull); }); // product short description test('vendor can add booking product short description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productId1, data.product.productInfo.description.shortDescription); + await vendor.addProductShortDescription(productIdBasic, data.product.productInfo.description.shortDescription); }); test('vendor can update booking product short description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productId, data.product.productInfo.description.shortDescription); + await vendor.addProductShortDescription(productIdFull, data.product.productInfo.description.shortDescription); }); test('vendor can remove booking product short description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShortDescription(productId, ''); + await vendor.addProductShortDescription(productIdFull, ''); }); // product description test('vendor can update booking product description', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductDescription(productId, data.product.productInfo.description.description); + await vendor.addProductDescription(productIdFull, data.product.productInfo.description.description); }); // product virtual options test('vendor can add product virtual option', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId] = await apiUtils.createProduct(payloads.createBookableProductRequiredFields(), payloads.vendorAuth); - await vendor.addProductVirtualOption(productId, true); + const [, productIdFull] = await apiUtils.createProduct(payloads.createBookableProductRequiredFields(), payloads.vendorAuth); + await vendor.addProductVirtualOption(productIdFull, true); }); test('vendor can remove product virtual option', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId] = await apiUtils.createProduct({ ...payloads.createBookableProductRequiredFields(), virtual: true }, payloads.vendorAuth); - await vendor.addProductVirtualOption(productId, false); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createBookableProductRequiredFields(), virtual: true }, payloads.vendorAuth); + await vendor.addProductVirtualOption(productIdFull, false); }); // product inventory options test('vendor can add product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'sku'); + await vendor.addProductInventory(productIdBasic, data.product.productInfo.inventory(), 'sku'); }); test('vendor can update product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName, data.product.productInfo.inventory(), 'sku'); + await vendor.addProductInventory(productIdFull, data.product.productInfo.inventory(), 'sku'); }); test('vendor can remove product inventory options (SKU)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName, { ...data.product.productInfo.inventory(), sku: '' }, 'sku'); + await vendor.addProductInventory(productIdFull, { ...data.product.productInfo.inventory(), sku: '' }, 'sku'); }); test('vendor can add product inventory options (stock status)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-status'); + test.skip(true, 'dokan issue option does not work'); + await vendor.addProductInventory(productIdBasic, data.product.productInfo.inventory(), 'stock-status'); }); test('vendor can add product inventory options (stock management)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-management'); + test.skip(true, 'dokan issue option does not work'); + await vendor.addProductInventory(productIdBasic, data.product.productInfo.inventory(), 'stock-management'); }); test('vendor can update product inventory options (stock management)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'stock-management'); + test.skip(true, 'dokan issue option does not work'); + await vendor.addProductInventory(productIdBasic, data.product.productInfo.inventory(), 'stock-management'); }); test('vendor can remove product inventory options (stock management)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductInventory(productName); + test.skip(true, 'dokan issue option does not work'); + await vendor.removeProductInventory(productIdFull); }); test('vendor can add product inventory options (allow single quantity)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName1, data.product.productInfo.inventory(), 'one-quantity'); + await vendor.addProductInventory(productIdBasic, data.product.productInfo.inventory(), 'one-quantity'); }); test('vendor can remove product inventory options (allow single quantity)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductInventory(productName, { ...data.product.productInfo.inventory(), oneQuantity: false }, 'one-quantity'); + await vendor.addProductInventory(productIdFull, { ...data.product.productInfo.inventory(), oneQuantity: false }, 'one-quantity'); }); // product other options test('vendor can add booking product other options (product status)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productId1, data.product.productInfo.otherOptions, 'status'); + await vendor.addProductOtherOptions(productIdBasic, data.product.productInfo.otherOptions, 'status'); }); test('vendor can add booking product other options (visibility)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductOtherOptions(productId1, data.product.productInfo.otherOptions, 'visibility'); + await vendor.addProductOtherOptions(productIdBasic, data.product.productInfo.otherOptions, 'visibility'); }); // shipping and tax test('vendor can add booking product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShipping(productId1, data.product.productInfo.shipping); + await vendor.addProductShipping(productIdBasic, data.product.productInfo.shipping); }); test('vendor can update booking product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductShipping(productId, data.product.productInfo.shipping); + await vendor.addProductShipping(productIdFull, data.product.productInfo.shipping); }); test('vendor can remove booking product shipping', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductShipping(productId); + await vendor.removeProductShipping(productIdFull); }); test('vendor can add booking product tax', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTax(productId1, data.product.productInfo.tax); + await vendor.addProductTax(productIdBasic, data.product.productInfo.tax); }); test('vendor can add booking product tax (with tax class)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductTax(productId1, data.product.productInfo.tax, true); + await vendor.addProductTax(productIdBasic, data.product.productInfo.tax, true); }); // booking duration test('vendor can add booking product duration', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductDuration(productId1, data.product.booking.duration); + await vendor.addProductDuration(productIdBasic, data.product.booking.duration); }); test('vendor can update booking product duration', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductDuration(productId1, { bookingDurationType: 'customer', bookingDuration: '3', bookingDurationUnit: 'month', bookingDurationMin: '2', bookingDurationMax: '30' }); + await vendor.addProductDuration(productIdBasic, { bookingDurationType: 'customer', bookingDuration: '3', bookingDurationUnit: 'month', bookingDurationMin: '2', bookingDurationMax: '30' }); }); test('vendor can add booking product basic options', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductBasicOptions(productId1, data.product.booking); + await vendor.addProductBasicOptions(productIdBasic, data.product.booking); }); // availability test('vendor can add booking product availability', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductAvailability(productId1, data.product.booking.availability); + await vendor.addProductAvailability(productIdBasic, data.product.booking.availability); }); test('vendor can update booking product availability', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductAvailability(productId1, { + await vendor.addProductAvailability(productIdBasic, { maxBookingsPerBlock: '10', minimumBookingWindowIntoTheFutureDate: '1', minimumBookingWindowIntoTheFutureDateUnit: 'week', @@ -267,75 +269,80 @@ test.describe('Booking Product details functionality test', () => { // costs test('vendor can add booking product costs', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCosts(productId1, data.product.booking.costs); + await vendor.addProductCosts(productIdBasic, data.product.booking.costs); }); test('vendor can update booking product costs', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCosts(productId, { baseCost: '10', blockCost: '20', displayCost: '30' }); + await vendor.addProductCosts(productIdFull, { baseCost: '10', blockCost: '20', displayCost: '30' }); }); test('vendor can remove booking product costs', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductCosts(productId, { baseCost: '0', blockCost: '0', displayCost: '0' }); + await vendor.addProductCosts(productIdFull, { baseCost: '0', blockCost: '0', displayCost: '0' }); }); // extra options test('vendor can add booking product extra options (persons)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductPersons(productId1, data.product.booking.extraOptions); + await vendor.addProductPersons(productIdBasic, data.product.booking.extraOptions); }); test('vendor can add booking product extra options (person type)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductPersonType(productId, data.product.booking.extraOptions); + await vendor.addProductPersonType(productIdFull, data.product.booking.extraOptions); }); test('vendor can update booking product extra options (person type)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductPersonType(productId, data.product.booking.extraOptions); + await vendor.addProductPersonType(productIdFull, data.product.booking.extraOptions); }); test('vendor can remove booking product extra options (person type)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductPersons(productId, data.product.booking.extraOptions); - await vendor.removeProductPersonType(productId); + await vendor.addProductPersons(productIdFull, data.product.booking.extraOptions); + await vendor.removeProductPersonType(productIdFull); }); test('vendor can add booking product extra options (resource)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductResources(productId1, data.product.booking.extraOptions); + await vendor.addProductResources(productIdBasic, data.product.booking.extraOptions); }); test('vendor can update booking product extra options (resource)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductResources(productId, data.product.booking.extraOptions); + await vendor.addProductResources(productIdFull, data.product.booking.extraOptions); }); test('vendor can remove booking product extra options (resource)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductResources(productId, data.product.booking.extraOptions); - await vendor.removeProductResource(productId); + await vendor.addProductResources(productIdFull, data.product.booking.extraOptions); + await vendor.removeProductResource(productIdFull); }); // attribute test('vendor can add booking product attribute', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductAttribute(productId1, data.product.productInfo.attribute); + await vendor.addProductAttribute(productIdBasic, data.product.productInfo.attribute); + }); + + test("vendor can't add already added booking product attribute", { tag: ['@pro', '@vendor'] }, async () => { + await vendor.cantAddAlreadyAddedAttribute(productIdFull, data.product.productInfo.attribute.attributeName); }); // todo: refactor below tests + test('vendor can create booking product attribute term', { tag: ['@pro', '@vendor'] }, async () => { const [, , , attributeName] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); - const [, productId] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth); - await vendor.addProductAttribute(productId, { ...data.product.productInfo.attribute, attributeName: attributeName }, true); + const [, productIdFull] = await apiUtils.createProduct(payloads.createAuctionProduct(), payloads.vendorAuth); + await vendor.addProductAttribute(productIdFull, { ...data.product.productInfo.attribute, attributeName: attributeName }, true); }); test('vendor can remove booking product attribute', { tag: ['@pro', '@vendor'] }, async () => { const [, attributeId, , attributeName, attributeTerm] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const attributes = { id: attributeId, name: attributeName, options: [attributeTerm] }; - const [, productId] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); - await vendor.removeProductAttribute(productId, attributeName); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); + await vendor.removeProductAttribute(productIdFull, attributeName); }); test('vendor can remove booking product attribute term', { tag: ['@pro', '@vendor'] }, async () => { const [, attributeId, , attributeName, attributeTerm] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const [, , , , attributeTerm2] = await apiUtils.createAttributeTerm(payloads.createAttribute(), payloads.createAttributeTerm(), payloads.adminAuth); const attributes = { id: attributeId, name: attributeName, options: [attributeTerm, attributeTerm2] }; - const [, productId] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); - await vendor.removeProductAttributeTerm(productId, attributeName, attributeTerm2); + const [, productIdFull] = await apiUtils.createProduct({ ...payloads.createAuctionProduct(), attributes: [attributes] }, payloads.vendorAuth); + await vendor.removeProductAttributeTerm(productIdFull, attributeName, attributeTerm2); }); // todo: vendor cant add already added attribute @@ -343,36 +350,36 @@ test.describe('Booking Product details functionality test', () => { // geolocation test('vendor can add booking product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeolocation(productId1, data.product.productInfo.geolocation); + await vendor.addProductGeolocation(productIdBasic, data.product.productInfo.geolocation); }); test('vendor can update booking product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.addProductGeolocation(productId, data.product.productInfo.geolocation); + await vendor.addProductGeolocation(productIdFull, data.product.productInfo.geolocation); }); test('vendor can remove booking product geolocation (individual)', { tag: ['@pro', '@vendor'] }, async () => { - await vendor.removeProductGeolocation(productId); + await vendor.removeProductGeolocation(productIdFull); }); // addon test('vendor can add product addon', { tag: ['@pro', '@vendor'] }, async () => { test.slow(); - await vendor.addProductAddon(productId1, data.product.productInfo.addon); + await vendor.addProductAddon(productIdBasic, data.product.productInfo.addon); }); test('vendor can import booking product addon', { tag: ['@pro', '@vendor'] }, async () => { const addon = payloads.createProductAddon(); - await vendor.importAddon(productId1, serialize([addon]), addon.name); + await vendor.importAddon(productIdBasic, serialize([addon]), addon.name); }); test('vendor can export booking product addon', { tag: ['@pro', '@vendor'] }, async () => { - const [responseBody, productId] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); - await vendor.exportAddon(productId, serialize(apiUtils.getMetaDataValue(responseBody.meta_data, '_product_addons'))); + const [responseBody, productIdFull] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); + await vendor.exportAddon(productIdFull, serialize(apiUtils.getMetaDataValue(responseBody.meta_data, '_product_addons'))); }); test('vendor can remove booking product addon', { tag: ['@pro', '@vendor'] }, async () => { - const [, productId, , addonNames] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); - await vendor.removeAddon(productId, addonNames[0] as string); + const [, productIdFull, , addonNames] = await apiUtils.createProductWithAddon(payloads.createAuctionProduct(), [payloads.createProductAddon()], payloads.vendorAuth); + await vendor.removeAddon(productIdFull, addonNames[0] as string); }); });