From df6330a0bf81d840fa6cd9126fadeb9f658deaea Mon Sep 17 00:00:00 2001 From: Alexey Kravchenko Date: Thu, 21 Nov 2024 12:56:23 +0200 Subject: [PATCH 1/6] SUPESC-871: Added test case to check if unnecessary requests was not sent --- .../product-attribute-management.cy.ts | 39 ++++ .../dynamic-product-attribute-management.json | 192 ++++++++++++++++++ .../static-product-attribute-management.json | 3 + .../dynamic-product-attribute-management.json | 192 ++++++++++++++++++ .../static-product-attribute-management.json | 3 + .../dynamic-product-attribute-management.json | 192 ++++++++++++++++++ .../static-product-attribute-management.json | 3 + .../pages/mp/products/products-page.ts | 12 ++ .../pages/mp/products/products-repository.ts | 2 + cypress/support/types/mp/index.ts | 1 + .../support/types/mp/marketplace-products.ts | 13 ++ 11 files changed, 652 insertions(+) create mode 100644 cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts create mode 100644 cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json create mode 100644 cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/static-product-attribute-management.json create mode 100644 cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json create mode 100644 cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/static-product-attribute-management.json create mode 100644 cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json create mode 100644 cypress/fixtures/suite/mp/marketplace-product-attributes/static-product-attribute-management.json create mode 100644 cypress/support/types/mp/marketplace-products.ts diff --git a/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts new file mode 100644 index 00000000..bee1e413 --- /dev/null +++ b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts @@ -0,0 +1,39 @@ +import { container } from '@utils'; +import { ProductManagementDynamicFixtures, ProductManagementStaticFixtures } from '@interfaces/mp'; +import { ProductsPage } from '@pages/mp'; +import { MerchantUserLoginScenario } from '@scenarios/mp'; + +(['b2b', 'b2c'].includes(Cypress.env('repositoryId')) ? describe.skip : describe)( + 'product attribute management', + { tags: ['@merchant-product-attributes'] }, + (): void => { + const productPage = container.get(ProductsPage); + const merchantUserLoginScenario = container.get(MerchantUserLoginScenario); + + let dynamicFixtures: ProductManagementDynamicFixtures; + let staticFixtures: ProductManagementStaticFixtures; + + before((): void => { + ({ dynamicFixtures, staticFixtures } = Cypress.env()); + }); + + it('Additional requests should not be sent on adding attribute', (): void => { + merchantUserLoginScenario.execute({ + username: dynamicFixtures.merchantUser.username, + password: staticFixtures.defaultPassword, + }); + + productPage.visit(); + productPage.getFirstTableRow().click(); + cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract/table-data**').as('dataTable'); + cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract').as('createAttribute'); + + cy.wait('@dataTable').then(() => { + cy.get(productPage.getAttributesTableSelector()).scrollIntoView().should('be.visible').then(() => { + productPage.getAddAttributeButton().click(); + cy.get('@createAttribute.all').should('have.length', 0); + }); + }); + }); + } +); diff --git a/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json new file mode 100644 index 00000000..840a8252 --- /dev/null +++ b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -0,0 +1,192 @@ +{ + "data": { + "type": "dynamic-fixtures", + "attributes": { + "synchronize": true, + "operations": [ + { + "type": "transfer", + "name": "LocaleTransfer", + "key": "localeEN", + "arguments": { "id_locale": 66, "locale_name": "en_US" } + }, + { + "type": "transfer", + "name": "LocaleTransfer", + "key": "localeDE", + "arguments": { "id_locale": 46, "locale_name": "de_DE" } + }, + { + "type": "transfer", + "name": "StoreTransfer", + "key": "store", + "arguments": { "id_store": 1, "name": "DE" } + }, + { + "type": "array-object", + "key": "stores", + "arguments": ["#store"] + }, + { + "type": "helper", + "name": "haveUser", + "key": "merchantUser", + "arguments": [{ "password": "change123" }] + }, + { + "type": "builder", + "name": "MerchantProfileBuilder", + "key": "merchantProfile" + }, + { + "type": "helper", + "name": "haveMerchant", + "key": "merchant", + "arguments": [ + { + "merchantProfile": "#merchantProfile", + "isActive": true, + "status": "approved", + "storeRelation": { + "idStores": ["#store.id_store"] + } + } + ] + }, + { + "type": "helper", + "name": "haveMerchantUserWithAclEntities", + "arguments": ["#merchant", "#merchantUser"] + }, + { + "type": "builder", + "name": "LocalizedAttributesBuilder", + "key": "localizedAttribute1" + }, + { + "type": "builder", + "name": "LocalizedAttributesBuilder", + "key": "localizedAttribute2" + }, + { + "type": "helper", + "name": "haveFullProduct", + "key": "concreteProduct1", + "arguments": [ + { + "attributes": ["attribute1", "attribute2"] + }, + { + "idTaxSet": 1, + "localizedAttributes": [ + { "locale": "#localeEN", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] }, + { "locale": "#localeDE", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] } + ] + } + ] + }, + { + "type": "helper", + "name": "haveFullProduct", + "key": "concreteProduct2", + "arguments": [ + { + "attributes": ["attribute1", "attribute2"] + }, + { + "idTaxSet": 1, + "localizedAttributes": [ + { "locale": "#localeEN", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] }, + { "locale": "#localeDE", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] } + ] + } + ] + }, + { + "type": "transfer", + "name": "ProductImageTransfer", + "key": "productImage1", + "arguments": { + "externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg", + "externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg" + } + }, + { + "type": "transfer", + "name": "ProductImageTransfer", + "key": "productImage2", + "arguments": { + "externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg", + "externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg" + } + }, + { + "type": "helper", + "name": "haveProductImageSet", + "arguments": [ + { + "name": "default", + "idProduct": "#concreteProduct1.id_product_concrete", + "idProductAbstract": "#concreteProduct1.fk_product_abstract", + "productImages": ["#productImage1"] + } + ] + }, + { + "type": "helper", + "name": "haveProductImageSet", + "arguments": [ + { + "name": "default", + "idProduct": "#concreteProduct2.id_product_concrete", + "idProductAbstract": "#concreteProduct2.fk_product_abstract", + "productImages": ["#productImage2"] + } + ] + }, + { + "type": "helper", + "name": "havePriceProduct", + "arguments": [ + { + "skuProductAbstract": "#concreteProduct1.abstract_sku", + "skuProduct": "#concreteProduct1.sku", + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } + } + ] + }, + { + "type": "helper", + "name": "havePriceProduct", + "arguments": [ + { + "skuProductAbstract": "#concreteProduct2.abstract_sku", + "skuProduct": "#concreteProduct2.sku", + "moneyValue": { "netAmount": 20000, "grossAmount": 20000 } + } + ] + }, + { + "type": "helper", + "name": "haveMerchantProduct", + "arguments": [ + { + "idMerchant": "#merchant.id_merchant", + "idProductAbstract": "#concreteProduct1.fk_product_abstract" + } + ] + }, + { + "type": "helper", + "name": "haveMerchantProduct", + "arguments": [ + { + "idMerchant": "#merchant.id_merchant", + "idProductAbstract": "#concreteProduct2.fk_product_abstract" + } + ] + } + ] + } + } +} diff --git a/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/static-product-attribute-management.json b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/static-product-attribute-management.json new file mode 100644 index 00000000..ba4339e8 --- /dev/null +++ b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/static-product-attribute-management.json @@ -0,0 +1,3 @@ +{ + "defaultPassword": "change123" +} diff --git a/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json new file mode 100644 index 00000000..840a8252 --- /dev/null +++ b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -0,0 +1,192 @@ +{ + "data": { + "type": "dynamic-fixtures", + "attributes": { + "synchronize": true, + "operations": [ + { + "type": "transfer", + "name": "LocaleTransfer", + "key": "localeEN", + "arguments": { "id_locale": 66, "locale_name": "en_US" } + }, + { + "type": "transfer", + "name": "LocaleTransfer", + "key": "localeDE", + "arguments": { "id_locale": 46, "locale_name": "de_DE" } + }, + { + "type": "transfer", + "name": "StoreTransfer", + "key": "store", + "arguments": { "id_store": 1, "name": "DE" } + }, + { + "type": "array-object", + "key": "stores", + "arguments": ["#store"] + }, + { + "type": "helper", + "name": "haveUser", + "key": "merchantUser", + "arguments": [{ "password": "change123" }] + }, + { + "type": "builder", + "name": "MerchantProfileBuilder", + "key": "merchantProfile" + }, + { + "type": "helper", + "name": "haveMerchant", + "key": "merchant", + "arguments": [ + { + "merchantProfile": "#merchantProfile", + "isActive": true, + "status": "approved", + "storeRelation": { + "idStores": ["#store.id_store"] + } + } + ] + }, + { + "type": "helper", + "name": "haveMerchantUserWithAclEntities", + "arguments": ["#merchant", "#merchantUser"] + }, + { + "type": "builder", + "name": "LocalizedAttributesBuilder", + "key": "localizedAttribute1" + }, + { + "type": "builder", + "name": "LocalizedAttributesBuilder", + "key": "localizedAttribute2" + }, + { + "type": "helper", + "name": "haveFullProduct", + "key": "concreteProduct1", + "arguments": [ + { + "attributes": ["attribute1", "attribute2"] + }, + { + "idTaxSet": 1, + "localizedAttributes": [ + { "locale": "#localeEN", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] }, + { "locale": "#localeDE", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] } + ] + } + ] + }, + { + "type": "helper", + "name": "haveFullProduct", + "key": "concreteProduct2", + "arguments": [ + { + "attributes": ["attribute1", "attribute2"] + }, + { + "idTaxSet": 1, + "localizedAttributes": [ + { "locale": "#localeEN", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] }, + { "locale": "#localeDE", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] } + ] + } + ] + }, + { + "type": "transfer", + "name": "ProductImageTransfer", + "key": "productImage1", + "arguments": { + "externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg", + "externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg" + } + }, + { + "type": "transfer", + "name": "ProductImageTransfer", + "key": "productImage2", + "arguments": { + "externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg", + "externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg" + } + }, + { + "type": "helper", + "name": "haveProductImageSet", + "arguments": [ + { + "name": "default", + "idProduct": "#concreteProduct1.id_product_concrete", + "idProductAbstract": "#concreteProduct1.fk_product_abstract", + "productImages": ["#productImage1"] + } + ] + }, + { + "type": "helper", + "name": "haveProductImageSet", + "arguments": [ + { + "name": "default", + "idProduct": "#concreteProduct2.id_product_concrete", + "idProductAbstract": "#concreteProduct2.fk_product_abstract", + "productImages": ["#productImage2"] + } + ] + }, + { + "type": "helper", + "name": "havePriceProduct", + "arguments": [ + { + "skuProductAbstract": "#concreteProduct1.abstract_sku", + "skuProduct": "#concreteProduct1.sku", + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } + } + ] + }, + { + "type": "helper", + "name": "havePriceProduct", + "arguments": [ + { + "skuProductAbstract": "#concreteProduct2.abstract_sku", + "skuProduct": "#concreteProduct2.sku", + "moneyValue": { "netAmount": 20000, "grossAmount": 20000 } + } + ] + }, + { + "type": "helper", + "name": "haveMerchantProduct", + "arguments": [ + { + "idMerchant": "#merchant.id_merchant", + "idProductAbstract": "#concreteProduct1.fk_product_abstract" + } + ] + }, + { + "type": "helper", + "name": "haveMerchantProduct", + "arguments": [ + { + "idMerchant": "#merchant.id_merchant", + "idProductAbstract": "#concreteProduct2.fk_product_abstract" + } + ] + } + ] + } + } +} diff --git a/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/static-product-attribute-management.json b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/static-product-attribute-management.json new file mode 100644 index 00000000..ba4339e8 --- /dev/null +++ b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/static-product-attribute-management.json @@ -0,0 +1,3 @@ +{ + "defaultPassword": "change123" +} diff --git a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json new file mode 100644 index 00000000..840a8252 --- /dev/null +++ b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -0,0 +1,192 @@ +{ + "data": { + "type": "dynamic-fixtures", + "attributes": { + "synchronize": true, + "operations": [ + { + "type": "transfer", + "name": "LocaleTransfer", + "key": "localeEN", + "arguments": { "id_locale": 66, "locale_name": "en_US" } + }, + { + "type": "transfer", + "name": "LocaleTransfer", + "key": "localeDE", + "arguments": { "id_locale": 46, "locale_name": "de_DE" } + }, + { + "type": "transfer", + "name": "StoreTransfer", + "key": "store", + "arguments": { "id_store": 1, "name": "DE" } + }, + { + "type": "array-object", + "key": "stores", + "arguments": ["#store"] + }, + { + "type": "helper", + "name": "haveUser", + "key": "merchantUser", + "arguments": [{ "password": "change123" }] + }, + { + "type": "builder", + "name": "MerchantProfileBuilder", + "key": "merchantProfile" + }, + { + "type": "helper", + "name": "haveMerchant", + "key": "merchant", + "arguments": [ + { + "merchantProfile": "#merchantProfile", + "isActive": true, + "status": "approved", + "storeRelation": { + "idStores": ["#store.id_store"] + } + } + ] + }, + { + "type": "helper", + "name": "haveMerchantUserWithAclEntities", + "arguments": ["#merchant", "#merchantUser"] + }, + { + "type": "builder", + "name": "LocalizedAttributesBuilder", + "key": "localizedAttribute1" + }, + { + "type": "builder", + "name": "LocalizedAttributesBuilder", + "key": "localizedAttribute2" + }, + { + "type": "helper", + "name": "haveFullProduct", + "key": "concreteProduct1", + "arguments": [ + { + "attributes": ["attribute1", "attribute2"] + }, + { + "idTaxSet": 1, + "localizedAttributes": [ + { "locale": "#localeEN", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] }, + { "locale": "#localeDE", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] } + ] + } + ] + }, + { + "type": "helper", + "name": "haveFullProduct", + "key": "concreteProduct2", + "arguments": [ + { + "attributes": ["attribute1", "attribute2"] + }, + { + "idTaxSet": 1, + "localizedAttributes": [ + { "locale": "#localeEN", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] }, + { "locale": "#localeDE", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] } + ] + } + ] + }, + { + "type": "transfer", + "name": "ProductImageTransfer", + "key": "productImage1", + "arguments": { + "externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg", + "externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg" + } + }, + { + "type": "transfer", + "name": "ProductImageTransfer", + "key": "productImage2", + "arguments": { + "externalUrlSmall": "https://images.icecat.biz/img/gallery_mediums/30691822_1486.jpg", + "externalUrlLarge": "https://images.icecat.biz/img/gallery/30691822_1486.jpg" + } + }, + { + "type": "helper", + "name": "haveProductImageSet", + "arguments": [ + { + "name": "default", + "idProduct": "#concreteProduct1.id_product_concrete", + "idProductAbstract": "#concreteProduct1.fk_product_abstract", + "productImages": ["#productImage1"] + } + ] + }, + { + "type": "helper", + "name": "haveProductImageSet", + "arguments": [ + { + "name": "default", + "idProduct": "#concreteProduct2.id_product_concrete", + "idProductAbstract": "#concreteProduct2.fk_product_abstract", + "productImages": ["#productImage2"] + } + ] + }, + { + "type": "helper", + "name": "havePriceProduct", + "arguments": [ + { + "skuProductAbstract": "#concreteProduct1.abstract_sku", + "skuProduct": "#concreteProduct1.sku", + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } + } + ] + }, + { + "type": "helper", + "name": "havePriceProduct", + "arguments": [ + { + "skuProductAbstract": "#concreteProduct2.abstract_sku", + "skuProduct": "#concreteProduct2.sku", + "moneyValue": { "netAmount": 20000, "grossAmount": 20000 } + } + ] + }, + { + "type": "helper", + "name": "haveMerchantProduct", + "arguments": [ + { + "idMerchant": "#merchant.id_merchant", + "idProductAbstract": "#concreteProduct1.fk_product_abstract" + } + ] + }, + { + "type": "helper", + "name": "haveMerchantProduct", + "arguments": [ + { + "idMerchant": "#merchant.id_merchant", + "idProductAbstract": "#concreteProduct2.fk_product_abstract" + } + ] + } + ] + } + } +} diff --git a/cypress/fixtures/suite/mp/marketplace-product-attributes/static-product-attribute-management.json b/cypress/fixtures/suite/mp/marketplace-product-attributes/static-product-attribute-management.json new file mode 100644 index 00000000..ba4339e8 --- /dev/null +++ b/cypress/fixtures/suite/mp/marketplace-product-attributes/static-product-attribute-management.json @@ -0,0 +1,3 @@ +{ + "defaultPassword": "change123" +} diff --git a/cypress/support/pages/mp/products/products-page.ts b/cypress/support/pages/mp/products/products-page.ts index f450839e..c55ebd15 100644 --- a/cypress/support/pages/mp/products/products-page.ts +++ b/cypress/support/pages/mp/products/products-page.ts @@ -24,6 +24,18 @@ export class ProductsPage extends MpPage { return this.repository.getFirstTableRow(); }; + getFirstTableRow = (): Cypress.Chainable => { + return this.repository.getFirstTableRow(); + } + + getAddAttributeButton = (): Cypress.Chainable => { + return this.repository.getAddAttributeButton(); + } + + getAttributesTableSelector = (): string => { + return this.repository.getAttributesTableSelector(); + } + getDrawer = (): Cypress.Chainable => { const drawer = this.repository.getDrawer(); diff --git a/cypress/support/pages/mp/products/products-repository.ts b/cypress/support/pages/mp/products/products-repository.ts index 6d52686c..6a5eec4a 100644 --- a/cypress/support/pages/mp/products/products-repository.ts +++ b/cypress/support/pages/mp/products/products-repository.ts @@ -8,4 +8,6 @@ export class ProductsRepository { getSearchSelector = (): string => '.spy-table-search-feature input[type="text"]'; getSaveButtonSelector = (): string => 'button:contains("Save")'; getDrawer = (): Cypress.Chainable => cy.get('.spy-drawer-wrapper'); + getAddAttributeButton = (): Cypress.Chainable => cy.get('.product-attributes-table button:contains("Add")'); + getAttributesTableSelector = (): string => '.product-attributes-table'; } diff --git a/cypress/support/types/mp/index.ts b/cypress/support/types/mp/index.ts index 7e1f4c4d..1f288a33 100644 --- a/cypress/support/types/mp/index.ts +++ b/cypress/support/types/mp/index.ts @@ -2,3 +2,4 @@ export * from './marketplace-agent-assist'; export * from './merchant-b2b-contract-requests'; export * from './marketplace-merchant-commission'; export * from './marketplace-product-concretes'; +export * from './marketplace-products'; diff --git a/cypress/support/types/mp/marketplace-products.ts b/cypress/support/types/mp/marketplace-products.ts new file mode 100644 index 00000000..4aa0459a --- /dev/null +++ b/cypress/support/types/mp/marketplace-products.ts @@ -0,0 +1,13 @@ +import { Merchant, ProductConcrete, User } from './shared'; + +export interface ProductManagementDynamicFixtures { + merchant: Merchant; + merchantUser: User; + + concreteProduct1: ProductConcrete; + concreteProduct2: ProductConcrete; +} + +export interface ProductManagementStaticFixtures { + defaultPassword: string; +} From 5efd87c99821d7d5eebdba5d34f276c69537403c Mon Sep 17 00:00:00 2001 From: Alexey Kravchenko Date: Thu, 21 Nov 2024 13:35:54 +0200 Subject: [PATCH 2/6] SUPESC-871: fix prettier --- .../product-attribute-management.cy.ts | 11 +++++---- .../dynamic-product-attribute-management.json | 24 +++++++++++++++---- .../dynamic-product-attribute-management.json | 24 +++++++++++++++---- .../dynamic-product-attribute-management.json | 24 +++++++++++++++---- .../pages/mp/products/products-page.ts | 6 ++--- 5 files changed, 70 insertions(+), 19 deletions(-) diff --git a/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts index bee1e413..ece3e968 100644 --- a/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts +++ b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts @@ -29,10 +29,13 @@ import { MerchantUserLoginScenario } from '@scenarios/mp'; cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract').as('createAttribute'); cy.wait('@dataTable').then(() => { - cy.get(productPage.getAttributesTableSelector()).scrollIntoView().should('be.visible').then(() => { - productPage.getAddAttributeButton().click(); - cy.get('@createAttribute.all').should('have.length', 0); - }); + cy.get(productPage.getAttributesTableSelector()) + .scrollIntoView() + .should('be.visible') + .then(() => { + productPage.getAddAttributeButton().click(); + cy.get('@createAttribute.all').should('have.length', 0); + }); }); }); } diff --git a/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 840a8252..44527afc 100644 --- a/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -79,8 +79,16 @@ { "idTaxSet": 1, "localizedAttributes": [ - { "locale": "#localeEN", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] }, - { "locale": "#localeDE", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] } + { + "locale": "#localeEN", + "name": "#localizedAttribute1.name", + "attributes": ["attribute1", "attribute2"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute1.name", + "attributes": ["attribute1", "attribute2"] + } ] } ] @@ -96,8 +104,16 @@ { "idTaxSet": 1, "localizedAttributes": [ - { "locale": "#localeEN", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] }, - { "locale": "#localeDE", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] } + { + "locale": "#localeEN", + "name": "#localizedAttribute2.name", + "attributes": ["attribute1", "attribute2"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute2.name", + "attributes": ["attribute1", "attribute2"] + } ] } ] diff --git a/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 840a8252..44527afc 100644 --- a/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -79,8 +79,16 @@ { "idTaxSet": 1, "localizedAttributes": [ - { "locale": "#localeEN", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] }, - { "locale": "#localeDE", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] } + { + "locale": "#localeEN", + "name": "#localizedAttribute1.name", + "attributes": ["attribute1", "attribute2"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute1.name", + "attributes": ["attribute1", "attribute2"] + } ] } ] @@ -96,8 +104,16 @@ { "idTaxSet": 1, "localizedAttributes": [ - { "locale": "#localeEN", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] }, - { "locale": "#localeDE", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] } + { + "locale": "#localeEN", + "name": "#localizedAttribute2.name", + "attributes": ["attribute1", "attribute2"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute2.name", + "attributes": ["attribute1", "attribute2"] + } ] } ] diff --git a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 840a8252..44527afc 100644 --- a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -79,8 +79,16 @@ { "idTaxSet": 1, "localizedAttributes": [ - { "locale": "#localeEN", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] }, - { "locale": "#localeDE", "name": "#localizedAttribute1.name", "attributes": ["attribute1", "attribute2"] } + { + "locale": "#localeEN", + "name": "#localizedAttribute1.name", + "attributes": ["attribute1", "attribute2"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute1.name", + "attributes": ["attribute1", "attribute2"] + } ] } ] @@ -96,8 +104,16 @@ { "idTaxSet": 1, "localizedAttributes": [ - { "locale": "#localeEN", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] }, - { "locale": "#localeDE", "name": "#localizedAttribute2.name", "attributes": ["attribute1", "attribute2"] } + { + "locale": "#localeEN", + "name": "#localizedAttribute2.name", + "attributes": ["attribute1", "attribute2"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute2.name", + "attributes": ["attribute1", "attribute2"] + } ] } ] diff --git a/cypress/support/pages/mp/products/products-page.ts b/cypress/support/pages/mp/products/products-page.ts index 19eaf09a..7f10484d 100644 --- a/cypress/support/pages/mp/products/products-page.ts +++ b/cypress/support/pages/mp/products/products-page.ts @@ -27,15 +27,15 @@ export class ProductsPage extends MpPage { getFirstTableRow = (): Cypress.Chainable => { return this.repository.getFirstTableRow(); - } + }; getAddAttributeButton = (): Cypress.Chainable => { return this.repository.getAddAttributeButton(); - } + }; getAttributesTableSelector = (): string => { return this.repository.getAttributesTableSelector(); - } + }; getDrawer = (): Cypress.Chainable => { const drawer = this.repository.getDrawer(); From 91f36a26748d540f4569c48bd82926140ee5c605 Mon Sep 17 00:00:00 2001 From: Alexey Kravchenko Date: Thu, 21 Nov 2024 13:57:51 +0200 Subject: [PATCH 3/6] SUPESC-871: refactoring --- .../product-attribute-management.cy.ts | 13 +------------ .../support/pages/mp/products/products-page.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts index ece3e968..19f8537c 100644 --- a/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts +++ b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts @@ -25,18 +25,7 @@ import { MerchantUserLoginScenario } from '@scenarios/mp'; productPage.visit(); productPage.getFirstTableRow().click(); - cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract/table-data**').as('dataTable'); - cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract').as('createAttribute'); - - cy.wait('@dataTable').then(() => { - cy.get(productPage.getAttributesTableSelector()) - .scrollIntoView() - .should('be.visible') - .then(() => { - productPage.getAddAttributeButton().click(); - cy.get('@createAttribute.all').should('have.length', 0); - }); - }); + productPage.clickAddAttributeButton(); }); } ); diff --git a/cypress/support/pages/mp/products/products-page.ts b/cypress/support/pages/mp/products/products-page.ts index 7f10484d..bc99aaf2 100644 --- a/cypress/support/pages/mp/products/products-page.ts +++ b/cypress/support/pages/mp/products/products-page.ts @@ -33,6 +33,22 @@ export class ProductsPage extends MpPage { return this.repository.getAddAttributeButton(); }; + clickAddAttributeButton = (): void => { + cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract/table-data**').as('dataTable'); + cy.intercept('GET', '/product-merchant-portal-gui/update-product-abstract').as('createAttribute'); + + cy.wait('@dataTable').then(() => { + cy.get(this.repository.getAttributesTableSelector()).as('attributesTable'); + cy.get('@attributesTable').scrollIntoView(); + cy.get('@attributesTable') + .should('be.visible') + .then(() => { + this.repository.getAddAttributeButton().click(); + cy.get('@createAttribute.all').should('have.length', 0); + }); + }); + } + getAttributesTableSelector = (): string => { return this.repository.getAttributesTableSelector(); }; From 562ac59792ee8e8a8fbfd3176f480cf4ad790025 Mon Sep 17 00:00:00 2001 From: Alexey Kravchenko Date: Thu, 21 Nov 2024 14:00:30 +0200 Subject: [PATCH 4/6] SUPESC-871: fix prettier --- cypress/support/pages/mp/products/products-page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/support/pages/mp/products/products-page.ts b/cypress/support/pages/mp/products/products-page.ts index bc99aaf2..46cf2357 100644 --- a/cypress/support/pages/mp/products/products-page.ts +++ b/cypress/support/pages/mp/products/products-page.ts @@ -47,7 +47,7 @@ export class ProductsPage extends MpPage { cy.get('@createAttribute.all').should('have.length', 0); }); }); - } + }; getAttributesTableSelector = (): string => { return this.repository.getAttributesTableSelector(); From 75f0cb3ef106ec588c706be644211d9e95cf7cb1 Mon Sep 17 00:00:00 2001 From: Alexey Kravchenko Date: Fri, 22 Nov 2024 16:14:54 +0200 Subject: [PATCH 5/6] SUPESC-871: removed unnecessary demodata --- .../dynamic-product-attribute-management.json | 8 ++------ .../dynamic-product-attribute-management.json | 8 ++------ .../dynamic-product-attribute-management.json | 6 ++---- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 44527afc..aef2016d 100644 --- a/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -73,9 +73,7 @@ "name": "haveFullProduct", "key": "concreteProduct1", "arguments": [ - { - "attributes": ["attribute1", "attribute2"] - }, + {}, { "idTaxSet": 1, "localizedAttributes": [ @@ -98,9 +96,7 @@ "name": "haveFullProduct", "key": "concreteProduct2", "arguments": [ - { - "attributes": ["attribute1", "attribute2"] - }, + {}, { "idTaxSet": 1, "localizedAttributes": [ diff --git a/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 44527afc..aef2016d 100644 --- a/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -73,9 +73,7 @@ "name": "haveFullProduct", "key": "concreteProduct1", "arguments": [ - { - "attributes": ["attribute1", "attribute2"] - }, + {}, { "idTaxSet": 1, "localizedAttributes": [ @@ -98,9 +96,7 @@ "name": "haveFullProduct", "key": "concreteProduct2", "arguments": [ - { - "attributes": ["attribute1", "attribute2"] - }, + {}, { "idTaxSet": 1, "localizedAttributes": [ diff --git a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 44527afc..7fe3086d 100644 --- a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -74,7 +74,6 @@ "key": "concreteProduct1", "arguments": [ { - "attributes": ["attribute1", "attribute2"] }, { "idTaxSet": 1, @@ -99,7 +98,6 @@ "key": "concreteProduct2", "arguments": [ { - "attributes": ["attribute1", "attribute2"] }, { "idTaxSet": 1, @@ -107,12 +105,12 @@ { "locale": "#localeEN", "name": "#localizedAttribute2.name", - "attributes": ["attribute1", "attribute2"] + "attributes": ["attribute3", "attribute4"] }, { "locale": "#localeDE", "name": "#localizedAttribute2.name", - "attributes": ["attribute1", "attribute2"] + "attributes": ["attribute3", "attribute4"] } ] } From 8dac3d4c5caf14d20d88b84a64e5f755788e0dc9 Mon Sep 17 00:00:00 2001 From: Alexey Kravchenko Date: Fri, 22 Nov 2024 16:19:09 +0200 Subject: [PATCH 6/6] SUPESC-871: fix prettier --- .../dynamic-product-attribute-management.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json index 7fe3086d..efe55d27 100644 --- a/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json +++ b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -73,8 +73,7 @@ "name": "haveFullProduct", "key": "concreteProduct1", "arguments": [ - { - }, + {}, { "idTaxSet": 1, "localizedAttributes": [ @@ -97,8 +96,7 @@ "name": "haveFullProduct", "key": "concreteProduct2", "arguments": [ - { - }, + {}, { "idTaxSet": 1, "localizedAttributes": [