From eb347c839583da439f8b854ab6d917777dc62a7f Mon Sep 17 00:00:00 2001 From: Sanyi Date: Mon, 27 Jan 2025 13:55:34 +0100 Subject: [PATCH] EMA-148 - Magento 2.4.7 compatibility - test update --- .github/workflows/tests.yml | 4 +- dev/testv2/products/list.spec.js | 643 +++++++++++++++---------------- 2 files changed, 323 insertions(+), 324 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c7b41ff..b3504c9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: magento-versions: - ["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"] + ["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce", "2.4.7ce"] steps: - name: Extract branch name shell: bash @@ -103,7 +103,7 @@ jobs: fail-fast: false matrix: magento-versions: - ["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"] + ["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce", "2.4.7ce"] steps: - name: Extract branch name shell: bash diff --git a/dev/testv2/products/list.spec.js b/dev/testv2/products/list.spec.js index 23fd14b..60454bc 100644 --- a/dev/testv2/products/list.spec.js +++ b/dev/testv2/products/list.spec.js @@ -1,380 +1,379 @@ 'use strict'; -const { ProductHelper } = require("../helpers/products"); -const {getTableName} = require("../helpers/get-table-name"); -// const { getProducts } = require('../fixtures/products'); +const {ProductHelper} = require("../helpers/products"); describe('Products endpoint', function () { - before(async function () { - await this.magentoApi.execute('attributes', 'set', { - websiteId: 0, - type: 'product', - attributeCodes: ['emarsys_test_fuel_type', 'country_of_manufacture'] + before(async function () { + await this.magentoApi.execute('attributes', 'set', { + websiteId: 0, + type: 'product', + attributeCodes: ['emarsys_test_fuel_type', 'country_of_manufacture'] + }); }); - }); - after(async function () { - await this.magentoApi.execute('attributes', 'set', { - websiteId: 0, - type: 'product', - attributeCodes: [] - }); - }); - - it('returns product count and products according to page and page_size', async function () { - const page = 3; - const limit = 10; - const productHelper = new ProductHelper(this.db, this.magentoEdition, this.magentoVersion); - const expectedProductCount = await productHelper.getProductCountFromDb(); - let expectedProducts = await productHelper.getProductsFromDb(page, limit); - let expectedProduct = expectedProducts[0]; - - await this.createProduct({ - sku: expectedProduct.sku, - custom_attributes: [ - { - attribute_code: 'special_price', - value: 2 - } - ] + after(async function () { + await this.magentoApi.execute('attributes', 'set', { + websiteId: 0, + type: 'product', + attributeCodes: [] + }); }); - expectedProduct = await productHelper.getProductFromDb(expectedProduct.entity_id); - - const { products, productCount } = await this.magentoApi.execute('products', 'get', { page, limit, storeIds: [1] }); - const product = products[0]; - const isPubInUrl = ProductHelper.isPubInUrl(product.images.image); - - if (!isPubInUrl) { - expectedProduct.images.image = ProductHelper.removePubFromUrl(expectedProduct.images.image); - expectedProduct.images.small_image = ProductHelper.removePubFromUrl(expectedProduct.images.small_image); - expectedProduct.images.thumbnail = ProductHelper.removePubFromUrl(expectedProduct.images.thumbnail); - } - - expect(products.length).to.equal(limit); - expect(productCount).to.equal(expectedProductCount); - - ['entity_id', 'type', 'sku', 'qty', 'is_in_stock', 'images'].forEach((key) => { - expect({ key, value: product[key] }).to.eql({ key, value: expectedProduct[key] }); - }); + it('returns product count and products according to page and page_size', async function () { + const page = 3; + const limit = 10; + const productHelper = new ProductHelper(this.db, this.magentoEdition, this.magentoVersion); + const expectedProductCount = await productHelper.getProductCountFromDb(); + let expectedProducts = await productHelper.getProductsFromDb(page, limit); + let expectedProduct = expectedProducts[0]; + + await this.createProduct({ + sku: expectedProduct.sku, + custom_attributes: [ + { + attribute_code: 'special_price', + value: 2 + } + ] + }); + + expectedProduct = await productHelper.getProductFromDb(expectedProduct.entity_id); + + const {products, productCount} = await this.magentoApi.execute('products', 'get', {page, limit, storeIds: [1]}); + const product = products[0]; + const isPubInUrl = ProductHelper.isPubInUrl(product.images.image); + + if (!isPubInUrl) { + expectedProduct.images.image = ProductHelper.removePubFromUrl(expectedProduct.images.image); + expectedProduct.images.small_image = ProductHelper.removePubFromUrl(expectedProduct.images.small_image); + expectedProduct.images.thumbnail = ProductHelper.removePubFromUrl(expectedProduct.images.thumbnail); + } - expect(product.children_entity_ids).to.be.an('array'); - expect(product.categories[0]).to.equal(expectedProduct.categories[0]); - expect(product.categories[1]).to.equal(expectedProduct.categories[1]); - - const storeLevelProduct = product.store_data.find((store) => store.store_id === 1); - [ - 'name', - 'price', - 'webshop_price', - 'original_webshop_price', - 'original_display_price', - 'display_webshop_price', - 'link', - 'status', - 'description' - ].forEach((key) => { - expect({ key, value: storeLevelProduct[key] }).to.eql({ key, value: expectedProduct.store_data[0][key] }); + expect(products.length).to.equal(limit); + expect(productCount).to.equal(expectedProductCount); + + ['entity_id', 'type', 'sku', 'qty', 'is_in_stock', 'images'].forEach((key) => { + expect({key, value: product[key]}).to.eql({key, value: expectedProduct[key]}); + }); + + expect(product.children_entity_ids).to.be.an('array'); + expect(product.categories[0]).to.equal(expectedProduct.categories[0]); + expect(product.categories[1]).to.equal(expectedProduct.categories[1]); + + const storeLevelProduct = product.store_data.find((store) => store.store_id === 1); + [ + 'name', + 'price', + 'webshop_price', + 'original_webshop_price', + 'original_display_price', + 'display_webshop_price', + 'link', + 'status', + 'description' + ].forEach((key) => { + expect({key, value: storeLevelProduct[key]}).to.eql({key, value: expectedProduct.store_data[0][key]}); + }); }); - }); - - it('returns child entities for configurable products', async function () { - const productHelper = new ProductHelper(this.db, this.magentoEdition, this.magentoVersion); - const limit = 1; - const testConfigurableProduct = await productHelper.getProductFromDb('configurable', 'type_id'); - const page = testConfigurableProduct.entity_id; + it('returns child entities for configurable products', async function () { + const productHelper = new ProductHelper(this.db, this.magentoEdition, this.magentoVersion); + const limit = 1; - const { products } = await this.magentoApi.execute('products', 'get', { page, limit, storeIds: [1] }); - const expectedProducts = await productHelper.getProductsFromDb(page, limit); - const product = products[0]; - const expectedProduct = expectedProducts[0]; + const testConfigurableProduct = await productHelper.getProductFromDb('configurable', 'type_id'); + const page = testConfigurableProduct.entity_id; - ['type', 'children_entity_ids'].forEach((key) => { - expect(product[key]).to.eql(expectedProduct[key]); - }); - }); + const {products} = await this.magentoApi.execute('products', 'get', {page, limit, storeIds: [1]}); + const expectedProducts = await productHelper.getProductsFromDb(page, limit); + const product = products[0]; + const expectedProduct = expectedProducts[0]; - it('returns extra_fields for products', async function () { - const { products: originalProducts } = await this.magentoApi.execute('products', 'get', { - page: 1, - limit: 1, - storeIds: [1] + ['type', 'children_entity_ids'].forEach((key) => { + expect(product[key]).to.eql(expectedProduct[key]); + }); }); - await this.magentoApi.put({ - path: `/rest/V1/products/${originalProducts[0].sku}`, - payload: { - product: { - custom_attributes: [ - { - attribute_code: 'emarsys_test_fuel_type', - value: 'gasoline' - }, - { - attribute_code: 'emarsys_test_number_of_seats', - value: 6 - }, - { - attribute_code: 'country_of_manufacture', - value: 'AZ' + it('returns extra_fields for products', async function () { + const {products: originalProducts} = await this.magentoApi.execute('products', 'get', { + page: 1, + limit: 1, + storeIds: [1] + }); + + await this.magentoApi.put({ + path: `/rest/V1/products/${originalProducts[0].sku}`, + payload: { + product: { + custom_attributes: [ + { + attribute_code: 'emarsys_test_fuel_type', + value: 'gasoline' + }, + { + attribute_code: 'emarsys_test_number_of_seats', + value: 6 + }, + { + attribute_code: 'country_of_manufacture', + value: 'AZ' + } + ] + } } - ] - } - } - }); + }); - const { products } = await this.magentoApi.execute('products', 'get', { page: 1, limit: 1, storeIds: [1] }); - const updatedProduct = products[0]; - - expect(updatedProduct.store_data[0].extra_fields[0].key).to.be.equal('emarsys_test_fuel_type'); - expect(updatedProduct.store_data[0].extra_fields[0].value).to.be.equal('gasoline'); - - expect(updatedProduct.store_data[0].extra_fields[1].key).to.be.equal('country_of_manufacture'); - expect(updatedProduct.store_data[0].extra_fields[1].value).to.be.equal('AZ'); - expect(updatedProduct.store_data[0].extra_fields[1].text_value).to.be.equal('Azerbaijan'); - expect(updatedProduct.store_data[0].extra_fields.length).to.be.equal(2); - }); - - it('returns different prices for the same product on multiple websites', async function () { - const sku = '24-MB01'; - - const extensionAttributes = this.magentoVersion.startsWith('2.1') - ? {} - : { extension_attributes: { website_ids: [1, 2] } }; - - // en: because of m2.4.4 - await this.magentoApi.post({ - path: '/rest/all/V1/products', - payload: { - product: { - sku, - price: 111, - ...extensionAttributes - } - } - }); + const {products} = await this.magentoApi.execute('products', 'get', {page: 1, limit: 1, storeIds: [1]}); + const updatedProduct = products[0]; - await this.magentoApi.post({ - path: '/rest/default/V1/products', - payload: { - product: { - sku, - price: 111, - ...extensionAttributes - } - } - }); + expect(updatedProduct.store_data[0].extra_fields[0].key).to.be.equal('emarsys_test_fuel_type'); + expect(updatedProduct.store_data[0].extra_fields[0].value).to.be.equal('gasoline'); - await this.magentoApi.post({ - path: '/rest/second_store/V1/products', - payload: { - product: { - sku, - price: 222, - ...extensionAttributes - } - } + expect(updatedProduct.store_data[0].extra_fields[1].key).to.be.equal('country_of_manufacture'); + expect(updatedProduct.store_data[0].extra_fields[1].value).to.be.equal('AZ'); + expect(updatedProduct.store_data[0].extra_fields[1].text_value).to.be.equal('Azerbaijan'); + expect(updatedProduct.store_data[0].extra_fields.length).to.be.equal(2); }); - const { products } = await this.magentoApi.execute('products', 'get', { page: 1, limit: 10, storeIds: [1, 2] }); - - const product = products.find((product) => product.sku === sku); - const defaultStoreItem = product.store_data.find((storeData) => storeData.store_id === 1); - const secondStoreItem = product.store_data.find((storeData) => storeData.store_id === 2); - - expect(defaultStoreItem.webshop_price).to.eql(111); - expect(defaultStoreItem.display_webshop_price).to.eql(222); - expect(defaultStoreItem.original_display_webshop_price).to.eql(222); + it('returns different prices for the same product on multiple websites', async function () { + const sku = '24-MB01'; + + const extensionAttributes = this.magentoVersion.startsWith('2.1') + ? {} + : {extension_attributes: {website_ids: [1, 2]}}; + + // en: because of m2.4.4 + await this.magentoApi.post({ + path: '/rest/all/V1/products', + payload: { + product: { + sku, + price: 111, + ...extensionAttributes + } + } + }); + + await this.magentoApi.post({ + path: '/rest/default/V1/products', + payload: { + product: { + sku, + price: 111, + ...extensionAttributes + } + } + }); + + await this.magentoApi.post({ + path: '/rest/second_store/V1/products', + payload: { + product: { + sku, + price: 222, + ...extensionAttributes + } + } + }); - expect(secondStoreItem.webshop_price).to.eql(222); - expect(secondStoreItem.display_webshop_price).to.eql(444); - expect(secondStoreItem.original_display_webshop_price).to.eql(444); - }); + const {products} = await this.magentoApi.execute('products', 'get', {page: 1, limit: 10, storeIds: [1, 2]}); - it('returns different original prices for the same product on multiple websites', async function () { - const sku = '24-MB04'; + const product = products.find((product) => product.sku === sku); + const defaultStoreItem = product.store_data.find((storeData) => storeData.store_id === 1); + const secondStoreItem = product.store_data.find((storeData) => storeData.store_id === 2); - const extensionAttributes = this.magentoVersion.startsWith('2.1') - ? {} - : { extension_attributes: { website_ids: [1, 2] } }; + expect(defaultStoreItem.webshop_price).to.eql(111); + expect(defaultStoreItem.display_webshop_price).to.eql(222); + expect(defaultStoreItem.original_display_webshop_price).to.eql(222); - await this.magentoApi.post({ - path: '/rest/second_store/V1/products', - payload: { - product: { - sku, - price: 1000, - ...extensionAttributes - } - } + expect(secondStoreItem.webshop_price).to.eql(222); + expect(secondStoreItem.display_webshop_price).to.eql(444); + expect(secondStoreItem.original_display_webshop_price).to.eql(444); }); - const { products } = await this.magentoApi.execute('products', 'get', { page: 1, limit: 10, storeIds: [1, 2] }); - - const product = products.find((product) => product.sku === sku); - const defaultStoreItem = product.store_data.find((storeData) => storeData.store_id === 1); - const secondStoreItem = product.store_data.find((storeData) => storeData.store_id === 2); + it('returns different original prices for the same product on multiple websites', async function () { + const sku = '24-MB04'; + + const extensionAttributes = this.magentoVersion.startsWith('2.1') + ? {} + : {extension_attributes: {website_ids: [1, 2]}}; + + await this.magentoApi.post({ + path: '/rest/second_store/V1/products', + payload: { + product: { + sku, + price: 1000, + ...extensionAttributes + } + } + }); - expect(defaultStoreItem.display_webshop_price).to.eql(64); - expect(defaultStoreItem.original_display_webshop_price).to.eql(64); - expect(secondStoreItem.display_webshop_price).to.eql(64); - expect(secondStoreItem.original_display_webshop_price).to.eql(2000); - }); + const {products} = await this.magentoApi.execute('products', 'get', {page: 1, limit: 10, storeIds: [1, 2]}); - it('returns product with status 0 if its not assigned to a website', async function () { - const sku = '24-MB01'; + const product = products.find((product) => product.sku === sku); + const defaultStoreItem = product.store_data.find((storeData) => storeData.store_id === 1); + const secondStoreItem = product.store_data.find((storeData) => storeData.store_id === 2); - await this.magentoApi.delete({ - path: `/rest/default/V1/products/${sku}/websites/2` + expect(defaultStoreItem.display_webshop_price).to.eql(64); + expect(defaultStoreItem.original_display_webshop_price).to.eql(64); + expect(secondStoreItem.display_webshop_price).to.eql(64); + expect(secondStoreItem.original_display_webshop_price).to.eql(2000); }); - const { products } = await this.magentoApi.execute('products', 'get', { page: 1, limit: 10, storeIds: [1, 2] }); + it('returns product with status 0 if its not assigned to a website', async function () { + const sku = '24-MB01'; - const product = products.find((product) => product.sku === sku); - const defaultStoreItem = product.store_data.find((storeData) => storeData.store_id === 1); - const secondStoreItem = product.store_data.find((storeData) => storeData.store_id === 2); + await this.magentoApi.delete({ + path: `/rest/default/V1/products/${sku}/websites/2` + }); - expect(defaultStoreItem.status).to.eql(1); - expect(secondStoreItem.status).to.eql(0); + const {products} = await this.magentoApi.execute('products', 'get', {page: 1, limit: 10, storeIds: [1, 2]}); - await this.magentoApi.post({ - path: `/rest/default/V1/products/${sku}/websites/`, - payload: { - productWebsiteLink: { - sku, - website_id: 2 - } - } - }); - }); - - it('returns product images for stores', async function () { - const sku = '24-MB04'; - - const timestamp = new Date() * 1; - const fileName = `my_custom_pic_${timestamp}.gif`; - - await this.magentoApi.post({ - path: `/rest/second_store/V1/products/${sku}/media`, - payload: { - entry: { - media_type: 'image', - label: 'Image', - position: 100, - disabled: false, - types: ['image', 'small_image', 'thumbnail'], - content: { - base64_encoded_data: 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', - type: 'image/gif', - name: fileName - } - } - } - }); + const product = products.find((product) => product.sku === sku); + const defaultStoreItem = product.store_data.find((storeData) => storeData.store_id === 1); + const secondStoreItem = product.store_data.find((storeData) => storeData.store_id === 2); - const { products } = await this.magentoApi.execute('products', 'get', { page: 1, limit: 10, storeIds: [1, 2] }); + expect(defaultStoreItem.status).to.eql(1); + expect(secondStoreItem.status).to.eql(0); - const product = products.find((product) => product.sku === sku); + await this.magentoApi.post({ + path: `/rest/default/V1/products/${sku}/websites/`, + payload: { + productWebsiteLink: { + sku, + website_id: 2 + } + } + }); + }); - const defaultStore = product.store_data.find((store) => store.store_id === 1); - const secondStore = product.store_data.find((store) => store.store_id === 2); + it('returns product images for stores', async function () { + const sku = '24-MB04'; + + const timestamp = new Date() * 1; + const fileName = `my_custom_pic_${timestamp}.gif`; + + await this.magentoApi.post({ + path: `/rest/second_store/V1/products/${sku}/media`, + payload: { + entry: { + media_type: 'image', + label: 'Image', + position: 100, + disabled: false, + types: ['image', 'small_image', 'thumbnail'], + content: { + base64_encoded_data: 'R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7', + type: 'image/gif', + name: fileName + } + } + } + }); - const isPubInUrl = ProductHelper.isPubInUrl(product.images.image); - const mediaBaseUrl = isPubInUrl ? 'http://magento-test.local/pub/media' : 'http://magento-test.local/media'; + const {products} = await this.magentoApi.execute('products', 'get', {page: 1, limit: 10, storeIds: [1, 2]}); - const expectedDefaultImages = { - image: mediaBaseUrl + '/catalog/product/m/b/mb04-black-0.jpg', - small_image: mediaBaseUrl + '/catalog/product/m/b/mb04-black-0.jpg', - thumbnail: mediaBaseUrl + '/catalog/product/m/b/mb04-black-0.jpg' - }; + const product = products.find((product) => product.sku === sku); - expect(product.images).to.eql(expectedDefaultImages); - expect(defaultStore.images).to.eql(expectedDefaultImages); - expect(secondStore.images).to.eql({ - image: `${mediaBaseUrl}/catalog/product/m/y/${fileName}`, - small_image: `${mediaBaseUrl}/catalog/product/m/y/${fileName}`, - thumbnail: `${mediaBaseUrl}/catalog/product/m/y/${fileName}` - }); - }); + const defaultStore = product.store_data.find((store) => store.store_id === 1); + const secondStore = product.store_data.find((store) => store.store_id === 2); - context('out of stock', function () { - const sku = '24-MB03'; - before(async function () { - await this.magentoApi.put({ - path: `/rest/V1/products/${sku}/stockItems/1`, - payload: { - stockItem: { - qty: 0 - } - } - }); - }); + const isPubInUrl = ProductHelper.isPubInUrl(product.images.image); + const mediaBaseUrl = isPubInUrl ? 'http://magento-test.local/pub/media' : 'http://magento-test.local/media'; - after(async function () { - await this.magentoApi.put({ - path: `/rest/V1/products/${sku}/stockItems/1`, - payload: { - stockItem: { - qty: 100, - is_in_stock: true - } - } - }); - }); + const expectedDefaultImages = { + image: mediaBaseUrl + '/catalog/product/m/b/mb04-black-0.jpg', + small_image: mediaBaseUrl + '/catalog/product/m/b/mb04-black-0.jpg', + thumbnail: mediaBaseUrl + '/catalog/product/m/b/mb04-black-0.jpg' + }; - it('should return out of stock products', async function () { - const { products } = await this.magentoApi.execute('products', 'get', { page: 1, limit: 3, storeIds: [1, 2] }); - const product = products.find((product) => product.sku === sku); + expect(product.images).to.eql(expectedDefaultImages); + expect(defaultStore.images).to.eql(expectedDefaultImages); + expect(secondStore.images).to.eql({ + image: `${mediaBaseUrl}/catalog/product/m/y/${fileName}`, + small_image: `${mediaBaseUrl}/catalog/product/m/y/${fileName}`, + thumbnail: `${mediaBaseUrl}/catalog/product/m/y/${fileName}` + }); + }); - expect(products.length).to.be.equal(3); - expect(product).not.to.be.undefined; + context('out of stock', function () { + const sku = '24-MB03'; + before(async function () { + await this.magentoApi.put({ + path: `/rest/V1/products/${sku}/stockItems/1`, + payload: { + stockItem: { + qty: 0 + } + } + }); + }); + + after(async function () { + await this.magentoApi.put({ + path: `/rest/V1/products/${sku}/stockItems/1`, + payload: { + stockItem: { + qty: 100, + is_in_stock: true + } + } + }); + }); + + it('should return out of stock products', async function () { + const {products} = await this.magentoApi.execute('products', 'get', {page: 1, limit: 3, storeIds: [1, 2]}); + const product = products.find((product) => product.sku === sku); + + expect(products.length).to.be.equal(3); + expect(product).not.to.be.undefined; + }); }); - }); - context('configurable price should not be 0', function () { - const requestParams = { page: 1, limit: 100, storeIds: [1, 2] }; - let entityIdUsed; - let originalPrice; + context('configurable price should not be 0', function () { + const requestParams = {page: 1, limit: 100, storeIds: [1, 2]}; + let entityIdUsed; + let originalPrice; - let priceTableName = ''; + let priceTableName = ''; - const setPriceForEntityId = (entityId, value, db, magentoEdition) => { - const query = magentoEdition === 'Enterprise' ? { row_id: entityId } : { entity_id: entityId }; - return db(priceTableName).where(query).update({ value }); - }; + const setPriceForEntityId = (entityId, value, db, magentoEdition) => { + const query = magentoEdition === 'Enterprise' ? {row_id: entityId} : {entity_id: entityId}; + return db(priceTableName).where(query).update({value}); + }; - before(async function () { - priceTableName = this.getTableName('catalog_product_entity_decimal'); + before(async function () { + priceTableName = this.getTableName('catalog_product_entity_decimal'); - const { products } = await this.magentoApi.execute('products', 'get', requestParams); - const configurableProduct = products.find((product) => product.type === 'configurable'); - entityIdUsed = configurableProduct.entity_id; - originalPrice = configurableProduct.store_data.find((data) => data.store_id !== 0).price; + const {products} = await this.magentoApi.execute('products', 'get', requestParams); + const configurableProduct = products.find((product) => product.type === 'configurable'); + entityIdUsed = configurableProduct.entity_id; + originalPrice = configurableProduct.store_data.find((data) => data.store_id !== 0).price; - await setPriceForEntityId(entityIdUsed, 0, this.db, this.magentoEdition); + await setPriceForEntityId(entityIdUsed, 0, this.db, this.magentoEdition); - try { - await this.reindex(); - } catch (e) { - console.log(e.message); - } - }); + try { + await this.reindex(); + } catch (e) { + console.log(e.message); + } + }); + + after(async function () { + await setPriceForEntityId(entityIdUsed, originalPrice, this.db, this.magentoEdition); + try { + await this.reindex(); + } catch (e) { + console.log(e.message); + } + }); - after(async function () { - await setPriceForEntityId(entityIdUsed, originalPrice, this.db, this.magentoEdition); - try { - await this.reindex(); - } catch (e) { - console.log(e.message); - } - }); - it('returns configurable product min price if price or final price is 0', async function () { - const { products } = await this.magentoApi.execute('products', 'get', requestParams); - const configurableProduct = products.find((product) => product.entity_id === entityIdUsed); - const notAdminStoreData = configurableProduct.store_data.find((data) => data.store_id !== 0); + it('returns configurable product min price if price or final price is 0', async function () { + const {products} = await this.magentoApi.execute('products', 'get', requestParams); + const configurableProduct = products.find((product) => product.entity_id === entityIdUsed); + const notAdminStoreData = configurableProduct.store_data.find((data) => data.store_id !== 0); - expect(notAdminStoreData.price).to.equal(originalPrice); + expect(notAdminStoreData.price).to.equal(originalPrice); + }); }); - }); });