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..19f8537c --- /dev/null +++ b/cypress/e2e/mp/marketplace-product-attributes/product-attribute-management.cy.ts @@ -0,0 +1,31 @@ +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(); + productPage.clickAddAttributeButton(); + }); + } +); 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..aef2016d --- /dev/null +++ b/cypress/fixtures/b2b-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -0,0 +1,204 @@ +{ + "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": [ + {}, + { + "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": [ + {}, + { + "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..aef2016d --- /dev/null +++ b/cypress/fixtures/b2c-mp/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -0,0 +1,204 @@ +{ + "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": [ + {}, + { + "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": [ + {}, + { + "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..efe55d27 --- /dev/null +++ b/cypress/fixtures/suite/mp/marketplace-product-attributes/dynamic-product-attribute-management.json @@ -0,0 +1,204 @@ +{ + "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": [ + {}, + { + "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": [ + {}, + { + "idTaxSet": 1, + "localizedAttributes": [ + { + "locale": "#localeEN", + "name": "#localizedAttribute2.name", + "attributes": ["attribute3", "attribute4"] + }, + { + "locale": "#localeDE", + "name": "#localizedAttribute2.name", + "attributes": ["attribute3", "attribute4"] + } + ] + } + ] + }, + { + "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 17d4bc0e..46cf2357 100644 --- a/cypress/support/pages/mp/products/products-page.ts +++ b/cypress/support/pages/mp/products/products-page.ts @@ -25,6 +25,34 @@ export class ProductsPage extends MpPage { return this.repository.getFirstTableRow(); }; + getFirstTableRow = (): Cypress.Chainable => { + return this.repository.getFirstTableRow(); + }; + + getAddAttributeButton = (): Cypress.Chainable => { + 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(); + }; + 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 93195551..9d17f68d 100644 --- a/cypress/support/pages/mp/products/products-repository.ts +++ b/cypress/support/pages/mp/products/products-repository.ts @@ -10,4 +10,6 @@ export class ProductsRepository { getTaxIdSelector = (): string => 'select[name="productAbstract[idTaxSet]"]'; getTaxIdOptionSelector = (): string => 'select[name="productAbstract[idTaxSet]"] > option'; 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; +}