From 5b2999aca7c3f6f41054a2a9bf5e09b09d4fc897 Mon Sep 17 00:00:00 2001 From: Dmytro Asieiev Date: Mon, 4 Mar 2024 12:37:33 +0300 Subject: [PATCH] Adjusted fixtures, removed types from pages. --- .../comments/dynamic/comments-suite-1.json | 54 +++----------- .../dynamic/order-management-suite-1.json | 33 ++------- .../dynamic/return-management-suite-1.json | 38 ++-------- .../marketplace-agent-assist-suite-1.json | 73 +++---------------- .../marketplace-agent-assist-suite-2.json | 71 ++++-------------- .../checkout/dynamic/checkout-suite-1.json | 43 ++--------- .../comments/dynamic/comments-suite-1.json | 54 +++----------- .../create/merchant-user-create-page.ts | 16 ++-- .../merchant/create/merchant-create-page.ts | 4 +- .../user/create/user-create-page.ts | 20 ++--- .../checkout/address/checkout-address-page.ts | 26 ++----- .../scenarios/yves/checkout-scenario.ts | 2 +- 12 files changed, 94 insertions(+), 340 deletions(-) diff --git a/cypress/fixtures/b2b/yves/comments/dynamic/comments-suite-1.json b/cypress/fixtures/b2b/yves/comments/dynamic/comments-suite-1.json index ad0249b8..bce312ee 100644 --- a/cypress/fixtures/b2b/yves/comments/dynamic/comments-suite-1.json +++ b/cypress/fixtures/b2b/yves/comments/dynamic/comments-suite-1.json @@ -8,21 +8,13 @@ "type": "transfer", "name": "LocaleTransfer", "key": "locale", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "helper", "name": "haveCustomer", "key": "customer", - "arguments": [ - { - "locale": "#locale", - "password": "change123" - } - ] + "arguments": [{ "locale": "#locale", "password": "change123" }] }, { "type": "helper", @@ -34,21 +26,17 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1 - } + "arguments": { "id_store": 1 } }, { "type": "helper", "name": "haveFullProduct", - "key": "productOne", - "arguments": [] + "key": "productOne" }, { "type": "helper", "name": "haveFullProduct", - "key": "productTwo", - "arguments": [] + "key": "productTwo" }, { "type": "helper", @@ -57,10 +45,7 @@ { "skuProductAbstract": "#productOne.abstract_sku", "skuProduct": "#productOne.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, @@ -71,34 +56,19 @@ { "skuProductAbstract": "#productTwo.abstract_sku", "skuProduct": "#productTwo.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, { "type": "helper", "name": "haveProductInStockForStore", - "arguments": [ - "#store", - { - "sku": "#productOne.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#productOne.sku", "isNeverOutOfStock": "1" }] }, { "type": "helper", "name": "haveProductInStockForStore", - "arguments": [ - "#store", - { - "sku": "#productTwo.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#productTwo.sku", "isNeverOutOfStock": "1" }] }, { "type": "transfer", @@ -159,11 +129,7 @@ "type": "helper", "name": "havePersistentQuote", "key": "emptyQuote", - "arguments": [ - { - "customer": "#customer" - } - ] + "arguments": [{ "customer": "#customer" }] } ] } diff --git a/cypress/fixtures/suite/backoffice/order-management/dynamic/order-management-suite-1.json b/cypress/fixtures/suite/backoffice/order-management/dynamic/order-management-suite-1.json index 5ab76c19..177aa115 100644 --- a/cypress/fixtures/suite/backoffice/order-management/dynamic/order-management-suite-1.json +++ b/cypress/fixtures/suite/backoffice/order-management/dynamic/order-management-suite-1.json @@ -8,29 +8,19 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1 - } + "arguments": { "id_store": 1 } }, { "type": "transfer", "name": "LocaleTransfer", "key": "locale", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "helper", "name": "haveCustomer", "key": "customer", - "arguments": [ - { - "locale": "#locale", - "password": "change123" - } - ] + "arguments": [{ "locale": "#locale", "password": "change123" }] }, { "type": "helper", @@ -41,8 +31,7 @@ { "type": "helper", "name": "haveFullProduct", - "key": "product", - "arguments": [] + "key": "product" }, { "type": "transfer", @@ -84,13 +73,7 @@ "type": "helper", "name": "haveProductInStockForStore", "key": "productWithPriceAndStore", - "arguments": [ - "#store", - { - "sku": "#product.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#product.sku", "isNeverOutOfStock": "1" }] }, { "type": "helper", @@ -115,11 +98,7 @@ "type": "helper", "name": "haveUser", "key": "rootUser", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", diff --git a/cypress/fixtures/suite/backoffice/return-management/dynamic/return-management-suite-1.json b/cypress/fixtures/suite/backoffice/return-management/dynamic/return-management-suite-1.json index 5b8a0be4..b9edc3b5 100644 --- a/cypress/fixtures/suite/backoffice/return-management/dynamic/return-management-suite-1.json +++ b/cypress/fixtures/suite/backoffice/return-management/dynamic/return-management-suite-1.json @@ -8,11 +8,7 @@ "type": "helper", "name": "haveUser", "key": "rootUser", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", @@ -23,29 +19,19 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1 - } + "arguments": { "id_store": 1 } }, { "type": "transfer", "name": "LocaleTransfer", "key": "locale", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "helper", "name": "haveCustomer", "key": "customer", - "arguments": [ - { - "locale": "#locale", - "password": "change123" - } - ] + "arguments": [{ "locale": "#locale", "password": "change123" }] }, { "type": "helper", @@ -56,8 +42,7 @@ { "type": "helper", "name": "haveFullProduct", - "key": "product", - "arguments": [] + "key": "product" }, { "type": "transfer", @@ -88,10 +73,7 @@ { "skuProductAbstract": "#product.abstract_sku", "skuProduct": "#product.sku", - "moneyValue": { - "netAmount": 50000, - "grossAmount": 50000 - } + "moneyValue": { "netAmount": 50000, "grossAmount": 50000 } } ] }, @@ -99,13 +81,7 @@ "type": "helper", "name": "haveProductInStockForStore", "key": "productWithPriceAndStore", - "arguments": [ - "#store", - { - "sku": "#product.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#product.sku", "isNeverOutOfStock": "1" }] }, { "type": "helper", diff --git a/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-1.json b/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-1.json index 0ea2a9be..b973e1a4 100644 --- a/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-1.json +++ b/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-1.json @@ -8,11 +8,7 @@ "type": "helper", "name": "haveUser", "key": "rootUser", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", @@ -23,12 +19,7 @@ "type": "helper", "name": "haveUser", "key": "merchantAgentUser", - "arguments": [ - { - "password": "change123", - "isMerchantAgent": true - } - ] + "arguments": [{ "password": "change123", "isMerchantAgent": true }] }, { "type": "helper", @@ -39,12 +30,7 @@ "type": "helper", "name": "haveUser", "key": "customerAgentUser", - "arguments": [ - { - "password": "change123", - "isAgent": true - } - ] + "arguments": [{ "password": "change123", "isAgent": true }] }, { "type": "helper", @@ -55,33 +41,19 @@ "type": "helper", "name": "haveUser", "key": "merchantUser", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", "name": "haveUser", "key": "deactivatedMerchantUser", - "arguments": [ - { - "password": "change123", - "status": "blocked" - } - ] + "arguments": [{ "password": "change123", "status": "blocked" }] }, { "type": "helper", "name": "haveUser", "key": "deletedMerchantUser", - "arguments": [ - { - "password": "change123", - "status": "deleted" - } - ] + "arguments": [{ "password": "change123", "status": "deleted" }] }, { "type": "builder", @@ -92,10 +64,7 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1, - "name": "DE" - } + "arguments": { "id_store": 1, "name": "DE" } }, { "type": "arrayObject", @@ -106,19 +75,13 @@ "type": "transfer", "name": "LocaleTransfer", "key": "localeEN", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "transfer", "name": "LocaleTransfer", "key": "localeDE", - "arguments": { - "id_locale": 46, - "locale_name": "de_DE" - } + "arguments": { "id_locale": 46, "locale_name": "de_DE" } }, { "type": "helper", @@ -198,11 +161,7 @@ "type": "helper", "name": "haveUser", "key": "merchantUserFromInactiveApprovedMerchant", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", @@ -233,11 +192,7 @@ "type": "helper", "name": "haveUser", "key": "merchantUserFromActiveDeniedMerchant", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", @@ -268,11 +223,7 @@ "type": "helper", "name": "haveUser", "key": "merchantUserFromInactiveDeniedMerchant", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", diff --git a/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-2.json b/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-2.json index 8c7ab6c6..f1ba5aad 100644 --- a/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-2.json +++ b/cypress/fixtures/suite/mp/marketplace-agent-assist/dynamic/marketplace-agent-assist-suite-2.json @@ -8,11 +8,7 @@ "type": "helper", "name": "haveUser", "key": "rootUser", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "helper", @@ -23,12 +19,7 @@ "type": "helper", "name": "haveUser", "key": "merchantAgentUser", - "arguments": [ - { - "password": "change123", - "isMerchantAgent": true - } - ] + "arguments": [{ "password": "change123", "isMerchantAgent": true }] }, { "type": "helper", @@ -39,11 +30,7 @@ "type": "helper", "name": "haveUser", "key": "merchantUser", - "arguments": [ - { - "password": "change123" - } - ] + "arguments": [{ "password": "change123" }] }, { "type": "builder", @@ -54,10 +41,7 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1, - "name": "DE" - } + "arguments": { "id_store": 1, "name": "DE" } }, { "type": "arrayObject", @@ -68,30 +52,19 @@ "type": "transfer", "name": "LocaleTransfer", "key": "localeEN", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "transfer", "name": "LocaleTransfer", "key": "localeDE", - "arguments": { - "id_locale": 46, - "locale_name": "de_DE" - } + "arguments": { "id_locale": 46, "locale_name": "de_DE" } }, { "type": "helper", "name": "haveCustomer", "key": "customer", - "arguments": [ - { - "locale": "#localeEN", - "password": "change123" - } - ] + "arguments": [{ "locale": "#localeEN", "password": "change123" }] }, { "type": "helper", @@ -156,14 +129,8 @@ { "idTaxSet": 1, "localizedAttributes": [ - { - "locale": "#localeEN", - "name": "#localizedAttribute.name" - }, - { - "locale": "#localeDE", - "name": "#localizedAttribute.name" - } + { "locale": "#localeEN", "name": "#localizedAttribute.name" }, + { "locale": "#localeDE", "name": "#localizedAttribute.name" } ] } ] @@ -198,14 +165,8 @@ { "idTaxSet": 1, "localizedAttributes": [ - { - "locale": "#localeEN", - "name": "#localizedAttribute.name" - }, - { - "locale": "#localeDE", - "name": "#localizedAttribute.name" - } + { "locale": "#localeEN", "name": "#localizedAttribute.name" }, + { "locale": "#localeDE", "name": "#localizedAttribute.name" } ] } ] @@ -229,10 +190,7 @@ { "skuProductAbstract": "#productConcreteForOffer.abstract_sku", "skuProduct": "#productConcreteForOffer.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, @@ -243,10 +201,7 @@ { "skuProductAbstract": "#productConcreteForMerchant.abstract_sku", "skuProduct": "#productConcreteForMerchant.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, diff --git a/cypress/fixtures/suite/yves/checkout/dynamic/checkout-suite-1.json b/cypress/fixtures/suite/yves/checkout/dynamic/checkout-suite-1.json index b7ae5486..9aa147fb 100644 --- a/cypress/fixtures/suite/yves/checkout/dynamic/checkout-suite-1.json +++ b/cypress/fixtures/suite/yves/checkout/dynamic/checkout-suite-1.json @@ -8,29 +8,19 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1 - } + "arguments": { "id_store": 1 } }, { "type": "transfer", "name": "LocaleTransfer", "key": "locale", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "helper", "name": "haveCustomer", "key": "customer", - "arguments": [ - { - "locale": "#locale", - "password": "change123" - } - ] + "arguments": [{ "locale": "#locale", "password": "change123" }] }, { "type": "helper", @@ -41,8 +31,7 @@ { "type": "helper", "name": "haveFullProduct", - "key": "productOne", - "arguments": [] + "key": "productOne" }, { "type": "transfer", @@ -68,8 +57,7 @@ { "type": "helper", "name": "haveFullProduct", - "key": "productTwo", - "arguments": [] + "key": "productTwo" }, { "type": "helper", @@ -106,10 +94,7 @@ { "skuProductAbstract": "#productTwo.abstract_sku", "skuProduct": "#productTwo.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, @@ -117,25 +102,13 @@ "type": "helper", "name": "haveProductInStockForStore", "key": "productOneWithPriceAndStore", - "arguments": [ - "#store", - { - "sku": "#productOne.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#productOne.sku", "isNeverOutOfStock": "1" }] }, { "type": "helper", "name": "haveProductInStockForStore", "key": "productTwoWithPriceAndStore", - "arguments": [ - "#store", - { - "sku": "#productTwo.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#productTwo.sku", "isNeverOutOfStock": "1" }] }, { "type": "helper", diff --git a/cypress/fixtures/suite/yves/comments/dynamic/comments-suite-1.json b/cypress/fixtures/suite/yves/comments/dynamic/comments-suite-1.json index ad0249b8..bce312ee 100644 --- a/cypress/fixtures/suite/yves/comments/dynamic/comments-suite-1.json +++ b/cypress/fixtures/suite/yves/comments/dynamic/comments-suite-1.json @@ -8,21 +8,13 @@ "type": "transfer", "name": "LocaleTransfer", "key": "locale", - "arguments": { - "id_locale": 66, - "locale_name": "en_US" - } + "arguments": { "id_locale": 66, "locale_name": "en_US" } }, { "type": "helper", "name": "haveCustomer", "key": "customer", - "arguments": [ - { - "locale": "#locale", - "password": "change123" - } - ] + "arguments": [{ "locale": "#locale", "password": "change123" }] }, { "type": "helper", @@ -34,21 +26,17 @@ "type": "transfer", "name": "StoreTransfer", "key": "store", - "arguments": { - "id_store": 1 - } + "arguments": { "id_store": 1 } }, { "type": "helper", "name": "haveFullProduct", - "key": "productOne", - "arguments": [] + "key": "productOne" }, { "type": "helper", "name": "haveFullProduct", - "key": "productTwo", - "arguments": [] + "key": "productTwo" }, { "type": "helper", @@ -57,10 +45,7 @@ { "skuProductAbstract": "#productOne.abstract_sku", "skuProduct": "#productOne.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, @@ -71,34 +56,19 @@ { "skuProductAbstract": "#productTwo.abstract_sku", "skuProduct": "#productTwo.sku", - "moneyValue": { - "netAmount": 30000, - "grossAmount": 30000 - } + "moneyValue": { "netAmount": 30000, "grossAmount": 30000 } } ] }, { "type": "helper", "name": "haveProductInStockForStore", - "arguments": [ - "#store", - { - "sku": "#productOne.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#productOne.sku", "isNeverOutOfStock": "1" }] }, { "type": "helper", "name": "haveProductInStockForStore", - "arguments": [ - "#store", - { - "sku": "#productTwo.sku", - "isNeverOutOfStock": "1" - } - ] + "arguments": ["#store", { "sku": "#productTwo.sku", "isNeverOutOfStock": "1" }] }, { "type": "transfer", @@ -159,11 +129,7 @@ "type": "helper", "name": "havePersistentQuote", "key": "emptyQuote", - "arguments": [ - { - "customer": "#customer" - } - ] + "arguments": [{ "customer": "#customer" }] } ] } diff --git a/cypress/support/pages/backoffice/merchant-user/create/merchant-user-create-page.ts b/cypress/support/pages/backoffice/merchant-user/create/merchant-user-create-page.ts index 7ba8e726..00bb4de1 100644 --- a/cypress/support/pages/backoffice/merchant-user/create/merchant-user-create-page.ts +++ b/cypress/support/pages/backoffice/merchant-user/create/merchant-user-create-page.ts @@ -13,16 +13,14 @@ export class MerchantUserCreatePage extends BackofficePage { super(); } - public createMerchantUser = (merchantUser?: MerchantUser): MerchantUser => { - if (!merchantUser) { - const uniquePrefix: string = this.faker.number.int({ min: 1000, max: 9999 }).toString(); + public createMerchantUser = () => { + const uniquePrefix: string = this.faker.number.int({ min: 1000, max: 9999 }).toString(); - merchantUser = { - username: this.faker.internet.email(), - firstName: uniquePrefix + '_' + this.faker.person.firstName(), - lastName: uniquePrefix + '_' + this.faker.person.lastName(), - }; - } + const merchantUser = { + username: this.faker.internet.email(), + firstName: uniquePrefix + '_' + this.faker.person.firstName(), + lastName: uniquePrefix + '_' + this.faker.person.lastName(), + }; this.repository.getEmailInput().clear().type(merchantUser.username); this.repository.getFirstNameInput().clear().type(merchantUser.firstName); diff --git a/cypress/support/pages/backoffice/merchant/create/merchant-create-page.ts b/cypress/support/pages/backoffice/merchant/create/merchant-create-page.ts index 12be878c..159f5c0b 100644 --- a/cypress/support/pages/backoffice/merchant/create/merchant-create-page.ts +++ b/cypress/support/pages/backoffice/merchant/create/merchant-create-page.ts @@ -13,10 +13,10 @@ export class MerchantCreatePage extends BackofficePage { super(); } - public createMerchant = (): Merchant => { + public createMerchant = () => { const identifier: string = this.faker.string.uuid(); - const merchant: Merchant = { + const merchant = { name: 'Name: ' + identifier, reference: 'ref-' + identifier, email: this.faker.internet.email(), diff --git a/cypress/support/pages/backoffice/user/create/user-create-page.ts b/cypress/support/pages/backoffice/user/create/user-create-page.ts index 8ef7337b..a2acdcec 100644 --- a/cypress/support/pages/backoffice/user/create/user-create-page.ts +++ b/cypress/support/pages/backoffice/user/create/user-create-page.ts @@ -16,13 +16,13 @@ export class UserCreatePage extends BackofficePage { super(); } - public createRootUser = (): User => { - const user: User = { + public createRootUser = () => { + const user = { username: this.faker.internet.email(), password: this.DEFAULT_PASSWORD, }; - this.fillCreateUserForm(user); + this.fillCreateUserForm(user.username, user.password); this.repository.getRootGroupCheckbox().check(); this.repository.getCreateUserButton().click(); @@ -31,13 +31,13 @@ export class UserCreatePage extends BackofficePage { return user; }; - public createAgentMerchantUser = (): User => { - const user: User = { + public createAgentMerchantUser = () => { + const user = { username: this.faker.internet.email(), password: this.DEFAULT_PASSWORD, }; - this.fillCreateUserForm(user); + this.fillCreateUserForm(user.username, user.password); this.repository.getRootGroupCheckbox().check(); this.repository.getAgentMerchantCheckbox().check(); @@ -47,10 +47,10 @@ export class UserCreatePage extends BackofficePage { return user; }; - private fillCreateUserForm = (user: User): void => { - this.repository.getUsernameInput().clear().type(user.username); - this.repository.getPasswordInput().clear().type(user.password); - this.repository.getRepeatPasswordInput().clear().type(user.password); + private fillCreateUserForm = (username: string, password: string): void => { + this.repository.getUsernameInput().clear().type(username); + this.repository.getPasswordInput().clear().type(password); + this.repository.getRepeatPasswordInput().clear().type(password); this.repository.getFirstNameInput().clear().type(this.faker.person.firstName()); this.repository.getLastNameInput().clear().type(this.faker.person.lastName()); this.repository.getInterfaceLanguageSelect().select(this.EN_LOCALE_VALUE); diff --git a/cypress/support/pages/yves/checkout/address/checkout-address-page.ts b/cypress/support/pages/yves/checkout/address/checkout-address-page.ts index f5fcd46c..f3d128c4 100644 --- a/cypress/support/pages/yves/checkout/address/checkout-address-page.ts +++ b/cypress/support/pages/yves/checkout/address/checkout-address-page.ts @@ -3,7 +3,6 @@ import { TYPES } from '../../../../utils/inversify/types'; import 'reflect-metadata'; import { CheckoutAddressRepository } from './checkout-address-repository'; import { autoWired } from '../../../../utils/inversify/auto-wired'; -import { CheckoutAddress } from '../../../../types/yves/checkout'; import { YvesPage } from '../../yves-page'; @injectable() @@ -15,13 +14,10 @@ export class CheckoutAddressPage extends YvesPage { super(); } - public fillShippingAddress = (checkoutAddress?: CheckoutAddress): void => { + public fillShippingAddress = (): void => { + const checkoutAddress = this.createDummyCheckoutAddress(); this.repository.getSelectShippingAddressField().select('0'); - if (!checkoutAddress) { - checkoutAddress = this.createDummyCheckoutAddress(); - } - // Setting mandatory fields this.repository.getShippingAddressFirstNameField().clear().type(checkoutAddress.firstName); this.repository.getShippingAddressLastNameField().clear().type(checkoutAddress.lastName); @@ -38,21 +34,18 @@ export class CheckoutAddressPage extends YvesPage { this.repository.getNextButton().click(); }; - public fillMultiShippingAddress = (checkoutAddresses?: CheckoutAddress[]): void => { + public fillMultiShippingAddress = (): void => { this.repository.getMultiShipmentTriggerButton().click(); this.repository .getMultiShipmentAddressItemElement() .children() .each(($addressItem, index) => { + const checkoutAddress = this.createDummyCheckoutAddress(); + this.repository.getMultiShipmentAddressItemDeliveryRadio($addressItem).click({ force: true }); this.repository.getMultiShipmentAddressItemAddressField($addressItem).select('0', { force: true }); - let checkoutAddress: CheckoutAddress | null = checkoutAddresses ? checkoutAddresses[index] : null; - if (!checkoutAddress) { - checkoutAddress = this.createDummyCheckoutAddress(); - } - // Setting mandatory fields this.repository .getMultiShipmentAddressItemAddressFirstNameField($addressItem, index) @@ -93,13 +86,10 @@ export class CheckoutAddressPage extends YvesPage { this.fillBillingAddress(); }; - public fillBillingAddress = (checkoutAddress?: CheckoutAddress): void => { + public fillBillingAddress = (): void => { + const checkoutAddress = this.createDummyCheckoutAddress(); this.repository.getSelectBillingAddressField().select('0'); - if (!checkoutAddress) { - checkoutAddress = this.createDummyCheckoutAddress(); - } - // Setting mandatory fields this.repository.getBillingAddressFirstNameField().clear().type(checkoutAddress.firstName); this.repository.getBillingAddressLastNameField().clear().type(checkoutAddress.lastName); @@ -115,7 +105,7 @@ export class CheckoutAddressPage extends YvesPage { this.repository.getNextButton().click(); }; - private createDummyCheckoutAddress = (): CheckoutAddress => { + private createDummyCheckoutAddress = () => { const prefix = '[e2e] '; return { diff --git a/cypress/support/scenarios/yves/checkout-scenario.ts b/cypress/support/scenarios/yves/checkout-scenario.ts index 38ec1a7a..6e68ac05 100644 --- a/cypress/support/scenarios/yves/checkout-scenario.ts +++ b/cypress/support/scenarios/yves/checkout-scenario.ts @@ -37,7 +37,7 @@ export class CheckoutScenario { this.checkoutPaymentPage.setDummyPaymentMethod(); this.checkoutSummaryPage.placeOrder(); - cy.wait(1000); + cy.wait(1000); // Wait for OMS to process the order this.cliHelper.run(['console oms:check-condition', 'console oms:check-timeout']); };