diff --git a/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/03_getCustomerGroupsId.ts b/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/03_getCustomerGroupsId.ts index 9371a8855224d..4aeab70209053 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/03_getCustomerGroupsId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/03_getCustomerGroupsId.ts @@ -244,8 +244,8 @@ describe('API : GET /customers/group/{customerGroupId}', async () => { expect(jsonResponse).to.have.property('localizedNames'); expect(jsonResponse.localizedNames).to.be.a('object'); - expect(jsonResponse.localizedNames[dataLanguages.english.id]).to.be.equal(nameEn); - expect(jsonResponse.localizedNames[dataLanguages.french.id]).to.be.equal(nameFr); + expect(jsonResponse.localizedNames[dataLanguages.english.locale]).to.be.equal(nameEn); + expect(jsonResponse.localizedNames[dataLanguages.french.locale]).to.be.equal(nameFr); }); it('should check the JSON Response : `reductionPercent`', async function () { diff --git a/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/04_putCustomerGroupsId.ts b/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/04_putCustomerGroupsId.ts index 6605e753060df..4226f2768958a 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/04_putCustomerGroupsId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/04_customerGroup/04_putCustomerGroupsId.ts @@ -225,8 +225,8 @@ describe('API : PUT /customers/group/{customerGroupId}', async () => { data: { customerGroupId: idCustomerGroup, localizedNames: { - [dataLanguages.french.id]: updateGroupData.frName, - [dataLanguages.english.id]: updateGroupData.name, + [dataLanguages.french.locale]: updateGroupData.frName, + [dataLanguages.english.locale]: updateGroupData.name, }, reductionPercent: updateGroupData.discount, displayPriceTaxExcluded: updateGroupData.priceDisplayMethod === 'Tax excluded', @@ -257,7 +257,10 @@ describe('API : PUT /customers/group/{customerGroupId}', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseJSON', baseContext); expect(jsonResponse.customerGroupId).to.equal(idCustomerGroup); - expect(jsonResponse.localizedNames).to.deep.equal({1: updateGroupData.name, 2: updateGroupData.frName}); + expect(jsonResponse.localizedNames).to.deep.equal({ + [dataLanguages.english.locale]: updateGroupData.name, + [dataLanguages.french.locale]: updateGroupData.frName, + }); expect(jsonResponse.reductionPercent).to.equal(updateGroupData.discount); expect(jsonResponse.displayPriceTaxExcluded).to.equal(updateGroupData.priceDisplayMethod === 'Tax excluded'); expect(jsonResponse.showPrice).to.equal(updateGroupData.shownPrices); @@ -292,14 +295,14 @@ describe('API : PUT /customers/group/{customerGroupId}', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseLocalizedNamesEN', baseContext); const value = await boCustomerGroupsCreatePage.getValue(page, 'localizedNames', dataLanguages.english.id); - expect(jsonResponse.localizedNames[dataLanguages.english.id]).to.be.equal(value); + expect(jsonResponse.localizedNames[dataLanguages.english.locale]).to.be.equal(value); }); it('should check the JSON Response : `localizedNames` (FR)', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseLocalizedNamesFR', baseContext); const value = await boCustomerGroupsCreatePage.getValue(page, 'localizedNames', dataLanguages.french.id); - expect(jsonResponse.localizedNames[dataLanguages.french.id]).to.be.equal(value); + expect(jsonResponse.localizedNames[dataLanguages.french.locale]).to.be.equal(value); }); it('should check the JSON Response : `reductionPercent`', async function () { diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/01_postProduct.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/01_postProduct.ts index 44765c881de84..9e474e8b248d0 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/01_postProduct.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/01_postProduct.ts @@ -150,12 +150,12 @@ describe('API : POST /product', async () => { type: createProduct.type, active: createProduct.status, names: { - [dataLanguages.english.id]: createProduct.name, - [dataLanguages.french.id]: createProduct.nameFR, + [dataLanguages.english.locale]: createProduct.name, + [dataLanguages.french.locale]: createProduct.nameFR, }, descriptions: { - [dataLanguages.english.id]: createProduct.description, - [dataLanguages.french.id]: createProduct.descriptionFR, + [dataLanguages.english.locale]: createProduct.description, + [dataLanguages.french.locale]: createProduct.descriptionFR, }, }, }); @@ -183,8 +183,8 @@ describe('API : POST /product', async () => { expect(jsonResponse.productId).to.be.gt(0); expect(jsonResponse.type).to.equal(createProduct.type); - expect(jsonResponse.names[dataLanguages.english.id]).to.equal(createProduct.name); - expect(jsonResponse.names[dataLanguages.french.id]).to.equal(createProduct.nameFR); + expect(jsonResponse.names[dataLanguages.english.locale]).to.equal(createProduct.name); + expect(jsonResponse.names[dataLanguages.french.locale]).to.equal(createProduct.nameFR); // @todo : https://github.com/PrestaShop/PrestaShop/issues/35619 //expect(jsonResponse.descriptions[dataLanguages.english.id]).to.equal(createProduct.description); //expect(jsonResponse.descriptions[dataLanguages.french.id]).to.equal(createProduct.descriptionFR); @@ -246,28 +246,28 @@ describe('API : POST /product', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseNamesEN', baseContext); const value = await createProductsPage.getProductName(page, dataLanguages.english.isoCode); - expect(value).to.equal(jsonResponse.names[dataLanguages.english.id]); + expect(value).to.equal(jsonResponse.names[dataLanguages.english.locale]); }); it('should check the JSON Response : `names` (FR)', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseNamesFR', baseContext); const value = await createProductsPage.getProductName(page, dataLanguages.french.isoCode); - expect(value).to.equal(jsonResponse.names[dataLanguages.french.id]); + expect(value).to.equal(jsonResponse.names[dataLanguages.french.locale]); }); it('should check the JSON Response : `description` (EN)', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseDescriptionsEN', baseContext); const value = await boProductsCreateTabDescriptionPage.getValue(page, 'description', dataLanguages.english.id.toString()); - expect(value).to.equal(jsonResponse.descriptions[dataLanguages.english.id]); + expect(value).to.equal(jsonResponse.descriptions[dataLanguages.english.locale]); }); it('should check the JSON Response : `description` (FR)', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseDescriptionsFR', baseContext); const value = await boProductsCreateTabDescriptionPage.getValue(page, 'description', dataLanguages.french.id.toString()); - expect(value).to.equal(jsonResponse.descriptions[dataLanguages.french.id]); + expect(value).to.equal(jsonResponse.descriptions[dataLanguages.french.locale]); }); }); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/03_getProductId.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/03_getProductId.ts index 33377b5ed2c26..fb84bd0845136 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/03_getProductId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/03_getProductId.ts @@ -266,8 +266,8 @@ describe('API : GET /product/{productId}', async () => { expect(jsonResponse).to.have.property('names'); expect(jsonResponse.names).to.be.a('object'); - expect(jsonResponse.names[dataLanguages.english.id]).to.be.equal(productNameEn); - expect(jsonResponse.names[dataLanguages.french.id]).to.be.equal(productNameFr); + expect(jsonResponse.names[dataLanguages.english.locale]).to.be.equal(productNameEn); + expect(jsonResponse.names[dataLanguages.french.locale]).to.be.equal(productNameFr); }); it('should check the JSON Response : `descriptions`', async function () { @@ -275,8 +275,8 @@ describe('API : GET /product/{productId}', async () => { expect(jsonResponse).to.have.property('descriptions'); expect(jsonResponse.descriptions).to.be.a('object'); - expect(jsonResponse.descriptions[dataLanguages.english.id]).to.be.equal(productDescriptionEn); - expect(jsonResponse.descriptions[dataLanguages.french.id]).to.be.equal(productDescriptionFr); + expect(jsonResponse.descriptions[dataLanguages.english.locale]).to.be.equal(productDescriptionEn); + expect(jsonResponse.descriptions[dataLanguages.french.locale]).to.be.equal(productDescriptionFr); }); }); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/04_patchProductId.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/04_patchProductId.ts index e355144b39d8c..4b6082aa01ef9 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/04_patchProductId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/04_patchProductId.ts @@ -199,15 +199,15 @@ describe('API : PATCH /product/{productId}', async () => { { propertyName: 'names', propertyValue: { - [dataLanguages.english.id]: patchProduct.name, - [dataLanguages.french.id]: patchProduct.nameFR, + [dataLanguages.english.locale]: patchProduct.name, + [dataLanguages.french.locale]: patchProduct.nameFR, }, }, { propertyName: 'descriptions', propertyValue: { - [dataLanguages.english.id]: patchProduct.description, - [dataLanguages.french.id]: patchProduct.descriptionFR, + [dataLanguages.english.locale]: patchProduct.description, + [dataLanguages.french.locale]: patchProduct.descriptionFR, }, }, ].forEach((data: { propertyName: string, propertyValue: boolean|string|object}) => { @@ -248,8 +248,8 @@ describe('API : PATCH /product/{productId}', async () => { const valuePropertyEN = await createProductsPage.getProductName(page, dataLanguages.english.isoCode); const valuePropertyFR = await createProductsPage.getProductName(page, dataLanguages.french.isoCode); expect({ - [dataLanguages.english.id]: valuePropertyEN, - [dataLanguages.french.id]: valuePropertyFR, + [dataLanguages.english.locale]: valuePropertyEN, + [dataLanguages.french.locale]: valuePropertyFR, }).to.deep.equal(data.propertyValue); } else if (data.propertyName === 'descriptions') { const valuePropertyEN = await boProductsCreateTabDescriptionPage.getValue( @@ -263,8 +263,8 @@ describe('API : PATCH /product/{productId}', async () => { dataLanguages.french.id.toString(), ); expect({ - [dataLanguages.english.id]: valuePropertyEN, - [dataLanguages.french.id]: valuePropertyFR, + [dataLanguages.english.locale]: valuePropertyEN, + [dataLanguages.french.locale]: valuePropertyFR, }).to.deep.equal(data.propertyValue); } }); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/05_postProductIdImage.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/05_postProductIdImage.ts index 5acc284a827f1..3c8bf24d4d38c 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/05_postProductIdImage.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/05_postProductIdImage.ts @@ -225,10 +225,10 @@ describe('API : POST /product/{productId}/image', async () => { expect(jsonResponse.thumbnailUrl).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.english.id]).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.english.id]).to.equals(''); - expect(jsonResponse.legends[dataLanguages.french.id]).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.french.id]).to.equals(''); + expect(jsonResponse.legends[dataLanguages.english.locale]).to.be.a('string'); + expect(jsonResponse.legends[dataLanguages.english.locale]).to.equals(''); + expect(jsonResponse.legends[dataLanguages.french.locale]).to.be.a('string'); + expect(jsonResponse.legends[dataLanguages.french.locale]).to.equals(''); expect(jsonResponse.cover).to.be.a('boolean'); expect(jsonResponse.cover).to.be.equals(true); @@ -262,8 +262,8 @@ describe('API : POST /product/{productId}/image', async () => { it('should check the JSON Response : `legends`', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseLegends', baseContext); - expect(productImageInformation.caption.en).to.equal(jsonResponse.legends[dataLanguages.english.id]); - expect(productImageInformation.caption.fr).to.equal(jsonResponse.legends[dataLanguages.french.id]); + expect(productImageInformation.caption.en).to.equal(jsonResponse.legends[dataLanguages.english.locale]); + expect(productImageInformation.caption.fr).to.equal(jsonResponse.legends[dataLanguages.french.locale]); }); it('should check the JSON Response : `cover`', async function () { diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/06_getProductIdImages.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/06_getProductIdImages.ts index ab7b9344c9884..315bd0638d4dd 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/06_getProductIdImages.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/06_getProductIdImages.ts @@ -173,8 +173,8 @@ describe('API : GET /product/{productId}/images', async () => { expect(jsonResponse[i].imageId).to.be.gt(0); expect(jsonResponse[i].imageUrl).to.be.a('string'); expect(jsonResponse[i].thumbnailUrl).to.be.a('string'); - expect(jsonResponse[i].legends[dataLanguages.english.id]).to.be.a('string'); - expect(jsonResponse[i].legends[dataLanguages.french.id]).to.be.a('string'); + expect(jsonResponse[i].legends[dataLanguages.english.locale]).to.be.a('string'); + expect(jsonResponse[i].legends[dataLanguages.french.locale]).to.be.a('string'); expect(jsonResponse[i].cover).to.be.a('boolean'); expect(jsonResponse[i].position).to.be.a('number'); expect(jsonResponse[i].shopIds).to.be.a('array'); @@ -226,8 +226,8 @@ describe('API : GET /product/{productId}/images', async () => { expect(productImageInformation.id).to.equal(jsonResponse[idxItem].imageId); - expect(productImageInformation.caption.en).to.equal(jsonResponse[idxItem].legends[dataLanguages.english.id]); - expect(productImageInformation.caption.fr).to.equal(jsonResponse[idxItem].legends[dataLanguages.french.id]); + expect(productImageInformation.caption.en).to.equal(jsonResponse[idxItem].legends[dataLanguages.english.locale]); + expect(productImageInformation.caption.fr).to.equal(jsonResponse[idxItem].legends[dataLanguages.french.locale]); expect(productImageInformation.isCover).to.equal(jsonResponse[idxItem].cover); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/07_getProductImageId.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/07_getProductImageId.ts index d1e42c57157fb..ae12b71aec0b7 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/07_getProductImageId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/07_getProductImageId.ts @@ -170,8 +170,8 @@ describe('API : GET /product/image/{imageId}', async () => { expect(jsonResponse.imageId).to.be.gt(0); expect(jsonResponse.imageUrl).to.be.a('string'); expect(jsonResponse.thumbnailUrl).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.english.id]).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.french.id]).to.be.a('string'); + expect(jsonResponse.legends[dataLanguages.english.locale]).to.be.a('string'); + expect(jsonResponse.legends[dataLanguages.french.locale]).to.be.a('string'); expect(jsonResponse.cover).to.be.a('boolean'); expect(jsonResponse.position).to.be.a('number'); expect(jsonResponse.shopIds).to.be.a('array'); @@ -218,8 +218,8 @@ describe('API : GET /product/image/{imageId}', async () => { expect(productImageInformation.id).to.equal(jsonResponse.imageId); - expect(productImageInformation.caption.en).to.equal(jsonResponse.legends[dataLanguages.english.id]); - expect(productImageInformation.caption.fr).to.equal(jsonResponse.legends[dataLanguages.french.id]); + expect(productImageInformation.caption.en).to.equal(jsonResponse.legends[dataLanguages.english.locale]); + expect(productImageInformation.caption.fr).to.equal(jsonResponse.legends[dataLanguages.french.locale]); expect(productImageInformation.isCover).to.equal(jsonResponse.cover); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/10_product/08_postProductImageId.ts b/tests/UI/campaigns/functional/API/02_endpoints/10_product/08_postProductImageId.ts index 78deda5ace2ac..0129a857993e3 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/10_product/08_postProductImageId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/10_product/08_postProductImageId.ts @@ -233,8 +233,8 @@ describe('API : POST /product/image/{imageId}', async () => { await testContext.addContextItem(this, 'testIdentifier', 'requestEndpoint', baseContext); const dataMultipart: any = {}; - dataMultipart[`legends[${dataLanguages.english.id}]`] = productCaptionUpdatedEN; - dataMultipart[`legends[${dataLanguages.french.id}]`] = productCaptionUpdatedFR; + dataMultipart[`legends[${dataLanguages.english.locale}]`] = productCaptionUpdatedEN; + dataMultipart[`legends[${dataLanguages.french.locale}]`] = productCaptionUpdatedFR; const apiResponse = await apiContext.post(`product/image/${productImageInformation.id}`, { headers: { @@ -281,10 +281,10 @@ describe('API : POST /product/image/{imageId}', async () => { expect(jsonResponse.thumbnailUrl).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.english.id]).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.english.id]).to.equals(productCaptionUpdatedEN); - expect(jsonResponse.legends[dataLanguages.french.id]).to.be.a('string'); - expect(jsonResponse.legends[dataLanguages.french.id]).to.equals(productCaptionUpdatedFR); + expect(jsonResponse.legends[dataLanguages.english.locale]).to.be.a('string'); + expect(jsonResponse.legends[dataLanguages.english.locale]).to.equals(productCaptionUpdatedEN); + expect(jsonResponse.legends[dataLanguages.french.locale]).to.be.a('string'); + expect(jsonResponse.legends[dataLanguages.french.locale]).to.equals(productCaptionUpdatedFR); expect(jsonResponse.cover).to.be.a('boolean'); expect(jsonResponse.cover).to.be.equals(true); @@ -314,10 +314,10 @@ describe('API : POST /product/image/{imageId}', async () => { it('should check the JSON Response : `legends`', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkResponseLegends', baseContext); - expect(productImageInformation.caption.en).to.equal(jsonResponse.legends[dataLanguages.english.id]); + expect(productImageInformation.caption.en).to.equal(jsonResponse.legends[dataLanguages.english.locale]); expect(productImageInformation.caption.en).to.equal(productCaptionUpdatedEN); - expect(productImageInformation.caption.fr).to.equal(jsonResponse.legends[dataLanguages.french.id]); + expect(productImageInformation.caption.fr).to.equal(jsonResponse.legends[dataLanguages.french.locale]); expect(productImageInformation.caption.fr).to.equal(productCaptionUpdatedFR); }); diff --git a/tests/UI/package-lock.json b/tests/UI/package-lock.json index 68979c995ae05..59646ab073c73 100644 --- a/tests/UI/package-lock.json +++ b/tests/UI/package-lock.json @@ -419,7 +419,7 @@ }, "node_modules/@prestashop-core/ui-testing": { "version": "0.0.12", - "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#f89ac228b2a7c6a82bef5f291a8b0216b2ab12d4", + "resolved": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#42e566c8da4a822934b06dd245924ca5e47d006e", "license": "MIT", "dependencies": { "@faker-js/faker": "^9.0.3", @@ -7746,7 +7746,7 @@ } }, "@prestashop-core/ui-testing": { - "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#f89ac228b2a7c6a82bef5f291a8b0216b2ab12d4", + "version": "git+ssh://git@github.com/PrestaShop/ui-testing-library.git#42e566c8da4a822934b06dd245924ca5e47d006e", "from": "@prestashop-core/ui-testing@https://github.com/PrestaShop/ui-testing-library#main", "requires": { "@faker-js/faker": "^9.0.3",