From d67fc23e7888c3d8d87a2d84b8215aeff5a388aa Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 21 Mar 2024 10:34:31 +0100 Subject: [PATCH] UI Tests : Bump `@prestashop-core/ui-testing` to 0.0.11 --- tests/UI/campaigns/cldr/03_deleteCurrency.ts | 47 +++--- .../cldr/04_searchCurrencyByISOCode.ts | 35 ++--- .../cldr/05_searchCurrencyByEnableDisable.ts | 31 ++-- .../cldr/07_editSymbolFormatCurrency.ts | 27 ++-- .../cldr/08_resetSymbolFormatSettings.ts | 23 +-- .../cldr/09_enableDisableCurrency.ts | 36 +++-- .../02_deleteAPICustomerGroupsId.ts | 7 +- .../04_putAPICustomerGroupsId.ts | 9 +- .../BO/01_dashboard/02_activityOverview.ts | 14 +- .../BO/02_orders/01_orders/04_updateStatus.ts | 24 +-- .../01_orders/05_bulkUpdateOrdersStatus.ts | 10 +- .../01_orders/06_bulkOpenInNewTab.ts | 20 ++- .../BO/02_orders/01_orders/09_viewGuest.ts | 16 +- .../BO/02_orders/01_orders/10_pagination.ts | 4 +- .../BO/02_orders/01_orders/11_previewOrder.ts | 20 ++- .../createOrders/01_searchViewCustomer.ts | 10 +- .../createOrders/02_createCustomer.ts | 8 +- .../createOrders/03_createSimpleOrderInBO.ts | 8 +- .../createOrders/04_selectPreviousCarts.ts | 10 +- .../createOrders/05_selectPreviousOrders.ts | 26 ++-- .../createOrders/06_addProductToTheCart.ts | 6 +- .../createOrders/08_chooseAddress.ts | 16 +- .../createOrders/09_chooseShipping.ts | 10 +- .../01_orders/createOrders/10_checkSummary.ts | 8 +- .../viewAndEditOrder/01_customerBlock.ts | 28 ++-- .../viewAndEditOrder/02_productBlock.ts | 16 +- .../viewAndEditOrder/03_statusTab.ts | 32 ++-- .../viewAndEditOrder/04_documentsTab.ts | 18 +-- .../viewAndEditOrder/05_carriersTab.ts | 4 +- .../06_merchandiseReturnsTab.ts | 14 +- .../viewAndEditOrder/07_messagesBlock.ts | 4 +- .../viewAndEditOrder/08_paymentBlock.ts | 22 +-- .../viewAndEditOrder/09_addDiscount.ts | 4 +- .../viewAndEditOrder/10_changeStatus.ts | 38 ++--- .../viewAndEditOrder/11_checkInvoice.ts | 20 +-- .../viewAndEditOrder/12_checkMultiInvoice.ts | 10 +- .../viewAndEditOrder/13_returnOrder.ts | 10 +- .../02_invoices/01_generateInvoiceByDate.ts | 12 +- .../02_invoices/02_generateInvoiceByStatus.ts | 18 ++- .../01_enableDisableInvoices.ts | 10 +- .../02_enableDisableTaxBreakdown.ts | 18 +-- .../03_enableDisableProductImage.ts | 14 +- .../03_invoiceOptions/04_invoicePrefix.ts | 12 +- .../05_enableDisableCurrentYear.ts | 12 +- .../03_invoiceOptions/06_otherOptions.ts | 12 +- .../01_createFilterCreditSlips.ts | 12 +- .../02_sortAndPaginationCreditSlips.ts | 12 +- .../03_generateCreditSlipsByDate.ts | 12 +- .../03_creditSlips/04_creditSlipOptions.ts | 14 +- .../01_generateDeliverySlipByDate.ts | 12 +- .../01_deliverySlipPrefix.ts | 14 +- .../02_deliverySlipNumber.ts | 12 +- .../03_enableDisableProductImage.ts | 14 +- .../05_shoppingCarts/02_sortAndPagination.ts | 16 +- .../05_shoppingCarts/03_viewCarts.ts | 22 +-- .../01_products/05_CRUDVirtualProduct.ts | 8 +- .../BO/03_catalog/01_products/12_packTab.ts | 12 +- .../03_catalog/01_products/13_virtualTab.ts | 4 +- .../02_enableDisablePartialUse.ts | 6 +- .../02_conditions/04_checkTotalAvailable.ts | 4 +- .../05_checkTotalAvailableForEachUser.ts | 4 +- .../02_conditions/06_countrySelection.ts | 12 +- .../01_movements/01_filterMovements.ts | 8 +- .../01_customers/02_CRUDCustomer.ts | 10 +- .../01_customers/03_customersBulkActions.ts | 10 +- .../01_customers/08_viewCustomer.ts | 30 ++-- .../11_transformGuestToCustomer.ts | 16 +- .../02_addresses/02_CRUDAddressInBO.ts | 9 +- .../02_addresses/03_addressesBulkActions.ts | 7 +- .../02_addresses/06_setRequiredFields.ts | 8 +- .../03_outstanding/02_viewOrder.ts | 10 +- .../03_outstanding/03_viewInvoice.ts | 10 +- .../03_outstanding/04_pagination.ts | 10 +- .../05_sortFilterOutstanding.ts | 32 ++-- .../01_customerService/06_forwardMessage.ts | 4 +- .../01_merchandiseReturnOptions.ts | 14 +- .../03_merchandiseReturns/02_deleteProduct.ts | 14 +- .../03_merchandiseReturns/03_updateStatus.ts | 12 +- .../09_shipping/01_carriers/01_CRUDCarrier.ts | 8 +- .../01_carriers/02_filterSortAndPagination.ts | 8 +- .../01_carriers/03_quickEditAndBulkActions.ts | 8 +- .../01_handling/01_handlingCharges.ts | 6 +- .../02_carrierOptions/01_defaultCarrier.ts | 6 +- .../02_preferences/02_groupRestrictions.ts | 12 +- .../01_importLocalizationPack.ts | 15 +- .../01_localization/04_defaultCurrency.ts | 19 ++- .../01_localization/05_defaultCountry.ts | 8 +- .../01_createOfficialCurrency.ts | 35 ++--- .../02_createUnofficialCurrency.ts | 35 ++--- .../03_currencies/04_updateExchangeRate.ts | 27 ++-- .../05_filterSortAndPagination.ts | 24 +-- .../01_zones/01_filterAndQuickEditZones.ts | 18 ++- .../02_locations/01_zones/02_CRUDZone.ts | 9 +- .../01_zones/03_bulkActionsZones.ts | 13 +- .../01_zones/04_sortAndPagination.ts | 7 +- .../01_filterAndQuickEditCountries.ts | 22 +-- .../02_countries/02_CRUDCountry.ts | 10 +- .../02_countries/03_bulkActionsCountries.ts | 12 +- .../02_countries/05_countriesRestrictions.ts | 22 ++- .../03_states/01_filterAndQuickEditStates.ts | 22 +-- .../02_locations/03_states/02_CRUDState.ts | 9 +- .../03_states/03_bulkActionsStates.ts | 13 +- .../03_states/04_sortAndPagination.ts | 10 +- .../01_taxes/01_filterAndQuickEditTaxes.ts | 18 ++- .../03_taxes/01_taxes/02_CRUDTaxesInBO.ts | 9 +- .../01_taxes/03_taxesBulkActionsInBO.ts | 9 +- .../02_taxRules/02_filterSortAndPagination.ts | 10 +- .../04_translations/01_modifyTranslation.ts | 4 +- .../general/05_recalculateShippingCosts.ts | 4 +- .../giftOptions/01_giftOptions.ts | 10 +- .../statuses/01_CRUDOrderStatus.ts | 9 +- .../statuses/02_filterSortAndPagination.ts | 12 +- .../02_statuses/statuses/03_quickEdit.ts | 10 +- .../02_statuses/statuses/04_bulkActions.ts | 7 +- .../02_defaultPackStockManagement.ts | 4 +- .../02_sendEmailAfterRegistration.ts | 10 +- .../01_filterSortAndPaginationGroups.ts | 6 +- .../02_groups/02_CRUDGroups.ts | 9 +- .../01_filterSortAndPaginationTitles.ts | 6 +- .../03_titles/02_CRUDTitles.ts | 9 +- .../03_titles/03_bulkActions.ts | 17 ++- .../03_administration/03_notifications.ts | 8 +- .../01_filterDeleteAndBulkActionsEmails.ts | 8 +- .../04_email/03_sortAndPagination.ts | 6 +- .../BO/15_header/08_checkNotifications.ts | 14 +- .../classic/01_login/01_passwordReminder.ts | 10 +- .../FO/classic/01_login/02_login.ts | 10 +- .../FO/classic/01_login/04_createAccount.ts | 8 +- .../02_checkLinksInFooter.ts | 6 +- .../02_headerAndFooter/03_changeCurrency.ts | 29 ++-- .../01_creditSlips/01_consultCreditSlip.ts | 28 ++-- .../03_userAccount/01_editInformation.ts | 26 ++-- .../classic/03_userAccount/02_CRUDAddress.ts | 16 +- .../02_orderHistory/01_consultOrderList.ts | 22 +-- .../01_reorderFromOrderDetails.ts | 6 +- .../01_orderDetails/02_downloadInvoice.ts | 12 +- .../03_requestMerchandiseReturn.ts | 12 +- .../01_orderDetails/04_sendMessage.ts | 12 +- .../02_reorderFromOrderList.ts | 6 +- .../02_orderHistory/03_downloadInvoice.ts | 12 +- .../01_consultReturnDetails.ts | 14 +- .../02_checkOrderReturnPDF.ts | 14 +- .../classic/03_userAccount/03_viewVouchers.ts | 8 +- .../03_userAccount/04_getGDPRDataInPDF.ts | 16 +- .../03_userAccount/05_getGDPRDataInCSV.ts | 16 +- .../04_newsletter/01_subscribeNewsletter.ts | 6 +- .../FO/classic/09_productPage/01_quickView.ts | 5 +- .../01_quickView/01_addToCart.ts | 5 +- .../01_orderAsAGuest.ts | 18 ++- .../01_personalInformation/02_signIn.ts | 6 +- .../03_createAccount.ts | 16 +- .../05_passwordReminder.ts | 10 +- .../02_addresses/01_CRUDAddress.ts | 18 ++- .../02_useDifferentAddressForInvoice.ts | 18 ++- .../03_shippingMethods/01_addOrderMessage.ts | 4 +- .../03_shippingMethods/02_selectCarrier.ts | 14 +- .../04_payment/01_choosePaymentMethod.ts | 14 +- .../12_orderConfirmation/05_contactUs.ts | 4 +- .../01_login/01_passwordReminder.ts | 10 +- .../FO/hummingbird/01_login/02_login.ts | 10 +- .../hummingbird/01_login/04_createAccount.ts | 8 +- .../02_checkLinksInFooter.ts | 6 +- .../02_headerAndFooter/03_changeCurrency.ts | 29 ++-- .../01_creditSlips/01_consultCreditSlip.ts | 28 ++-- .../03_userAccount/01_editInformation.ts | 26 ++-- .../03_userAccount/02_CRUDAddress.ts | 16 +- .../01_consultDetailsAndReorder.ts | 24 +-- .../01_reorderFromOrderDetails.ts | 6 +- .../01_orderDetails/02_downloadInvoice.ts | 12 +- .../03_requestMerchandiseReturn.ts | 12 +- .../01_orderDetails/04_sendMessage.ts | 12 +- .../02_orderHistory/03_downloadInvoice.ts | 12 +- .../01_consultReturnDetails.ts | 14 +- .../02_checkOrderReturnPDF.ts | 14 +- .../03_userAccount/03_viewVoucher.ts | 8 +- .../04_newsletter/01_subscribeNewsletter.ts | 6 +- .../01_quickView/01_addToCart.ts | 5 +- .../01_orderAsAGuest.ts | 18 ++- .../01_personalInformation/02_signIn.ts | 6 +- .../03_createAccount.ts | 16 +- .../05_passwordReminder.ts | 10 +- .../02_addresses/01_CRUDAddress.ts | 18 ++- .../03_shippingMethods/01_addOrderMessage.ts | 4 +- .../03_shippingMethods/02_selectCarrier.ts | 14 +- .../04_payment/01_choosePaymentMethod.ts | 14 +- .../12_orderConfirmation/05_contactUs.ts | 4 +- .../02_statisticsTabSettings.ts | 36 ++--- .../01_installation/04_resetModule.ts | 74 ++++----- .../02_configuration/01_placeOrderWithIt.ts | 84 +++++----- .../01_enableDisableProductAvailability.ts | 10 +- .../02_enableDisableOrderEdit.ts | 4 +- .../01_enableDisableNewOrder.ts | 4 +- .../04_enableDisableReturn.ts | 18 +-- .../checkout/100PercentDiscount_FO.ts | 12 +- .../currencies/computingPrecision_FO.ts | 14 +- .../sanity/02_ordersBO/02_editOrder.ts | 10 +- .../sanity/06_checkoutFO/01_orderProduct.ts | 4 +- tests/UI/commonTests/BO/customers/address.ts | 8 +- tests/UI/commonTests/BO/customers/customer.ts | 18 ++- .../commonTests/BO/international/currency.ts | 13 +- .../commonTests/BO/modules/moduleManager.ts | 10 +- tests/UI/commonTests/FO/classic/account.ts | 16 +- tests/UI/commonTests/FO/classic/loginFO.ts | 8 +- .../UI/commonTests/FO/hummingbird/account.ts | 10 +- tests/UI/data/demo/address.ts | 11 +- tests/UI/data/demo/carriers.ts | 13 +- tests/UI/data/demo/countries.ts | 60 -------- tests/UI/data/demo/currencies.ts | 139 ----------------- tests/UI/data/demo/modules.ts | 35 +++-- tests/UI/data/demo/orderStatuses.ts | 100 ------------ tests/UI/data/demo/orders.ts | 24 +-- tests/UI/data/demo/paymentMethods.ts | 19 --- tests/UI/data/demo/states.ts | 28 ---- tests/UI/data/demo/tax.ts | 16 -- tests/UI/data/demo/taxRule.ts | 14 +- tests/UI/data/demo/taxRuleBehaviour.ts | 1 - tests/UI/data/demo/zones.ts | 44 ------ tests/UI/data/faker/address.ts | 113 -------------- tests/UI/data/faker/brandAddress.ts | 9 +- tests/UI/data/faker/carrier.ts | 144 ------------------ tests/UI/data/faker/cartRule.ts | 8 +- tests/UI/data/faker/catalogPriceRule.ts | 10 +- tests/UI/data/faker/category.ts | 6 +- tests/UI/data/faker/country.ts | 83 ---------- tests/UI/data/faker/currency.ts | 50 ------ tests/UI/data/faker/customer.ts | 121 --------------- tests/UI/data/faker/module.ts | 27 ---- tests/UI/data/faker/order.ts | 40 ++--- tests/UI/data/faker/orderStatus.ts | 82 ---------- tests/UI/data/faker/paymentMethod.ts | 29 ---- tests/UI/data/faker/shoppingCart.ts | 12 +- tests/UI/data/faker/state.ts | 53 ------- tests/UI/data/faker/supplier.ts | 9 +- tests/UI/data/faker/tax.ts | 41 ----- tests/UI/data/faker/taxRule.ts | 52 ------- tests/UI/data/faker/title.ts | 54 ------- tests/UI/data/faker/zone.ts | 31 ---- tests/UI/data/import/addresses.ts | 6 +- tests/UI/data/import/customers.ts | 4 +- tests/UI/data/types/cart.d.ts | 11 -- tests/UI/data/types/cartRule.d.ts | 8 +- tests/UI/data/types/category.d.ts | 8 +- tests/UI/data/types/order.d.ts | 22 +-- tests/UI/data/types/playwright.d.ts | 8 - tests/UI/data/types/shoppingCart.d.ts | 11 +- tests/UI/package-lock.json | 14 +- tests/UI/package.json | 2 +- tests/UI/pages/BO/customers/add.ts | 21 +-- tests/UI/pages/BO/customers/addresses/add.ts | 8 +- .../themeAndLogo/pagesConfiguration/index.ts | 8 +- .../pages/BO/international/currencies/add.ts | 13 +- .../BO/international/currencies/index.ts | 10 +- .../pages/BO/international/locations/add.ts | 8 +- .../international/locations/countries/add.ts | 9 +- .../BO/international/locations/states/add.ts | 8 +- tests/UI/pages/BO/international/taxes/add.ts | 8 +- .../BO/international/taxes/taxRules/add.ts | 9 +- .../pages/BO/modules/blockwishlist/index.ts | 52 ------- .../BO/modules/blockwishlist/statistics.ts | 58 ------- .../pages/BO/modules/moduleManager/index.ts | 29 ++-- tests/UI/pages/BO/orders/add.ts | 22 +-- tests/UI/pages/BO/orders/index.ts | 8 +- .../UI/pages/BO/orders/view/customerBlock.ts | 10 +- tests/UI/pages/BO/shipping/carriers/add.ts | 10 +- .../UI/pages/BO/shipping/preferences/index.ts | 9 +- .../customerSettings/groups/add.ts | 10 +- .../customerSettings/titles/add.ts | 9 +- .../orderSettings/statuses/add.ts | 8 +- tests/UI/pages/FO/classic/checkout/index.ts | 24 +-- tests/UI/pages/FO/classic/login/index.ts | 10 +- tests/UI/pages/FO/classic/modal/blockCart.ts | 5 +- tests/UI/pages/FO/classic/myAccount/add.ts | 10 +- .../pages/FO/classic/myAccount/addAddress.ts | 8 +- tests/UI/pages/commonPage.ts | 5 +- 274 files changed, 1861 insertions(+), 2960 deletions(-) delete mode 100644 tests/UI/data/demo/countries.ts delete mode 100644 tests/UI/data/demo/currencies.ts delete mode 100644 tests/UI/data/demo/orderStatuses.ts delete mode 100644 tests/UI/data/demo/paymentMethods.ts delete mode 100644 tests/UI/data/demo/states.ts delete mode 100644 tests/UI/data/demo/tax.ts delete mode 100644 tests/UI/data/demo/taxRuleBehaviour.ts delete mode 100644 tests/UI/data/demo/zones.ts delete mode 100644 tests/UI/data/faker/address.ts delete mode 100644 tests/UI/data/faker/carrier.ts delete mode 100644 tests/UI/data/faker/country.ts delete mode 100644 tests/UI/data/faker/currency.ts delete mode 100644 tests/UI/data/faker/customer.ts delete mode 100644 tests/UI/data/faker/module.ts delete mode 100644 tests/UI/data/faker/orderStatus.ts delete mode 100644 tests/UI/data/faker/paymentMethod.ts delete mode 100644 tests/UI/data/faker/state.ts delete mode 100644 tests/UI/data/faker/tax.ts delete mode 100644 tests/UI/data/faker/taxRule.ts delete mode 100644 tests/UI/data/faker/title.ts delete mode 100644 tests/UI/data/faker/zone.ts delete mode 100644 tests/UI/data/types/cart.d.ts delete mode 100644 tests/UI/data/types/playwright.d.ts delete mode 100644 tests/UI/pages/BO/modules/blockwishlist/index.ts delete mode 100644 tests/UI/pages/BO/modules/blockwishlist/statistics.ts diff --git a/tests/UI/campaigns/cldr/03_deleteCurrency.ts b/tests/UI/campaigns/cldr/03_deleteCurrency.ts index bb6980f7108db..677792ab78a23 100644 --- a/tests/UI/campaigns/cldr/03_deleteCurrency.ts +++ b/tests/UI/campaigns/cldr/03_deleteCurrency.ts @@ -11,9 +11,10 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; -import CurrencyData from '@data/faker/currency'; +import { + dataCurrencies, + type FakerCurrency, +} from '@prestashop-core/ui-testing'; import {use, expect} from 'chai'; import chaiString from 'chai-string'; @@ -28,10 +29,10 @@ describe('CLDR : Delete a currency', async () => { let page: Page; let numberOfCurrencies: number; - const currencies: CurrencyData[] = [ - Currencies.gbp, - Currencies.jpy, - Currencies.usd, + const currencies: FakerCurrency[] = [ + dataCurrencies.gbp, + dataCurrencies.jpy, + dataCurrencies.usd, ]; before(async function () { @@ -77,7 +78,7 @@ describe('CLDR : Delete a currency', async () => { expect(numberOfCurrencies).to.be.above(0); }); - currencies.forEach((currency: CurrencyData, index : number) => { + currencies.forEach((currency: FakerCurrency, index : number) => { it('should go to create new currency page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddNewCurrencyPage${currency.isoCode}`, baseContext); @@ -109,10 +110,13 @@ describe('CLDR : Delete a currency', async () => { expect(pageTitle).to.contains(localizationPage.pageTitle); }); - it(`should choose '${Currencies.usd.isoCode}' as default currency`, async function () { + it(`should choose '${dataCurrencies.usd.isoCode}' as default currency`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'setUSDAsDefaultCurrency', baseContext); - const textResult = await localizationPage.setDefaultCurrency(page, `${Currencies.usd.name} (${Currencies.usd.isoCode})`); + const textResult = await localizationPage.setDefaultCurrency( + page, + `${dataCurrencies.usd.name} (${dataCurrencies.usd.isoCode})`, + ); expect(textResult).to.contains(localizationPage.successfulSettingsUpdateMessage); }); @@ -125,11 +129,11 @@ describe('CLDR : Delete a currency', async () => { expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code of currency '${Currencies.usd.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.usd.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToUSDCurrency0', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.usd.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.usd.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -137,7 +141,7 @@ describe('CLDR : Delete a currency', async () => { // Check currency const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.usd.isoCode); + expect(textColumn).to.contains(dataCurrencies.usd.isoCode); }); it('should delete currency', async function () { @@ -156,10 +160,13 @@ describe('CLDR : Delete a currency', async () => { expect(pageTitle).to.contains(localizationPage.pageTitle); }); - it(`should choose '${Currencies.euro.isoCode}' as default currency`, async function () { + it(`should choose '${dataCurrencies.euro.isoCode}' as default currency`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'setEURAsDefaultCurrency', baseContext); - const textResult = await localizationPage.setDefaultCurrency(page, `${Currencies.euro.name} (${Currencies.euro.isoCode})`); + const textResult = await localizationPage.setDefaultCurrency( + page, + `${dataCurrencies.euro.name} (${dataCurrencies.euro.isoCode})`, + ); expect(textResult).to.contains(localizationPage.successfulSettingsUpdateMessage); }); @@ -172,11 +179,11 @@ describe('CLDR : Delete a currency', async () => { expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code of currency '${Currencies.usd.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.usd.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToUSDCurrency1', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.usd.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.usd.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -184,7 +191,7 @@ describe('CLDR : Delete a currency', async () => { // Check currency const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.usd.isoCode); + expect(textColumn).to.contains(dataCurrencies.usd.isoCode); }); it('should delete currency', async function () { @@ -194,7 +201,7 @@ describe('CLDR : Delete a currency', async () => { expect(result).to.be.equal(currenciesPage.successfulDeleteMessage); }); - it(`should select rows except '${Currencies.euro.isoCode}'`, async function () { + it(`should select rows except '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'resetAndSelectRowsExceptEUR', baseContext); const numberOfCurrenciesAfterDelete = await currenciesPage.resetAndGetNumberOfLines(page); @@ -206,7 +213,7 @@ describe('CLDR : Delete a currency', async () => { for (let numRow = 1; numRow <= numberOfCurrenciesAfterDelete; numRow++) { const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, numRow, 'iso_code'); - if (textColumn !== Currencies.euro.isoCode) { + if (textColumn !== dataCurrencies.euro.isoCode) { await currenciesPage.selectRow(page, numRow); } } diff --git a/tests/UI/campaigns/cldr/04_searchCurrencyByISOCode.ts b/tests/UI/campaigns/cldr/04_searchCurrencyByISOCode.ts index d79595edcf749..e50275716ae08 100644 --- a/tests/UI/campaigns/cldr/04_searchCurrencyByISOCode.ts +++ b/tests/UI/campaigns/cldr/04_searchCurrencyByISOCode.ts @@ -12,9 +12,10 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; -import CurrencyData from '@data/faker/currency'; +import { + dataCurrencies, + type FakerCurrency, +} from '@prestashop-core/ui-testing'; import {use, expect} from 'chai'; import chaiString from 'chai-string'; @@ -29,11 +30,11 @@ describe('CLDR : Search a currency by ISO code', async () => { let page: Page; let numberOfCurrencies: number; - const installedCurrencies: CurrencyData[] = [ - Currencies.usd, - Currencies.pyg, - Currencies.jpy, - Currencies.gbp, + const installedCurrencies: FakerCurrency[] = [ + dataCurrencies.usd, + dataCurrencies.pyg, + dataCurrencies.jpy, + dataCurrencies.gbp, ]; before(async function () { @@ -79,7 +80,7 @@ describe('CLDR : Search a currency by ISO code', async () => { expect(numberOfCurrencies).to.be.above(0); }); - installedCurrencies.forEach((currency: CurrencyData, index: number) => { + installedCurrencies.forEach((currency: FakerCurrency, index: number) => { it('should go to create new currency page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddNewCurrencyPage${currency.isoCode}`, baseContext); @@ -114,7 +115,7 @@ describe('CLDR : Search a currency by ISO code', async () => { // Check currency const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.euro.isoCode); + expect(textColumn).to.contains(dataCurrencies.euro.isoCode); }); it('should filter by iso code "US"', async function () { @@ -129,7 +130,7 @@ describe('CLDR : Search a currency by ISO code', async () => { // Check currency const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.usd.isoCode); + expect(textColumn).to.contains(dataCurrencies.usd.isoCode); }); it('should filter by iso code "PY"', async function () { @@ -145,10 +146,10 @@ describe('CLDR : Search a currency by ISO code', async () => { // Check currencies const textColumnRow1 = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumnRow1).to.contains(Currencies.jpy.isoCode); + expect(textColumnRow1).to.contains(dataCurrencies.jpy.isoCode); const textColumnRow2 = await currenciesPage.getTextColumnFromTableCurrency(page, 2, 'iso_code'); - expect(textColumnRow2).to.contains(Currencies.pyg.isoCode); + expect(textColumnRow2).to.contains(dataCurrencies.pyg.isoCode); }); it('should filter by iso code "P"', async function () { @@ -164,13 +165,13 @@ describe('CLDR : Search a currency by ISO code', async () => { // Check currencies const textColumnRow1 = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumnRow1).to.contains(Currencies.gbp.isoCode); + expect(textColumnRow1).to.contains(dataCurrencies.gbp.isoCode); const textColumnRow2 = await currenciesPage.getTextColumnFromTableCurrency(page, 2, 'iso_code'); - expect(textColumnRow2).to.contains(Currencies.jpy.isoCode); + expect(textColumnRow2).to.contains(dataCurrencies.jpy.isoCode); const textColumnRow3 = await currenciesPage.getTextColumnFromTableCurrency(page, 3, 'iso_code'); - expect(textColumnRow3).to.contains(Currencies.pyg.isoCode); + expect(textColumnRow3).to.contains(dataCurrencies.pyg.isoCode); }); it('should filter by iso code "ABC"', async function () { @@ -196,7 +197,7 @@ describe('CLDR : Search a currency by ISO code', async () => { }); // Post-condition - Delete currencies - installedCurrencies.forEach((currency: CurrencyData, index: number) => { + installedCurrencies.forEach((currency: FakerCurrency, index: number) => { deleteCurrencyTest(currency, `${baseContext}_postTest_${index}`); }); }); diff --git a/tests/UI/campaigns/cldr/05_searchCurrencyByEnableDisable.ts b/tests/UI/campaigns/cldr/05_searchCurrencyByEnableDisable.ts index aa95eb88cb36b..4326571a2b24d 100644 --- a/tests/UI/campaigns/cldr/05_searchCurrencyByEnableDisable.ts +++ b/tests/UI/campaigns/cldr/05_searchCurrencyByEnableDisable.ts @@ -12,8 +12,9 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; import {use, expect} from 'chai'; import chaiString from 'chai-string'; @@ -84,7 +85,7 @@ describe('CLDR : Search a currency by enable/disable', async () => { await testContext.addContextItem(this, 'testIdentifier', 'createOfficialCurrencyUSD', baseContext); // Create and check successful message - const textResult = await addCurrencyPage.addOfficialCurrency(page, Currencies.usd); + const textResult = await addCurrencyPage.addOfficialCurrency(page, dataCurrencies.usd); expect(textResult).to.contains(currenciesPage.successfulCreationMessage); // Check number of currencies after creation @@ -92,11 +93,11 @@ describe('CLDR : Search a currency by enable/disable', async () => { expect(numberOfCurrenciesAfterCreation).to.be.equal(numberOfCurrencies + 1); }); - it(`should filter by iso code of currency '${Currencies.usd.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.usd.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToUSDCurrency', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.usd.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.usd.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -104,11 +105,11 @@ describe('CLDR : Search a currency by enable/disable', async () => { // Check currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.usd.isoCode); + expect(textColumn).to.contains(dataCurrencies.usd.isoCode); }); - it(`should disable currency '${Currencies.usd.isoCode}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', `disableCurrency${Currencies.usd.isoCode}`, baseContext); + it(`should disable currency '${dataCurrencies.usd.isoCode}'`, async function () { + await testContext.addContextItem(this, 'testIdentifier', `disableCurrency${dataCurrencies.usd.isoCode}`, baseContext); await currenciesPage.setStatus(page, 1, false); @@ -126,7 +127,7 @@ describe('CLDR : Search a currency by enable/disable', async () => { expect(numberEnabledCurrencies).to.be.eq(1); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.euro.isoCode); + expect(textColumn).to.contains(dataCurrencies.euro.isoCode); }); it('should search Disabled currencies', async function () { @@ -139,11 +140,11 @@ describe('CLDR : Search a currency by enable/disable', async () => { expect(numberEnabledCurrencies).to.be.eq(1); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.usd.isoCode); + expect(textColumn).to.contains(dataCurrencies.usd.isoCode); }); - it(`should enable currency '${Currencies.usd.isoCode}'`, async function () { - await testContext.addContextItem(this, 'testIdentifier', `enableCurrency${Currencies.usd.isoCode}`, baseContext); + it(`should enable currency '${dataCurrencies.usd.isoCode}'`, async function () { + await testContext.addContextItem(this, 'testIdentifier', `enableCurrency${dataCurrencies.usd.isoCode}`, baseContext); await currenciesPage.setStatus(page, 1, true); @@ -164,7 +165,7 @@ describe('CLDR : Search a currency by enable/disable', async () => { await testContext.addContextItem(this, 'testIdentifier', 'createOfficialCurrencyGBP', baseContext); // Create and check successful message - const textResult = await addCurrencyPage.addOfficialCurrency(page, Currencies.gbp); + const textResult = await addCurrencyPage.addOfficialCurrency(page, dataCurrencies.gbp); expect(textResult).to.contains(currenciesPage.successfulCreationMessage); // Check number of currencies after creation @@ -180,8 +181,8 @@ describe('CLDR : Search a currency by enable/disable', async () => { }); // Post-condition - Delete currency USD - deleteCurrencyTest(Currencies.usd, `${baseContext}_postTest_1`); + deleteCurrencyTest(dataCurrencies.usd, `${baseContext}_postTest_1`); // Post-condition - Delete currency GBP - deleteCurrencyTest(Currencies.gbp, `${baseContext}_postTest_2`); + deleteCurrencyTest(dataCurrencies.gbp, `${baseContext}_postTest_2`); }); diff --git a/tests/UI/campaigns/cldr/07_editSymbolFormatCurrency.ts b/tests/UI/campaigns/cldr/07_editSymbolFormatCurrency.ts index d73ddbece6f8e..82d41cd20646e 100644 --- a/tests/UI/campaigns/cldr/07_editSymbolFormatCurrency.ts +++ b/tests/UI/campaigns/cldr/07_editSymbolFormatCurrency.ts @@ -11,8 +11,9 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; import {use, expect} from 'chai'; import chaiString from 'chai-string'; @@ -72,11 +73,11 @@ describe('CLDR : Edit symbol / format currency', async () => { expect(numberOfCurrencies).to.be.above(0); }); - it(`should filter by iso code of currency '${Currencies.euro.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToEurCurrency0', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.euro.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.euro.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -84,16 +85,16 @@ describe('CLDR : Edit symbol / format currency', async () => { // Check currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.euro.isoCode); + expect(textColumn).to.contains(dataCurrencies.euro.isoCode); }); - it(`should edit the currency '${Currencies.euro.isoCode}'`, async function () { + it(`should edit the currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToEuroCurrencyPage0', baseContext); await currenciesPage.goToEditCurrencyPage(page, 1); const pageTitle = await addCurrencyPage.getPageTitle(page); - expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(Currencies.euro.name)); + expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(dataCurrencies.euro.name)); }); it('should have multiples currencies formats', async function () { @@ -128,7 +129,7 @@ describe('CLDR : Edit symbol / format currency', async () => { expect(growlMessage).to.be.eq(addCurrencyPage.resetCurrencyFormatMessage); const exampleFormat = await addCurrencyPage.getTextColumnFromTable(page, 1, 2); - expect(exampleFormat).to.startWith(Currencies.euro.symbol); + expect(exampleFormat).to.startWith(dataCurrencies.euro.symbol); }); [1, 2].forEach((numRow: number) => { @@ -161,13 +162,13 @@ describe('CLDR : Edit symbol / format currency', async () => { expect(symbolCurrency).to.be.eq(customSymbol); }); - it(`should edit the currency '${Currencies.euro.isoCode}'`, async function () { + it(`should edit the currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToEuroCurrencyPage1', baseContext); await currenciesPage.goToEditCurrencyPage(page, 1); const pageTitle = await addCurrencyPage.getPageTitle(page); - expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(Currencies.euro.name)); + expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(dataCurrencies.euro.name)); }); it('should restore default settings\'', async function () { @@ -181,10 +182,10 @@ describe('CLDR : Edit symbol / format currency', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkRestorationDone', baseContext); const exampleFormatRow1 = await addCurrencyPage.getTextColumnFromTable(page, 1, 2); - expect(exampleFormatRow1).to.startWith(Currencies.euro.symbol); + expect(exampleFormatRow1).to.startWith(dataCurrencies.euro.symbol); const exampleFormatRow2 = await addCurrencyPage.getTextColumnFromTable(page, 2, 2); - expect(exampleFormatRow2).to.endWith(` ${Currencies.euro.symbol}`); + expect(exampleFormatRow2).to.endWith(` ${dataCurrencies.euro.symbol}`); }); it('should update the currency', async function () { @@ -194,7 +195,7 @@ describe('CLDR : Edit symbol / format currency', async () => { expect(result).to.be.eq(currenciesPage.successfulUpdateMessage); const symbolCurrency = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'symbol'); - expect(symbolCurrency).to.be.eq(Currencies.euro.symbol); + expect(symbolCurrency).to.be.eq(dataCurrencies.euro.symbol); }); it('should reset all filters', async function () { diff --git a/tests/UI/campaigns/cldr/08_resetSymbolFormatSettings.ts b/tests/UI/campaigns/cldr/08_resetSymbolFormatSettings.ts index 23b1670e27eb1..6688674b1a60e 100644 --- a/tests/UI/campaigns/cldr/08_resetSymbolFormatSettings.ts +++ b/tests/UI/campaigns/cldr/08_resetSymbolFormatSettings.ts @@ -11,8 +11,9 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; import {use, expect} from 'chai'; import chaiString from 'chai-string'; @@ -72,11 +73,11 @@ describe('CLDR : Reset symbol / format settings', async () => { expect(numberOfCurrencies).to.be.above(0); }); - it(`should filter by iso code of currency '${Currencies.euro.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToEurCurrency0', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.euro.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.euro.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -84,16 +85,16 @@ describe('CLDR : Reset symbol / format settings', async () => { // Check currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.euro.isoCode); + expect(textColumn).to.contains(dataCurrencies.euro.isoCode); }); - it(`should edit the currency '${Currencies.euro.isoCode}'`, async function () { + it(`should edit the currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToEuroCurrencyPage0', baseContext); await currenciesPage.goToEditCurrencyPage(page, 1); const pageTitle = await addCurrencyPage.getPageTitle(page); - expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(Currencies.euro.name)); + expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(dataCurrencies.euro.name)); }); it('should have multiples currencies formats', async function () { @@ -130,13 +131,13 @@ describe('CLDR : Reset symbol / format settings', async () => { expect(symbolCurrency).to.be.eq(customSymbol); }); - it(`should edit the currency '${Currencies.euro.isoCode}'`, async function () { + it(`should edit the currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToEuroCurrencyPage1', baseContext); await currenciesPage.goToEditCurrencyPage(page, 1); const pageTitle = await addCurrencyPage.getPageTitle(page); - expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(Currencies.euro.name)); + expect(pageTitle).to.contains(addCurrencyPage.pageTitleEdit(dataCurrencies.euro.name)); }); it('should reset the currency format', async function () { @@ -146,7 +147,7 @@ describe('CLDR : Reset symbol / format settings', async () => { expect(growlMessage).to.be.eq(addCurrencyPage.resetCurrencyFormatMessage); const exampleFormat = await addCurrencyPage.getTextColumnFromTable(page, 1, 2); - expect(exampleFormat).to.startWith(Currencies.euro.symbol); + expect(exampleFormat).to.startWith(dataCurrencies.euro.symbol); }); it('should update the currency', async function () { @@ -156,7 +157,7 @@ describe('CLDR : Reset symbol / format settings', async () => { expect(result).to.be.eq(currenciesPage.successfulUpdateMessage); const symbolCurrency = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'symbol'); - expect(symbolCurrency).to.be.eq(Currencies.euro.symbol); + expect(symbolCurrency).to.be.eq(dataCurrencies.euro.symbol); }); it('should reset all filters', async function () { diff --git a/tests/UI/campaigns/cldr/09_enableDisableCurrency.ts b/tests/UI/campaigns/cldr/09_enableDisableCurrency.ts index 2333bc4312f97..c4fa304fbb405 100644 --- a/tests/UI/campaigns/cldr/09_enableDisableCurrency.ts +++ b/tests/UI/campaigns/cldr/09_enableDisableCurrency.ts @@ -11,9 +11,10 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; -import CurrencyData from '@data/faker/currency'; +import { + dataCurrencies, + FakerCurrency, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import {BrowserContext, Page} from 'playwright'; @@ -25,9 +26,9 @@ describe('CLDR : Enable/Disable a currency', async () => { let page: Page; let numberOfCurrencies: number; - const currencyDollar: CurrencyData = new CurrencyData({ - name: Currencies.usd.name, - isoCode: Currencies.usd.isoCode, + const currencyDollar: FakerCurrency = new FakerCurrency({ + name: dataCurrencies.usd.name, + isoCode: dataCurrencies.usd.isoCode, enabled: false, }); @@ -74,11 +75,11 @@ describe('CLDR : Enable/Disable a currency', async () => { expect(numberOfCurrencies).to.be.above(0); }); - it(`should filter by iso code of currency '${Currencies.euro.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToEurCurrency0', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.euro.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.euro.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -86,7 +87,7 @@ describe('CLDR : Enable/Disable a currency', async () => { // Check currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.euro.isoCode); + expect(textColumn).to.contains(dataCurrencies.euro.isoCode); }); it('should disable the default currency and check the error message', async function () { @@ -183,11 +184,11 @@ describe('CLDR : Enable/Disable a currency', async () => { expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code of currency '${Currencies.euro.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToEurCurrency1', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.euro.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.euro.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -195,10 +196,10 @@ describe('CLDR : Enable/Disable a currency', async () => { // Check currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.euro.isoCode); + expect(textColumn).to.contains(dataCurrencies.euro.isoCode); }); - it(`should disable the currency '${Currencies.euro.isoCode}'`, async function () { + it(`should disable the currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'disableEuroCurrency', baseContext); const isActionPerformed = await currenciesPage.setStatus(page, 1, false); @@ -211,7 +212,7 @@ describe('CLDR : Enable/Disable a currency', async () => { expect(currencyStatus).to.eq(false); }); - it(`should enable the currency '${Currencies.euro.isoCode}'`, async function () { + it(`should enable the currency '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'enableEuroCurrency', baseContext); const isActionPerformed = await currenciesPage.setStatus(page, 1, true); @@ -233,10 +234,13 @@ describe('CLDR : Enable/Disable a currency', async () => { expect(pageTitle).to.contains(localizationPage.pageTitle); }); - it(`should choose '${Currencies.euro.isoCode}' as default currency`, async function () { + it(`should choose '${dataCurrencies.euro.isoCode}' as default currency`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'setEuroAsDefaultCurrency', baseContext); - const textResult = await localizationPage.setDefaultCurrency(page, `${Currencies.euro.name} (${Currencies.euro.isoCode})`); + const textResult = await localizationPage.setDefaultCurrency( + page, + `${dataCurrencies.euro.name} (${dataCurrencies.euro.isoCode})`, + ); expect(textResult).to.contain(localizationPage.successfulSettingsUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/02_deleteAPICustomerGroupsId.ts b/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/02_deleteAPICustomerGroupsId.ts index a37be783ad892..81fe06f38605d 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/02_deleteAPICustomerGroupsId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/02_deleteAPICustomerGroupsId.ts @@ -17,7 +17,10 @@ import addGroupPage from '@pages/BO/shopParameters/customerSettings/groups/add'; // Import data import APIClientData from '@data/faker/APIClient'; -import GroupData from '@data/faker/group'; + +import { + FakerGroup, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {APIRequestContext, BrowserContext, Page} from 'playwright'; @@ -40,7 +43,7 @@ describe('API : DELETE /api/customers/group/{customerGroupId}', async () => { clientScope, ], }); - const createGroupData: GroupData = new GroupData(); + const createGroupData: FakerGroup = new FakerGroup(); before(async function () { browserContext = await helper.createBrowserContext(this.browser); diff --git a/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/04_putAPICustomerGroupsId.ts b/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/04_putAPICustomerGroupsId.ts index 5904b2a3c2517..8b141ded567ab 100644 --- a/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/04_putAPICustomerGroupsId.ts +++ b/tests/UI/campaigns/functional/API/02_endpoints/03_customerGroup/04_putAPICustomerGroupsId.ts @@ -18,7 +18,10 @@ import addGroupPage from '@pages/BO/shopParameters/customerSettings/groups/add'; // Import data import Languages from '@data/demo/languages'; import APIClientData from '@data/faker/APIClient'; -import GroupData from '@data/faker/group'; + +import { + FakerGroup, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {APIRequestContext, BrowserContext, Page} from 'playwright'; @@ -42,10 +45,10 @@ describe('API : PUT /api/customers/group/{customerGroupId}', async () => { clientScope, ], }); - const createGroupData: GroupData = new GroupData({ + const createGroupData: FakerGroup = new FakerGroup({ priceDisplayMethod: 'Tax included', }); - const updateGroupData: GroupData = new GroupData({ + const updateGroupData: FakerGroup = new FakerGroup({ name: 'Customer Group EN', frName: 'Customer Group FR', discount: 42, diff --git a/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts b/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts index 7304d9cfb570e..3ace2a89185f1 100644 --- a/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts +++ b/tests/UI/campaigns/functional/BO/01_dashboard/02_activityOverview.ts @@ -38,16 +38,16 @@ import {deleteProductTest} from '@commonTests/BO/catalog/product'; import {deleteCustomerTest} from '@commonTests/BO/customers/customer'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import OrderStatuses from '@data/demo/orderStatuses'; import Orders from '@data/demo/orders'; import ProductData from '@data/faker/product'; import MessageData from '@data/faker/message'; -import CustomerData from '@data/faker/customer'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -80,7 +80,7 @@ describe('BO - Dashboard : Activity overview', async () => { reference: Orders.firstOrder.reference, }); - const createCustomerData: CustomerData = new CustomerData({newsletter: true}); + const createCustomerData: FakerCustomer = new FakerCustomer({newsletter: true}); enableMerchandiseReturns(baseContext); @@ -269,7 +269,7 @@ describe('BO - Dashboard : Activity overview', async () => { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -316,7 +316,7 @@ describe('BO - Dashboard : Activity overview', async () => { it('should change the first order status to Processing in progress', async function () { await testContext.addContextItem(this, 'testIdentifier', 'changeOrderStatus1', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.processingInProgress); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.processingInProgress); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); @@ -369,7 +369,7 @@ describe('BO - Dashboard : Activity overview', async () => { it('should change the first order status to Delivered', async function () { await testContext.addContextItem(this, 'testIdentifier', 'changeOrderStatus2', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.delivered); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.delivered); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/04_updateStatus.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/04_updateStatus.ts index c34e89715c349..5443fa47c3af3 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/04_updateStatus.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/04_updateStatus.ts @@ -20,14 +20,14 @@ import {myAccountPage} from '@pages/FO/classic/myAccount'; import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -69,7 +69,7 @@ describe('BO - orders : Update order status', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order in FO @@ -132,12 +132,12 @@ describe('BO - orders : Update order status', async () => { describe('Change orders status in BO then check it in FO', async () => { [ - {args: {orderStatus: OrderStatuses.canceled, email: 'Canceled'}}, - {args: {orderStatus: OrderStatuses.refunded, email: 'Refunded'}}, - {args: {orderStatus: OrderStatuses.onBackorderNotPaid, email: 'On backorder (not paid)'}}, - {args: {orderStatus: OrderStatuses.onBackorderPaid, email: 'On backorder (paid)'}}, - {args: {orderStatus: OrderStatuses.paymentAccepted, email: 'Payment accepted'}}, - {args: {orderStatus: OrderStatuses.shipped, email: 'Shipped'}}, + {args: {orderStatus: dataOrderStatuses.canceled, email: 'Canceled'}}, + {args: {orderStatus: dataOrderStatuses.refunded, email: 'Refunded'}}, + {args: {orderStatus: dataOrderStatuses.onBackorderNotPaid, email: 'On backorder (not paid)'}}, + {args: {orderStatus: dataOrderStatuses.onBackorderPaid, email: 'On backorder (paid)'}}, + {args: {orderStatus: dataOrderStatuses.paymentAccepted, email: 'Payment accepted'}}, + {args: {orderStatus: dataOrderStatuses.shipped, email: 'Shipped'}}, ].forEach((test, index: number) => { describe(`Change orders status to '${test.args.orderStatus.name}' in BO`, async () => { it('should update order status', async function () { @@ -160,7 +160,7 @@ describe('BO - orders : Update order status', async () => { expect(allEmails[allEmails.length - 1].subject).to.equal(`[${global.INSTALL.SHOP_NAME}] ${test.args.email}`); }); - if (test.args.orderStatus.name === OrderStatuses.paymentAccepted.name) { + if (test.args.orderStatus.name === dataOrderStatuses.paymentAccepted.name) { it('should download invoice', async function () { await testContext.addContextItem(this, 'testIdentifier', 'downloadInvoice', baseContext); @@ -198,7 +198,7 @@ describe('BO - orders : Update order status', async () => { }); } - if (test.args.orderStatus.name === OrderStatuses.delivered.name) { + if (test.args.orderStatus.name === dataOrderStatuses.delivered.name) { it('should download delivery slip', async function () { await testContext.addContextItem(this, 'testIdentifier', 'downloadDeliverySlip', baseContext); @@ -285,7 +285,7 @@ describe('BO - orders : Update order status', async () => { expect(orderStatusFO, 'Order status is not correct').to.equal(test.args.orderStatus.name); }); - if (test.args.orderStatus.name === OrderStatuses.paymentAccepted.name) { + if (test.args.orderStatus.name === dataOrderStatuses.paymentAccepted.name) { it('should check if the last invoice is visible', async function () { await testContext.addContextItem(this, 'testIdentifier', `checkLastInvoice${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/05_bulkUpdateOrdersStatus.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/05_bulkUpdateOrdersStatus.ts index 757606c207c2d..ee8fed957960a 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/05_bulkUpdateOrdersStatus.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/05_bulkUpdateOrdersStatus.ts @@ -11,14 +11,14 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import OrderStatuses from '@data/demo/orderStatuses'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -45,7 +45,7 @@ describe('BO - Orders : Bulk update orders status', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create 2 orders in FO @@ -88,7 +88,7 @@ describe('BO - Orders : Bulk update orders status', async () => { const textResult = await ordersPage.bulkUpdateOrdersStatus( page, - OrderStatuses.paymentAccepted.name, + dataOrderStatuses.paymentAccepted.name, false, [1, 2], ); @@ -100,7 +100,7 @@ describe('BO - Orders : Bulk update orders status', async () => { await testContext.addContextItem(this, 'testIdentifier', `checkOrderStatus${index + 1}`, baseContext); const orderStatus = await ordersPage.getTextColumn(page, 'osname', index + 1); - expect(orderStatus, 'Order status is not correct').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status is not correct').to.equal(dataOrderStatuses.paymentAccepted.name); }); }); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/06_bulkOpenInNewTab.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/06_bulkOpenInNewTab.ts index e8ed511d2e9ff..767c91bcdd4ca 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/06_bulkOpenInNewTab.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/06_bulkOpenInNewTab.ts @@ -13,12 +13,16 @@ import ordersPage from '@pages/BO/orders'; import orderPageCustomerBlock from '@pages/BO/orders/view/customerBlock'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -38,9 +42,9 @@ describe('BO - Orders : Bulk open on new tab', async () => { let browserContext: BrowserContext; let page: Page; - const firstCustomerData: CustomerData = new CustomerData(); - const secondCustomerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({country: 'France'}); + const firstCustomerData: FakerCustomer = new FakerCustomer(); + const secondCustomerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); const firstOrderByGuestData: OrderData = new OrderData({ customer: firstCustomerData, products: [ @@ -50,7 +54,7 @@ describe('BO - Orders : Bulk open on new tab', async () => { }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const secondOrderByGuestData: OrderData = new OrderData({ customer: secondCustomerData, @@ -61,7 +65,7 @@ describe('BO - Orders : Bulk open on new tab', async () => { }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create first order in FO diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/09_viewGuest.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/09_viewGuest.ts index 2f305897a19c2..ad539d630b827 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/09_viewGuest.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/09_viewGuest.ts @@ -13,12 +13,16 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -39,8 +43,8 @@ describe('BO - Orders : View guest from orders page', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); // New order by guest data const orderByGuestData: OrderData = new OrderData({ customer: customerData, @@ -51,7 +55,7 @@ describe('BO - Orders : View guest from orders page', async () => { }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order by guest in FO diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/10_pagination.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/10_pagination.ts index c3525a51b1e48..89a12d68e9c9c 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/10_pagination.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/10_pagination.ts @@ -12,13 +12,13 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -55,7 +55,7 @@ describe('BO - Orders : Pagination of orders table', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create 6 orders in FO diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/11_previewOrder.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/11_previewOrder.ts index 53839b1fd0bba..d5b8e3ba9bde2 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/11_previewOrder.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/11_previewOrder.ts @@ -23,12 +23,16 @@ import {searchResultsPage} from '@pages/FO/classic/searchResults'; // Import data import Carriers from '@data/demo/carriers'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderShippingData from '@data/faker/orderShipping'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -50,10 +54,10 @@ describe('BO - Orders : Preview order', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); - const editShippingAddressData: AddressData = new AddressData({country: 'France'}); - const editInvoiceAddressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); + const editShippingAddressData: FakerAddress = new FakerAddress({country: 'France'}); + const editInvoiceAddressData: FakerAddress = new FakerAddress({country: 'France'}); const shippingDetailsData: OrderShippingData = new OrderShippingData({ trackingNumber: '123654789', carrier: Carriers.myCarrier.name, @@ -158,7 +162,7 @@ describe('BO - Orders : Preview order', async () => { expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/01_searchViewCustomer.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/01_searchViewCustomer.ts index 5be24368d46eb..f41b96c1b316d 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/01_searchViewCustomer.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/01_searchViewCustomer.ts @@ -12,12 +12,10 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; import addOrderPage from '@pages/BO/orders/add'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -43,9 +41,9 @@ describe('BO - Orders - Create order : Search and view customer details from new let page: Page; let customerIframe: Frame|null; - const nonExistentCustomer: CustomerData = new CustomerData(); - const disabledCustomer: CustomerData = new CustomerData({enabled: false}); - const newCustomer: CustomerData = new CustomerData({ + const nonExistentCustomer: FakerCustomer = new FakerCustomer(); + const disabledCustomer: FakerCustomer = new FakerCustomer({enabled: false}); + const newCustomer: FakerCustomer = new FakerCustomer({ firstName: 'Jane', lastName: 'DOE', defaultCustomerGroup: 'Customer', diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/02_createCustomer.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/02_createCustomer.ts index 9d8f14761d8f5..3164e4ebeb06c 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/02_createCustomer.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/02_createCustomer.ts @@ -11,8 +11,10 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; import addOrderPage from '@pages/BO/orders/add'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -30,7 +32,7 @@ describe('BO - Orders - Create order : Create customer from new order page', asy let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); before(async function () { browserContext = await helper.createBrowserContext(this.browser); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/03_createSimpleOrderInBO.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/03_createSimpleOrderInBO.ts index a75c4abb664a3..2b6909c6e1af0 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/03_createSimpleOrderInBO.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/03_createSimpleOrderInBO.ts @@ -16,14 +16,14 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; // Import data import Addresses from '@data/demo/address'; import Carriers from '@data/demo/carriers'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -65,8 +65,8 @@ describe('BO - Orders - Create order : Create simple order in BO', async () => { name: `${Carriers.default.name} - ${Carriers.default.delay}`, freeShipping: true, }, - paymentMethod: PaymentMethods.checkPayment, - status: OrderStatuses.paymentAccepted, + paymentMethod: dataPaymentMethods.checkPayment, + status: dataOrderStatuses.paymentAccepted, totalPrice: (Products.demo_5.priceTaxExcluded * 4) * 1.2, // Price tax included }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts index bca7136965fd3..6e677e60fdc32 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/04_selectPreviousCarts.ts @@ -23,13 +23,13 @@ import {productPage} from '@pages/FO/classic/product'; // Import data import Carriers from '@data/demo/carriers'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -479,7 +479,7 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkCartInformationBlock', baseContext); const orderInformation = await viewShoppingCartPage.getOrderInformation(shoppingCartPage!); - await expect(orderInformation).to.contains('The customer has not proceeded to checkout yet.'); + expect(orderInformation).to.contains('The customer has not proceeded to checkout yet.'); const hasButtonCreateOrderFromCart = await viewShoppingCartPage.hasButtonCreateOrderFromCart(shoppingCartPage!); expect(hasButtonCreateOrderFromCart).to.eq(true); @@ -559,8 +559,8 @@ describe('BO - Orders - Create Order : Select Previous Carts', async () => { await addOrderPage.setSummaryAndCreateOrder( page, - PaymentMethods.checkPayment.moduleName, - OrderStatuses.paymentAccepted, + dataPaymentMethods.checkPayment.moduleName, + dataOrderStatuses.paymentAccepted, ); const pageTitle = await orderPageProductsBlock.getPageTitle(page); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/05_selectPreviousOrders.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/05_selectPreviousOrders.ts index 0c48a08e3e5f7..affbc2ac86585 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/05_selectPreviousOrders.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/05_selectPreviousOrders.ts @@ -19,13 +19,17 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; -import OrderStatusData from '@data/faker/orderStatus'; + +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, + type FakerOrderStatus, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Frame, Page} from 'playwright'; @@ -54,8 +58,8 @@ describe('BO - Orders - Create order : Select previous orders', async () => { let orderIframe: Frame|null; const today: string = date.getDateFormat('yyyy-mm-dd'); - const newCustomer: CustomerData = new CustomerData(); - const newAddress: AddressData = new AddressData({ + const newCustomer: FakerCustomer = new FakerCustomer(); + const newAddress: FakerAddress = new FakerAddress({ email: newCustomer.email, country: 'France', }); @@ -67,10 +71,10 @@ describe('BO - Orders - Create order : Select previous orders', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); - const paymentMethodModuleName: string = PaymentMethods.checkPayment.moduleName; - const orderStatus: OrderStatusData = OrderStatuses.paymentAccepted; + const paymentMethodModuleName: string = dataPaymentMethods.checkPayment.moduleName; + const orderStatus: FakerOrderStatus = dataOrderStatuses.paymentAccepted; // Pre-condition: Create new customer createCustomerTest(newCustomer, `${baseContext}_preTest_1`); @@ -239,7 +243,7 @@ describe('BO - Orders - Create order : Select previous orders', async () => { it('should check customer title, name, lastname, reference', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkCustomerInfo', baseContext); - orderIframe = await addOrderPage.getOrderIframe(page, orderID); + orderIframe = addOrderPage.getOrderIframe(page, orderID); expect(orderIframe).to.not.eq(null); const customerInfo = await orderPageCustomerBlock.getCustomerInfoBlock(orderIframe!); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/06_addProductToTheCart.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/06_addProductToTheCart.ts index 751aa8ba933dc..d058fa7e968e3 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/06_addProductToTheCart.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/06_addProductToTheCart.ts @@ -22,13 +22,13 @@ import ordersPage from '@pages/BO/orders'; import addOrderPage from '@pages/BO/orders/add'; // Import data -import Currencies from '@data/demo/currencies'; import Products from '@data/demo/products'; import CartRuleData from '@data/faker/cartRule'; import ProductData from '@data/faker/product'; import { // Import data + dataCurrencies, dataCustomers, } from '@prestashop-core/ui-testing'; @@ -198,7 +198,7 @@ describe('BO - Orders - Create order : Add a product to the cart', async () => { enableEcoTaxTest(`${baseContext}_preTest_1`); // Pre-condition: Create currency - createCurrencyTest(Currencies.mad, `${baseContext}_preTest_2`); + createCurrencyTest(dataCurrencies.mad, `${baseContext}_preTest_2`); before(async function () { browserContext = await helper.createBrowserContext(this.browser); @@ -706,7 +706,7 @@ describe('BO - Orders - Create order : Add a product to the cart', async () => { disableEcoTaxTest(`${baseContext}_postTest_2`); // Post-condition: Delete currency - deleteCurrencyTest(Currencies.mad, `${baseContext}_postTest_3`); + deleteCurrencyTest(dataCurrencies.mad, `${baseContext}_postTest_3`); // Post-condition: Delete cart rule deleteCartRuleTest(newCartRuleData.name, `${baseContext}_postTest_4`); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/08_chooseAddress.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/08_chooseAddress.ts index 9388c807b9066..b7b13c456edf6 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/08_chooseAddress.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/08_chooseAddress.ts @@ -21,14 +21,14 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -60,17 +60,17 @@ describe('BO - Orders - Create order : Choose address', async () => { let orderID : number; // Const used for the payment status - const paymentMethodModuleName: string = PaymentMethods.checkPayment.moduleName; + const paymentMethodModuleName: string = dataPaymentMethods.checkPayment.moduleName; // Variable used to create new address in Pre-condition - const newAddressToCreate: AddressData = new AddressData({ + const newAddressToCreate: FakerAddress = new FakerAddress({ email: dataCustomers.johnDoe.email, lastName: 'test', country: 'France', }); // Variable used to edit demo address - const addressToEditData: AddressData = new AddressData({country: 'France'}); + const addressToEditData: FakerAddress = new FakerAddress({country: 'France'}); // Variable used to add new address from new order page - const newAddressData: AddressData = new AddressData({lastName: 'test', country: 'France'}); + const newAddressData: FakerAddress = new FakerAddress({lastName: 'test', country: 'France'}); // Pre-condition: Create new address createAddressTest(newAddressToCreate, `${baseContext}_preTest_1`); @@ -161,7 +161,7 @@ describe('BO - Orders - Create order : Choose address', async () => { it('should complete the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'completeOrder', baseContext); - await addOrderPage.setSummaryAndCreateOrder(page, paymentMethodModuleName, OrderStatuses.paymentAccepted); + await addOrderPage.setSummaryAndCreateOrder(page, paymentMethodModuleName, dataOrderStatuses.paymentAccepted); const pageTitle = await orderPageCustomerBlock.getPageTitle(page); expect(pageTitle).to.contains(orderPageCustomerBlock.pageTitle); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/09_chooseShipping.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/09_chooseShipping.ts index 6803f826e51fa..3c45577f58439 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/09_chooseShipping.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/09_chooseShipping.ts @@ -17,14 +17,14 @@ import orderSettingsPage from '@pages/BO/shopParameters/orderSettings'; // Import data import Carriers from '@data/demo/carriers'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import OrderStatusData from '@data/faker/orderStatus'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + type FakerOrderStatus, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -65,8 +65,8 @@ describe('BO - Orders - Create order : Choose shipping', async () => { tax: 'None', isRecyclablePackage: false, }; - const paymentMethodModuleName: string = PaymentMethods.checkPayment.moduleName; - const orderStatus: OrderStatusData = OrderStatuses.paymentAccepted; + const paymentMethodModuleName: string = dataPaymentMethods.checkPayment.moduleName; + const orderStatus: FakerOrderStatus = dataOrderStatuses.paymentAccepted; const giftMessage: string = 'Gift message to test'; before(async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/10_checkSummary.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/10_checkSummary.ts index f46af406e550d..13ccb7a4b85b5 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/10_checkSummary.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/createOrders/10_checkSummary.ts @@ -19,8 +19,6 @@ import {checkoutPage} from '@pages/FO/classic/checkout'; // Import data import Carriers from '@data/demo/carriers'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import CartRuleData from '@data/faker/cartRule'; import type MailDevEmail from '@data/types/maildevEmail'; @@ -28,6 +26,8 @@ import type MailDevEmail from '@data/types/maildevEmail'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -65,7 +65,7 @@ describe('BO - Orders - Create order : Check summary', async () => { tax: 'Tax excluded', }, }); - const paymentMethodModuleName: string = PaymentMethods.checkPayment.moduleName; + const paymentMethodModuleName: string = dataPaymentMethods.checkPayment.moduleName; const orderMessage: string = 'Test order message'; // Pre-condition: Create cart rule with code @@ -324,7 +324,7 @@ describe('BO - Orders - Create order : Check summary', async () => { await testContext.addContextItem(this, 'testIdentifier', 'clickOnCreateOrder3', baseContext); await addOrderPage.setPaymentMethod(page, paymentMethodModuleName); - await addOrderPage.setOrderStatus(page, OrderStatuses.paymentAccepted); + await addOrderPage.setOrderStatus(page, dataOrderStatuses.paymentAccepted); const isOrderCreated = await addOrderPage.clickOnCreateOrderButton(page, true); expect(isOrderCreated, 'The order is created!').to.eq(true); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/01_customerBlock.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/01_customerBlock.ts index f7734281ecda7..65194b9958dd6 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/01_customerBlock.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/01_customerBlock.ts @@ -11,13 +11,6 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; import orderPageCustomerBlock from '@pages/BO/orders/view/customerBlock'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; - -import {expect} from 'chai'; -import type {BrowserContext, Page} from 'playwright'; - // Import BO pages import customersPage from '@pages/BO/customers'; import addressesPage from '@pages/BO/customers/addresses'; @@ -25,14 +18,19 @@ import viewCustomerPage from '@pages/BO/customers/view'; // Import data import Products from '@data/demo/products'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataPaymentMethods, + FakerAddress, + FakerCustomer, } from '@prestashop-core/ui-testing'; +import {expect} from 'chai'; +import type {BrowserContext, Page} from 'playwright'; + const baseContext: string = 'functional_BO_orders_orders_viewAndEditOrder_customerBlock'; /* @@ -58,11 +56,11 @@ describe('BO - Orders - View and edit order : Check and edit customer block', as let customerID: number = 0; let addressID: string = '0'; - const customerData: CustomerData = new CustomerData(); - const firstAddressData: AddressData = new AddressData({firstName: 'first', country: 'France'}); - const secondAddressData: AddressData = new AddressData({firstName: 'second', country: 'France'}); - const editShippingAddressData: AddressData = new AddressData({country: 'France'}); - const editInvoiceAddressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer(); + const firstAddressData: FakerAddress = new FakerAddress({firstName: 'first', country: 'France'}); + const secondAddressData: FakerAddress = new FakerAddress({firstName: 'second', country: 'France'}); + const editShippingAddressData: FakerAddress = new FakerAddress({country: 'France'}); + const editInvoiceAddressData: FakerAddress = new FakerAddress({country: 'France'}); const privateNote: string = 'Test private note'; // New order by customer data const orderData: OrderData = new OrderData({ @@ -73,10 +71,10 @@ describe('BO - Orders - View and edit order : Check and edit customer block', as quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Customer login data - const customerLoginData = new CustomerData({ + const customerLoginData = new FakerCustomer({ email: customerData.email, password: customerData.password, }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/02_productBlock.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/02_productBlock.ts index 45630662e5378..40e1e3211094d 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/02_productBlock.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/02_productBlock.ts @@ -22,14 +22,18 @@ import ordersPage from '@pages/BO/orders'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; import CartRuleData from '@data/faker/cartRule'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; import ProductData from '@data/faker/product'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -75,8 +79,8 @@ describe('BO - Orders - View and edit order : Check product block in view order // Prefix for the new products to simply delete them by bulk actions const prefixNewProduct: string = 'TOTEST'; - const customerData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); // New order by guest data const orderData: OrderData = new OrderData({ customer: customerData, @@ -87,7 +91,7 @@ describe('BO - Orders - View and edit order : Check product block in view order }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const productOutOfStockAllowed: ProductData = new ProductData({ name: `Out of stock allowed ${prefixNewProduct}`, diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/03_statusTab.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/03_statusTab.ts index 665420ad0efb7..6b6ae0e57c2ab 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/03_statusTab.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/03_statusTab.ts @@ -19,11 +19,7 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import Employees from '@data/demo/employees'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import EmployeeData from '@data/faker/employee'; import OrderData from '@data/faker/order'; import type MailDevEmail from '@data/types/maildevEmail'; @@ -31,6 +27,10 @@ import type MailDevEmail from '@data/types/maildevEmail'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -70,8 +70,8 @@ describe('BO - Orders - View and edit order : Check order status tab', async () const today: string = date.getDateFormat('mm/dd/yyyy'); const orderNote: string = 'Test order note'; - const addressData: AddressData = new AddressData({country: 'France'}); - const customerData: CustomerData = new CustomerData({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); // New employee data const createEmployeeData: EmployeeData = new EmployeeData({ defaultPage: 'Dashboard', @@ -87,7 +87,7 @@ describe('BO - Orders - View and edit order : Check order status tab', async () quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // New order by guest data const orderByGuestData: OrderData = new OrderData({ @@ -99,7 +99,7 @@ describe('BO - Orders - View and edit order : Check order status tab', async () }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition: Setup config SMTP @@ -211,10 +211,10 @@ describe('BO - Orders - View and edit order : Check order status tab', async () expect(textResult).to.contains(orderPageTabListBlock.errorAssignSameStatus); }); - it(`should change the order status to '${OrderStatuses.canceled.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.canceled.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'cancelOrderByStatus', baseContext); - const textResult = await orderPageTabListBlock.updateOrderStatus(page, OrderStatuses.canceled.name); + const textResult = await orderPageTabListBlock.updateOrderStatus(page, dataOrderStatuses.canceled.name); expect(textResult).to.equal(orderPageTabListBlock.successfulUpdateMessage); }); @@ -229,7 +229,7 @@ describe('BO - Orders - View and edit order : Check order status tab', async () await testContext.addContextItem(this, 'testIdentifier', 'checkStatusName1', baseContext); const statusName = await orderPageTabListBlock.getTextColumnFromHistoryTable(page, 'status', 1); - expect(statusName).to.be.equal(OrderStatuses.canceled.name); + expect(statusName).to.be.equal(dataOrderStatuses.canceled.name); }); it('should check the employee name from the table', async function () { @@ -309,10 +309,10 @@ describe('BO - Orders - View and edit order : Check order status tab', async () expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatusToAccepted', baseContext); - const textResult = await orderPageTabListBlock.updateOrderStatus(page, OrderStatuses.paymentAccepted.name); + const textResult = await orderPageTabListBlock.updateOrderStatus(page, dataOrderStatuses.paymentAccepted.name); expect(textResult).to.equal(orderPageTabListBlock.successfulUpdateMessage); }); @@ -327,7 +327,7 @@ describe('BO - Orders - View and edit order : Check order status tab', async () await testContext.addContextItem(this, 'testIdentifier', 'checkStatusName2', baseContext); const statusName = await orderPageTabListBlock.getTextColumnFromHistoryTable(page, 'status', 1); - expect(statusName).to.be.equal(OrderStatuses.paymentAccepted.name); + expect(statusName).to.be.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check the employee name from the table', async function () { @@ -344,10 +344,10 @@ describe('BO - Orders - View and edit order : Check order status tab', async () expect(date).to.contain(today); }); - it(`should change the order status to '${OrderStatuses.shipped.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatusToShipped', baseContext); - const textResult = await orderPageTabListBlock.updateOrderStatus(page, OrderStatuses.shipped.name); + const textResult = await orderPageTabListBlock.updateOrderStatus(page, dataOrderStatuses.shipped.name); expect(textResult).to.equal(orderPageTabListBlock.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/04_documentsTab.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/04_documentsTab.ts index 81450d8745477..b398a4a78db62 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/04_documentsTab.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/04_documentsTab.ts @@ -16,14 +16,14 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -55,7 +55,7 @@ describe('BO - Orders - View and edit order : Check order documents tab', async quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition - Create order by default customer @@ -326,11 +326,11 @@ describe('BO - Orders - View and edit order : Check order documents tab', async expect(amountValue).to.not.equal(''); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatusPaymentAccepted', baseContext); - const textResult = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(textResult).to.equal(OrderStatuses.paymentAccepted.name); + const textResult = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(textResult).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check that the button \'Enter payment\' is not visible', async function () { @@ -340,11 +340,11 @@ describe('BO - Orders - View and edit order : Check order documents tab', async expect(isVisible).to.eq(false); }); - it(`should change the order status to '${OrderStatuses.shipped.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatusShipped', baseContext); - const textResult = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(textResult).to.equal(OrderStatuses.shipped.name); + const textResult = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(textResult).to.equal(dataOrderStatuses.shipped.name); }); it('should check that documents number is equal to 2', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/05_carriersTab.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/05_carriersTab.ts index 70b3823517e39..d3af5b7680097 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/05_carriersTab.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/05_carriersTab.ts @@ -14,7 +14,6 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import Carriers from '@data/demo/carriers'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import OrderShippingData from '@data/faker/orderShipping'; @@ -22,6 +21,7 @@ import OrderShippingData from '@data/faker/orderShipping'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -58,7 +58,7 @@ describe('BO - Orders - View and edit order : Check order carriers tab', async ( quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition - Create order by default customer diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/06_merchandiseReturnsTab.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/06_merchandiseReturnsTab.ts index 1a06b4652a091..5a0fb4d4e1700 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/06_merchandiseReturnsTab.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/06_merchandiseReturnsTab.ts @@ -24,14 +24,14 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data import OrderReturnStatuses from '@data/demo/orderReturnStatuses'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -72,7 +72,7 @@ describe('BO - Orders - View and edit order : Check merchandise returns tab', as quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order by default customer @@ -91,7 +91,7 @@ describe('BO - Orders - View and edit order : Check merchandise returns tab', as await helper.closeBrowserContext(browserContext); }); - describe(`Change the new order status to '${OrderStatuses.shipped.name}'`, async () => { + describe(`Change the new order status to '${dataOrderStatuses.shipped.name}'`, async () => { it('should login in BO', async function () { await loginCommon.loginBO(this, page); }); @@ -135,11 +135,11 @@ describe('BO - Orders - View and edit order : Check merchandise returns tab', as expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check if the button \'Return products\' is visible', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts index 727fd7e1577fe..aad0bff0d8885 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/07_messagesBlock.ts @@ -22,7 +22,6 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data import Employees from '@data/demo/employees'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import type {OrderHistoryMessage, OrderMessage} from '@data/types/order'; @@ -30,6 +29,7 @@ import type {OrderHistoryMessage, OrderMessage} from '@data/types/order'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -67,7 +67,7 @@ describe('BO - Orders - View and edit order : Check messages block', async () => quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const messageToSendData: OrderHistoryMessage = {product: '', message: 'Test customer message'}; diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/08_paymentBlock.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/08_paymentBlock.ts index 547d9c690e5d9..d84e4e6d74861 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/08_paymentBlock.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/08_paymentBlock.ts @@ -17,16 +17,16 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import Currencies from '@data/demo/currencies'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import type {OrderPayment} from '@data/types/order'; import { // Import data + dataCurrencies, dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -67,7 +67,7 @@ describe('BO - Orders - View and edit order : Check payment Block', async () => quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const paymentDataAmountInfTotal: OrderPayment = { date: today, @@ -95,7 +95,7 @@ describe('BO - Orders - View and edit order : Check payment Block', async () => paymentMethod: 'Bank transfer', transactionID: 12640, amount: 5.25, - currency: Currencies.mad.isoCode, + currency: dataCurrencies.mad.isoCode, }; const paymentDataAmountEqualRest: OrderPayment = { date: today, @@ -112,7 +112,7 @@ describe('BO - Orders - View and edit order : Check payment Block', async () => createOrderByCustomerTest(orderByCustomerData, `${baseContext}_preTest_2`); // Pre-condition: Create currency - createCurrencyTest(Currencies.mad, `${baseContext}_preTest_3`); + createCurrencyTest(dataCurrencies.mad, `${baseContext}_preTest_3`); // before and after functions before(async function () { @@ -348,7 +348,7 @@ describe('BO - Orders - View and edit order : Check payment Block', async () => const listOfCurrencies = await orderPageMessagesBlock.getCurrencySelectOptions(page); expect(listOfCurrencies).to.contain('€') - .and.to.contain(Currencies.mad.isoCode); + .and.to.contain(dataCurrencies.mad.isoCode); }); it('should add payment with new currency', async function () { @@ -407,11 +407,11 @@ describe('BO - Orders - View and edit order : Check payment Block', async () => expect(paymentsNumber, 'Payments number is not correct! ').to.equal(0); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatusPaymentAccepted', baseContext); - const textResult = await orderPageMessagesBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(textResult).to.equal(OrderStatuses.paymentAccepted.name); + const textResult = await orderPageMessagesBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(textResult).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check that the payments number is equal to 1', async function () { @@ -513,5 +513,5 @@ describe('BO - Orders - View and edit order : Check payment Block', async () => }); // Post-condition - Delete currency - deleteCurrencyTest(Currencies.mad, `${baseContext}_postTest_1`); + deleteCurrencyTest(dataCurrencies.mad, `${baseContext}_postTest_1`); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/09_addDiscount.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/09_addDiscount.ts index 07c73ed307d1a..3fa9e636c0c81 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/09_addDiscount.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/09_addDiscount.ts @@ -16,13 +16,13 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import Carriers from '@data/demo/carriers'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -66,7 +66,7 @@ describe('BO - Orders - View and edit order : Add discount', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const numberOfCartRules: number = 0; // Discount data invalid value diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/10_changeStatus.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/10_changeStatus.ts index 19fb42bf83b9f..a9062f754a435 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/10_changeStatus.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/10_changeStatus.ts @@ -13,14 +13,14 @@ import ordersPage from '@pages/BO/orders'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -51,7 +51,7 @@ describe('BO - Orders - View and edit order : Change order status', async () => quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition : Create order from FO @@ -129,7 +129,7 @@ describe('BO - Orders - View and edit order : Change order status', async () => await testContext.addContextItem(this, 'testIdentifier', 'selectSameStatus', baseContext); const actualStatus = await orderPageTabListBlock.getOrderStatus(page); - expect(actualStatus).to.be.equal(OrderStatuses.awaitingBankWire.name); + expect(actualStatus).to.be.equal(dataOrderStatuses.awaitingBankWire.name); await orderPageTabListBlock.selectOrderStatus(page, actualStatus); }); @@ -162,11 +162,11 @@ describe('BO - Orders - View and edit order : Change order status', async () => expect(isButtonVisible, 'Partial refund button is visible!').to.eq(false); }); - it(`should select the status '${OrderStatuses.canceled.name}'`, async function () { + it(`should select the status '${dataOrderStatuses.canceled.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'selectCanceledStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.canceled.name); - expect(result).to.equal(OrderStatuses.canceled.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.canceled.name); + expect(result).to.equal(dataOrderStatuses.canceled.name); }); it('should check that the statuses number is equal to 2', async function () { @@ -176,11 +176,11 @@ describe('BO - Orders - View and edit order : Change order status', async () => expect(statusesNumber).to.be.equal(2); }); - it(`should check that the actual status is '${OrderStatuses.canceled.name}'`, async function () { + it(`should check that the actual status is '${dataOrderStatuses.canceled.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkActualStatus', baseContext); const actualStatus = await orderPageTabListBlock.getOrderStatus(page); - expect(actualStatus).to.be.equal(OrderStatuses.canceled.name); + expect(actualStatus).to.be.equal(dataOrderStatuses.canceled.name); }); it('should check that \'Partial refund\' button is not visible', async function () { @@ -204,11 +204,11 @@ describe('BO - Orders - View and edit order : Change order status', async () => expect(isButtonVisible, 'Partial refund button is visible!').to.eq(false); }); - it(`should select the status '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should select the status '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'selectPaymentAcceptedStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(result).to.equal(OrderStatuses.paymentAccepted.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(result).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check that the statuses number is equal to 3', async function () { @@ -218,11 +218,11 @@ describe('BO - Orders - View and edit order : Change order status', async () => expect(statusesNumber).to.be.equal(3); }); - it(`should check that the actual status is '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should check that the actual status is '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkActualStatus2', baseContext); const actualStatus = await orderPageTabListBlock.getOrderStatus(page); - expect(actualStatus).to.be.equal(OrderStatuses.paymentAccepted.name); + expect(actualStatus).to.be.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check that \'Partial refund\' button is visible', async function () { @@ -256,11 +256,11 @@ describe('BO - Orders - View and edit order : Change order status', async () => expect(doesFileExist, 'File is not downloaded!').to.eq(true); }); - it(`should select the status '${OrderStatuses.shipped.name}'`, async function () { + it(`should select the status '${dataOrderStatuses.shipped.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'selectShippedStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check that the statuses number is equal to 4', async function () { @@ -270,11 +270,11 @@ describe('BO - Orders - View and edit order : Change order status', async () => expect(statusesNumber).to.be.equal(4); }); - it(`should check that the actual status is '${OrderStatuses.shipped.name}'`, async function () { + it(`should check that the actual status is '${dataOrderStatuses.shipped.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkActualStatus3', baseContext); const actualStatus = await orderPageTabListBlock.getOrderStatus(page); - expect(actualStatus).to.be.equal(OrderStatuses.shipped.name); + expect(actualStatus).to.be.equal(dataOrderStatuses.shipped.name); }); it('should click on \'View delivery slip\' button and check that the file is downloaded', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/11_checkInvoice.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/11_checkInvoice.ts index b478f6ad73ef4..03f571f20a6ef 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/11_checkInvoice.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/11_checkInvoice.ts @@ -27,8 +27,6 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import Addresses from '@data/demo/address'; import Carriers from '@data/demo/carriers'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import ProductData from '@data/faker/product'; import OrderData from '@data/faker/order'; @@ -36,6 +34,8 @@ import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -89,7 +89,7 @@ describe('BO - Orders - View and edit order: Check invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Customized product data const customizedProduct: ProductData = new ProductData({ @@ -113,7 +113,7 @@ describe('BO - Orders - View and edit order: Check invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Virtual product data const virtualProduct: ProductData = new ProductData({ @@ -358,11 +358,11 @@ describe('BO - Orders - View and edit order: Check invoice', async () => { expect(alertMessage).to.contains(orderPageCustomerBlock.successfulUpdateMessage); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus1', baseContext); - const textResult = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(textResult).to.equal(OrderStatuses.paymentAccepted.name); + const textResult = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(textResult).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check that there is no carrier', async function () { @@ -601,11 +601,11 @@ describe('BO - Orders - View and edit order: Check invoice', async () => { }); describe('Create invoice', async () => { - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus2', baseContext); - const textResult = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(textResult).to.equal(OrderStatuses.paymentAccepted.name); + const textResult = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(textResult).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should get the invoice file name', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/12_checkMultiInvoice.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/12_checkMultiInvoice.ts index 187b7e853a783..9960856a8534c 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/12_checkMultiInvoice.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/12_checkMultiInvoice.ts @@ -17,14 +17,14 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import Carriers from '@data/demo/carriers'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import OrderData from '@data/faker/order'; import ProductData from '@data/faker/product'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -82,7 +82,7 @@ describe('BO - Orders - View and edit order: Check multi invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const carrierDataToSelect: OrderShippingData = new OrderShippingData({ trackingNumber: '', @@ -157,10 +157,10 @@ describe('BO - Orders - View and edit order: Check multi invoice', async () => { // 2 - Create first invoice describe('Create the first invoice', async () => { - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await orderPageTabListBlock.updateOrderStatus(page, OrderStatuses.paymentAccepted.name); + const textResult = await orderPageTabListBlock.updateOrderStatus(page, dataOrderStatuses.paymentAccepted.name); expect(textResult).to.equal(orderPageProductsBlock.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/13_returnOrder.ts b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/13_returnOrder.ts index 604f6d267810c..d9c6c5b82f8aa 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/13_returnOrder.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/01_orders/viewAndEditOrder/13_returnOrder.ts @@ -15,8 +15,6 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import MailDevEmail from '@data/types/maildevEmail'; @@ -24,6 +22,8 @@ import MailDevEmail from '@data/types/maildevEmail'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -64,7 +64,7 @@ describe('BO - Orders - View and edit order : Return an order', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order by default customer @@ -117,10 +117,10 @@ describe('BO - Orders - View and edit order : Return an order', async () => { expect(pageTitle).to.contains(ordersPage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.delivered.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.delivered.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await ordersPage.setOrderStatus(page, 1, OrderStatuses.delivered); + const result = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.delivered); expect(result).to.equal(ordersPage.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/01_generateInvoiceByDate.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/01_generateInvoiceByDate.ts index d1cbc4de53c2d..40d3cb2436223 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/01_generateInvoiceByDate.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/01_generateInvoiceByDate.ts @@ -13,8 +13,10 @@ import ordersPage from '@pages/BO/orders'; import invoicesPage from '@pages/BO/orders/invoices'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -76,11 +78,11 @@ describe('BO - Orders - Invoices : Generate PDF file by date', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/02_generateInvoiceByStatus.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/02_generateInvoiceByStatus.ts index b71eed030d7eb..47f93d97d07a5 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/02_generateInvoiceByStatus.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/02_generateInvoiceByStatus.ts @@ -12,8 +12,10 @@ import ordersPage from '@pages/BO/orders'; import invoicesPage from '@pages/BO/orders/invoices'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -42,8 +44,8 @@ describe('BO - Orders - Invoices : Generate PDF file by status', async () => { describe('Create 2 invoices by changing the order status', async () => { [ - {args: {orderRow: 1, status: OrderStatuses.shipped.name}}, - {args: {orderRow: 2, status: OrderStatuses.paymentAccepted.name}}, + {args: {orderRow: 1, status: dataOrderStatuses.shipped.name}}, + {args: {orderRow: 2, status: dataOrderStatuses.paymentAccepted.name}}, ].forEach((orderToEdit, index: number) => { it('should go to \'Orders > Orders\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToOrdersPage${index + 1}`, baseContext); @@ -103,7 +105,7 @@ describe('BO - Orders - Invoices : Generate PDF file by status', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkNoInvoiceMessageError', baseContext); // Choose one status - await invoicesPage.chooseStatus(page, OrderStatuses.canceled.name); + await invoicesPage.chooseStatus(page, dataOrderStatuses.canceled.name); // Generate PDF const textMessage = await invoicesPage.generatePDFByStatusAndFail(page); @@ -114,8 +116,8 @@ describe('BO - Orders - Invoices : Generate PDF file by status', async () => { await testContext.addContextItem(this, 'testIdentifier', 'selectStatusesAndCheckInvoiceExistence', baseContext); // Choose 2 statuses - await invoicesPage.chooseStatus(page, OrderStatuses.paymentAccepted.name); - await invoicesPage.chooseStatus(page, OrderStatuses.shipped.name); + await invoicesPage.chooseStatus(page, dataOrderStatuses.paymentAccepted.name); + await invoicesPage.chooseStatus(page, dataOrderStatuses.shipped.name); // Generate PDF filePath = await invoicesPage.generatePDFByStatusAndDownload(page); @@ -132,7 +134,7 @@ describe('BO - Orders - Invoices : Generate PDF file by status', async () => { await testContext.addContextItem(this, 'testIdentifier', 'selectOneStatusAndCheckInvoiceExistence', baseContext); // Choose one status - await invoicesPage.chooseStatus(page, OrderStatuses.paymentAccepted.name); + await invoicesPage.chooseStatus(page, dataOrderStatuses.paymentAccepted.name); // Generate PDF filePath = await invoicesPage.generatePDFByStatusAndDownload(page); diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/01_enableDisableInvoices.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/01_enableDisableInvoices.ts index 34d44b5d3fc9a..bae4fc8ab4d94 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/01_enableDisableInvoices.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/01_enableDisableInvoices.ts @@ -13,14 +13,14 @@ import invoicesPage from '@pages/BO/orders/invoices'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -46,7 +46,7 @@ describe('BO - Orders - Invoices : Enable/Disable invoices', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order in FO @@ -67,7 +67,7 @@ describe('BO - Orders - Invoices : Enable/Disable invoices', async () => { args: { action: 'Disable', status: false, - orderStatus: OrderStatuses.shipped.name, + orderStatus: dataOrderStatuses.shipped.name, isInvoiceCreated: 'no invoice document created', }, }, @@ -75,7 +75,7 @@ describe('BO - Orders - Invoices : Enable/Disable invoices', async () => { args: { action: 'Enable', status: true, - orderStatus: OrderStatuses.paymentAccepted.name, + orderStatus: dataOrderStatuses.paymentAccepted.name, isInvoiceCreated: 'an invoice document created', }, }, diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/02_enableDisableTaxBreakdown.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/02_enableDisableTaxBreakdown.ts index cfad2fbe80d35..e436fb37d0d73 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/02_enableDisableTaxBreakdown.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/02_enableDisableTaxBreakdown.ts @@ -25,15 +25,15 @@ import {productPage as foProductPage} from '@pages/FO/classic/product'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import ProductData from '@data/faker/product'; -import TaxRuleData from '@data/faker/taxRule'; import TaxRulesGroupData from '@data/faker/taxRulesGroup'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + FakerTaxRule, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -60,12 +60,12 @@ describe('BO - Orders - Invoices : Enable/Disable tax breakdown', async () => { let secondInvoiceFileName: string | null; const taxRuleGroupToCreate: TaxRulesGroupData = new TaxRulesGroupData(); - const firstTaxRuleToCreate: TaxRuleData = new TaxRuleData({ + const firstTaxRuleToCreate: FakerTaxRule = new FakerTaxRule({ country: 'France', behaviour: 'Combine', name: 'TVA FR 20%', }); - const secondTaxRuleToCreate: TaxRuleData = new TaxRuleData({ + const secondTaxRuleToCreate: FakerTaxRule = new FakerTaxRule({ country: 'France', behaviour: 'Combine', name: 'TVA FR 10%', @@ -281,7 +281,7 @@ describe('BO - Orders - Invoices : Enable/Disable tax breakdown', async () => { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -322,11 +322,11 @@ describe('BO - Orders - Invoices : Enable/Disable tax breakdown', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'changeOrderStatusTaxBreakdown', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(result).to.equal(OrderStatuses.paymentAccepted.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(result).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should download the invoice', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/03_enableDisableProductImage.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/03_enableDisableProductImage.ts index b1a87a6da599e..3036735913622 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/03_enableDisableProductImage.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/03_enableDisableProductImage.ts @@ -20,13 +20,11 @@ import {homePage} from '@pages/FO/classic/home'; import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {productPage} from '@pages/FO/classic/product'; -// Importing data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; - import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -161,7 +159,7 @@ describe('BO - Orders - Invoices : Enable/Disable product image in invoices', as await testContext.addContextItem(this, 'testIdentifier', `confirmOrder${index}`, baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -211,11 +209,11 @@ describe('BO - Orders - Invoices : Enable/Disable product image in invoices', as expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', `updateOrderStatus${index}`, baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should download the invoice', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/04_invoicePrefix.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/04_invoicePrefix.ts index 21bb660ca49dd..7beea28724774 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/04_invoicePrefix.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/04_invoicePrefix.ts @@ -12,9 +12,13 @@ import invoicesPage from '@pages/BO/orders/invoices'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; import InvoiceData from '@data/faker/invoice'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -98,11 +102,11 @@ describe('BO - Orders - Invoices : Update invoice prefix and check the generated expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'UpdateStatusForUpdatedPrefix', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it(`should check that the invoice file name contain the prefix '${invoiceData.prefix}'`, async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/05_enableDisableCurrentYear.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/05_enableDisableCurrentYear.ts index 810e05fa27fe6..0e97440a898a2 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/05_enableDisableCurrentYear.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/05_enableDisableCurrentYear.ts @@ -11,8 +11,10 @@ import ordersPage from '@pages/BO/orders'; import invoicesPage from '@pages/BO/orders/invoices'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {use, expect} from 'chai'; import chaiString from 'chai-string'; @@ -111,11 +113,11 @@ describe('BO - Orders - Invoices : Enable/Disable current year', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatusEnabledCurrentYearInTheEnd', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check that the invoice file name contain current year at the end', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/06_otherOptions.ts b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/06_otherOptions.ts index 00c8ea883d556..112328ec3eb70 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/06_otherOptions.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/02_invoices/03_invoiceOptions/06_otherOptions.ts @@ -14,8 +14,6 @@ import invoicesPage from '@pages/BO/orders/invoices'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import InvoiceData from '@data/faker/invoice'; import OrderData from '@data/faker/order'; @@ -23,6 +21,8 @@ import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -60,7 +60,7 @@ describe('BO - Orders - Invoices : Update \'Invoice number, Legal free text and quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order in FO @@ -129,11 +129,11 @@ describe('BO - Orders - Invoices : Update \'Invoice number, Legal free text and expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatusUpdatedOptions', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should download the invoice', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/01_createFilterCreditSlips.ts b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/01_createFilterCreditSlips.ts index 9c36a800df28b..13da7ce4c0ac0 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/01_createFilterCreditSlips.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/01_createFilterCreditSlips.ts @@ -16,14 +16,14 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -54,7 +54,7 @@ describe('BO - Orders - Credit slips : Create, filter and check credit slips fil quantity: 5, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order in FO @@ -97,11 +97,11 @@ describe('BO - Orders - Credit slips : Create, filter and check credit slips fil expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateCreatedOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); const tests = [ diff --git a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/02_sortAndPaginationCreditSlips.ts b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/02_sortAndPaginationCreditSlips.ts index 651b7df949e2b..b92661a053d37 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/02_sortAndPaginationCreditSlips.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/02_sortAndPaginationCreditSlips.ts @@ -14,15 +14,15 @@ import ordersPage from '@pages/BO/orders'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; +// Import data= import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -54,7 +54,7 @@ describe('BO - Orders - Credit slips : Sort (by ID, Date and OrderID) and Pagina quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const numberOfOrderToCreate: number = 11; @@ -96,7 +96,7 @@ describe('BO - Orders - Credit slips : Sort (by ID, Date and OrderID) and Pagina expect(pageTitle).to.contains(ordersPage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem( this, 'testIdentifier', @@ -104,7 +104,7 @@ describe('BO - Orders - Credit slips : Sort (by ID, Date and OrderID) and Pagina `${baseContext}_preTest_${i}`, ); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.shipped); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.shipped); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/03_generateCreditSlipsByDate.ts b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/03_generateCreditSlipsByDate.ts index b444fa3d31a8a..9c7ac2143d227 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/03_generateCreditSlipsByDate.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/03_generateCreditSlipsByDate.ts @@ -16,14 +16,14 @@ import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -52,7 +52,7 @@ describe('BO - Orders - Credit slips : Generate Credit slip file by date', async quantity: 5, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order in FO @@ -95,11 +95,11 @@ describe('BO - Orders - Credit slips : Generate Credit slip file by date', async expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateCreatedOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should add a partial refund', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/04_creditSlipOptions.ts b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/04_creditSlipOptions.ts index db234a98aac45..0e9e959ff92fc 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/04_creditSlipOptions.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/03_creditSlips/04_creditSlipOptions.ts @@ -14,15 +14,15 @@ import ordersPage from '@pages/BO/orders'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; +// Import data= import OrderData from '@data/faker/order'; import ProductData from '@data/faker/product'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -65,7 +65,7 @@ describe('BO - Orders - Credit slips: Credit slip options', async () => { quantity: 3, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create first product @@ -136,11 +136,11 @@ describe('BO - Orders - Credit slips: Credit slip options', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should create a partial refund', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/01_generateDeliverySlipByDate.ts b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/01_generateDeliverySlipByDate.ts index c30a49645c9cb..d6c8c64af2f4f 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/01_generateDeliverySlipByDate.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/01_generateDeliverySlipByDate.ts @@ -13,8 +13,10 @@ import deliverySlipsPage from '@pages/BO/orders/deliverySlips'; import ordersPage from '@pages/BO/orders'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -70,11 +72,11 @@ describe('BO - Orders - Delivery slips : Generate Delivery slip file by date', a expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check the delivery slip document name', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/01_deliverySlipPrefix.ts b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/01_deliverySlipPrefix.ts index 8536929daf369..17626858a3a26 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/01_deliverySlipPrefix.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/01_deliverySlipPrefix.ts @@ -12,9 +12,13 @@ import deliverySlipsPage from '@pages/BO/orders/deliverySlips'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; import DeliverySlipOptionsData from '@data/faker/deliverySlipOptions'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -73,7 +77,7 @@ describe('BO - Orders - Delivery slips : Update delivery slip prefix and check t }); }); - describe(`Update the order status to '${OrderStatuses.shipped.name}' and check the file name`, async () => { + describe(`Update the order status to '${dataOrderStatuses.shipped.name}' and check the file name`, async () => { it('should go to \'Orders > Orders\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToOrdersPage', baseContext); @@ -96,11 +100,11 @@ describe('BO - Orders - Delivery slips : Update delivery slip prefix and check t expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it(`should check that the delivery slip file name contain '${deliverySlipData.prefix}'`, async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/02_deliverySlipNumber.ts b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/02_deliverySlipNumber.ts index f15c337174ee4..fcb510cb7fbfa 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/02_deliverySlipNumber.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/02_deliverySlipNumber.ts @@ -13,8 +13,6 @@ import ordersPage from '@pages/BO/orders'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import DeliverySlipOptionsData from '@data/faker/deliverySlipOptions'; import OrderData from '@data/faker/order'; @@ -22,6 +20,8 @@ import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -51,7 +51,7 @@ describe('BO - Orders - Delivery slips : Update \'Delivery slip number\'', async quantity: 5, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const deliverySlipData: DeliverySlipOptionsData = new DeliverySlipOptionsData(); @@ -120,11 +120,11 @@ describe('BO - Orders - Delivery slips : Update \'Delivery slip number\'', async expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}'`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check that the delivery slip file name contain the \'Delivery slip number\'', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/03_enableDisableProductImage.ts b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/03_enableDisableProductImage.ts index eb4ce380a74e1..7ea28ebe19c1c 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/03_enableDisableProductImage.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/04_deliverySlips/02_deliverySlipOptions/03_enableDisableProductImage.ts @@ -20,13 +20,11 @@ import deliverySlipsPage from '@pages/BO/orders/deliverySlips'; import ordersPage from '@pages/BO/orders'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import OrderStatuses from '@data/demo/orderStatuses'; - import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -175,7 +173,7 @@ describe('BO - Orders - Delivery slips : Enable/Disable product image', async () await testContext.addContextItem(this, 'testIdentifier', `confirmOrder${index}`, baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -225,11 +223,11 @@ describe('BO - Orders - Delivery slips : Enable/Disable product image', async () expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', `updateOrderStatus${index}`, baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should download the delivery slip', async function () { diff --git a/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/02_sortAndPagination.ts b/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/02_sortAndPagination.ts index 8bb3efebea03f..88f5ffce30089 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/02_sortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/02_sortAndPagination.ts @@ -13,12 +13,16 @@ import dashboardPage from '@pages/BO/dashboard'; import shoppingCartsPage from '@pages/BO/orders/shoppingCarts'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -37,8 +41,8 @@ describe('BO - Orders - Shopping carts : Sort and pagination shopping carts', as let browserContext: BrowserContext; let page: Page; - const addressData: AddressData = new AddressData({country: 'France'}); - const customerData: CustomerData = new CustomerData({password: '', lastName: 'guest'}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: '', lastName: 'guest'}); // New order by guest data const orderByGuestData: OrderData = new OrderData({ customer: customerData, @@ -49,7 +53,7 @@ describe('BO - Orders - Shopping carts : Sort and pagination shopping carts', as }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create 16 orders diff --git a/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/03_viewCarts.ts b/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/03_viewCarts.ts index c588035e6c404..574b93b41584c 100644 --- a/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/03_viewCarts.ts +++ b/tests/UI/campaigns/functional/BO/02_orders/05_shoppingCarts/03_viewCarts.ts @@ -17,13 +17,17 @@ import shoppingCartViewPage from '@pages/BO/orders/shoppingCarts/view'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -49,7 +53,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => { let numberOfShoppingCarts: number; let orderId: number; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); const orderData: OrderData = new OrderData({ customer: customerData, products: [ @@ -59,7 +63,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => { }, ], }); - const addressData: AddressData = new AddressData({ + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); @@ -151,7 +155,7 @@ describe('BO - Orders - Shopping carts : View carts', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkCartInformationBlock1', baseContext); const orderInformation = await shoppingCartViewPage.getOrderInformation(page); - await expect(orderInformation).to.contains('The customer has not proceeded to checkout yet.'); + expect(orderInformation).to.contains('The customer has not proceeded to checkout yet.'); const hasButtonCreateOrderFromCart = await shoppingCartViewPage.hasButtonCreateOrderFromCart(page); expect(hasButtonCreateOrderFromCart).to.eq(true); @@ -201,9 +205,9 @@ describe('BO - Orders - Shopping carts : View carts', async () => { await testContext.addContextItem(this, 'testIdentifier', 'fillAndCreateOrder', baseContext); // Choose payment method - await addOrderPage.setPaymentMethod(page, PaymentMethods.checkPayment.moduleName); + await addOrderPage.setPaymentMethod(page, dataPaymentMethods.checkPayment.moduleName); // Set order status - await addOrderPage.setOrderStatus(page, OrderStatuses.paymentAccepted); + await addOrderPage.setOrderStatus(page, dataOrderStatuses.paymentAccepted); // Create the order await addOrderPage.clickOnCreateOrderButton(page); diff --git a/tests/UI/campaigns/functional/BO/03_catalog/01_products/05_CRUDVirtualProduct.ts b/tests/UI/campaigns/functional/BO/03_catalog/01_products/05_CRUDVirtualProduct.ts index c9613660f3cad..cef6137e9e702 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/01_products/05_CRUDVirtualProduct.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/01_products/05_CRUDVirtualProduct.ts @@ -24,14 +24,14 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import ProductData from '@data/faker/product'; import type MailDevEmail from '@data/types/maildevEmail'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import type {BrowserContext, Page} from 'playwright'; @@ -256,7 +256,7 @@ describe('BO - Catalog - Products : CRUD virtual product', async () => { await testContext.addContextItem(this, 'testIdentifier', 'payTheOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -289,7 +289,7 @@ describe('BO - Catalog - Products : CRUD virtual product', async () => { it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/functional/BO/03_catalog/01_products/12_packTab.ts b/tests/UI/campaigns/functional/BO/03_catalog/01_products/12_packTab.ts index c2c51e51b7bd7..0a85c11cc4dca 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/01_products/12_packTab.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/01_products/12_packTab.ts @@ -22,14 +22,14 @@ import {checkoutPage} from '@pages/FO/classic/checkout'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import ProductData from '@data/faker/product'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import type {BrowserContext, Page} from 'playwright'; @@ -368,7 +368,7 @@ describe('BO - Catalog - Products : Pack Tab', async () => { expect(isStepDeliveryComplete).to.be.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -403,7 +403,7 @@ describe('BO - Catalog - Products : Pack Tab', async () => { }); }); - describe(`Set the order to ${OrderStatuses.delivered.name} & check stock`, async () => { + describe(`Set the order to ${dataOrderStatuses.delivered.name} & check stock`, async () => { it('should go to \'Orders > Orders\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToOrdersPage', baseContext); @@ -420,7 +420,7 @@ describe('BO - Catalog - Products : Pack Tab', async () => { it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult: string = await ordersPage.setOrderStatus(page, 1, OrderStatuses.delivered); + const textResult: string = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.delivered); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); @@ -507,7 +507,7 @@ describe('BO - Catalog - Products : Pack Tab', async () => { expect(isStepDeliveryComplete).to.be.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/BO/03_catalog/01_products/13_virtualTab.ts b/tests/UI/campaigns/functional/BO/03_catalog/01_products/13_virtualTab.ts index f1893c3a5aab9..ff583fdb99aee 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/01_products/13_virtualTab.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/01_products/13_virtualTab.ts @@ -26,11 +26,11 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; // Import data import ProductData from '@data/faker/product'; -import PaymentMethods from '@data/demo/paymentMethods'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import type {BrowserContext, Page} from 'playwright'; @@ -163,7 +163,7 @@ describe('BO - Catalog - Products : Virtual tab', async () => { it('should pay the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'payTheOrder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); expect(cardTitle).to.contains(orderConfirmationPage.orderConfirmationCardTitle); diff --git a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/01_information/02_enableDisablePartialUse.ts b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/01_information/02_enableDisablePartialUse.ts index fc4d91a641ec5..8ffba55851fa9 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/01_information/02_enableDisablePartialUse.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/01_information/02_enableDisablePartialUse.ts @@ -21,11 +21,11 @@ import {checkoutPage} from '@pages/FO/classic/checkout'; // Import data import Products from '@data/demo/products'; import CartRuleData from '@data/faker/cartRule'; -import PaymentMethods from '@data/demo/paymentMethods'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -190,7 +190,7 @@ describe('BO - Catalog - Cart rules : CRUD cart rule with enabled/disabled parti await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -389,7 +389,7 @@ describe('BO - Catalog - Cart rules : CRUD cart rule with enabled/disabled parti await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder2', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/04_checkTotalAvailable.ts b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/04_checkTotalAvailable.ts index 7bfbd9110e326..e739ff3c0d6e1 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/04_checkTotalAvailable.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/04_checkTotalAvailable.ts @@ -19,13 +19,13 @@ import {homePage as foHomePage} from '@pages/FO/classic/home'; import {productPage as foProductPage} from '@pages/FO/classic/product'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import CartRuleData from '@data/faker/cartRule'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -189,7 +189,7 @@ describe('BO - Catalog - Cart rules : Check Total available', async () => { it('should choose the payment type and confirm the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'choosePaymentMethod', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/05_checkTotalAvailableForEachUser.ts b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/05_checkTotalAvailableForEachUser.ts index 3b873dd254c95..906d406cce5b0 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/05_checkTotalAvailableForEachUser.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/05_checkTotalAvailableForEachUser.ts @@ -21,13 +21,13 @@ import {productPage} from '@pages/FO/classic/product'; import {loginPage} from '@pages/FO/classic/login'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import CartRuleData from '@data/faker/cartRule'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -192,7 +192,7 @@ describe('BO - Catalog - Cart rules : Check Total available for each user', asyn it('should choose the payment type and confirm the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'choosePaymentMethod', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/06_countrySelection.ts b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/06_countrySelection.ts index 639717f2d287f..735bfe2827a2f 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/06_countrySelection.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/07_discounts/01_cartRules/01_CRUDCartRule/02_conditions/06_countrySelection.ts @@ -20,13 +20,13 @@ import {homePage as foHomePage} from '@pages/FO/classic/home'; import {productPage as foProductPage} from '@pages/FO/classic/product'; // Import data -import Countries from '@data/demo/countries'; import Products from '@data/demo/products'; import Carriers from '@data/demo/carriers'; import CartRuleData from '@data/faker/cartRule'; import { // Import data + dataCountries, dataCustomers, } from '@prestashop-core/ui-testing'; @@ -57,7 +57,7 @@ describe('BO - Catalog - Cart rules : Country selection', async () => { name: 'Cart rule country selection', code: '4QABV6L3', countrySelection: true, - countryIDToRemove: Countries.france.id, + countryIDToRemove: dataCountries.france.id, discountType: 'Amount', discountAmount: { value: 15, @@ -80,7 +80,7 @@ describe('BO - Catalog - Cart rules : Country selection', async () => { await loginCommon.loginBO(this, page); }); - describe(`BO : Enable the country '${Countries.unitedStates.name}'`, async () => { + describe(`BO : Enable the country '${dataCountries.unitedStates.name}'`, async () => { it('should go to \'International > Locations\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToLocationsPage', baseContext); @@ -111,16 +111,16 @@ describe('BO - Catalog - Cart rules : Country selection', async () => { expect(numberOfCountries).to.be.above(0); }); - it(`should search for the country '${Countries.unitedStates.name}'`, async function () { + it(`should search for the country '${dataCountries.unitedStates.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterByNameToEnable', baseContext); - await countriesPage.filterTable(page, 'input', 'b!name', Countries.unitedStates.name); + await countriesPage.filterTable(page, 'input', 'b!name', dataCountries.unitedStates.name); const numberOfCountriesAfterFilter = await countriesPage.getNumberOfElementInGrid(page); expect(numberOfCountriesAfterFilter).to.be.equal(1); const textColumn = await countriesPage.getTextColumnFromTable(page, 1, 'b!name'); - expect(textColumn).to.equal(Countries.unitedStates.name); + expect(textColumn).to.equal(dataCountries.unitedStates.name); }); it('should enable the country', async function () { diff --git a/tests/UI/campaigns/functional/BO/03_catalog/08_stocks/01_movements/01_filterMovements.ts b/tests/UI/campaigns/functional/BO/03_catalog/08_stocks/01_movements/01_filterMovements.ts index fc8537adb87e5..62bce1a2c9dbe 100644 --- a/tests/UI/campaigns/functional/BO/03_catalog/08_stocks/01_movements/01_filterMovements.ts +++ b/tests/UI/campaigns/functional/BO/03_catalog/08_stocks/01_movements/01_filterMovements.ts @@ -28,8 +28,6 @@ import {productPage as foProductPage} from '@pages/FO/classic/product'; // Import data import Categories from '@data/demo/categories'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import EmployeeData from '@data/faker/employee'; import {ProductCombinationBulk} from '@data/types/product'; @@ -37,6 +35,8 @@ import {ProductCombinationBulk} from '@data/types/product'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -203,7 +203,7 @@ describe('BO - Stocks - Movements : Filter by category, movement type, employee await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -248,7 +248,7 @@ describe('BO - Stocks - Movements : Filter by category, movement type, employee it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.delivered); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.delivered); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); }); diff --git a/tests/UI/campaigns/functional/BO/04_customers/01_customers/02_CRUDCustomer.ts b/tests/UI/campaigns/functional/BO/04_customers/01_customers/02_CRUDCustomer.ts index 52b16b74939d9..bbe345da28334 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/01_customers/02_CRUDCustomer.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/01_customers/02_CRUDCustomer.ts @@ -15,8 +15,10 @@ import dashboardPage from '@pages/BO/dashboard'; import {homePage as foHomePage} from '@pages/FO/classic/home'; import {loginPage as foLoginPage} from '@pages/FO/classic/login'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -29,8 +31,8 @@ describe('BO - Customers - Customers : CRUD Customer in BO', async () => { let page: Page; let numberOfCustomers: number = 0; - const createCustomerData: CustomerData = new CustomerData(); - const editCustomerData: CustomerData = new CustomerData({enabled: false}); + const createCustomerData: FakerCustomer = new FakerCustomer(); + const editCustomerData: FakerCustomer = new FakerCustomer({enabled: false}); const createCustomerName: string = `${createCustomerData.firstName[0]}. ${createCustomerData.lastName}`; const editCustomerName: string = `${editCustomerData.firstName[0]}. ${editCustomerData.lastName}`; diff --git a/tests/UI/campaigns/functional/BO/04_customers/01_customers/03_customersBulkActions.ts b/tests/UI/campaigns/functional/BO/04_customers/01_customers/03_customersBulkActions.ts index 31bc584f1d3d8..49696f08ee664 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/01_customers/03_customersBulkActions.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/01_customers/03_customersBulkActions.ts @@ -10,8 +10,10 @@ import customersPage from '@pages/BO/customers'; import addCustomerPage from '@pages/BO/customers/add'; import dashboardPage from '@pages/BO/dashboard'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -27,8 +29,8 @@ describe('BO - Customers - Customers : Customers bulk actions', async () => { let page: Page; let numberOfCustomers: number = 0; - const firstCustomerData: CustomerData = new CustomerData({firstName: 'todelete'}); - const secondCustomerData: CustomerData = new CustomerData({firstName: 'todelete'}); + const firstCustomerData: FakerCustomer = new FakerCustomer({firstName: 'todelete'}); + const secondCustomerData: FakerCustomer = new FakerCustomer({firstName: 'todelete'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/04_customers/01_customers/08_viewCustomer.ts b/tests/UI/campaigns/functional/BO/04_customers/01_customers/08_viewCustomer.ts index e2b09629200bf..4e232818f3d8c 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/01_customers/08_viewCustomer.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/01_customers/08_viewCustomer.ts @@ -24,11 +24,15 @@ import {productPage} from '@pages/FO/classic/product'; // Import data import Languages from '@data/demo/languages'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; + +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -53,10 +57,10 @@ describe('BO - Customers - Customers : View information about customer', async ( const today: string = date.getDateFormat('mm/dd/yyyy'); // Init data - const createCustomerData: CustomerData = new CustomerData({defaultCustomerGroup: 'Customer'}); - const editCustomerData: CustomerData = new CustomerData({defaultCustomerGroup: 'Visitor'}); - const address: AddressData = new AddressData({city: 'Paris', country: 'France'}); - const createAddressData: AddressData = new AddressData({country: 'France'}); + const createCustomerData: FakerCustomer = new FakerCustomer({defaultCustomerGroup: 'Customer'}); + const editCustomerData: FakerCustomer = new FakerCustomer({defaultCustomerGroup: 'Visitor'}); + const address: FakerAddress = new FakerAddress({city: 'Paris', country: 'France'}); + const createAddressData: FakerAddress = new FakerAddress({country: 'France'}); // Get customer birthdate format 'mm/dd/yyyy' const mmBirth: string = `0${createCustomerData.monthOfBirth}`.slice(-2); @@ -259,7 +263,7 @@ describe('BO - Customers - Customers : View information about customer', async ( it('should choose the payment method and confirm the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'choosePaymentMethod', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -358,7 +362,7 @@ describe('BO - Customers - Customers : View information about customer', async ( const carts = await viewCustomerPage.getTextFromElement(page, 'Orders'); expect(carts).to.contains(today); expect(carts).to.contains('Bank transfer'); - expect(carts).to.contains(OrderStatuses.awaitingBankWire.name); + expect(carts).to.contains(dataOrderStatuses.awaitingBankWire.name); expect(carts).to.contains('€0.00'); }); @@ -481,8 +485,8 @@ describe('BO - Customers - Customers : View information about customer', async ( it('should modify order status', async function () { await testContext.addContextItem(this, 'testIdentifier', 'modifyOrderStatus', baseContext); - const result = await orderPageCustomerBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageCustomerBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should go to \'Customers > Customers\' page', async function () { @@ -523,7 +527,7 @@ describe('BO - Customers - Customers : View information about customer', async ( const carts = await viewCustomerPage.getTextFromElement(page, 'Orders'); expect(carts).to.contains(today); expect(carts).to.contains('Bank transfer'); - expect(carts).to.contains(OrderStatuses.shipped.name); + expect(carts).to.contains(dataOrderStatuses.shipped.name); expect(carts).to.contains(Products.demo_1.finalPrice); }); diff --git a/tests/UI/campaigns/functional/BO/04_customers/01_customers/11_transformGuestToCustomer.ts b/tests/UI/campaigns/functional/BO/04_customers/01_customers/11_transformGuestToCustomer.ts index 609e40b657cb3..d480d265bac70 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/01_customers/11_transformGuestToCustomer.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/01_customers/11_transformGuestToCustomer.ts @@ -15,12 +15,16 @@ import customersPage from '@pages/BO/customers'; import viewCustomerPage from '@pages/BO/customers/view'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import MailDevEmail from '@data/types/maildevEmail'; @@ -35,8 +39,8 @@ describe('BO - Customers _ Customers : Transform guest to customer account', asy let newMail: MailDevEmail; let mailListener: MailDev; - const customerData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); const orderData: OrderData = new OrderData({ customer: customerData, @@ -47,7 +51,7 @@ describe('BO - Customers _ Customers : Transform guest to customer account', asy }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition: Setup config SMTP diff --git a/tests/UI/campaigns/functional/BO/04_customers/02_addresses/02_CRUDAddressInBO.ts b/tests/UI/campaigns/functional/BO/04_customers/02_addresses/02_CRUDAddressInBO.ts index 731602af54a42..0fd3ec7535f98 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/02_addresses/02_CRUDAddressInBO.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/02_addresses/02_CRUDAddressInBO.ts @@ -10,8 +10,9 @@ import addressesPage from '@pages/BO/customers/addresses'; import addAddressPage from '@pages/BO/customers/addresses/add'; import dashboardPage from '@pages/BO/dashboard'; -// Import data -import AddressData from '@data/faker/address'; +import { + FakerAddress, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,8 +25,8 @@ describe('BO - Customers - Addresses : CRUD Address in BO', async () => { let page: Page; let numberOfAddresses: number = 0; - const createAddressData: AddressData = new AddressData({email: 'pub@prestashop.com', country: 'France'}); - const editAddressData: AddressData = new AddressData({country: 'France'}); + const createAddressData: FakerAddress = new FakerAddress({email: 'pub@prestashop.com', country: 'France'}); + const editAddressData: FakerAddress = new FakerAddress({country: 'France'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/04_customers/02_addresses/03_addressesBulkActions.ts b/tests/UI/campaigns/functional/BO/04_customers/02_addresses/03_addressesBulkActions.ts index 21c4d77d7a7f1..075e8fa3c9de6 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/02_addresses/03_addressesBulkActions.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/02_addresses/03_addressesBulkActions.ts @@ -10,8 +10,9 @@ import addressesPage from '@pages/BO/customers/addresses'; import addAddressPage from '@pages/BO/customers/addresses/add'; import dashboardPage from '@pages/BO/dashboard'; -// Import data -import AddressData from '@data/faker/address'; +import { + FakerAddress, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,7 +25,7 @@ describe('BO - Customers - Addresses : Addresses bulk actions', async () => { let page: Page; let numberOfAddresses: number = 0; - const addressData: AddressData = new AddressData({address: 'todelete', email: 'pub@prestashop.com', country: 'France'}); + const addressData: FakerAddress = new FakerAddress({address: 'todelete', email: 'pub@prestashop.com', country: 'France'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/04_customers/02_addresses/06_setRequiredFields.ts b/tests/UI/campaigns/functional/BO/04_customers/02_addresses/06_setRequiredFields.ts index 1d803907bd2df..31fdff1781dd1 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/02_addresses/06_setRequiredFields.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/02_addresses/06_setRequiredFields.ts @@ -16,12 +16,10 @@ import {myAccountPage} from '@pages/FO/classic/myAccount'; import {addressesPage as foAddressesPage} from '@pages/FO/classic/myAccount/addresses'; import {addAddressPage} from '@pages/FO/classic/myAccount/addAddress'; -// Import data -import AddressData from '@data/faker/address'; - import { // Import data dataCustomers, + FakerAddress, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -39,8 +37,8 @@ describe('BO - Customers - Addresses : Set required fields for addresses', async let browserContext: BrowserContext; let page: Page; - const addressDataWithVatNumber: AddressData = new AddressData({country: 'France', vatNumber: '0102030405'}); - const addressDataWithoutVatNumber: AddressData = new AddressData({country: 'France'}); + const addressDataWithVatNumber: FakerAddress = new FakerAddress({country: 'France', vatNumber: '0102030405'}); + const addressDataWithoutVatNumber: FakerAddress = new FakerAddress({country: 'France'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/02_viewOrder.ts b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/02_viewOrder.ts index d7101f96da3f0..06be4b94d4de3 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/02_viewOrder.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/02_viewOrder.ts @@ -14,14 +14,14 @@ import ordersPage from '@pages/BO/orders'; import {viewOrderBasePage} from '@pages/BO/orders/view/viewOrderBasePage'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -57,7 +57,7 @@ describe('BO - Customers - Outstanding : View order', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition : Enable B2B @@ -113,7 +113,7 @@ describe('BO - Customers - Outstanding : View order', async () => { it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); @@ -121,7 +121,7 @@ describe('BO - Customers - Outstanding : View order', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkStatusBO', baseContext); const orderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(orderStatus, 'Order status was not updated').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status was not updated').to.equal(dataOrderStatuses.paymentAccepted.name); }); }); diff --git a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/03_viewInvoice.ts b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/03_viewInvoice.ts index 881fa3fc8ed42..41032378a68fa 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/03_viewInvoice.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/03_viewInvoice.ts @@ -14,14 +14,14 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -56,7 +56,7 @@ describe('BO - Customers - Outstanding : View invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition : Enable B2B @@ -106,7 +106,7 @@ describe('BO - Customers - Outstanding : View invoice', async () => { it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); @@ -114,7 +114,7 @@ describe('BO - Customers - Outstanding : View invoice', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkStatusBO', baseContext); const orderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(orderStatus, 'Order status was not updated').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status was not updated').to.equal(dataOrderStatuses.paymentAccepted.name); }); }); diff --git a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/04_pagination.ts b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/04_pagination.ts index edafd76deb9f3..79bd7d1194e5d 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/04_pagination.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/04_pagination.ts @@ -13,14 +13,14 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -57,7 +57,7 @@ describe('BO - Customers - Outstanding : Pagination of the outstanding page', as quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition : Enable B2B @@ -103,7 +103,7 @@ describe('BO - Customers - Outstanding : Pagination of the outstanding page', as it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', `updateOrderStatus_${index}`, baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); @@ -111,7 +111,7 @@ describe('BO - Customers - Outstanding : Pagination of the outstanding page', as await testContext.addContextItem(this, 'testIdentifier', `checkStatusBO_${index}`, baseContext); const orderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(orderStatus, 'Order status was not updated').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status was not updated').to.equal(dataOrderStatuses.paymentAccepted.name); }); }); }); diff --git a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/05_sortFilterOutstanding.ts b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/05_sortFilterOutstanding.ts index f9fd7dd724106..40483dd84c4e0 100644 --- a/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/05_sortFilterOutstanding.ts +++ b/tests/UI/campaigns/functional/BO/04_customers/03_outstanding/05_sortFilterOutstanding.ts @@ -17,13 +17,17 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; +import { + //Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -50,11 +54,11 @@ describe('BO - Customers - Outstanding : Filter and sort the Outstanding table', let numberOutstanding: number; // New B2B customers - const createCustomerData1: CustomerData = new CustomerData(); - const createCustomerData2: CustomerData = new CustomerData(); - const createCustomerData3: CustomerData = new CustomerData(); + const createCustomerData1: FakerCustomer = new FakerCustomer(); + const createCustomerData2: FakerCustomer = new FakerCustomer(); + const createCustomerData3: FakerCustomer = new FakerCustomer(); - const customersData: CustomerData[] = [createCustomerData1, createCustomerData2, createCustomerData3]; + const customersData: FakerCustomer[] = [createCustomerData1, createCustomerData2, createCustomerData3]; // Const used to get today date format const today: string = date.getDateFormat('yyyy-mm-dd'); @@ -77,8 +81,8 @@ describe('BO - Customers - Outstanding : Filter and sort the Outstanding table', it('should login to BO', async function () { await loginCommon.loginBO(this, page); }); - customersData.forEach((customerData: CustomerData, index: number) => { - const addressData: AddressData = new AddressData({ + customersData.forEach((customerData: FakerCustomer, index: number) => { + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); @@ -91,7 +95,7 @@ describe('BO - Customers - Outstanding : Filter and sort the Outstanding table', }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition : Create new B2B customer @@ -125,7 +129,7 @@ describe('BO - Customers - Outstanding : Filter and sort the Outstanding table', it('should update order status', async function () { await testContext.addContextItem(this, 'testIdentifier', `updateOrderStatus_${index}`, baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); }); @@ -133,7 +137,7 @@ describe('BO - Customers - Outstanding : Filter and sort the Outstanding table', await testContext.addContextItem(this, 'testIdentifier', `checkStatusBO_${index}`, baseContext); const orderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(orderStatus, 'Order status was not updated').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status was not updated').to.equal(dataOrderStatuses.paymentAccepted.name); }); }); }); @@ -389,7 +393,7 @@ describe('BO - Customers - Outstanding : Filter and sort the Outstanding table', }); // Post-Condition: Delete created customers by bulk action - customersData.forEach((customerData: CustomerData, index: number) => { + customersData.forEach((customerData: FakerCustomer, index: number) => { bulkDeleteCustomersTest('email', customerData.email, `${baseContext}_postTest_${index + 1}`); }); diff --git a/tests/UI/campaigns/functional/BO/05_customerService/01_customerService/06_forwardMessage.ts b/tests/UI/campaigns/functional/BO/05_customerService/01_customerService/06_forwardMessage.ts index 04b3ad857c3a9..6b993f247c488 100644 --- a/tests/UI/campaigns/functional/BO/05_customerService/01_customerService/06_forwardMessage.ts +++ b/tests/UI/campaigns/functional/BO/05_customerService/01_customerService/06_forwardMessage.ts @@ -27,7 +27,6 @@ import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import MessageData from '@data/faker/message'; import EmployeeData from '@data/faker/employee'; import type MailDevEmail from '@data/types/maildevEmail'; @@ -35,6 +34,7 @@ import type MailDevEmail from '@data/types/maildevEmail'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -182,7 +182,7 @@ describe('BO - Customer Service : Forward message', async () => { it('should Pay and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); expect(cardTitle).to.contains(orderConfirmationPage.orderConfirmationCardTitle); diff --git a/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/01_merchandiseReturnOptions.ts b/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/01_merchandiseReturnOptions.ts index cf0f80fca8157..4e2950d5028db 100644 --- a/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/01_merchandiseReturnOptions.ts +++ b/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/01_merchandiseReturnOptions.ts @@ -23,13 +23,11 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {productPage} from '@pages/FO/classic/product'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; - import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -130,7 +128,7 @@ describe('BO - Customer Service - Merchandise Returns : Merchandise return (RMA) await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -216,11 +214,11 @@ describe('BO - Customer Service - Merchandise Returns : Merchandise return (RMA) expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', `updateOrderStatus${index}`, baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check if the button \'Return products\' is visible', async function () { diff --git a/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/02_deleteProduct.ts b/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/02_deleteProduct.ts index fc9fd625acbc5..3fa441cba34a4 100644 --- a/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/02_deleteProduct.ts +++ b/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/02_deleteProduct.ts @@ -25,13 +25,11 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; - import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -139,7 +137,7 @@ describe('BO - Customer Service - Merchandise Returns : Delete product', async ( it('should choose payment method and confirm the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); expect(cardTitle).to.contains(orderConfirmationPage.orderConfirmationCardTitle); @@ -196,11 +194,11 @@ describe('BO - Customer Service - Merchandise Returns : Delete product', async ( expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check if the button \'Return products\' is visible', async function () { diff --git a/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/03_updateStatus.ts b/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/03_updateStatus.ts index 989d49d34da1a..170e316f011fb 100644 --- a/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/03_updateStatus.ts +++ b/tests/UI/campaigns/functional/BO/05_customerService/03_merchandiseReturns/03_updateStatus.ts @@ -27,8 +27,6 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderReturnStatuses from '@data/demo/orderReturnStatuses'; import Addresses from '@data/demo/address'; @@ -37,6 +35,8 @@ import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -79,7 +79,7 @@ describe('BO - Customer Service - Merchandise Returns : Update status', async () quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // before and after functions @@ -141,11 +141,11 @@ describe('BO - Customer Service - Merchandise Returns : Update status', async () expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should check if the button \'Return products\' is visible', async function () { diff --git a/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/01_CRUDCarrier.ts b/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/01_CRUDCarrier.ts index f786b4e8f1e1e..0093d4642d999 100644 --- a/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/01_CRUDCarrier.ts +++ b/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/01_CRUDCarrier.ts @@ -18,12 +18,10 @@ import {homePage} from '@pages/FO/classic/home'; import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {productPage} from '@pages/FO/classic/product'; -// Import data -import CarrierData from '@data/faker/carrier'; - import { // Import data dataCustomers, + FakerCarrier, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -44,8 +42,8 @@ describe('BO - Shipping - Carriers : CRUD carrier in BO', async () => { let numberOfCarriers: number = 0; let carrierID: number = 0; - const createCarrierData: CarrierData = new CarrierData({freeShipping: false, zoneID: 4, allZones: false}); - const editCarrierData: CarrierData = new CarrierData({ + const createCarrierData: FakerCarrier = new FakerCarrier({freeShipping: false, zoneID: 4, allZones: false}); + const editCarrierData: FakerCarrier = new FakerCarrier({ freeShipping: false, rangeSup: 50, allZones: true, diff --git a/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/02_filterSortAndPagination.ts b/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/02_filterSortAndPagination.ts index 7ce085abde1de..219ff2873b61d 100644 --- a/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/02_filterSortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/02_filterSortAndPagination.ts @@ -14,7 +14,11 @@ import addCarrierPage from '@pages/BO/shipping/carriers/add'; // Import data import Carriers from '@data/demo/carriers'; -import CarrierData from '@data/faker/carrier'; + +import { + // Import data + FakerCarrier, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -232,7 +236,7 @@ describe('BO - Shipping - Carriers : Filter, sort and pagination carriers', asyn creationTests.forEach((test: number, index: number) => { before(() => files.generateImage(`todelete${index}.jpg`)); - const carrierData: CarrierData = new CarrierData({name: `todelete${index}`}); + const carrierData: FakerCarrier = new FakerCarrier({name: `todelete${index}`}); it('should go to add new carrier page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddCarrierPage${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/03_quickEditAndBulkActions.ts b/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/03_quickEditAndBulkActions.ts index 0dc9104015b51..97b581e3b6ad1 100644 --- a/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/03_quickEditAndBulkActions.ts +++ b/tests/UI/campaigns/functional/BO/09_shipping/01_carriers/03_quickEditAndBulkActions.ts @@ -11,8 +11,10 @@ import dashboardPage from '@pages/BO/dashboard'; import carriersPage from '@pages/BO/shipping/carriers'; import addCarrierPage from '@pages/BO/shipping/carriers/add'; -// Import data -import CarrierData from '@data/faker/carrier'; +import { + // Import data + FakerCarrier, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -69,7 +71,7 @@ describe('BO - Shipping - Carriers : Quick edit and bulk actions carriers', asyn creationTests.forEach((test: number, index: number) => { before(() => files.generateImage(`todelete${index}.jpg`)); - const carrierData: CarrierData = new CarrierData({name: `todelete${index}`}); + const carrierData: FakerCarrier = new FakerCarrier({name: `todelete${index}`}); it('should go to add new carrier page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddCarrierPage${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/01_handling/01_handlingCharges.ts b/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/01_handling/01_handlingCharges.ts index c88f0748aa241..bfbf5eb7c58ce 100644 --- a/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/01_handling/01_handlingCharges.ts +++ b/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/01_handling/01_handlingCharges.ts @@ -22,13 +22,11 @@ import {homePage} from '@pages/FO/classic/home'; import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {productPage} from '@pages/FO/classic/product'; -// Import data -import CarrierData from '@data/faker/carrier'; - import { // Import data dataCustomers, dataGroups, + FakerCarrier, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -51,7 +49,7 @@ describe('BO - Shipping - Preferences : Test handling charges for carriers in FO let page: Page; let newCarrierID: number = 0; - const createCarrierData: CarrierData = new CarrierData({ + const createCarrierData: FakerCarrier = new FakerCarrier({ freeShipping: false, allZones: true, handlingCosts: true, diff --git a/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/02_carrierOptions/01_defaultCarrier.ts b/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/02_carrierOptions/01_defaultCarrier.ts index 1c1aa6972c98a..d6033d445be1e 100644 --- a/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/02_carrierOptions/01_defaultCarrier.ts +++ b/tests/UI/campaigns/functional/BO/09_shipping/02_preferences/02_carrierOptions/01_defaultCarrier.ts @@ -17,11 +17,11 @@ import {homePage as foHomePage} from '@pages/FO/classic/home'; // Import data import Carriers from '@data/demo/carriers'; -import CarrierData from '@data/faker/carrier'; import { // Import data dataCustomers, + FakerCarrier, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -68,12 +68,12 @@ describe('BO - Shipping - Preferences : Update default carrier and check it in F expect(pageTitle).to.contains(preferencesPage.pageTitle); }); - const carriers: CarrierData[] = [ + const carriers: FakerCarrier[] = [ Carriers.myCarrier, Carriers.default, ]; - carriers.forEach((carrier: CarrierData, index: number) => { + carriers.forEach((carrier: FakerCarrier, index: number) => { describe(`Set default carrier to '${carrier.name}' and check result in FO`, async () => { it(`should set default carrier to ${carrier.name} in BO`, async function () { await testContext.addContextItem(this, 'testIdentifier', `setDefaultCarrier${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/10_payment/02_preferences/02_groupRestrictions.ts b/tests/UI/campaigns/functional/BO/10_payment/02_preferences/02_groupRestrictions.ts index 98829da23e35d..5aa3b63b15d18 100644 --- a/tests/UI/campaigns/functional/BO/10_payment/02_preferences/02_groupRestrictions.ts +++ b/tests/UI/campaigns/functional/BO/10_payment/02_preferences/02_groupRestrictions.ts @@ -17,13 +17,11 @@ import {checkoutPage} from '@pages/FO/classic/checkout'; import {homePage} from '@pages/FO/classic/home'; import {productPage} from '@pages/FO/classic/product'; -// Import data -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerAddress, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -37,9 +35,9 @@ describe('BO - Payment - Preferences : Configure group restrictions', async () = let numberOfCustomers: number = 0; - const address: AddressData = new AddressData({city: 'Paris', country: 'France'}); - const visitorData: CustomerData = new CustomerData({defaultCustomerGroup: 'Visitor'}); - const guestData: CustomerData = new CustomerData({defaultCustomerGroup: 'Guest'}); + const address: FakerAddress = new FakerAddress({city: 'Paris', country: 'France'}); + const visitorData: FakerCustomer = new FakerCustomer({defaultCustomerGroup: 'Visitor'}); + const guestData: FakerCustomer = new FakerCustomer({defaultCustomerGroup: 'Guest'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/01_importLocalizationPack.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/01_importLocalizationPack.ts index 60509ba772a26..3d2f21e22e804 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/01_importLocalizationPack.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/01_importLocalizationPack.ts @@ -15,9 +15,12 @@ import languagesPage from '@pages/BO/international/languages'; import {homePage as foHomePage} from '@pages/FO/classic/home'; // Import data -import Currencies from '@data/demo/currencies'; import Languages from '@data/demo/languages'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -92,10 +95,10 @@ describe('BO - International - Localization : Import a localization pack', async await testContext.addContextItem(this, 'testIdentifier', 'changeFoCurrency', baseContext); // Check currency - await foHomePage.changeCurrency(page, Currencies.chileanPeso.isoCode, Currencies.chileanPeso.symbol); + await foHomePage.changeCurrency(page, dataCurrencies.chileanPeso.isoCode, dataCurrencies.chileanPeso.symbol); const shopCurrency = await foHomePage.getDefaultCurrency(page); - expect(shopCurrency).to.contain(Currencies.chileanPeso.isoCode); + expect(shopCurrency).to.contain(dataCurrencies.chileanPeso.isoCode); }); it('should change FO language', async function () { @@ -164,13 +167,13 @@ describe('BO - International - Localization : Import a localization pack', async expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code of currency '${Currencies.chileanPeso.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.chileanPeso.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterCurrencies', baseContext); - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.chileanPeso.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.chileanPeso.isoCode); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.chileanPeso.isoCode); + expect(textColumn).to.contains(dataCurrencies.chileanPeso.isoCode); }); it('should delete currency', async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/04_defaultCurrency.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/04_defaultCurrency.ts index 4bc4d72ba7c35..31482990cafa5 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/04_defaultCurrency.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/04_defaultCurrency.ts @@ -15,9 +15,12 @@ import languagesPage from '@pages/BO/international/languages'; import {homePage as foHomePage} from '@pages/FO/classic/home'; // Import Data -import Currencies from '@data/demo/currencies'; import Languages from '@data/demo/languages'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -77,14 +80,14 @@ describe('BO - International - Localization : Update default currency', async () const currenciesToTest = [ { args: { - defaultCurrency: `${Currencies.chileanPeso.name} (${Currencies.chileanPeso.isoCode})`, - currency: `${Currencies.chileanPeso.isoCode} ${Currencies.chileanPeso.symbol}`, + defaultCurrency: `${dataCurrencies.chileanPeso.name} (${dataCurrencies.chileanPeso.isoCode})`, + currency: `${dataCurrencies.chileanPeso.isoCode} ${dataCurrencies.chileanPeso.symbol}`, }, }, { args: { - defaultCurrency: `${Currencies.euro.name} (${Currencies.euro.isoCode})`, - currency: `${Currencies.euro.isoCode} ${Currencies.euro.symbol}`, + defaultCurrency: `${dataCurrencies.euro.name} (${dataCurrencies.euro.isoCode})`, + currency: `${dataCurrencies.euro.isoCode} ${dataCurrencies.euro.symbol}`, }, }, ]; @@ -160,13 +163,13 @@ describe('BO - International - Localization : Update default currency', async () expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code of currency '${Currencies.chileanPeso.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.chileanPeso.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterCurrencies', baseContext); - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.chileanPeso.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.chileanPeso.isoCode); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.chileanPeso.isoCode); + expect(textColumn).to.contains(dataCurrencies.chileanPeso.isoCode); }); it('should delete currency', async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/05_defaultCountry.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/05_defaultCountry.ts index 5efc40ed67ee4..ae92520b7f2b8 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/05_defaultCountry.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/01_localization/05_defaultCountry.ts @@ -11,8 +11,10 @@ import localizationPage from '@pages/BO/international/localization'; import addressesPage from '@pages/BO/customers/addresses'; import addAddressPage from '@pages/BO/customers/addresses/add'; -// Import Data -import Countries from '@data/demo/countries'; +import { + // Import data + dataCountries, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -33,7 +35,7 @@ describe('BO - International - Localization : Update default country', async () let browserContext: BrowserContext; let page: Page; - const countriesToTest: string[] = [Countries.netherlands.name, Countries.france.name]; + const countriesToTest: string[] = [dataCountries.netherlands.name, dataCountries.france.name]; // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/01_createOfficialCurrency.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/01_createOfficialCurrency.ts index f62d9e46f6e77..8d2a914e76b91 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/01_createOfficialCurrency.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/01_createOfficialCurrency.ts @@ -14,8 +14,9 @@ import addCurrencyPage from '@pages/BO/international/currencies/add'; // Import FO pages import {homePage as foHomePage} from '@pages/FO/classic/home'; -// Import data -import Currencies from '@data/demo/currencies'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -91,7 +92,7 @@ describe('BO - International - Currencies : Create official currency and check i await testContext.addContextItem(this, 'testIdentifier', 'createOfficialCurrency', baseContext); // Create and check successful message - const textResult = await addCurrencyPage.addOfficialCurrency(page, Currencies.mad); + const textResult = await addCurrencyPage.addOfficialCurrency(page, dataCurrencies.mad); expect(textResult).to.contains(currenciesPage.successfulCreationMessage); // Check number of currencies after creation @@ -100,12 +101,12 @@ describe('BO - International - Currencies : Create official currency and check i }); it( - `should filter by iso code of currency '${Currencies.mad.isoCode}' and check values created in table`, + `should filter by iso code of currency '${dataCurrencies.mad.isoCode}' and check values created in table`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkCurrencyValues', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -114,11 +115,11 @@ describe('BO - International - Currencies : Create official currency and check i // Check currency created const createdCurrency = await currenciesPage.getCurrencyFromTable(page, 1); await Promise.all([ - expect(createdCurrency.name).to.contains(Currencies.mad.name), - expect(createdCurrency.symbol).to.contains(Currencies.mad.symbol), - expect(createdCurrency.isoCode).to.contains(Currencies.mad.isoCode), + expect(createdCurrency.name).to.contains(dataCurrencies.mad.name), + expect(createdCurrency.symbol).to.contains(dataCurrencies.mad.symbol), + expect(createdCurrency.isoCode).to.contains(dataCurrencies.mad.isoCode), expect(createdCurrency.exchangeRate).to.be.above(0), - expect(createdCurrency.enabled).to.be.equal(Currencies.mad.enabled), + expect(createdCurrency.enabled).to.be.equal(dataCurrencies.mad.enabled), ]); }, ); @@ -137,10 +138,10 @@ describe('BO - International - Currencies : Create official currency and check i await testContext.addContextItem(this, 'testIdentifier', 'changeFoCurrency1', baseContext); // Check currency - await foHomePage.changeCurrency(page, Currencies.mad.isoCode, Currencies.mad.symbol); + await foHomePage.changeCurrency(page, dataCurrencies.mad.isoCode, dataCurrencies.mad.symbol); const shopCurrency = await foHomePage.getDefaultCurrency(page); - expect(shopCurrency).to.contain(Currencies.mad.isoCode); + expect(shopCurrency).to.contain(dataCurrencies.mad.isoCode); }); it('should go back to BO', async function () { @@ -161,11 +162,11 @@ describe('BO - International - Currencies : Create official currency and check i }); describe('Disable and check currency in FO', async () => { - it(`should filter by iso code of currency '${Currencies.mad.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToDisableCurrency', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -173,7 +174,7 @@ describe('BO - International - Currencies : Create official currency and check i // Check existence of currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.mad.isoCode); + expect(textColumn).to.contains(dataCurrencies.mad.isoCode); }); it('should disable currency', async function () { @@ -227,18 +228,18 @@ describe('BO - International - Currencies : Create official currency and check i }); describe('Delete currency created ', async () => { - it(`should filter by iso code of currency '${Currencies.mad.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToDelete', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); expect(numberOfCurrenciesAfterFilter).to.be.equal(numberOfCurrencies); // Check currency to delete const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.mad.isoCode); + expect(textColumn).to.contains(dataCurrencies.mad.isoCode); }); it('should delete currency', async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/02_createUnofficialCurrency.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/02_createUnofficialCurrency.ts index 290253259a62d..25fbf7397687b 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/02_createUnofficialCurrency.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/02_createUnofficialCurrency.ts @@ -14,8 +14,9 @@ import addCurrencyPage from '@pages/BO/international/currencies/add'; // Import FO pages import {homePage as foHomePage} from '@pages/FO/classic/home'; -// Import data -import Currencies from '@data/demo/currencies'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -91,7 +92,7 @@ describe('BO - International - Currencies : Create unofficial currency and check await testContext.addContextItem(this, 'testIdentifier', 'createUnofficialCurrency', baseContext); // Check successful message after creation - const textResult = await addCurrencyPage.createUnOfficialCurrency(page, Currencies.toman); + const textResult = await addCurrencyPage.createUnOfficialCurrency(page, dataCurrencies.toman); expect(textResult).to.contains(currenciesPage.successfulCreationMessage); // Check number of currencies after creation @@ -100,12 +101,12 @@ describe('BO - International - Currencies : Create unofficial currency and check }); it( - `should filter by iso code of currency '${Currencies.toman.isoCode}' and check values created in table`, + `should filter by iso code of currency '${dataCurrencies.toman.isoCode}' and check values created in table`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkCurrencyValues', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.toman.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.toman.isoCode); // Check number of element const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -113,11 +114,11 @@ describe('BO - International - Currencies : Create unofficial currency and check const createdCurrency = await currenciesPage.getCurrencyFromTable(page, 1); await Promise.all([ - expect(createdCurrency.name).to.contains(Currencies.toman.name), - expect(createdCurrency.symbol).to.contains(Currencies.toman.symbol), - expect(createdCurrency.isoCode).to.contains(Currencies.toman.isoCode), + expect(createdCurrency.name).to.contains(dataCurrencies.toman.name), + expect(createdCurrency.symbol).to.contains(dataCurrencies.toman.symbol), + expect(createdCurrency.isoCode).to.contains(dataCurrencies.toman.isoCode), expect(createdCurrency.exchangeRate).to.be.above(0), - expect(createdCurrency.enabled).to.be.equal(Currencies.toman.enabled), + expect(createdCurrency.enabled).to.be.equal(dataCurrencies.toman.enabled), ]); }, ); @@ -136,10 +137,10 @@ describe('BO - International - Currencies : Create unofficial currency and check await testContext.addContextItem(this, 'testIdentifier', 'changeFoCurrency1', baseContext); // Check currency - await foHomePage.changeCurrency(page, Currencies.toman.isoCode, Currencies.toman.symbol); + await foHomePage.changeCurrency(page, dataCurrencies.toman.isoCode, dataCurrencies.toman.symbol); const shopCurrency = await foHomePage.getDefaultCurrency(page); - expect(shopCurrency).to.contain(Currencies.toman.isoCode); + expect(shopCurrency).to.contain(dataCurrencies.toman.isoCode); }); it('should go back to BO', async function () { @@ -160,11 +161,11 @@ describe('BO - International - Currencies : Create unofficial currency and check }); describe('Disable and check currency in FO', async () => { - it(`should filter by iso code of currency '${Currencies.toman.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.toman.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToDisableCurrency', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.toman.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.toman.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -172,7 +173,7 @@ describe('BO - International - Currencies : Create unofficial currency and check // Check currency created const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.toman.isoCode); + expect(textColumn).to.contains(dataCurrencies.toman.isoCode); }); it('should disable currency', async function () { @@ -225,18 +226,18 @@ describe('BO - International - Currencies : Create unofficial currency and check }); describe('Delete currency created ', async () => { - it(`should filter by iso code of currency '${Currencies.toman.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.toman.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToDelete', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.toman.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.toman.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); expect(numberOfCurrenciesAfterFilter).to.be.equal(numberOfCurrencies); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.toman.isoCode); + expect(textColumn).to.contains(dataCurrencies.toman.isoCode); }); it('should delete currency', async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/04_updateExchangeRate.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/04_updateExchangeRate.ts index 1801dc72ef2e0..d9952dd4ec48c 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/04_updateExchangeRate.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/04_updateExchangeRate.ts @@ -11,8 +11,9 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -84,7 +85,7 @@ describe('BO - International - Currencies : Update exchange rate', async () => { await testContext.addContextItem(this, 'testIdentifier', 'createOfficialCurrency', baseContext); // Create and check successful message - const textResult = await addCurrencyPage.addOfficialCurrency(page, Currencies.mad); + const textResult = await addCurrencyPage.addOfficialCurrency(page, dataCurrencies.mad); expect(textResult).to.contains(currenciesPage.successfulCreationMessage); // Check number of currencies after creation @@ -94,18 +95,18 @@ describe('BO - International - Currencies : Update exchange rate', async () => { }); describe('Update exchange rates', async () => { - it(`should filter by iso code of currency '${Currencies.mad.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToUpdate', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); expect(numberOfCurrenciesAfterFilter).to.be.equal(numberOfCurrencies); // Check currency to delete const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.mad.isoCode); + expect(textColumn).to.contains(dataCurrencies.mad.isoCode); }); it('should go to the created currency page', async function () { @@ -133,17 +134,17 @@ describe('BO - International - Currencies : Update exchange rate', async () => { expect(textResult).to.contains(currenciesPage.successfulUpdateMessage); }); - it(`should filter by iso code of currency '${Currencies.mad.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToCheckValue', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.mad.isoCode); + expect(textColumn).to.contains(dataCurrencies.mad.isoCode); }); - it(`should check that the exchange rate of currency '${Currencies.mad.isoCode}' is updated`, async function () { + it(`should check that the exchange rate of currency '${dataCurrencies.mad.isoCode}' is updated`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkExchangeRates', baseContext); const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'conversion_rate'); @@ -152,18 +153,18 @@ describe('BO - International - Currencies : Update exchange rate', async () => { }); describe('Delete currency created', async () => { - it(`should filter by iso code of currency '${Currencies.mad.isoCode}'`, async function () { + it(`should filter by iso code of currency '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToDelete', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); expect(numberOfCurrenciesAfterFilter).to.be.equal(numberOfCurrencies); // Check currency to delete const textColumn = await currenciesPage.getTextColumnFromTableCurrency(page, 1, 'iso_code'); - expect(textColumn).to.contains(Currencies.mad.isoCode); + expect(textColumn).to.contains(dataCurrencies.mad.isoCode); }); it('should delete currency', async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/05_filterSortAndPagination.ts b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/05_filterSortAndPagination.ts index 90da674c5a0cc..938f5a2b61ca6 100644 --- a/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/05_filterSortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/11_international/01_localization/03_currencies/05_filterSortAndPagination.ts @@ -12,9 +12,10 @@ import localizationPage from '@pages/BO/international/localization'; import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; -// Import data -import Currencies from '@data/demo/currencies'; -import type CurrencyData from '@data/faker/currency'; +import { + dataCurrencies, + type FakerCurrency, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -77,12 +78,13 @@ describe('BO - International - Currencies : Filter, sort and pagination', async expect(numberOfCurrencies).to.be.above(0); }); - const currencies: CurrencyData[] = [Currencies.mad, Currencies.all, Currencies.chileanPeso, Currencies.dzd, Currencies.tnd, - Currencies.try, Currencies.usd, Currencies.aed, Currencies.lyd, Currencies.lsl, + const currencies: FakerCurrency[] = [ + dataCurrencies.mad, dataCurrencies.all, dataCurrencies.chileanPeso, dataCurrencies.dzd, dataCurrencies.tnd, + dataCurrencies.try, dataCurrencies.usd, dataCurrencies.aed, dataCurrencies.lyd, dataCurrencies.lsl, ]; // 1 - Create 10 currencies - currencies.forEach((currency: CurrencyData, index: number) => { + currencies.forEach((currency: FakerCurrency, index: number) => { describe(`Create official currency '${currency.name}'`, async () => { it('should go to create new currency page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddNewCurrencyPage${index}`, baseContext); @@ -125,7 +127,7 @@ describe('BO - International - Currencies : Filter, sort and pagination', async testIdentifier: 'filterByName', filterType: 'input', filterBy: 'name', - filterValue: Currencies.all.name, + filterValue: dataCurrencies.all.name, }, }, { @@ -134,7 +136,7 @@ describe('BO - International - Currencies : Filter, sort and pagination', async testIdentifier: 'filterBySymbol', filterType: 'input', filterBy: 'symbol', - filterValue: Currencies.all.symbol, + filterValue: dataCurrencies.all.symbol, }, }, @@ -144,7 +146,7 @@ describe('BO - International - Currencies : Filter, sort and pagination', async testIdentifier: 'filterByIsoCode', filterType: 'input', filterBy: 'iso_code', - filterValue: Currencies.all.isoCode, + filterValue: dataCurrencies.all.isoCode, }, }, { @@ -153,7 +155,7 @@ describe('BO - International - Currencies : Filter, sort and pagination', async testIdentifier: 'filterByEnabled', filterType: 'select', filterBy: 'active', - filterValue: Currencies.all.enabled ? '1' : '0', + filterValue: dataCurrencies.all.enabled ? '1' : '0', }, }, ].forEach((test, index: number) => { @@ -285,7 +287,7 @@ describe('BO - International - Currencies : Filter, sort and pagination', async // 4 : Delete currencies created describe('Delete currencies', async () => { - currencies.forEach((currency: CurrencyData, index: number) => { + currencies.forEach((currency: FakerCurrency, index: number) => { it(`should filter list by currency name '${currency.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', `filterToDelete${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/01_filterAndQuickEditZones.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/01_filterAndQuickEditZones.ts index 859a7ef88a57f..9d476fb24734d 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/01_filterAndQuickEditZones.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/01_filterAndQuickEditZones.ts @@ -9,8 +9,10 @@ import loginCommon from '@commonTests/BO/loginBO'; import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; -// Import data -import Zones from '@data/demo/zones'; +import { + // Import data + dataZones, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -68,7 +70,7 @@ describe('BO - International - Zones : Filter and quick edit', async () => { testIdentifier: 'filterId', filterType: 'input', filterBy: 'id_zone', - filterValue: Zones.europe.id.toString(), + filterValue: dataZones.europe.id.toString(), }, }, { @@ -76,7 +78,7 @@ describe('BO - International - Zones : Filter and quick edit', async () => { testIdentifier: 'filterZone', filterType: 'input', filterBy: 'name', - filterValue: Zones.europe.name, + filterValue: dataZones.europe.name, }, }, { @@ -84,7 +86,7 @@ describe('BO - International - Zones : Filter and quick edit', async () => { testIdentifier: 'filterStatus', filterType: 'select', filterBy: 'active', - filterValue: Zones.europe.status ? '1' : '0', + filterValue: dataZones.europe.status ? '1' : '0', }, }, ].forEach((test) => { @@ -126,21 +128,21 @@ describe('BO - International - Zones : Filter and quick edit', async () => { }); describe('Quick edit zone', async () => { - it(`should filter by name '${Zones.northAmerica.name}'`, async function () { + it(`should filter by name '${dataZones.northAmerica.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterToQuickEdit', baseContext); await zonesPage.filterZones( page, 'input', 'name', - Zones.northAmerica.name, + dataZones.northAmerica.name, ); const numberOfZonesAfterFilter = await zonesPage.getNumberOfElementInGrid(page); expect(numberOfZonesAfterFilter).to.be.below(numberOfZones); const textColumn = await zonesPage.getTextColumn(page, 1, 'name'); - expect(textColumn).to.contains(Zones.northAmerica.name); + expect(textColumn).to.contains(dataZones.northAmerica.name); }); [ diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/02_CRUDZone.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/02_CRUDZone.ts index 165f3c2ecce85..ca169a9453388 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/02_CRUDZone.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/02_CRUDZone.ts @@ -10,8 +10,9 @@ import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; import addZonePage from '@pages/BO/international/locations/add'; -// Import data -import ZoneData from '@data/faker/zone'; +import { + FakerZone, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -23,8 +24,8 @@ describe('BO - International - Zones : CRUD zone', async () => { let page: Page; let numberOfZones: number = 0; - const createZoneData: ZoneData = new ZoneData(); - const editZoneData: ZoneData = new ZoneData(); + const createZoneData: FakerZone = new FakerZone(); + const editZoneData: FakerZone = new FakerZone(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/03_bulkActionsZones.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/03_bulkActionsZones.ts index 96341418a4d49..a7d4508db8db5 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/03_bulkActionsZones.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/03_bulkActionsZones.ts @@ -10,8 +10,9 @@ import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; import addZonePage from '@pages/BO/international/locations/add'; -// Import data -import ZoneData from '@data/faker/zone'; +import { + FakerZone, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -23,9 +24,9 @@ describe('BO - International - Zones : Bulk enable, disable and delete', async ( let page: Page; let numberOfZones: number = 0; - const zonesToCreate: ZoneData[] = [ - new ZoneData({name: 'todelete1'}), - new ZoneData({name: 'todelete2'}), + const zonesToCreate: FakerZone[] = [ + new FakerZone({name: 'todelete1'}), + new FakerZone({name: 'todelete2'}), ]; // before and after functions @@ -64,7 +65,7 @@ describe('BO - International - Zones : Bulk enable, disable and delete', async ( }); describe('Create 2 zones in BO', async () => { - zonesToCreate.forEach((zoneToCreate: ZoneData, index: number) => { + zonesToCreate.forEach((zoneToCreate: FakerZone, index: number) => { it('should go to add new title page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToNewZonePage${index + 1}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/04_sortAndPagination.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/04_sortAndPagination.ts index 4721948c23fef..19adc41d8d77f 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/04_sortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/01_zones/04_sortAndPagination.ts @@ -11,8 +11,9 @@ import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; import addZonePage from '@pages/BO/international/locations/add'; -// Import data -import ZoneData from '@data/faker/zone'; +import { + FakerZone, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -126,7 +127,7 @@ describe('BO - International - Zones : Sort and pagination', async () => { creationTests.forEach((test: number, index: number) => { describe(`Create zone n°${index + 1} in BO`, async () => { - const createZoneData = new ZoneData({name: `todelete${index}`}); + const createZoneData: FakerZone = new FakerZone({name: `todelete${index}`}); it('should go to add new zone page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddZonePage${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/01_filterAndQuickEditCountries.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/01_filterAndQuickEditCountries.ts index 41e9f324e779a..84e3abd12b1aa 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/01_filterAndQuickEditCountries.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/01_filterAndQuickEditCountries.ts @@ -10,8 +10,10 @@ import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; import countriesPage from '@pages/BO/international/locations/countries'; -// Import data -import Countries from '@data/demo/countries'; +import { + // Import data + dataCountries, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -78,7 +80,7 @@ describe('BO - International - Countries : Filter and quick edit', async () => { testIdentifier: 'filterId', filterType: 'input', filterBy: 'id_country', - filterValue: Countries.france.id.toString(), + filterValue: dataCountries.france.id.toString(), }, }, { @@ -86,7 +88,7 @@ describe('BO - International - Countries : Filter and quick edit', async () => { testIdentifier: 'filterName', filterType: 'input', filterBy: 'b!name', - filterValue: Countries.netherlands.name, + filterValue: dataCountries.netherlands.name, }, }, { @@ -94,7 +96,7 @@ describe('BO - International - Countries : Filter and quick edit', async () => { testIdentifier: 'filterIsoCode', filterType: 'input', filterBy: 'iso_code', - filterValue: Countries.netherlands.isoCode, + filterValue: dataCountries.netherlands.isoCode, }, }, { @@ -102,7 +104,7 @@ describe('BO - International - Countries : Filter and quick edit', async () => { testIdentifier: 'filterPrefix', filterType: 'input', filterBy: 'call_prefix', - filterValue: Countries.unitedKingdom.callPrefix.toString(), + filterValue: dataCountries.unitedKingdom.callPrefix.toString(), }, }, { @@ -110,7 +112,7 @@ describe('BO - International - Countries : Filter and quick edit', async () => { testIdentifier: 'filterZone', filterType: 'select', filterBy: 'z!id_zone', - filterValue: Countries.unitedKingdom.zone, + filterValue: dataCountries.unitedKingdom.zone, }, }, { @@ -118,7 +120,7 @@ describe('BO - International - Countries : Filter and quick edit', async () => { testIdentifier: 'filterStatus', filterType: 'select', filterBy: 'a!active', - filterValue: Countries.france.active ? '1' : '0', + filterValue: dataCountries.france.active ? '1' : '0', }, }, ]; @@ -167,14 +169,14 @@ describe('BO - International - Countries : Filter and quick edit', async () => { page, 'input', 'b!name', - Countries.germany.name, + dataCountries.germany.name, ); const numberOfCountriesAfterFilter = await countriesPage.getNumberOfElementInGrid(page); expect(numberOfCountriesAfterFilter).to.be.below(numberOfCountries); const textColumn = await countriesPage.getTextColumnFromTable(page, 1, 'b!name'); - expect(textColumn).to.contains(Countries.germany.name); + expect(textColumn).to.contains(dataCountries.germany.name); }); [ diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/02_CRUDCountry.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/02_CRUDCountry.ts index b8d604bf02430..cd8f94330ed43 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/02_CRUDCountry.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/02_CRUDCountry.ts @@ -18,12 +18,10 @@ import {myAccountPage} from '@pages/FO/classic/myAccount'; import {addressesPage} from '@pages/FO/classic/myAccount/addresses'; import {addAddressPage} from '@pages/FO/classic/myAccount/addAddress'; -// Import data -import CountryData from '@data/faker/country'; - import { // Import data dataCustomers, + FakerCountry, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -45,7 +43,7 @@ describe('BO - International - Countries : CRUD country', async () => { let page: Page; let numberOfCountries: number = 0; - const countryDataIncorrectDate: CountryData = new CountryData({ + const countryDataIncorrectDate: FakerCountry = new FakerCountry({ name: 'countryTest', isoCode: 'MC', callPrefix: '+99', @@ -53,7 +51,7 @@ describe('BO - International - Countries : CRUD country', async () => { zipCodeFormat: 'NNNN', active: true, }); - const createCountryData: CountryData = new CountryData({ + const createCountryData: FakerCountry = new FakerCountry({ name: 'countryTest', isoCode: 'CT', callPrefix: '216', @@ -61,7 +59,7 @@ describe('BO - International - Countries : CRUD country', async () => { zipCodeFormat: 'NNNN', active: true, }); - const editCountryData: CountryData = new CountryData({ + const editCountryData: FakerCountry = new FakerCountry({ name: 'countryTestEdit', isoCode: 'CT', callPrefix: '333', diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/03_bulkActionsCountries.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/03_bulkActionsCountries.ts index 57268a1fe9021..cc9ffeb45d628 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/03_bulkActionsCountries.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/03_bulkActionsCountries.ts @@ -11,8 +11,10 @@ import zonesPage from '@pages/BO/international/locations'; import countriesPage from '@pages/BO/international/locations/countries'; import addCountryPage from '@pages/BO/international/locations/countries/add'; -// Import data -import CountryData from '@data/faker/country'; +import { + // Import data + FakerCountry, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -30,7 +32,7 @@ describe('BO - International - Countries : Bulk actions', async () => { let page: Page; let numberOfCountries: number = 0; - const firstCountryToCreate: CountryData = new CountryData({ + const firstCountryToCreate: FakerCountry = new FakerCountry({ name: 'todelete1', isoCode: 'CT', callPrefix: '216', @@ -38,7 +40,7 @@ describe('BO - International - Countries : Bulk actions', async () => { zipCodeFormat: 'NNNN', active: true, }); - const secondCountryToCreate: CountryData = new CountryData({ + const secondCountryToCreate: FakerCountry = new FakerCountry({ name: 'todelete2', isoCode: 'JF', callPrefix: '333', @@ -93,7 +95,7 @@ describe('BO - International - Countries : Bulk actions', async () => { describe('Create country', async () => { [firstCountryToCreate, secondCountryToCreate] - .forEach((countryToCreate: CountryData, index: number) => { + .forEach((countryToCreate: FakerCountry, index: number) => { it('should go to add new country page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddNewCountryPage${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/05_countriesRestrictions.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/05_countriesRestrictions.ts index f1b2d838a9803..f3e818b382bd2 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/05_countriesRestrictions.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/02_countries/05_countriesRestrictions.ts @@ -17,11 +17,9 @@ import {myAccountPage} from '@pages/FO/classic/myAccount'; import {addressesPage} from '@pages/FO/classic/myAccount/addresses'; import {addAddressPage} from '@pages/FO/classic/myAccount/addAddress'; -// Import data -import Countries from '@data/demo/countries'; - import { // Import data + dataCountries, dataCustomers, } from '@prestashop-core/ui-testing'; @@ -87,19 +85,19 @@ describe('BO - International - Countries : Restrict country selections in front expect(numberOfCountries).to.be.above(0); }); - it(`should search for the country '${Countries.afghanistan.name}'`, async function () { + it(`should search for the country '${dataCountries.afghanistan.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterByNameToEnable', baseContext); - await countriesPage.filterTable(page, 'input', 'b!name', Countries.afghanistan.name); + await countriesPage.filterTable(page, 'input', 'b!name', dataCountries.afghanistan.name); const numberOfCountriesAfterFilter = await countriesPage.getNumberOfElementInGrid(page); expect(numberOfCountriesAfterFilter).to.be.equal(1); const textColumn = await countriesPage.getTextColumnFromTable(page, 1, 'b!name'); - expect(textColumn).to.equal(Countries.afghanistan.name); + expect(textColumn).to.equal(dataCountries.afghanistan.name); }); - it(`should enable the country '${Countries.afghanistan.name}'`, async function () { + it(`should enable the country '${dataCountries.afghanistan.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'enableCountry', baseContext); await countriesPage.setCountryStatus(page, 1, true); @@ -155,12 +153,12 @@ describe('BO - International - Countries : Restrict country selections in front expect(pageTitle, 'Fail to open addresses page').to.contains(addressesPage.pageTitle); }); - it(`should check if the country '${Countries.afghanistan.name}' exist`, async function () { + it(`should check if the country '${dataCountries.afghanistan.name}' exist`, async function () { await testContext.addContextItem(this, 'testIdentifier', `checkIsNewCountryExist${index}`, baseContext); await addressesPage.openNewAddressForm(page); - const countryExist = await addAddressPage.countryExist(page, Countries.afghanistan.name); + const countryExist = await addAddressPage.countryExist(page, dataCountries.afghanistan.name); expect(countryExist).to.equal(status.args.isCountryVisible); }); @@ -183,16 +181,16 @@ describe('BO - International - Countries : Restrict country selections in front }); }); - it(`should search for the country '${Countries.afghanistan.name}'`, async function () { + it(`should search for the country '${dataCountries.afghanistan.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterByNameToDisable', baseContext); - await countriesPage.filterTable(page, 'input', 'b!name', Countries.afghanistan.name); + await countriesPage.filterTable(page, 'input', 'b!name', dataCountries.afghanistan.name); const numberOfCountriesAfterFilter = await countriesPage.getNumberOfElementInGrid(page); expect(numberOfCountriesAfterFilter).to.be.equal(1); const textColumn = await countriesPage.getTextColumnFromTable(page, 1, 'b!name'); - expect(textColumn).to.equal(Countries.afghanistan.name); + expect(textColumn).to.equal(dataCountries.afghanistan.name); }); it('should disable the country', async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/01_filterAndQuickEditStates.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/01_filterAndQuickEditStates.ts index fa3fafd3cff14..2132b319c8be5 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/01_filterAndQuickEditStates.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/01_filterAndQuickEditStates.ts @@ -10,8 +10,10 @@ import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; import statesPage from '@pages/BO/international/locations/states'; -// Import data -import States from '@data/demo/states'; +import { + // Import data + dataStates, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -78,7 +80,7 @@ describe('BO - International - States : Filter and quick edit', async () => { testIdentifier: 'filterId', filterType: 'input', filterBy: 'id_state', - filterValue: States.california.id.toString(), + filterValue: dataStates.california.id.toString(), }, }, { @@ -86,7 +88,7 @@ describe('BO - International - States : Filter and quick edit', async () => { testIdentifier: 'filterName', filterType: 'input', filterBy: 'name', - filterValue: States.bari.name, + filterValue: dataStates.bari.name, }, }, { @@ -94,7 +96,7 @@ describe('BO - International - States : Filter and quick edit', async () => { testIdentifier: 'filterIsoCode', filterType: 'input', filterBy: 'iso_code', - filterValue: States.california.isoCode, + filterValue: dataStates.california.isoCode, }, }, { @@ -102,7 +104,7 @@ describe('BO - International - States : Filter and quick edit', async () => { testIdentifier: 'filterZone', filterType: 'select', filterBy: 'id_zone', - filterValue: States.bihar.zone, + filterValue: dataStates.bihar.zone, }, }, { @@ -110,7 +112,7 @@ describe('BO - International - States : Filter and quick edit', async () => { testIdentifier: 'filterCountry', filterType: 'select', filterBy: 'id_country', - filterValue: States.california.country, + filterValue: dataStates.california.country, }, }, { @@ -118,7 +120,7 @@ describe('BO - International - States : Filter and quick edit', async () => { testIdentifier: 'filterStatus', filterType: 'select', filterBy: 'active', - filterValue: States.bari.status ? '1' : '0', + filterValue: dataStates.bari.status ? '1' : '0', }, }, ]; @@ -167,14 +169,14 @@ describe('BO - International - States : Filter and quick edit', async () => { page, 'input', 'name', - States.california.name, + dataStates.california.name, ); const numberOfStatesAfterFilter = await statesPage.getNumberOfElementInGrid(page); expect(numberOfStatesAfterFilter).to.be.below(numberOfStates); const textColumn = await statesPage.getTextColumn(page, 1, 'name'); - expect(textColumn).to.contains(States.california.name); + expect(textColumn).to.contains(dataStates.california.name); }); [ diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/02_CRUDState.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/02_CRUDState.ts index 76be9ec6fd6d7..99e391bdaf0e9 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/02_CRUDState.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/02_CRUDState.ts @@ -11,8 +11,9 @@ import zonesPage from '@pages/BO/international/locations'; import statesPage from '@pages/BO/international/locations/states'; import addStatePage from '@pages/BO/international/locations/states/add'; -// Import data -import StateData from '@data/faker/state'; +import { + FakerState, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,8 +25,8 @@ describe('BO - International - States : CRUD state', async () => { let page: Page; let numberOfStates: number = 0; - const createStateData: StateData = new StateData(); - const editStateData: StateData = new StateData(); + const createStateData: FakerState = new FakerState(); + const editStateData: FakerState = new FakerState(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/03_bulkActionsStates.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/03_bulkActionsStates.ts index 5fac847ef5402..5cbba653f507f 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/03_bulkActionsStates.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/03_bulkActionsStates.ts @@ -11,8 +11,9 @@ import zonesPage from '@pages/BO/international/locations'; import statesPage from '@pages/BO/international/locations/states'; import addStatePage from '@pages/BO/international/locations/states/add'; -// Import data -import StateData from '@data/faker/state'; +import { + FakerState, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,9 +25,9 @@ describe('BO - International - States : Bulk edit status and bulk delete', async let page: Page; let numberOfStates: number = 0; - const statesToCreate: StateData[] = [ - new StateData({name: 'todelete1', isoCode: 'HM', status: false}), - new StateData({name: 'todelete2', isoCode: 'BV', status: false}), + const statesToCreate: FakerState[] = [ + new FakerState({name: 'todelete1', isoCode: 'HM', status: false}), + new FakerState({name: 'todelete2', isoCode: 'BV', status: false}), ]; // before and after functions @@ -76,7 +77,7 @@ describe('BO - International - States : Bulk edit status and bulk delete', async }); describe('Create 2 states in BO', async () => { - statesToCreate.forEach((stateToCreate: StateData, index: number) => { + statesToCreate.forEach((stateToCreate: FakerState, index: number) => { it('should go to add new title page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToNewStatePage${index + 1}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/04_sortAndPagination.ts b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/04_sortAndPagination.ts index 0f59efac0849a..5d1c55859dc22 100644 --- a/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/04_sortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/11_international/02_locations/03_states/04_sortAndPagination.ts @@ -11,8 +11,10 @@ import dashboardPage from '@pages/BO/dashboard'; import zonesPage from '@pages/BO/international/locations'; import statesPage from '@pages/BO/international/locations/states'; -// Import data -import Countries from '@data/demo/countries'; +import { + // Import data + dataCountries, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -96,10 +98,10 @@ describe('BO - International - States : Sort and pagination', async () => { // 2 : Sort states table describe('Sort states table', async () => { - it(`should filter by country '${Countries.canada.name}'`, async function () { + it(`should filter by country '${dataCountries.canada.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterBeforeSort', baseContext); - await statesPage.filterStates(page, 'select', 'id_country', Countries.canada.name); + await statesPage.filterStates(page, 'select', 'id_country', dataCountries.canada.name); const paginationNumber = await statesPage.selectPaginationLimit(page, 100); expect(paginationNumber).to.contains('(page 1 / 1)'); diff --git a/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/01_filterAndQuickEditTaxes.ts b/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/01_filterAndQuickEditTaxes.ts index d5088b4fd5896..6cc8e92c629e6 100644 --- a/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/01_filterAndQuickEditTaxes.ts +++ b/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/01_filterAndQuickEditTaxes.ts @@ -9,8 +9,10 @@ import loginCommon from '@commonTests/BO/loginBO'; import dashboardPage from '@pages/BO/dashboard'; import taxesPage from '@pages/BO/international/taxes'; -// Import data -import tax from '@data/demo/tax'; +import { + // Import data + dataTaxes, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -65,12 +67,12 @@ describe('BO - International - Taxes : Filter And Quick Edit', async () => { const tests = [ { args: { - testIdentifier: 'filterId', filterType: 'input', filterBy: 'id_tax', filterValue: tax.DefaultFrTax.id.toString(), + testIdentifier: 'filterId', filterType: 'input', filterBy: 'id_tax', filterValue: dataTaxes.DefaultFrTax.id.toString(), }, }, { args: { - testIdentifier: 'filterName', filterType: 'input', filterBy: 'name', filterValue: tax.DefaultFrTax.name, + testIdentifier: 'filterName', filterType: 'input', filterBy: 'name', filterValue: dataTaxes.DefaultFrTax.name, }, }, { @@ -79,7 +81,7 @@ describe('BO - International - Taxes : Filter And Quick Edit', async () => { testIdentifier: 'filterRate', filterType: 'input', filterBy: 'rate', - filterValue: tax.DefaultFrTax.rate, + filterValue: dataTaxes.DefaultFrTax.rate, }, }, { @@ -88,7 +90,7 @@ describe('BO - International - Taxes : Filter And Quick Edit', async () => { testIdentifier: 'filterActive', filterType: 'select', filterBy: 'active', - filterValue: tax.DefaultFrTax.enabled ? '1' : '0', + filterValue: dataTaxes.DefaultFrTax.enabled ? '1' : '0', }, }, ]; @@ -129,13 +131,13 @@ describe('BO - International - Taxes : Filter And Quick Edit', async () => { it('should filter by name', async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterForQuickEdit', baseContext); - await taxesPage.filterTaxes(page, 'input', 'name', tax.DefaultFrTax.name); + await taxesPage.filterTaxes(page, 'input', 'name', dataTaxes.DefaultFrTax.name); const numberOfTaxesAfterFilter = await taxesPage.getNumberOfElementInGrid(page); expect(numberOfTaxesAfterFilter).to.be.at.most(numberOfTaxes); const textColumn = await taxesPage.getTextColumnFromTableTaxes(page, 1, 'name'); - expect(textColumn).to.contains(tax.DefaultFrTax.name); + expect(textColumn).to.contains(dataTaxes.DefaultFrTax.name); }); [ diff --git a/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/02_CRUDTaxesInBO.ts b/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/02_CRUDTaxesInBO.ts index b74743b23a60e..982d73853c3b5 100644 --- a/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/02_CRUDTaxesInBO.ts +++ b/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/02_CRUDTaxesInBO.ts @@ -10,8 +10,9 @@ import dashboardPage from '@pages/BO/dashboard'; import taxesPage from '@pages/BO/international/taxes'; import addTaxPage from '@pages/BO/international/taxes/add'; -// Import data -import TaxData from '@data/faker/tax'; +import { + FakerTax, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,8 +25,8 @@ describe('BO - International - Taxes : Create, Update and Delete Tax', async () let page: Page; let numberOfTaxes: number = 0; - const createTaxData: TaxData = new TaxData(); - const editTaxData: TaxData = new TaxData({enabled: false}); + const createTaxData: FakerTax = new FakerTax(); + const editTaxData: FakerTax = new FakerTax({enabled: false}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/03_taxesBulkActionsInBO.ts b/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/03_taxesBulkActionsInBO.ts index 09c24d409daf5..cd94d23adf261 100644 --- a/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/03_taxesBulkActionsInBO.ts +++ b/tests/UI/campaigns/functional/BO/11_international/03_taxes/01_taxes/03_taxesBulkActionsInBO.ts @@ -10,8 +10,9 @@ import dashboardPage from '@pages/BO/dashboard'; import taxesPage from '@pages/BO/international/taxes'; import addTaxPage from '@pages/BO/international/taxes/add'; -// Import data -import TaxData from '@data/faker/tax'; +import { + FakerTax, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,8 +25,8 @@ describe('BO - International - Taxes : Bulk actions', async () => { let page: Page; let numberOfTaxes: number = 0; - const firstTaxData: TaxData = new TaxData({name: 'TVA to delete'}); - const secondTaxData: TaxData = new TaxData({name: 'TVA to delete2'}); + const firstTaxData: FakerTax = new FakerTax({name: 'TVA to delete'}); + const secondTaxData: FakerTax = new FakerTax({name: 'TVA to delete2'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/11_international/03_taxes/02_taxRules/02_filterSortAndPagination.ts b/tests/UI/campaigns/functional/BO/11_international/03_taxes/02_taxRules/02_filterSortAndPagination.ts index 5de48f12acc81..6ba8354ece023 100644 --- a/tests/UI/campaigns/functional/BO/11_international/03_taxes/02_taxRules/02_filterSortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/11_international/03_taxes/02_taxRules/02_filterSortAndPagination.ts @@ -13,9 +13,13 @@ import taxRulesPage from '@pages/BO/international/taxes/taxRules'; import addTaxRulesPage from '@pages/BO/international/taxes/taxRules/add'; // Import data -import TaxRules from '@data/demo/taxRule'; import TaxRulesGroupData from '@data/faker/taxRulesGroup'; +import { + // Import data + dataTaxRules, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -85,7 +89,7 @@ describe('BO - International - Tax rules : Filter, sort and pagination', async ( testIdentifier: 'filterById', filterType: 'input', filterBy: 'id_tax_rules_group', - filterValue: TaxRules[3].id.toString(), + filterValue: dataTaxRules[3].id.toString(), }, }, { @@ -94,7 +98,7 @@ describe('BO - International - Tax rules : Filter, sort and pagination', async ( testIdentifier: 'filterByName', filterType: 'input', filterBy: 'name', - filterValue: TaxRules[1].name, + filterValue: dataTaxRules[1].name, }, }, { diff --git a/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts b/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts index 34b779b3a3031..384763f820b8a 100644 --- a/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts +++ b/tests/UI/campaigns/functional/BO/11_international/04_translations/01_modifyTranslation.ts @@ -29,11 +29,11 @@ import loginPageHummingbird from '@pages/FO/hummingbird/login'; // Import data import Languages from '@data/demo/languages'; import Modules from '@data/demo/modules'; -import CustomerData from '@data/faker/customer'; import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -48,7 +48,7 @@ describe('BO - International - Translation : Modify translation', async () => { let page: Page; let newMail: MailDevEmail; let mailListener: MailDev; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); // Pre-Condition: Setup config SMTP setupSmtpConfigTest(`${baseContext}_preTest_1`); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/general/05_recalculateShippingCosts.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/general/05_recalculateShippingCosts.ts index c4cb43e38f3d5..dabd8a8741f62 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/general/05_recalculateShippingCosts.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/general/05_recalculateShippingCosts.ts @@ -15,13 +15,13 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import OrderData from '@data/faker/order'; import Products from '@data/demo/products'; -import PaymentMethods from '@data/demo/paymentMethods'; import OrderShippingData from '@data/faker/orderShipping'; import Carriers from '@data/demo/carriers'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -41,7 +41,7 @@ describe('BO - Shop Parameters - Order Settings : Recalculate shipping costs aft quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const shippingDetailsData: OrderShippingData = new OrderShippingData({ diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/giftOptions/01_giftOptions.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/giftOptions/01_giftOptions.ts index c1ca6d735bd29..354a85c39d54c 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/giftOptions/01_giftOptions.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/01_orderSettings/giftOptions/01_giftOptions.ts @@ -20,13 +20,11 @@ import {checkoutPage} from '@pages/FO/classic/checkout'; import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; -// Import data -import tax from '@data/demo/tax'; -import PaymentMethods from '@data/demo/paymentMethods'; - import { // Import data dataCustomers, + dataPaymentMethods, + dataTaxes, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -93,7 +91,7 @@ describe('BO - Shop Parameters - Order Settings : Update gift options ', async ( isGiftWrapping: true, giftWrappingPrice: 1, isGiftWrappingTax: 'FR Taux standard (20%)', - taxValue: parseInt(tax.DefaultFrTax.rate, 10) / 100, + taxValue: parseInt(dataTaxes.DefaultFrTax.rate, 10) / 100, isRecycledPackaging: false, }, }, @@ -269,7 +267,7 @@ describe('BO - Shop Parameters - Order Settings : Update gift options ', async ( it('should choose payment method and confirm the order', async function () { await testContext.addContextItem(this, 'testIdentifier', `confirmOrder${index}`, baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); expect(cardTitle).to.contains(orderConfirmationPage.orderConfirmationCardTitle); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/01_CRUDOrderStatus.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/01_CRUDOrderStatus.ts index 5b4fe70d1b506..d67443f8bddcf 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/01_CRUDOrderStatus.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/01_CRUDOrderStatus.ts @@ -14,8 +14,9 @@ import addOrderStatusPage from '@pages/BO/shopParameters/orderSettings/statuses/ import ordersPage from '@pages/BO/orders'; import {viewOrderBasePage} from '@pages/BO/orders/view/viewOrderBasePage'; -// Import data -import OrderStatusData from '@data/faker/orderStatus'; +import { + FakerOrderStatus, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -34,8 +35,8 @@ describe('BO - Shop Parameters - Order Settings - Statuses : CRUD order status', let numberOfOrderStatuses: number = 0; const tableName: string = 'order'; - const createOrderStatusData: OrderStatusData = new OrderStatusData(); - const editOrderStatusData: OrderStatusData = new OrderStatusData({name: `edit_${createOrderStatusData.name}`}); + const createOrderStatusData: FakerOrderStatus = new FakerOrderStatus(); + const editOrderStatusData: FakerOrderStatus = new FakerOrderStatus({name: `edit_${createOrderStatusData.name}`}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/02_filterSortAndPagination.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/02_filterSortAndPagination.ts index 95c6305d7af25..0588ff41795e4 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/02_filterSortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/02_filterSortAndPagination.ts @@ -11,8 +11,10 @@ import dashboardPage from '@pages/BO/dashboard'; import orderSettingsPage from '@pages/BO/shopParameters/orderSettings'; import statusesPage from '@pages/BO/shopParameters/orderSettings/statuses'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -83,7 +85,7 @@ describe('BO - Shop Parameters - Order Settings - Statuses : Filter, sort and pa testIdentifier: 'filterById', filterType: 'input', filterBy: 'id_order_state', - filterValue: OrderStatuses.paymentAccepted.id.toString(), + filterValue: dataOrderStatuses.paymentAccepted.id.toString(), filterTypeOf: 'numeric', }, }, @@ -93,7 +95,7 @@ describe('BO - Shop Parameters - Order Settings - Statuses : Filter, sort and pa testIdentifier: 'filterByName', filterType: 'input', filterBy: 'name', - filterValue: OrderStatuses.shipped.name, + filterValue: dataOrderStatuses.shipped.name, filterTypeOf: 'string', }, }, @@ -133,7 +135,7 @@ describe('BO - Shop Parameters - Order Settings - Statuses : Filter, sort and pa testIdentifier: 'filterByEmailTemplate', filterType: 'input', filterBy: 'template', - filterValue: OrderStatuses.canceled.emailTemplate, + filterValue: dataOrderStatuses.canceled.emailTemplate, filterTypeOf: 'string', }, }, diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/03_quickEdit.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/03_quickEdit.ts index 493c5675f9bb7..9560077007542 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/03_quickEdit.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/03_quickEdit.ts @@ -10,8 +10,10 @@ import dashboardPage from '@pages/BO/dashboard'; import orderSettingsPage from '@pages/BO/shopParameters/orderSettings'; import statusesPage from '@pages/BO/shopParameters/orderSettings/statuses'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -72,14 +74,14 @@ describe('BO - Shop Parameters - Order Settings - Statuses : Quick edit order st numberOfOrderStatuses = await statusesPage.resetAndGetNumberOfLines(page, tableName); expect(numberOfOrderStatuses).to.be.above(0); - await statusesPage.filterTable(page, tableName, 'input', 'name', OrderStatuses.shipped.name); + await statusesPage.filterTable(page, tableName, 'input', 'name', dataOrderStatuses.shipped.name); const numberOfLinesAfterFilter = await statusesPage.getNumberOfElementInGrid(page, tableName); expect(numberOfLinesAfterFilter).to.be.above(0); for (let row = 1; row <= numberOfLinesAfterFilter; row++) { const textColumn = await statusesPage.getTextColumn(page, tableName, row, 'name'); - expect(textColumn).to.contains(OrderStatuses.shipped.name); + expect(textColumn).to.contains(dataOrderStatuses.shipped.name); } }); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/04_bulkActions.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/04_bulkActions.ts index 697db08ef0365..aa5dad4a3256a 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/04_bulkActions.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/02_orderSettings/02_statuses/statuses/04_bulkActions.ts @@ -12,8 +12,9 @@ import orderSettingsPage from '@pages/BO/shopParameters/orderSettings'; import statusesPage from '@pages/BO/shopParameters/orderSettings/statuses'; import addOrderStatusPage from '@pages/BO/shopParameters/orderSettings/statuses/add'; -// Import data -import OrderStatusData from '@data/faker/orderStatus'; +import { + FakerOrderStatus, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -91,7 +92,7 @@ describe('BO - Shop Parameters - Order Settings - Statuses : Bulk actions in ord describe(`Create order status n°${index + 1} in BO`, async () => { before(() => files.generateImage(`todelete${index}.jpg`)); - const orderStatusData: OrderStatusData = new OrderStatusData({name: `todelete${index}`}); + const orderStatusData: FakerOrderStatus = new FakerOrderStatus({name: `todelete${index}`}); it('should go to add new order status group page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddOrderStatusPage${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/03_productSettings/03_productsStock/02_defaultPackStockManagement.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/03_productSettings/03_productsStock/02_defaultPackStockManagement.ts index 5b3a598b10d68..26fb7a52f9eba 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/03_productSettings/03_productsStock/02_defaultPackStockManagement.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/03_productSettings/03_productsStock/02_defaultPackStockManagement.ts @@ -20,12 +20,12 @@ import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmatio import {searchResultsPage} from '@pages/FO/classic/searchResults'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import ProductData from '@data/faker/product'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -244,7 +244,7 @@ describe('BO - Shop Parameters - Product Settings : Default pack stock managemen await testContext.addContextItem(this, 'testIdentifier', `confirmTheOrder${index}`, baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/01_customers/02_sendEmailAfterRegistration.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/01_customers/02_sendEmailAfterRegistration.ts index 806f16c9621bd..4d0d56826543a 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/01_customers/02_sendEmailAfterRegistration.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/01_customers/02_sendEmailAfterRegistration.ts @@ -21,8 +21,10 @@ import {homePage} from '@pages/FO/classic/home'; import {loginPage as loginFOPage} from '@pages/FO/classic/login'; import {createAccountPage} from '@pages/FO/classic/myAccount/add'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -45,8 +47,8 @@ describe('BO - Shop Parameters - Customer Settings : Enable/Disable send an emai let mailListener: MailDev; let numberOfCustomers: number = 0; - const firstCustomerToCreate: CustomerData = new CustomerData(); - const secondCustomerToCreate: CustomerData = new CustomerData(); + const firstCustomerToCreate: FakerCustomer = new FakerCustomer(); + const secondCustomerToCreate: FakerCustomer = new FakerCustomer(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/01_filterSortAndPaginationGroups.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/01_filterSortAndPaginationGroups.ts index 7683cc5c9bd61..291d4451ad8dd 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/01_filterSortAndPaginationGroups.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/01_filterSortAndPaginationGroups.ts @@ -12,12 +12,10 @@ import customerSettingsPage from '@pages/BO/shopParameters/customerSettings'; import groupsPage from '@pages/BO/shopParameters/customerSettings/groups'; import addGroupPage from '@pages/BO/shopParameters/customerSettings/groups/add'; -// Import data -import GroupData from '@data/faker/group'; - import { // Import data dataGroups, + FakerGroup, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -270,7 +268,7 @@ describe('BO - Shop Parameters - Customer Settings : Filter, sort and pagination describe('Create 18 groups', async () => { const creationTests: number[] = new Array(18).fill(0, 0, 18); creationTests.forEach((value: number, index: number) => { - const groupToCreate: GroupData = new GroupData({name: `toSortAndPaginate${index}`}); + const groupToCreate: FakerGroup = new FakerGroup({name: `toSortAndPaginate${index}`}); it('should go to add new group page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToNewGroupPage${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/02_CRUDGroups.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/02_CRUDGroups.ts index ade80185536bc..f4ac5c5923dd0 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/02_CRUDGroups.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/02_groups/02_CRUDGroups.ts @@ -11,8 +11,9 @@ import customerSettingsPage from '@pages/BO/shopParameters/customerSettings'; import groupsPage from '@pages/BO/shopParameters/customerSettings/groups'; import addGroupPage from '@pages/BO/shopParameters/customerSettings/groups/add'; -// Import data -import GroupData from '@data/faker/group'; +import { + FakerGroup, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -24,8 +25,8 @@ describe('BO - Shop Parameters - Customer Settings : Create, update and delete g let page: Page; let numberOfGroups: number = 0; - const createGroupData: GroupData = new GroupData(); - const editGroupData: GroupData = new GroupData(); + const createGroupData: FakerGroup = new FakerGroup(); + const editGroupData: FakerGroup = new FakerGroup(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/01_filterSortAndPaginationTitles.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/01_filterSortAndPaginationTitles.ts index 73c93abc0c14a..f7f0701d3a5c3 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/01_filterSortAndPaginationTitles.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/01_filterSortAndPaginationTitles.ts @@ -13,12 +13,10 @@ import customerSettingsPage from '@pages/BO/shopParameters/customerSettings'; import titlesPage from '@pages/BO/shopParameters/customerSettings/titles'; import addTitlePage from '@pages/BO/shopParameters/customerSettings/titles/add'; -// Import data -import TitleData from '@data/faker/title'; - import { // Import data dataTitles, + FakerTitle, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -190,7 +188,7 @@ describe('BO _ Shop Parameters - Customer Settings : Filter, sort and pagination describe('Create 9 titles', async () => { const creationTests: number[] = new Array(9).fill(0, 0, 9); creationTests.forEach((value: number, index: number) => { - const titleToCreate: TitleData = new TitleData({name: `toSortAndPaginate${index}`, imageName: 'image.png'}); + const titleToCreate: FakerTitle = new FakerTitle({name: `toSortAndPaginate${index}`, imageName: 'image.png'}); it('should go to add new title page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToAddNewTitle${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/02_CRUDTitles.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/02_CRUDTitles.ts index ae9441f00757e..1896b749fa46c 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/02_CRUDTitles.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/02_CRUDTitles.ts @@ -12,8 +12,9 @@ import customerSettingsPage from '@pages/BO/shopParameters/customerSettings'; import titlesPage from '@pages/BO/shopParameters/customerSettings/titles'; import addTitlePage from '@pages/BO/shopParameters/customerSettings/titles/add'; -// Import data -import TitleData from '@data/faker/title'; +import { + FakerTitle, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -25,8 +26,8 @@ describe('BO - Shop Parameters - Customer Settings : Create, update and delete t let page: Page; let numberOfTitles: number = 0; - const createTitleData: TitleData = new TitleData(); - const editTitleData: TitleData = new TitleData(); + const createTitleData: FakerTitle = new FakerTitle(); + const editTitleData: FakerTitle = new FakerTitle(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/03_bulkActions.ts b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/03_bulkActions.ts index 016b78d1c66ac..be739fb671df6 100644 --- a/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/03_bulkActions.ts +++ b/tests/UI/campaigns/functional/BO/13_shopParameters/04_customerSettings/03_titles/03_bulkActions.ts @@ -12,8 +12,9 @@ import customerSettingsPage from '@pages/BO/shopParameters/customerSettings'; import titlesPage from '@pages/BO/shopParameters/customerSettings/titles'; import addTitlePage from '@pages/BO/shopParameters/customerSettings/titles/add'; -// Import data -import TitleData from '@data/faker/title'; +import { + FakerTitle, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -25,9 +26,9 @@ describe('BO - Shop Parameters - Customer Settings : Bulk actions', async () => let page: Page; let numberOfTitles: number = 0; - const titlesToCreate: TitleData[] = [ - new TitleData({name: 'todelete1'}), - new TitleData({name: 'todelete2'}), + const titlesToCreate: FakerTitle[] = [ + new FakerTitle({name: 'todelete1'}), + new FakerTitle({name: 'todelete2'}), ]; // before and after functions @@ -36,13 +37,13 @@ describe('BO - Shop Parameters - Customer Settings : Bulk actions', async () => page = await helper.newTab(browserContext); // Create images - titlesToCreate.forEach((titleToCreate: TitleData) => files.generateImage(titleToCreate.imageName)); + titlesToCreate.forEach((titleToCreate: FakerTitle) => files.generateImage(titleToCreate.imageName)); }); after(async () => { await helper.closeBrowserContext(browserContext); - titlesToCreate.forEach((titleToCreate: TitleData) => files.deleteFile(titleToCreate.imageName)); + titlesToCreate.forEach((titleToCreate: FakerTitle) => files.deleteFile(titleToCreate.imageName)); }); it('should login in BO', async function () { @@ -80,7 +81,7 @@ describe('BO - Shop Parameters - Customer Settings : Bulk actions', async () => }); describe('Create 2 titles in BO', async () => { - titlesToCreate.forEach((titleToCreate: TitleData, index: number) => { + titlesToCreate.forEach((titleToCreate: FakerTitle, index: number) => { it('should go to add new title page', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToNewTitlePage${index + 1}`, baseContext); diff --git a/tests/UI/campaigns/functional/BO/14_advancedParameters/03_administration/03_notifications.ts b/tests/UI/campaigns/functional/BO/14_advancedParameters/03_administration/03_notifications.ts index c8e009c4a2bdf..5766ac43c1a1b 100644 --- a/tests/UI/campaigns/functional/BO/14_advancedParameters/03_administration/03_notifications.ts +++ b/tests/UI/campaigns/functional/BO/14_advancedParameters/03_administration/03_notifications.ts @@ -25,13 +25,13 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import CustomerData from '@data/faker/customer'; import Products from '@data/demo/products'; import { // Import data dataCustomers, + dataPaymentMethods, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -43,7 +43,7 @@ const baseContext: string = 'functional_BO_advancedParameters_administration_not describe('BO - Advanced Parameters - Administration : Check notifications', async () => { let browserContext: BrowserContext; let page: Page; - const createCustomerData: CustomerData = new CustomerData(); + const createCustomerData: FakerCustomer = new FakerCustomer(); const messageSend: string = faker.lorem.sentence().substring(0, 35).trim(); const messageOption: string = `${Products.demo_1.name} (Size: ${Products.demo_1.attributes[0].values[0]} ` + `- Color: ${Products.demo_1.attributes[1].values[0]})`; @@ -186,7 +186,7 @@ describe('BO - Advanced Parameters - Administration : Check notifications', asyn await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/01_filterDeleteAndBulkActionsEmails.ts b/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/01_filterDeleteAndBulkActionsEmails.ts index 17c0bf918756c..efb5aabc13809 100644 --- a/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/01_filterDeleteAndBulkActionsEmails.ts +++ b/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/01_filterDeleteAndBulkActionsEmails.ts @@ -20,11 +20,11 @@ import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmatio // Import data import Languages from '@data/demo/languages'; -import PaymentMethods from '@data/demo/paymentMethods'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -117,7 +117,7 @@ describe('BO - Advanced Parameters - Email : Filter, delete and bulk delete emai await testContext.addContextItem(this, 'testIdentifier', 'payTheOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -208,7 +208,7 @@ describe('BO - Advanced Parameters - Email : Filter, delete and bulk delete emai identifier: 'filterBySubject', filterType: 'input', filterBy: 'subject', - filterValue: PaymentMethods.wirePayment.name.toLowerCase(), + filterValue: dataPaymentMethods.wirePayment.name.toLowerCase(), }, }, ]; @@ -267,7 +267,7 @@ describe('BO - Advanced Parameters - Email : Filter, delete and bulk delete emai it('should filter email list by \'subject\'', async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterBySubjectToDelete', baseContext); - await emailPage.filterEmailLogs(page, 'input', 'subject', PaymentMethods.wirePayment.name); + await emailPage.filterEmailLogs(page, 'input', 'subject', dataPaymentMethods.wirePayment.name); const numberOfEmailsAfterFilter = await emailPage.getNumberOfElementInGrid(page); expect(numberOfEmailsAfterFilter).to.be.at.most(numberOfEmails); diff --git a/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/03_sortAndPagination.ts b/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/03_sortAndPagination.ts index 3da5d90df5338..e73f845cfcfd1 100644 --- a/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/03_sortAndPagination.ts +++ b/tests/UI/campaigns/functional/BO/14_advancedParameters/04_email/03_sortAndPagination.ts @@ -19,12 +19,10 @@ import {cartPage} from '@pages/FO/classic/cart'; import {checkoutPage} from '@pages/FO/classic/checkout'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; - import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -144,7 +142,7 @@ describe('BO - Advanced Parameters - E-mail : Sort and pagination emails', async expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/BO/15_header/08_checkNotifications.ts b/tests/UI/campaigns/functional/BO/15_header/08_checkNotifications.ts index 55396eeacf995..2d0517b5c06be 100644 --- a/tests/UI/campaigns/functional/BO/15_header/08_checkNotifications.ts +++ b/tests/UI/campaigns/functional/BO/15_header/08_checkNotifications.ts @@ -22,13 +22,13 @@ import viewCustomerPage from '@pages/BO/customers/view'; // import data import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; -import PaymentMethods from '@data/demo/paymentMethods'; -import CustomerData from '@data/faker/customer'; -import AddressData from '@data/faker/address'; import { // Import data dataCustomers, + dataPaymentMethods, + FakerAddress, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -65,13 +65,13 @@ describe('BO - Header : Check notifications', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const messageSend: string = faker.lorem.sentence().substring(0, 35).trim(); const messageOption: string = `${Products.demo_1.name} (Size: ${Products.demo_1.attributes[0].values[0]} ` + `- Color: ${Products.demo_1.attributes[1].values[0]})`; - const customerData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); // New order by guest data const orderByGuestData: OrderData = new OrderData({ customer: customerData, @@ -82,7 +82,7 @@ describe('BO - Header : Check notifications', async () => { }, ], deliveryAddress: addressData, - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // PRE-condition : Create order by default customer diff --git a/tests/UI/campaigns/functional/FO/classic/01_login/01_passwordReminder.ts b/tests/UI/campaigns/functional/FO/classic/01_login/01_passwordReminder.ts index 2ffb2fc5b574a..9502aeeb3c0ac 100644 --- a/tests/UI/campaigns/functional/FO/classic/01_login/01_passwordReminder.ts +++ b/tests/UI/campaigns/functional/FO/classic/01_login/01_passwordReminder.ts @@ -15,9 +15,13 @@ import {myAccountPage} from '@pages/FO/classic/myAccount'; import {passwordReminderPage} from '@pages/FO/classic/passwordReminder'; // Import data -import CustomerData from '@data/faker/customer'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import , + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type MailDev from 'maildev'; import type {BrowserContext, Page} from 'playwright'; @@ -44,9 +48,9 @@ describe('FO - Login : Password reminder', async () => { let mailListener: MailDev; const resetPasswordMailSubject: string = 'Password query confirmation'; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); const newPassword: string = 'new test password'; - const customerNewPassword: CustomerData = new CustomerData(); + const customerNewPassword: FakerCustomer = new FakerCustomer(); customerNewPassword.email = customerData.email; customerNewPassword.password = newPassword; diff --git a/tests/UI/campaigns/functional/FO/classic/01_login/02_login.ts b/tests/UI/campaigns/functional/FO/classic/01_login/02_login.ts index bba4dd37de698..af95dddbc883e 100644 --- a/tests/UI/campaigns/functional/FO/classic/01_login/02_login.ts +++ b/tests/UI/campaigns/functional/FO/classic/01_login/02_login.ts @@ -6,12 +6,10 @@ import testContext from '@utils/testContext'; import {homePage} from '@pages/FO/classic/home'; import {loginPage} from '@pages/FO/classic/login'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -23,9 +21,9 @@ describe('FO - Login : Login in FO', async () => { let browserContext: BrowserContext; let page: Page; - const firstCredentialsData: CustomerData = new CustomerData(); - const secondCredentialsData: CustomerData = new CustomerData({password: dataCustomers.johnDoe.password}); - const thirdCredentialsData: CustomerData = new CustomerData({email: dataCustomers.johnDoe.email}); + const firstCredentialsData: FakerCustomer = new FakerCustomer(); + const secondCredentialsData: FakerCustomer = new FakerCustomer({password: dataCustomers.johnDoe.password}); + const thirdCredentialsData: FakerCustomer = new FakerCustomer({email: dataCustomers.johnDoe.email}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/01_login/04_createAccount.ts b/tests/UI/campaigns/functional/FO/classic/01_login/04_createAccount.ts index cc9a4909f7525..8359adfc14550 100644 --- a/tests/UI/campaigns/functional/FO/classic/01_login/04_createAccount.ts +++ b/tests/UI/campaigns/functional/FO/classic/01_login/04_createAccount.ts @@ -13,9 +13,13 @@ import {loginPage} from '@pages/FO/classic/login'; import {createAccountPage} from '@pages/FO/classic/myAccount/add'; // Import data -import CustomerData from '@data/faker/customer'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type MailDev from 'maildev'; import type {BrowserContext, Page} from 'playwright'; @@ -28,7 +32,7 @@ describe('FO - Login : Create account', async () => { let newMail: MailDevEmail; let mailListener: MailDev; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/02_checkLinksInFooter.ts b/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/02_checkLinksInFooter.ts index b0593b79ec18a..fb04e937fa0da 100644 --- a/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/02_checkLinksInFooter.ts +++ b/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/02_checkLinksInFooter.ts @@ -32,12 +32,10 @@ import {siteMapPage} from '@pages/FO/classic/siteMap'; import {storesPage} from '@pages/FO/classic/stores'; import {termsAndConditionsOfUsePage} from '@pages/FO/classic/termsAndConditionsOfUse'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -67,7 +65,7 @@ describe('FO - Header and Footer : Check links in footer page', async () => { const today: Date = new Date(); const currentYear: string = today.getFullYear().toString(); - const createCustomerData: CustomerData = new CustomerData(); + const createCustomerData: FakerCustomer = new FakerCustomer(); // Pre-condition: Create new account on FO createAccountTest(createCustomerData, `${baseContext}_preTest1`); diff --git a/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/03_changeCurrency.ts b/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/03_changeCurrency.ts index 693a27f16963c..2cc1312cba78b 100644 --- a/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/03_changeCurrency.ts +++ b/tests/UI/campaigns/functional/FO/classic/02_headerAndFooter/03_changeCurrency.ts @@ -17,9 +17,12 @@ import {homePage} from '@pages/FO/classic/home'; import {searchResultsPage} from '@pages/FO/classic/searchResults'; // Import data -import Currencies from '@data/demo/currencies'; import Products from '@data/demo/products'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -74,7 +77,7 @@ describe('FO - Header and Footer : Change currency', async () => { }); // Pre-condition: Create currency - createCurrencyTest(Currencies.mad, `${baseContext}_preTest_2`); + createCurrencyTest(dataCurrencies.mad, `${baseContext}_preTest_2`); describe('Filter by iso code of currency and get the exchange rate value ', async () => { it('should login in BO', async function () { @@ -104,11 +107,11 @@ describe('FO - Header and Footer : Change currency', async () => { expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should get the currency exchange rate value '${Currencies.mad.isoCode}'`, async function () { + it(`should get the currency exchange rate value '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'getExchangeRate', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); // Check exchange rate exchangeRateValue = await currenciesPage.getExchangeRateValue(page, 1); @@ -130,10 +133,10 @@ describe('FO - Header and Footer : Change currency', async () => { await testContext.addContextItem(this, 'testIdentifier', 'changeFoCurrency', baseContext); // Check currency - await homePage.changeCurrency(page, Currencies.mad.isoCode, Currencies.mad.symbol); + await homePage.changeCurrency(page, dataCurrencies.mad.isoCode, dataCurrencies.mad.symbol); const shopCurrency = await homePage.getDefaultCurrency(page); - expect(shopCurrency).to.contains(Currencies.mad.isoCode); + expect(shopCurrency).to.contains(dataCurrencies.mad.isoCode); }); it('should search product', async function () { @@ -148,10 +151,10 @@ describe('FO - Header and Footer : Change currency', async () => { it('should check the product price', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkProductPrice', baseContext); - const newExchangeRateValue = (exchangeRateValue * Products.demo_11.finalPrice).toFixed(Currencies.mad.decimals); + const newExchangeRateValue = (exchangeRateValue * Products.demo_11.finalPrice).toFixed(dataCurrencies.mad.decimals); const productPrice = await searchResultsPage.getProductPrice(page); - expect(productPrice).to.contains(`${Currencies.mad.symbol}${newExchangeRateValue}`); + expect(productPrice).to.contains(`${dataCurrencies.mad.symbol}${newExchangeRateValue}`); }); it('should switch back to the default currency', async function () { @@ -163,22 +166,22 @@ describe('FO - Header and Footer : Change currency', async () => { ); // Check currency - await homePage.changeCurrency(page, Currencies.euro.isoCode, Currencies.euro.symbol); + await homePage.changeCurrency(page, dataCurrencies.euro.isoCode, dataCurrencies.euro.symbol); const shopCurrency = await homePage.getDefaultCurrency(page); - expect(shopCurrency).to.contains(Currencies.euro.isoCode); + expect(shopCurrency).to.contains(dataCurrencies.euro.isoCode); }); it('should check the product price', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkProductPrice2', baseContext); - const exchangeRate = Math.round(Currencies.euro.exchangeRate * Products.demo_11.finalPrice); + const exchangeRate = Math.round(dataCurrencies.euro.exchangeRate * Products.demo_11.finalPrice); const productPrice = await searchResultsPage.getProductPrice(page); - expect(productPrice).to.contains(`${Currencies.euro.symbol}${exchangeRate}`); + expect(productPrice).to.contains(`${dataCurrencies.euro.symbol}${exchangeRate}`); }); }); // Post-condition - Delete currency - deleteCurrencyTest(Currencies.mad, `${baseContext}_postTest_1`); + deleteCurrencyTest(dataCurrencies.mad, `${baseContext}_postTest_1`); }); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_creditSlips/01_consultCreditSlip.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_creditSlips/01_consultCreditSlip.ts index e78da5f587e0c..763dbe1bbf734 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_creditSlips/01_consultCreditSlip.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_creditSlips/01_consultCreditSlip.ts @@ -27,14 +27,18 @@ import {creditSlipPage} from '@pages/FO/classic/myAccount/creditSlips'; import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import type MailDev from 'maildev'; @@ -63,8 +67,8 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as let newMail: MailDevEmail; let mailListener: MailDev; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); @@ -76,7 +80,7 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create new account on FO @@ -194,11 +198,11 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(result).to.equal(OrderStatuses.paymentAccepted.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(result).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check if the button \'Partial Refund\' is visible', async function () { @@ -336,10 +340,10 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as .to.eq(true); // Check payment method in pdf - const paymentMethodExist = await files.isTextInPDF(filePath, PaymentMethods.wirePayment.displayName); + const paymentMethodExist = await files.isTextInPDF(filePath, dataPaymentMethods.wirePayment.displayName); expect( paymentMethodExist, - `Payment Method '${PaymentMethods.wirePayment.displayName}' does not exist in credit slip`, + `Payment Method '${dataPaymentMethods.wirePayment.displayName}' does not exist in credit slip`, ).to.eq(true); }); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_editInformation.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_editInformation.ts index a0a17bcad817e..94f1eca0b5955 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_editInformation.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/01_editInformation.ts @@ -12,8 +12,10 @@ import {loginPage} from '@pages/FO/classic/login'; import {myAccountPage} from '@pages/FO/classic/myAccount'; import {accountIdentityPage} from '@pages/FO/classic/myAccount/identity'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -41,25 +43,25 @@ describe('FO - Account : Edit information', async () => { let browserContext: BrowserContext; let page: Page; - const createCustomerData: CustomerData = new CustomerData(); + const createCustomerData: FakerCustomer = new FakerCustomer(); // New customer data with empty new password - const editCustomerData1: CustomerData = new CustomerData({password: ''}); + const editCustomerData1: FakerCustomer = new FakerCustomer({password: ''}); // New customer data with repeated letters - const editCustomerData2: CustomerData = new CustomerData({password: 'abcabcabc'}); + const editCustomerData2: FakerCustomer = new FakerCustomer({password: 'abcabcabc'}); // New customer data with password below 8 - const editCustomerData3: CustomerData = new CustomerData({password: 'presta'}); + const editCustomerData3: FakerCustomer = new FakerCustomer({password: 'presta'}); // New customer data with an old similar password - const editCustomerData4: CustomerData = new CustomerData({password: 'testoune'}); + const editCustomerData4: FakerCustomer = new FakerCustomer({password: 'testoune'}); // New customer data with simple characters password - const editCustomerData5: CustomerData = new CustomerData({password: 'prestash'}); + const editCustomerData5: FakerCustomer = new FakerCustomer({password: 'prestash'}); // New customer data with common password - const editCustomerData6: CustomerData = new CustomerData({password: 'azerty123'}); + const editCustomerData6: FakerCustomer = new FakerCustomer({password: 'azerty123'}); // New customer data with top 10 common password - const editCustomerData7: CustomerData = new CustomerData({password: '123456789'}); + const editCustomerData7: FakerCustomer = new FakerCustomer({password: '123456789'}); // New customer data with same characters - const editCustomerData8: CustomerData = new CustomerData({password: 'aaaaaaaaa'}); + const editCustomerData8: FakerCustomer = new FakerCustomer({password: 'aaaaaaaaa'}); // New customer data with good password - const editCustomerData9: CustomerData = new CustomerData({password: 'test edit information'}); + const editCustomerData9: FakerCustomer = new FakerCustomer({password: 'test edit information'}); // Pre-condition: Create new account on FO createAccountTest(createCustomerData, `${baseContext}_preTest`); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_CRUDAddress.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_CRUDAddress.ts index 8fe8e9e1645d6..eb0d4cb34222c 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_CRUDAddress.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_CRUDAddress.ts @@ -19,8 +19,12 @@ import {productPage} from '@pages/FO/classic/product'; // Import data import Products from '@data/demo/products'; -import CustomerData from '@data/faker/customer'; -import AddressData from '@data/faker/address'; + +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -48,10 +52,10 @@ describe('FO - Account : CRUD address', async () => { let firstAddressPosition: number = 0; let secondAddressPosition: number = 0; - const newCustomerData: CustomerData = new CustomerData(); - const createAddressData: AddressData = new AddressData({country: 'France'}); - const editAddressData: AddressData = new AddressData({country: 'France'}); - const secondAddressData: AddressData = new AddressData({country: 'France'}); + const newCustomerData: FakerCustomer = new FakerCustomer(); + const createAddressData: FakerAddress = new FakerAddress({country: 'France'}); + const editAddressData: FakerAddress = new FakerAddress({country: 'France'}); + const secondAddressData: FakerAddress = new FakerAddress({country: 'France'}); // Pre-condition: Delete cache deleteCacheTest(baseContext); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_consultOrderList.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_consultOrderList.ts index 178b1d85c555c..e8265ec804563 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_consultOrderList.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_consultOrderList.ts @@ -16,14 +16,18 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {myAccountPage} from '@pages/FO/classic/myAccount'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; import {OrderHistory} from '@data/types/order'; import Products from '@data/demo/products'; +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -48,8 +52,8 @@ describe('FO - Account - Order history : Consult order list', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); @@ -61,7 +65,7 @@ describe('FO - Account - Order history : Consult order list', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const today: string = date.getDateFormat('mm/dd/yyyy'); @@ -155,8 +159,8 @@ describe('FO - Account - Order history : Consult order list', async () => { expect(result.reference).not.null, expect(result.date).to.equal(today), expect(result.price).to.equal(`€${Products.demo_1.finalPrice}`), - expect(result.paymentType).to.equal(PaymentMethods.wirePayment.displayName), - expect(result.status).to.equal(OrderStatuses.awaitingBankWire.name), + expect(result.paymentType).to.equal(dataPaymentMethods.wirePayment.displayName), + expect(result.status).to.equal(dataOrderStatuses.awaitingBankWire.name), expect(result.invoice).to.equal('-'), ]); }); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts index b48785d67c912..2e6ce8d659f29 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts @@ -15,13 +15,13 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -54,7 +54,7 @@ describe('FO - Account - Order details : Reorder from order detail', async () => quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order @@ -151,7 +151,7 @@ describe('FO - Account - Order details : Reorder from order detail', async () => it('should Pay by bank wire and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmReorder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const pageTitle = await orderConfirmationPage.getPageTitle(page); expect(pageTitle).to.equal(orderConfirmationPage.pageTitle); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts index eb93923d2f208..a591e1e4ddb41 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts @@ -18,14 +18,14 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -55,7 +55,7 @@ describe('FO - Account - Order details : Download invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order @@ -102,11 +102,11 @@ describe('FO - Account - Order details : Download invoice', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatus', baseContext); - const result: string = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result: string = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should get the invoice file name', async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts index 47cf03eaf3b7a..7d1373ac4aadd 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts @@ -24,13 +24,13 @@ import {merchandiseReturnsPage as foMerchandiseReturnsPage} from '@pages/FO/clas // Import data import Products from '@data/demo/products'; -import PaymentMethods from '@data/demo/paymentMethods'; -import OrderStatuses from '@data/demo/orderStatuses'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -64,7 +64,7 @@ describe('FO - Account - Order details : Request merchandise return', async () = quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const today: string = date.getDateFormat('mm/dd/yyyy'); @@ -112,11 +112,11 @@ describe('FO - Account - Order details : Request merchandise return', async () = expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.delivered.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.delivered.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.delivered.name); - expect(result).to.equal(OrderStatuses.delivered.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.delivered.name); + expect(result).to.equal(dataOrderStatuses.delivered.name); }); it('should get the order reference', async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts index 6aab42c15d2c2..e1618fc7d4262 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts @@ -24,13 +24,13 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {productPage} from '@pages/FO/classic/product'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -144,7 +144,7 @@ describe('FO - Account : Send a message with an ordered product', async () => { expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message @@ -186,14 +186,14 @@ describe('FO - Account : Send a message with an ordered product', async () => { expect(numberOfOrders).to.be.above(0); }); - it(`should update order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should update order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); const orderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(orderStatus, 'Order status was not updated').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status was not updated').to.equal(dataOrderStatuses.paymentAccepted.name); }); it('disconnect from BO', async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/02_reorderFromOrderList.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/02_reorderFromOrderList.ts index 6811c7026052f..2b346a81b0ec1 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/02_reorderFromOrderList.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/02_reorderFromOrderList.ts @@ -16,12 +16,12 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; // Import data import Products from '@data/demo/products'; -import PaymentMethods from '@data/demo/paymentMethods'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -54,7 +54,7 @@ describe('FO - Account - Order history : Reorder from order list', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order @@ -142,7 +142,7 @@ describe('FO - Account - Order history : Reorder from order list', async () => { it('should Pay by bank wire and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmReorder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const pageTitle = await orderConfirmationPage.getPageTitle(page); expect(pageTitle).to.equal(orderConfirmationPage.pageTitle); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/03_downloadInvoice.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/03_downloadInvoice.ts index d1ec919938d9a..05eea32262163 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/03_downloadInvoice.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/02_orderHistory/03_downloadInvoice.ts @@ -17,14 +17,14 @@ import ordersPage from '@pages/BO/orders'; import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import OrderStatuses from '@data/demo/orderStatuses'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -54,7 +54,7 @@ describe('FO - Account - Order history : download invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order @@ -101,11 +101,11 @@ describe('FO - Account - Order history : download invoice', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatus', baseContext); - const result: string = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result: string = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should get the invoice file name', async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts index f63aa47f05ba5..1192b714b859d 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts @@ -25,14 +25,14 @@ import {returnDetailsPage} from '@pages/FO/classic/myAccount/returnDetails'; // Import data import OrderReturnStatuses from '@data/demo/orderReturnStatuses'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -67,7 +67,7 @@ describe('FO - Account : Consult return details', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order @@ -87,7 +87,7 @@ describe('FO - Account : Consult return details', async () => { }); describe(`Case 1 : Check merchandise returns status '${OrderReturnStatuses.waitingForConfirmation.name}'`, async () => { - describe(`Change the created orders status to '${OrderStatuses.shipped.name}'`, async () => { + describe(`Change the created orders status to '${dataOrderStatuses.shipped.name}'`, async () => { it('should login in BO', async function () { await loginCommon.loginBO(this, page); }); @@ -146,11 +146,11 @@ describe('FO - Account : Consult return details', async () => { expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should go to \'Orders > Orders\' page', async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts index e3801b9a79703..21e0b51359a69 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts @@ -27,8 +27,6 @@ import {returnDetailsPage} from '@pages/FO/classic/myAccount/returnDetails'; // Import data import Addresses from '@data/demo/address'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderReturnStatuses from '@data/demo/orderReturnStatuses'; import OrderData from '@data/faker/order'; @@ -36,6 +34,8 @@ import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -73,7 +73,7 @@ describe('FO - Account : Check order return PDF', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create order @@ -92,7 +92,7 @@ describe('FO - Account : Check order return PDF', async () => { await helper.closeBrowserContext(browserContext); }); - describe(`Change the created orders status to '${OrderStatuses.shipped.name}'`, async () => { + describe(`Change the created orders status to '${dataOrderStatuses.shipped.name}'`, async () => { it('should login in BO', async function () { await loginCommon.loginBO(this, page); }); @@ -151,11 +151,11 @@ describe('FO - Account : Check order return PDF', async () => { expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should go to \'Orders > Orders\' page', async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_viewVouchers.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_viewVouchers.ts index 66c2b8cec04e1..761ca414697f1 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_viewVouchers.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/03_viewVouchers.ts @@ -16,7 +16,11 @@ import {vouchersPage as foVouchersPage} from '@pages/FO/classic/myAccount/vouche // Import data import CartRuleData from '@data/faker/cartRule'; -import CustomerData from '@data/faker/customer'; + +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -41,7 +45,7 @@ describe('FO - Account : View vouchers', async () => { const pastDate: string = date.getDateFormat('yyyy-mm-dd', 'past'); const futureDate: string = date.getDateFormat('yyyy-mm-dd', 'future'); const expirationDate: string = date.getDateFormat('mm/dd/yyyy', 'future'); - const customerData: CustomerData = new CustomerData({}); + const customerData: FakerCustomer = new FakerCustomer({}); const firstCartRule: CartRuleData = new CartRuleData({ code: 'promo20', customer: customerData, diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/04_getGDPRDataInPDF.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/04_getGDPRDataInPDF.ts index cf249206f0326..fcf768a633ede 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/04_getGDPRDataInPDF.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/04_getGDPRDataInPDF.ts @@ -29,12 +29,16 @@ import gdprPersonalDataPage from '@pages/FO/classic/myAccount/gdprPersonalData'; import {productPage} from '@pages/FO/classic/product'; // Import data -import AddressData from '@data/faker/address'; import MessageData from '@data/faker/message'; -import CustomerData from '@data/faker/customer'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -67,14 +71,14 @@ describe('FO - Account : Get GDPR data in PDF', async () => { let ipAddress: string; let connectionOrigin: string; - const customerData: CustomerData = new CustomerData({ + const customerData: FakerCustomer = new FakerCustomer({ firstName: 'Marc', lastName: 'Beier', email: 'presta@prestashop.com', }); const today: string = date.getDateFormat('mm/dd/yyyy'); const dateNow: Date = new Date(); - const addressData: AddressData = new AddressData({ + const addressData: FakerAddress = new FakerAddress({ alias: 'My Address', firstName: 'Marc', lastName: 'Beier', @@ -487,7 +491,7 @@ describe('FO - Account : Get GDPR data in PDF', async () => { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/FO/classic/03_userAccount/05_getGDPRDataInCSV.ts b/tests/UI/campaigns/functional/FO/classic/03_userAccount/05_getGDPRDataInCSV.ts index 914244f8adba7..f20f073eac0af 100644 --- a/tests/UI/campaigns/functional/FO/classic/03_userAccount/05_getGDPRDataInCSV.ts +++ b/tests/UI/campaigns/functional/FO/classic/03_userAccount/05_getGDPRDataInCSV.ts @@ -27,11 +27,15 @@ import shoppingCartsPage from '@pages/BO/orders/shoppingCarts'; import {productPage} from '@pages/FO/classic/product'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; import MessageData from '@data/faker/message'; -import CustomerData from '@data/faker/customer'; + +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -65,13 +69,13 @@ describe('FO - Account : Get GDPR data in CSV', async () => { let ipAddress: string; let connectionOrigin: string; - const customerData: CustomerData = new CustomerData({ + const customerData: FakerCustomer = new FakerCustomer({ firstName: 'Marc', lastName: 'Beier', email: 'presta@prestashop.com', }); const date: Date = new Date(); - const addressData: AddressData = new AddressData({ + const addressData: FakerAddress = new FakerAddress({ firstName: 'Marc', lastName: 'Beier', country: 'France', @@ -517,7 +521,7 @@ describe('FO - Account : Get GDPR data in CSV', async () => { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/FO/classic/04_newsletter/01_subscribeNewsletter.ts b/tests/UI/campaigns/functional/FO/classic/04_newsletter/01_subscribeNewsletter.ts index 458c149dea6f4..ae29c3f63c4a0 100644 --- a/tests/UI/campaigns/functional/FO/classic/04_newsletter/01_subscribeNewsletter.ts +++ b/tests/UI/campaigns/functional/FO/classic/04_newsletter/01_subscribeNewsletter.ts @@ -17,12 +17,10 @@ import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {myAccountPage} from '@pages/FO/classic/myAccount'; import {accountIdentityPage} from '@pages/FO/classic/myAccount/identity'; -// Import data -import ModuleData from '@data/faker/module'; - import { // Import data dataCustomers, + FakerModule, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -44,7 +42,7 @@ describe('FO - Newsletter : Subscribe to Newsletter', async () => { let browserContext: BrowserContext; let page: Page; - const moduleInformation: ModuleData = new ModuleData({ + const moduleInformation: FakerModule = new FakerModule({ tag: 'ps_emailsubscription', name: 'Newsletter subscription', }); diff --git a/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView.ts b/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView.ts index 77dc2b8c4fd5b..e7e50f8e3b4a4 100644 --- a/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView.ts +++ b/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView.ts @@ -23,9 +23,12 @@ import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; // Import data import Products from '@data/demo/products'; import ProductData from '@data/faker/product'; -import CartProductDetails from '@data/types/cart'; import type {ProductAttribute, ProductImageUrls} from '@data/types/product'; +import { + type CartProductDetails, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; diff --git a/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView/01_addToCart.ts b/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView/01_addToCart.ts index 896c3dc8e253b..064ac88d4bd21 100644 --- a/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView/01_addToCart.ts +++ b/tests/UI/campaigns/functional/FO/classic/09_productPage/01_quickView/01_addToCart.ts @@ -9,11 +9,14 @@ import {searchResultsPage} from '@pages/FO/classic/searchResults'; // Import data import Products from '@data/demo/products'; -import CartProductDetails from '@data/types/cart'; import {ProductAttribute} from '@data/types/product'; import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; +import { + type CartProductDetails, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import {BrowserContext, Page} from 'playwright'; diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/01_orderAsAGuest.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/01_orderAsAGuest.ts index 5c14de0a65b78..570fe4981d62b 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/01_orderAsAGuest.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/01_orderAsAGuest.ts @@ -9,10 +9,12 @@ import {cartPage} from '@pages/FO/classic/cart'; import {checkoutPage} from '@pages/FO/classic/checkout'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -31,9 +33,9 @@ Scenario: describe('FO - Checkout - Personal information : Order as a guest', async () => { let browserContext: BrowserContext; let page: Page; - const guestData: CustomerData = new CustomerData({password: ''}); - const secondGuestData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const guestData: FakerCustomer = new FakerCustomer({password: ''}); + const secondGuestData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); // before and after functions before(async function () { @@ -106,7 +108,7 @@ describe('FO - Checkout - Personal information : Order as a guest', async () => expect(isStepDeliveryComplete, 'Step Address is not complete').to.equal(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/02_signIn.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/02_signIn.ts index 2281696943718..6fa9540c7d19c 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/02_signIn.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/02_signIn.ts @@ -8,12 +8,10 @@ import {productPage} from '@pages/FO/classic/product'; import {cartPage} from '@pages/FO/classic/cart'; import {checkoutPage} from '@pages/FO/classic/checkout'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -34,7 +32,7 @@ describe('FO - Checkout - Personal information : Sign in', async () => { let browserContext: BrowserContext; let page: Page; - const credentialsData: CustomerData = new CustomerData(); + const credentialsData: FakerCustomer = new FakerCustomer(); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/03_createAccount.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/03_createAccount.ts index 8f67b5ac94cd8..a2713076544a4 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/03_createAccount.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/03_createAccount.ts @@ -14,10 +14,12 @@ import {cartPage} from '@pages/FO/classic/cart'; import {checkoutPage} from '@pages/FO/classic/checkout'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -45,8 +47,8 @@ Post-condition: describe('FO - Checkout - Personal information : Create account', async () => { let browserContext: BrowserContext; let page: Page; - const guestData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({country: 'France'}); + const guestData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); let allEmails: MailDevEmail[]; let numberOfEmails: number; let mailListener: MailDev; @@ -127,7 +129,7 @@ describe('FO - Checkout - Personal information : Create account', async () => { expect(isStepDeliveryComplete, 'Step Address is not complete').to.equal(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/05_passwordReminder.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/05_passwordReminder.ts index b46c8337f9bc7..8e4f4a3d53eca 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/05_passwordReminder.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/01_personalInformation/05_passwordReminder.ts @@ -17,9 +17,13 @@ import {passwordReminderPage} from '@pages/FO/classic/passwordReminder'; import {myAccountPage} from '@pages/FO/classic/myAccount'; // Import data -import CustomerData from '@data/faker/customer'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import type MailDev from 'maildev'; @@ -49,9 +53,9 @@ describe('FO - Checkout - Personal information : Password reminder', async () => let mailListener: MailDev; const resetPasswordMailSubject: string = 'Password query confirmation'; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); const newPassword: string = 'new test password'; - const customerNewPassword: CustomerData = new CustomerData(); + const customerNewPassword: FakerCustomer = new FakerCustomer(); customerNewPassword.email = customerData.email; customerNewPassword.password = newPassword; diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/01_CRUDAddress.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/01_CRUDAddress.ts index 3ee65cb069749..ece5f99879748 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/01_CRUDAddress.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/01_CRUDAddress.ts @@ -13,9 +13,11 @@ import Products from '@data/demo/products'; import {cartPage} from '@pages/FO/classic/cart'; import {checkoutPage} from '@pages/FO/classic/checkout'; -// Import data -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -39,22 +41,22 @@ describe('FO - Checkout - Addresses : CRUD address', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); - const editAddressData: AddressData = new AddressData({ + const editAddressData: FakerAddress = new FakerAddress({ alias: 'First address', email: customerData.email, country: 'France', }); - const newAddressData: AddressData = new AddressData({ + const newAddressData: FakerAddress = new FakerAddress({ alias: 'Second address', email: customerData.email, country: 'France', }); - const newInvoiceAddressData: AddressData = new AddressData({ + const newInvoiceAddressData: FakerAddress = new FakerAddress({ alias: 'Third address', email: customerData.email, country: 'France', diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/02_useDifferentAddressForInvoice.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/02_useDifferentAddressForInvoice.ts index 4ff679ed12610..4e18345ea61b4 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/02_useDifferentAddressForInvoice.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/02_addresses/02_useDifferentAddressForInvoice.ts @@ -19,10 +19,14 @@ import {checkoutPage as foCheckoutPage} from '@pages/FO/classic/checkout'; import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; + +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -47,9 +51,9 @@ Check that the 2 addresses are different describe('FO - Guest checkout: Use different invoice address', async () => { // Create faker data - const guestData: CustomerData = new CustomerData({password: ''}); - const deliveryAddress: AddressData = new AddressData({country: 'France'}); - const invoiceAddress: AddressData = new AddressData({country: 'France'}); + const guestData: FakerCustomer = new FakerCustomer({password: ''}); + const deliveryAddress: FakerAddress = new FakerAddress({country: 'France'}); + const invoiceAddress: FakerAddress = new FakerAddress({country: 'France'}); let browserContext: BrowserContext; let page: Page; @@ -127,7 +131,7 @@ describe('FO - Guest checkout: Use different invoice address', async () => { expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); // Payment step - Choose payment step - await foCheckoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await foCheckoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/01_addOrderMessage.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/01_addOrderMessage.ts index 0ee84d24807e5..68f40f5e51271 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/01_addOrderMessage.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/01_addOrderMessage.ts @@ -15,11 +15,11 @@ import {orderDetailsPage} from '@pages/FO/classic/myAccount/orderDetails'; // Import data import Carriers from '@data/demo/carriers'; -import PaymentMethods from '@data/demo/paymentMethods'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -145,7 +145,7 @@ describe('FO - Checkout - Shipping methods : Add order message', async () => { it('should choose a payment method and validate the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'choosePaymentMethod', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle: string = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/02_selectCarrier.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/02_selectCarrier.ts index abee7398ff82f..c503a2abe17c3 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/02_selectCarrier.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/03_shippingMethods/02_selectCarrier.ts @@ -14,10 +14,14 @@ import {productPage} from '@pages/FO/classic/product'; // Import data import Carriers from '@data/demo/carriers'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import Products from '@data/demo/products'; +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -37,12 +41,12 @@ Post-condition: describe('FO - Checkout - Shipping methods : Select carrier', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); - const addressDataInUnitedStates: AddressData = new AddressData({ + const addressDataInUnitedStates: FakerAddress = new FakerAddress({ email: customerData.email, country: 'United States', state: 'Alabama', diff --git a/tests/UI/campaigns/functional/FO/classic/11_checkout/04_payment/01_choosePaymentMethod.ts b/tests/UI/campaigns/functional/FO/classic/11_checkout/04_payment/01_choosePaymentMethod.ts index e2e9e1f6975b5..d883a20ae8334 100644 --- a/tests/UI/campaigns/functional/FO/classic/11_checkout/04_payment/01_choosePaymentMethod.ts +++ b/tests/UI/campaigns/functional/FO/classic/11_checkout/04_payment/01_choosePaymentMethod.ts @@ -14,13 +14,11 @@ import {checkoutPage} from '@pages/FO/classic/checkout'; import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import PaymentMethodData from '@data/faker/paymentMethod'; - import { // Import data dataCustomers, + dataPaymentMethods, + type FakerPaymentMethod, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -62,10 +60,10 @@ describe('FO - Checkout - Payment : Choose a payment method', async () => { describe('Choose a payment method', async () => { [ - PaymentMethods.wirePayment, - PaymentMethods.checkPayment, - PaymentMethods.cashOnDelivery, - ].forEach((test: PaymentMethodData, index: number) => { + dataPaymentMethods.wirePayment, + dataPaymentMethods.checkPayment, + dataPaymentMethods.cashOnDelivery, + ].forEach((test: FakerPaymentMethod, index: number) => { it('should go to FO', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToFo${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/FO/classic/12_orderConfirmation/05_contactUs.ts b/tests/UI/campaigns/functional/FO/classic/12_orderConfirmation/05_contactUs.ts index 42bfee12fd9d0..c61217e2ee997 100644 --- a/tests/UI/campaigns/functional/FO/classic/12_orderConfirmation/05_contactUs.ts +++ b/tests/UI/campaigns/functional/FO/classic/12_orderConfirmation/05_contactUs.ts @@ -24,12 +24,12 @@ import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; // Import data import Products from '@data/demo/products'; -import PaymentMethods from '@data/demo/paymentMethods'; import MessageData from '@data/faker/message'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -168,7 +168,7 @@ describe('FO - Order confirmation : Contact us', async () => { it('should Pay by back wire and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const pageTitle = await orderConfirmationPage.getPageTitle(page); expect(pageTitle).to.equal(orderConfirmationPage.pageTitle); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/01_login/01_passwordReminder.ts b/tests/UI/campaigns/functional/FO/hummingbird/01_login/01_passwordReminder.ts index 770fc39af12ba..c428ecfdaaaf2 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/01_login/01_passwordReminder.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/01_login/01_passwordReminder.ts @@ -16,9 +16,13 @@ import myAccountPage from '@pages/FO/hummingbird/myAccount'; import passwordReminderPage from '@pages/FO/hummingbird/passwordReminder'; // Import data -import CustomerData from '@data/faker/customer'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type MailDev from 'maildev'; import type {BrowserContext, Page} from 'playwright'; @@ -45,9 +49,9 @@ describe('FO - Login : Password reminder', async () => { let mailListener: MailDev; const resetPasswordMailSubject: string = 'Password query confirmation'; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); const newPassword: string = 'new test password'; - const customerNewPassword: CustomerData = new CustomerData(); + const customerNewPassword: FakerCustomer = new FakerCustomer(); customerNewPassword.email = customerData.email; customerNewPassword.password = newPassword; diff --git a/tests/UI/campaigns/functional/FO/hummingbird/01_login/02_login.ts b/tests/UI/campaigns/functional/FO/hummingbird/01_login/02_login.ts index f40851ffe8ed2..15f6efd185f66 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/01_login/02_login.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/01_login/02_login.ts @@ -9,12 +9,10 @@ import {installHummingbird, uninstallHummingbird} from '@commonTests/BO/design/h import homePage from '@pages/FO/hummingbird/home'; import loginPage from '@pages/FO/hummingbird/login'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -26,9 +24,9 @@ describe('FO - Login : Login in FO', async () => { let browserContext: BrowserContext; let page: Page; - const firstCredentialsData: CustomerData = new CustomerData(); - const secondCredentialsData: CustomerData = new CustomerData({password: dataCustomers.johnDoe.password}); - const thirdCredentialsData: CustomerData = new CustomerData({email: dataCustomers.johnDoe.email}); + const firstCredentialsData: FakerCustomer = new FakerCustomer(); + const secondCredentialsData: FakerCustomer = new FakerCustomer({password: dataCustomers.johnDoe.password}); + const thirdCredentialsData: FakerCustomer = new FakerCustomer({email: dataCustomers.johnDoe.email}); // Pre-condition : Install Hummingbird installHummingbird(`${baseContext}_preTest_1`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/01_login/04_createAccount.ts b/tests/UI/campaigns/functional/FO/hummingbird/01_login/04_createAccount.ts index d47059dbeb53e..8591328702c23 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/01_login/04_createAccount.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/01_login/04_createAccount.ts @@ -11,8 +11,10 @@ import homePage from '@pages/FO/hummingbird/home'; import loginPage from '@pages/FO/hummingbird/login'; import createAccountPage from '@pages/FO/hummingbird/myAccount/add'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -23,7 +25,7 @@ describe('FO - Login : Create account', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); // Pre-condition : Install Hummingbird installHummingbird(`${baseContext}_preTest_1`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/02_checkLinksInFooter.ts b/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/02_checkLinksInFooter.ts index 37c22e3527328..c7fb3fb9f3188 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/02_checkLinksInFooter.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/02_checkLinksInFooter.ts @@ -33,12 +33,10 @@ import siteMapPage from '@pages/FO/hummingbird/siteMap'; import storesPage from '@pages/FO/hummingbird/stores'; import termsAndConditionsOfUsePage from '@pages/FO/hummingbird/termsAndConditionsOfUse'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -68,7 +66,7 @@ describe('FO - Header and Footer : Check links in footer page', async () => { const today: Date = new Date(); const currentYear: string = today.getFullYear().toString(); - const createCustomerData: CustomerData = new CustomerData(); + const createCustomerData: FakerCustomer = new FakerCustomer(); // Pre-condition: Create new account on FO createAccountTest(createCustomerData, `${baseContext}_preTest_1`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/03_changeCurrency.ts b/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/03_changeCurrency.ts index 97c38ab508b6a..0972dfb78e71c 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/03_changeCurrency.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/02_headerAndFooter/03_changeCurrency.ts @@ -17,9 +17,12 @@ import homePage from '@pages/FO/hummingbird/home'; import searchResultsPage from '@pages/FO/hummingbird/searchResults'; // Import data -import Currencies from '@data/demo/currencies'; import Products from '@data/demo/products'; +import { + dataCurrencies, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -76,7 +79,7 @@ describe('FO - Header and Footer : Change currency', async () => { }); // Pre-condition: Create currency - createCurrencyTest(Currencies.mad, `${baseContext}_preTest_2`); + createCurrencyTest(dataCurrencies.mad, `${baseContext}_preTest_2`); describe('Filter by iso code of currency and get the exchange rate value ', async () => { it('should login in BO', async function () { @@ -106,11 +109,11 @@ describe('FO - Header and Footer : Change currency', async () => { expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should get the currency exchange rate value '${Currencies.mad.isoCode}'`, async function () { + it(`should get the currency exchange rate value '${dataCurrencies.mad.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'getExchangeRate', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.mad.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.mad.isoCode); // Check exchange rate exchangeRateValue = await currenciesPage.getExchangeRateValue(page, 1); @@ -132,10 +135,10 @@ describe('FO - Header and Footer : Change currency', async () => { await testContext.addContextItem(this, 'testIdentifier', 'changeFoCurrency', baseContext); // Check currency - await homePage.changeCurrency(page, Currencies.mad.isoCode, Currencies.mad.symbol); + await homePage.changeCurrency(page, dataCurrencies.mad.isoCode, dataCurrencies.mad.symbol); const shopCurrency = await homePage.getDefaultCurrency(page); - expect(shopCurrency).to.contains(Currencies.mad.isoCode); + expect(shopCurrency).to.contains(dataCurrencies.mad.isoCode); }); it('should search product', async function () { @@ -150,10 +153,10 @@ describe('FO - Header and Footer : Change currency', async () => { it('should check the product price', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkProductPrice', baseContext); - const newExchangeRateValue = (exchangeRateValue * Products.demo_11.finalPrice).toFixed(Currencies.mad.decimals); + const newExchangeRateValue = (exchangeRateValue * Products.demo_11.finalPrice).toFixed(dataCurrencies.mad.decimals); const productPrice = await searchResultsPage.getProductPrice(page); - expect(productPrice).to.contains(`${Currencies.mad.symbol}${newExchangeRateValue}`); + expect(productPrice).to.contains(`${dataCurrencies.mad.symbol}${newExchangeRateValue}`); }); it('should switch back to the default currency', async function () { @@ -165,25 +168,25 @@ describe('FO - Header and Footer : Change currency', async () => { ); // Check currency - await homePage.changeCurrency(page, Currencies.euro.isoCode, Currencies.euro.symbol); + await homePage.changeCurrency(page, dataCurrencies.euro.isoCode, dataCurrencies.euro.symbol); const shopCurrency = await homePage.getDefaultCurrency(page); - expect(shopCurrency).to.contains(Currencies.euro.isoCode); + expect(shopCurrency).to.contains(dataCurrencies.euro.isoCode); }); it('should check the product price', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkProductPrice2', baseContext); - const exchangeRate = Math.round(Currencies.euro.exchangeRate * Products.demo_11.finalPrice); + const exchangeRate = Math.round(dataCurrencies.euro.exchangeRate * Products.demo_11.finalPrice); const productPrice = await searchResultsPage.getProductPrice(page); - expect(productPrice).to.contains(`${Currencies.euro.symbol}${exchangeRate}`); + expect(productPrice).to.contains(`${dataCurrencies.euro.symbol}${exchangeRate}`); }); }); }); // Post-condition - Delete currency - deleteCurrencyTest(Currencies.mad, `${baseContext}_postTest_1`); + deleteCurrencyTest(dataCurrencies.mad, `${baseContext}_postTest_1`); // Post-condition : Uninstall Hummingbird uninstallHummingbird(`${baseContext}_postTest_2`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_creditSlips/01_consultCreditSlip.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_creditSlips/01_consultCreditSlip.ts index bae2f0f93fc25..52f528760c88b 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_creditSlips/01_consultCreditSlip.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_creditSlips/01_consultCreditSlip.ts @@ -28,14 +28,18 @@ import creditSlipPage from '@pages/FO/hummingbird/myAccount/creditSlips'; import orderDetailsPage from '@pages/FO/hummingbird/myAccount/orderDetails'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import type MailDev from 'maildev'; @@ -64,8 +68,8 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as let newMail: MailDevEmail; let mailListener: MailDev; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); @@ -77,7 +81,7 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create new account on FO @@ -197,11 +201,11 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.paymentAccepted.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.paymentAccepted.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(result).to.equal(OrderStatuses.paymentAccepted.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(result).to.equal(dataOrderStatuses.paymentAccepted.name); }); it('should check if the button \'Partial Refund\' is visible', async function () { @@ -339,10 +343,10 @@ describe('FO - Consult credit slip list & View PDF Credit slip & View order', as .to.eq(true); // Check payment method in pdf - const paymentMethodExist = await files.isTextInPDF(filePath, PaymentMethods.wirePayment.displayName); + const paymentMethodExist = await files.isTextInPDF(filePath, dataPaymentMethods.wirePayment.displayName); expect( paymentMethodExist, - `Payment Method '${PaymentMethods.wirePayment.displayName}' does not exist in credit slip`, + `Payment Method '${dataPaymentMethods.wirePayment.displayName}' does not exist in credit slip`, ).to.eq(true); }); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_editInformation.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_editInformation.ts index e940966679cdc..286efa1d32d70 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_editInformation.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/01_editInformation.ts @@ -13,8 +13,10 @@ import loginPage from '@pages/FO/hummingbird/login'; import myAccountPage from '@pages/FO/hummingbird/myAccount'; import accountIdentityPage from '@pages/FO/hummingbird/myAccount/identity'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -42,25 +44,25 @@ describe('FO - Account : Edit information', async () => { let browserContext: BrowserContext; let page: Page; - const createCustomerData: CustomerData = new CustomerData(); + const createCustomerData: FakerCustomer = new FakerCustomer(); // New customer data with empty new password - const editCustomerData1: CustomerData = new CustomerData({password: ''}); + const editCustomerData1: FakerCustomer = new FakerCustomer({password: ''}); // New customer data with repeated letters - const editCustomerData2: CustomerData = new CustomerData({password: 'abcabcabc'}); + const editCustomerData2: FakerCustomer = new FakerCustomer({password: 'abcabcabc'}); // New customer data with password below 8 - const editCustomerData3: CustomerData = new CustomerData({password: 'presta'}); + const editCustomerData3: FakerCustomer = new FakerCustomer({password: 'presta'}); // New customer data with an old similar password - const editCustomerData4: CustomerData = new CustomerData({password: 'testoune'}); + const editCustomerData4: FakerCustomer = new FakerCustomer({password: 'testoune'}); // New customer data with simple characters password - const editCustomerData5: CustomerData = new CustomerData({password: 'prestash'}); + const editCustomerData5: FakerCustomer = new FakerCustomer({password: 'prestash'}); // New customer data with common password - const editCustomerData6: CustomerData = new CustomerData({password: 'azerty123'}); + const editCustomerData6: FakerCustomer = new FakerCustomer({password: 'azerty123'}); // New customer data with top 10 common password - const editCustomerData7: CustomerData = new CustomerData({password: '123456789'}); + const editCustomerData7: FakerCustomer = new FakerCustomer({password: '123456789'}); // New customer data with same characters - const editCustomerData8: CustomerData = new CustomerData({password: 'aaaaaaaaa'}); + const editCustomerData8: FakerCustomer = new FakerCustomer({password: 'aaaaaaaaa'}); // New customer data with good password - const editCustomerData9: CustomerData = new CustomerData({password: 'test edit information'}); + const editCustomerData9: FakerCustomer = new FakerCustomer({password: 'test edit information'}); // Pre-condition: Create new account on FO createAccountTest(createCustomerData, `${baseContext}_preTest_0`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_CRUDAddress.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_CRUDAddress.ts index 19a04d39dce2a..a621d1caeb8ff 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_CRUDAddress.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_CRUDAddress.ts @@ -19,8 +19,12 @@ import productPage from '@pages/FO/hummingbird/product'; // Import data import Products from '@data/demo/products'; -import CustomerData from '@data/faker/customer'; -import AddressData from '@data/faker/address'; + +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -49,10 +53,10 @@ describe('FO - Account : CRUD address', async () => { let firstAddressPosition: number = 0; let secondAddressPosition: number = 0; - const newCustomerData: CustomerData = new CustomerData(); - const createAddressData: AddressData = new AddressData({country: 'France'}); - const editAddressData: AddressData = new AddressData({country: 'France'}); - const secondAddressData: AddressData = new AddressData({country: 'France'}); + const newCustomerData: FakerCustomer = new FakerCustomer(); + const createAddressData: FakerAddress = new FakerAddress({country: 'France'}); + const editAddressData: FakerAddress = new FakerAddress({country: 'France'}); + const secondAddressData: FakerAddress = new FakerAddress({country: 'France'}); // Pre-condition createAccountTest(newCustomerData, `${baseContext}_preTest_1`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_consultDetailsAndReorder.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_consultDetailsAndReorder.ts index 098e2deb6add8..c4faf2955fd6b 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_consultDetailsAndReorder.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_consultDetailsAndReorder.ts @@ -20,13 +20,17 @@ import checkoutPage from '@pages/FO/hummingbird/checkout'; import orderConfirmationPage from '@pages/FO/hummingbird/checkout/orderConfirmation'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import OrderData from '@data/faker/order'; import Products from '@data/demo/products'; +import { + // Import data + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -53,8 +57,8 @@ describe('FO - Account - Order history : Consult details and reorder', async () let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); @@ -66,7 +70,7 @@ describe('FO - Account - Order history : Consult details and reorder', async () quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const today: string = date.getDateFormat('mm/dd/yyyy'); @@ -163,8 +167,8 @@ describe('FO - Account - Order history : Consult details and reorder', async () expect(result.reference).not.null, expect(result.date).to.equal(today), expect(result.price).to.equal(`€${Products.demo_1.finalPrice}`), - expect(result.paymentType).to.equal(PaymentMethods.wirePayment.displayName), - expect(result.status).to.equal(OrderStatuses.awaitingBankWire.name), + expect(result.paymentType).to.equal(dataPaymentMethods.wirePayment.displayName), + expect(result.status).to.equal(dataOrderStatuses.awaitingBankWire.name), expect(result.invoice).to.equal('-'), ]); }); @@ -216,7 +220,7 @@ describe('FO - Account - Order history : Consult details and reorder', async () await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts index 04b5d72be008d..743cdf774771a 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/01_reorderFromOrderDetails.ts @@ -16,13 +16,13 @@ import orderDetailsPage from '@pages/FO/hummingbird/myAccount/orderDetails'; import orderHistoryPage from '@pages/FO/hummingbird/myAccount/orderHistory'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -58,7 +58,7 @@ describe('FO - Account - Order details : Reorder from order detail', async () => quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition : Install Hummingbird @@ -158,7 +158,7 @@ describe('FO - Account - Order details : Reorder from order detail', async () => it('should Pay by bank wire and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmReorder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const pageTitle = await orderConfirmationPage.getPageTitle(page); expect(pageTitle).to.equal(orderConfirmationPage.pageTitle); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts index 56c7fcd7bc12c..aa489e442dc9e 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/02_downloadInvoice.ts @@ -21,14 +21,14 @@ import orderHistoryPage from '@pages/FO/hummingbird/myAccount/orderHistory'; import orderDetailsPage from '@pages/FO/hummingbird/myAccount/orderDetails'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -61,7 +61,7 @@ describe('FO - Account - Order details : Download invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition : Install Hummingbird @@ -111,11 +111,11 @@ describe('FO - Account - Order details : Download invoice', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should get the invoice file name', async function () { diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts index 1a1551fd1c787..f3f8f950fb77e 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/03_requestMerchandiseReturn.ts @@ -27,13 +27,13 @@ import orderPageTabListBlock from '@pages/BO/orders/view/tabListBlock'; // Import data import Products from '@data/demo/products'; -import PaymentMethods from '@data/demo/paymentMethods'; -import OrderStatuses from '@data/demo/orderStatuses'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -67,7 +67,7 @@ describe('FO - Account - Order details : Request merchandise return', async () = quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); const today: string = date.getDateFormat('mm/dd/yyyy'); @@ -118,11 +118,11 @@ describe('FO - Account - Order details : Request merchandise return', async () = expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.delivered.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.delivered.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatus', baseContext); - const result = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.delivered.name); - expect(result).to.equal(OrderStatuses.delivered.name); + const result = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.delivered.name); + expect(result).to.equal(dataOrderStatuses.delivered.name); }); it('should get the order reference', async function () { diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts index 757c5eae89a7e..0f35ecb568e58 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/01_orderDetails/04_sendMessage.ts @@ -25,13 +25,13 @@ import orderHistoryPage from '@pages/FO/hummingbird/myAccount/orderHistory'; import productPage from '@pages/FO/hummingbird/product'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -148,7 +148,7 @@ describe('FO - Account : Send a message with an ordered product', async () => { expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message @@ -190,14 +190,14 @@ describe('FO - Account : Send a message with an ordered product', async () => { expect(numberOfOrders).to.be.above(0); }); - it(`should update order status to '${OrderStatuses.paymentAccepted.name}'`, async function () { + it(`should update order status to '${dataOrderStatuses.paymentAccepted.name}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const textResult = await ordersPage.setOrderStatus(page, 1, OrderStatuses.paymentAccepted); + const textResult = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.paymentAccepted); expect(textResult).to.equal(ordersPage.successfulUpdateMessage); const orderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(orderStatus, 'Order status was not updated').to.equal(OrderStatuses.paymentAccepted.name); + expect(orderStatus, 'Order status was not updated').to.equal(dataOrderStatuses.paymentAccepted.name); }); it('disconnect from BO', async function () { diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/03_downloadInvoice.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/03_downloadInvoice.ts index 2fbc7884196cb..7336ab3ff78f6 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/03_downloadInvoice.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/02_orderHistory/03_downloadInvoice.ts @@ -20,14 +20,14 @@ import myAccountPage from '@pages/FO/hummingbird/myAccount'; import orderHistoryPage from '@pages/FO/hummingbird/myAccount/orderHistory'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; -import OrderStatuses from '@data/demo/orderStatuses'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -60,7 +60,7 @@ describe('FO - Account - Order history : download invoice', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition : Install Hummingbird @@ -110,11 +110,11 @@ describe('FO - Account - Order history : download invoice', async () => { expect(pageTitle).to.contains(orderPageTabListBlock.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateStatus', baseContext); - const result: string = await orderPageTabListBlock.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result: string = await orderPageTabListBlock.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should get the invoice file name', async function () { diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts index e71d416629888..06b3812699426 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/01_consultReturnDetails.ts @@ -26,14 +26,14 @@ import returnDetailsPage from '@pages/FO/hummingbird/myAccount/returnDetails'; // Import data import OrderReturnStatuses from '@data/demo/orderReturnStatuses'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -70,7 +70,7 @@ describe('FO - Account : Consult return details', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition : Install Hummingbird @@ -93,7 +93,7 @@ describe('FO - Account : Consult return details', async () => { }); describe(`Case 1 : Check merchandise returns status '${OrderReturnStatuses.waitingForConfirmation.name}'`, async () => { - describe(`Change the created orders status to '${OrderStatuses.shipped.name}'`, async () => { + describe(`Change the created orders status to '${dataOrderStatuses.shipped.name}'`, async () => { it('should login in BO', async function () { await loginCommon.loginBO(this, page); }); @@ -152,11 +152,11 @@ describe('FO - Account : Consult return details', async () => { expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should go to \'Orders > Orders\' page', async function () { diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts index 358b39822a0d3..66d58cfc71312 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_merchandiseReturns/02_checkOrderReturnPDF.ts @@ -28,8 +28,6 @@ import returnDetailsPage from '@pages/FO/hummingbird/myAccount/returnDetails'; // Import data import Addresses from '@data/demo/address'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderReturnStatuses from '@data/demo/orderReturnStatuses'; import OrderData from '@data/faker/order'; @@ -37,6 +35,8 @@ import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -76,7 +76,7 @@ describe('FO - Account : Check order return PDF', async () => { quantity: 1, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition : Install Hummingbird @@ -98,7 +98,7 @@ describe('FO - Account : Check order return PDF', async () => { await helper.closeBrowserContext(browserContext); }); - describe(`Change the created orders status to '${OrderStatuses.shipped.name}'`, async () => { + describe(`Change the created orders status to '${dataOrderStatuses.shipped.name}'`, async () => { it('should login in BO', async function () { await loginCommon.loginBO(this, page); }); @@ -157,11 +157,11 @@ describe('FO - Account : Check order return PDF', async () => { expect(pageTitle).to.contains(viewOrderBasePage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.shipped.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.shipped.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await viewOrderBasePage.modifyOrderStatus(page, OrderStatuses.shipped.name); - expect(result).to.equal(OrderStatuses.shipped.name); + const result = await viewOrderBasePage.modifyOrderStatus(page, dataOrderStatuses.shipped.name); + expect(result).to.equal(dataOrderStatuses.shipped.name); }); it('should go to \'Orders > Orders\' page', async function () { diff --git a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_viewVoucher.ts b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_viewVoucher.ts index 64f0ee57c16b5..c15babcd6714e 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_viewVoucher.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/03_userAccount/03_viewVoucher.ts @@ -17,7 +17,11 @@ import foVouchersPage from '@pages/FO/hummingbird/myAccount/vouchers'; // Import data import CartRuleData from '@data/faker/cartRule'; -import CustomerData from '@data/faker/customer'; + +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -44,7 +48,7 @@ describe('FO - Account : View vouchers', async () => { const pastDate: string = date.getDateFormat('yyyy-mm-dd', 'past'); const futureDate: string = date.getDateFormat('yyyy-mm-dd', 'future'); const expirationDate: string = date.getDateFormat('mm/dd/yyyy', 'future'); - const customerData: CustomerData = new CustomerData({}); + const customerData: FakerCustomer = new FakerCustomer({}); const firstCartRule: CartRuleData = new CartRuleData({ code: 'promo20', customer: customerData, diff --git a/tests/UI/campaigns/functional/FO/hummingbird/04_newsletter/01_subscribeNewsletter.ts b/tests/UI/campaigns/functional/FO/hummingbird/04_newsletter/01_subscribeNewsletter.ts index c361b6c05c8be..bc50988c80d85 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/04_newsletter/01_subscribeNewsletter.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/04_newsletter/01_subscribeNewsletter.ts @@ -18,12 +18,10 @@ import loginPage from '@pages/FO/hummingbird/login'; import myAccountPage from '@pages/FO/hummingbird/myAccount'; import accountIdentityPage from '@pages/FO/hummingbird/myAccount/identity'; -// Import data -import ModuleData from '@data/faker/module'; - import { // Import data dataCustomers, + FakerModule, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -50,7 +48,7 @@ describe('FO - Newsletter : Subscribe to Newsletter', async () => { let browserContext: BrowserContext; let page: Page; - const moduleInformation: ModuleData = new ModuleData({ + const moduleInformation: FakerModule = new FakerModule({ tag: 'ps_emailsubscription', name: 'Newsletter subscription', }); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/09_productPage/01_quickView/01_addToCart.ts b/tests/UI/campaigns/functional/FO/hummingbird/09_productPage/01_quickView/01_addToCart.ts index 96838795b122e..c5b7c52e73b31 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/09_productPage/01_quickView/01_addToCart.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/09_productPage/01_quickView/01_addToCart.ts @@ -14,9 +14,12 @@ import blockCartModal from '@pages/FO/hummingbird/modal/blockCart'; // Import data import Products from '@data/demo/products'; -import CartProductDetails from '@data/types/cart'; import {ProductAttribute} from '@data/types/product'; +import { + type CartProductDetails, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/01_orderAsAGuest.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/01_orderAsAGuest.ts index 9afb4ab0f3246..68c5f6dcb634b 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/01_orderAsAGuest.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/01_orderAsAGuest.ts @@ -12,10 +12,12 @@ import cartPage from '@pages/FO/hummingbird/cart'; import checkoutPage from '@pages/FO/hummingbird/checkout'; import orderConfirmationPage from '@pages/FO/hummingbird/checkout/orderConfirmation'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -38,9 +40,9 @@ Post-condition: describe('FO - Checkout - Personal information : Order as a guest', async () => { let browserContext: BrowserContext; let page: Page; - const guestData: CustomerData = new CustomerData({password: ''}); - const secondGuestData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const guestData: FakerCustomer = new FakerCustomer({password: ''}); + const secondGuestData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); // Pre-condition : Install Hummingbird installHummingbird(`${baseContext}_preTest`); @@ -117,7 +119,7 @@ describe('FO - Checkout - Personal information : Order as a guest', async () => expect(isStepDeliveryComplete, 'Step Address is not complete').to.equal(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/02_signIn.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/02_signIn.ts index 392968b371bcd..e7dec03a3fa35 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/02_signIn.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/02_signIn.ts @@ -11,12 +11,10 @@ import productPage from '@pages/FO/hummingbird/product'; import cartPage from '@pages/FO/hummingbird/cart'; import checkoutPage from '@pages/FO/hummingbird/checkout'; -// Import data -import CustomerData from '@data/faker/customer'; - import { // Import data dataCustomers, + FakerCustomer, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -41,7 +39,7 @@ describe('FO - Checkout - Personal information : Sign in', async () => { let browserContext: BrowserContext; let page: Page; - const credentialsData: CustomerData = new CustomerData(); + const credentialsData: FakerCustomer = new FakerCustomer(); // Pre-condition : Install Hummingbird installHummingbird(`${baseContext}_preTest`); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/03_createAccount.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/03_createAccount.ts index bf24d325f401f..6ab1713336060 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/03_createAccount.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/03_createAccount.ts @@ -15,10 +15,12 @@ import cartPage from '@pages/FO/hummingbird/cart'; import checkoutPage from '@pages/FO/hummingbird/checkout'; import orderConfirmationPage from '@pages/FO/hummingbird/checkout/orderConfirmation'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; +import { + // Import data + dataPaymentMethods, + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -48,8 +50,8 @@ Post-condition: describe('FO - Checkout - Personal information : Create account', async () => { let browserContext: BrowserContext; let page: Page; - const guestData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({country: 'France'}); + const guestData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); let allEmails: MailDevEmail[]; let numberOfEmails: number; let mailListener: MailDev; @@ -133,7 +135,7 @@ describe('FO - Checkout - Personal information : Create account', async () => { expect(isStepDeliveryComplete, 'Step Address is not complete').to.equal(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/05_passwordReminder.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/05_passwordReminder.ts index 4d2e62114a653..9c4a7569c4bee 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/05_passwordReminder.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/01_personalInformation/05_passwordReminder.ts @@ -18,9 +18,13 @@ import passwordReminderPage from '@pages/FO/hummingbird/passwordReminder'; import myAccountPage from '@pages/FO/hummingbird/myAccount'; // Import data -import CustomerData from '@data/faker/customer'; import type MailDevEmail from '@data/types/maildevEmail'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; import type MailDev from 'maildev'; @@ -50,9 +54,9 @@ describe('FO - Checkout - Personal information : Password reminder', async () => let mailListener: MailDev; const resetPasswordMailSubject: string = 'Password query confirmation'; - const customerData: CustomerData = new CustomerData(); + const customerData: FakerCustomer = new FakerCustomer(); const newPassword: string = 'new test password'; - const customerNewPassword: CustomerData = new CustomerData(); + const customerNewPassword: FakerCustomer = new FakerCustomer(); customerNewPassword.email = customerData.email; customerNewPassword.password = newPassword; diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/02_addresses/01_CRUDAddress.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/02_addresses/01_CRUDAddress.ts index 86910802cc0be..8fe4b848d27b4 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/02_addresses/01_CRUDAddress.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/02_addresses/01_CRUDAddress.ts @@ -15,8 +15,12 @@ import checkoutPage from '@pages/FO/hummingbird/checkout'; // Import data import Products from '@data/demo/products'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; + +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -40,22 +44,22 @@ describe('FO - Checkout - Addresses : CRUD address', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); - const editAddressData: AddressData = new AddressData({ + const editAddressData: FakerAddress = new FakerAddress({ alias: 'First address', email: customerData.email, country: 'France', }); - const newAddressData: AddressData = new AddressData({ + const newAddressData: FakerAddress = new FakerAddress({ alias: 'Second address', email: customerData.email, country: 'France', }); - const newInvoiceAddressData: AddressData = new AddressData({ + const newInvoiceAddressData: FakerAddress = new FakerAddress({ alias: 'Third address', email: customerData.email, country: 'France', diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/01_addOrderMessage.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/01_addOrderMessage.ts index 2c0e11ac86696..88253bc3c1a5d 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/01_addOrderMessage.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/01_addOrderMessage.ts @@ -18,11 +18,11 @@ import orderDetailsPage from '@pages/FO/hummingbird/myAccount/orderDetails'; // Import data import Carriers from '@data/demo/carriers'; -import PaymentMethods from '@data/demo/paymentMethods'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -152,7 +152,7 @@ describe('FO - Checkout - Shipping methods : Add order message', async () => { it('should choose a payment method and validate the order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'choosePaymentMethod', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle: string = await orderConfirmationPage.getOrderConfirmationCardTitle(page); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/02_selectCarrier.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/02_selectCarrier.ts index 4a16b45a2f6b0..0f8c6137943ea 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/02_selectCarrier.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/03_shippingMethods/02_selectCarrier.ts @@ -15,10 +15,14 @@ import productPage from '@pages/FO/hummingbird/product'; // Import data import Carriers from '@data/demo/carriers'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; import Products from '@data/demo/products'; +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -38,12 +42,12 @@ Post-condition: describe('FO - Checkout - Shipping methods : Select carrier', async () => { let browserContext: BrowserContext; let page: Page; - const customerData: CustomerData = new CustomerData(); - const addressData: AddressData = new AddressData({ + const customerData: FakerCustomer = new FakerCustomer(); + const addressData: FakerAddress = new FakerAddress({ email: customerData.email, country: 'France', }); - const addressDataInUnitedStates: AddressData = new AddressData({ + const addressDataInUnitedStates: FakerAddress = new FakerAddress({ email: customerData.email, country: 'United States', state: 'Alabama', diff --git a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/04_payment/01_choosePaymentMethod.ts b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/04_payment/01_choosePaymentMethod.ts index 48ee4c26a7f33..10cb31f77d27f 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/04_payment/01_choosePaymentMethod.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/11_checkout/04_payment/01_choosePaymentMethod.ts @@ -15,13 +15,11 @@ import checkoutPage from '@pages/FO/hummingbird/checkout'; import quickViewModal from '@pages/FO/hummingbird/modal/quickView'; import blockCartModal from '@pages/FO/hummingbird/modal/blockCart'; -// Import data -import PaymentMethods from '@data/demo/paymentMethods'; -import PaymentMethodData from '@data/faker/paymentMethod'; - import { // Import data dataCustomers, + dataPaymentMethods, + type FakerPaymentMethod, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -66,10 +64,10 @@ describe('FO - Checkout - Payment : Choose a payment method', async () => { describe('Choose a payment method', async () => { [ - PaymentMethods.wirePayment, - PaymentMethods.checkPayment, - PaymentMethods.cashOnDelivery, - ].forEach((test: PaymentMethodData, index: number) => { + dataPaymentMethods.wirePayment, + dataPaymentMethods.checkPayment, + dataPaymentMethods.cashOnDelivery, + ].forEach((test: FakerPaymentMethod, index: number) => { it('should go to FO', async function () { await testContext.addContextItem(this, 'testIdentifier', `goToFo${index}`, baseContext); diff --git a/tests/UI/campaigns/functional/FO/hummingbird/12_orderConfirmation/05_contactUs.ts b/tests/UI/campaigns/functional/FO/hummingbird/12_orderConfirmation/05_contactUs.ts index beab7e91871ef..a5daa7f946151 100644 --- a/tests/UI/campaigns/functional/FO/hummingbird/12_orderConfirmation/05_contactUs.ts +++ b/tests/UI/campaigns/functional/FO/hummingbird/12_orderConfirmation/05_contactUs.ts @@ -25,12 +25,12 @@ import blockCartModal from '@pages/FO/hummingbird/modal/blockCart'; // Import data import Products from '@data/demo/products'; -import PaymentMethods from '@data/demo/paymentMethods'; import MessageData from '@data/faker/message'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -173,7 +173,7 @@ describe('FO - Order confirmation : Contact us', async () => { it('should Pay by bank wire and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const pageTitle = await orderConfirmationPage.getPageTitle(page); expect(pageTitle).to.equal(orderConfirmationPage.pageTitle); diff --git a/tests/UI/campaigns/modules/blockwishlist/02_configuration/02_statisticsTabSettings.ts b/tests/UI/campaigns/modules/blockwishlist/02_configuration/02_statisticsTabSettings.ts index 1512b5501e434..9e515a0f3f5fb 100644 --- a/tests/UI/campaigns/modules/blockwishlist/02_configuration/02_statisticsTabSettings.ts +++ b/tests/UI/campaigns/modules/blockwishlist/02_configuration/02_statisticsTabSettings.ts @@ -10,9 +10,9 @@ import { boDashboardPage, boModuleManagerPage, // Import FO pages - foCategoryPage, - foHomePage, - foLoginPage, + foClassicCategoryPage, + foClassicHomePage, + foClassicLoginPage, // Import modules modBlockwishlistBoMain, modBlockwishlistBoStatistics, @@ -98,36 +98,36 @@ describe('Wishlist module - Statistics tab settings', async () => { await testContext.addContextItem(this, 'testIdentifier', 'goToFO', baseContext); page = await modBlockwishlistBoStatistics.viewMyShop(page); - await foHomePage.changeLanguage(page, 'en'); + await foClassicHomePage.changeLanguage(page, 'en'); - const isHomePage = await foHomePage.isHomePage(page); + const isHomePage = await foClassicHomePage.isHomePage(page); expect(isHomePage).to.eq(true); }); it('should go to login page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToLoginPage', baseContext); - await foHomePage.goToLoginPage(page); + await foClassicHomePage.goToLoginPage(page); - const pageTitle = await foLoginPage.getPageTitle(page); - expect(pageTitle, 'Fail to open FO login page').to.contains(foLoginPage.pageTitle); + const pageTitle = await foClassicLoginPage.getPageTitle(page); + expect(pageTitle, 'Fail to open FO login page').to.contains(foClassicLoginPage.pageTitle); }); it('should sign in with default customer', async function () { await testContext.addContextItem(this, 'testIdentifier', 'sighInFo', baseContext); - await foLoginPage.customerLogin(page, dataCustomers.johnDoe); + await foClassicLoginPage.customerLogin(page, dataCustomers.johnDoe); - const isCustomerConnected = await foLoginPage.isCustomerConnected(page); + const isCustomerConnected = await foClassicLoginPage.isCustomerConnected(page); expect(isCustomerConnected, 'Customer is not connected').to.eq(true); }); it('should go to all products page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToAllProducts', baseContext); - await foHomePage.goToAllProductsPage(page); + await foClassicHomePage.goToAllProductsPage(page); - const isCategoryPageVisible = await foCategoryPage.isCategoryPage(page); + const isCategoryPageVisible = await foClassicCategoryPage.isCategoryPage(page); expect(isCategoryPageVisible).to.eq(true); }); @@ -136,10 +136,10 @@ describe('Wishlist module - Statistics tab settings', async () => { it(`should add product #${idxProduct} to wishlist`, async function () { await testContext.addContextItem(this, 'testIdentifier', `addToFavorite${idxProduct}`, baseContext); - const textResult = await foCategoryPage.addToWishList(page, idxProduct); - expect(textResult).to.be.eq(foCategoryPage.messageAddedToWishlist); + const textResult = await foClassicCategoryPage.addToWishList(page, idxProduct); + expect(textResult).to.be.eq(foClassicCategoryPage.messageAddedToWishlist); - const isAddedToWishlist = await foCategoryPage.isAddedToWishlist(page, idxProduct); + const isAddedToWishlist = await foClassicCategoryPage.isAddedToWishlist(page, idxProduct); expect(isAddedToWishlist).to.eq(true); }); } @@ -147,9 +147,9 @@ describe('Wishlist module - Statistics tab settings', async () => { it('should logout', async function () { await testContext.addContextItem(this, 'testIdentifier', 'foLogout', baseContext); - await foCategoryPage.logout(page); + await foClassicCategoryPage.logout(page); - const isCustomerConnected = await foHomePage.isCustomerConnected(page); + const isCustomerConnected = await foClassicHomePage.isCustomerConnected(page); expect(isCustomerConnected).to.eq(false); }); }); @@ -157,7 +157,7 @@ describe('Wishlist module - Statistics tab settings', async () => { it('should go to BO', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToBoBack', baseContext); - page = await foHomePage.closePage(browserContext, page, 0); + page = await foClassicHomePage.closePage(browserContext, page, 0); const pageTitle = await modBlockwishlistBoStatistics.getPageTitle(page); expect(pageTitle).to.contains(modBlockwishlistBoStatistics.pageTitle); diff --git a/tests/UI/campaigns/modules/ps_cashondelivery/01_installation/04_resetModule.ts b/tests/UI/campaigns/modules/ps_cashondelivery/01_installation/04_resetModule.ts index 7d8a2e37b4ffa..e3337ced0ad1f 100644 --- a/tests/UI/campaigns/modules/ps_cashondelivery/01_installation/04_resetModule.ts +++ b/tests/UI/campaigns/modules/ps_cashondelivery/01_installation/04_resetModule.ts @@ -6,14 +6,8 @@ import testContext from '@utils/testContext'; import loginCommon from '@commonTests/BO/loginBO'; // Import pages -// Import BO pages -import dashboardPage from '@pages/BO/dashboard'; -import {moduleManager as moduleManagerPage} from '@pages/BO/modules/moduleManager'; // Import FO pages -import {cartPage} from '@pages/FO/classic/cart'; -import {checkoutPage} from '@pages/FO/classic/checkout'; import {homePage} from '@pages/FO/classic/home'; -import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; @@ -23,6 +17,14 @@ import Modules from '@data/demo/modules'; import { // Import data dataCustomers, + // Import BO pages + boDashboardPage, + boModuleManagerPage, + // Import FO pages + foClassicCartPage, + foClassicCheckoutPage, + foClassicHomePage, + foClassicLoginPage, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -51,97 +53,97 @@ describe('Cash on delivery (COD) module - Reset module', async () => { it('should go to \'Modules > Module Manager\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToModuleManagerPage', baseContext); - await dashboardPage.goToSubMenu( + await boDashboardPage.goToSubMenu( page, - dashboardPage.modulesParentLink, - dashboardPage.moduleManagerLink, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, ); - await moduleManagerPage.closeSfToolBar(page); + await boModuleManagerPage.closeSfToolBar(page); - const pageTitle = await moduleManagerPage.getPageTitle(page); - expect(pageTitle).to.contains(moduleManagerPage.pageTitle); + const pageTitle = await boModuleManagerPage.getPageTitle(page); + expect(pageTitle).to.contains(boModuleManagerPage.pageTitle); }); it(`should search the module ${Modules.psCashOnDelivery.name}`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'searchModule', baseContext); - const isModuleVisible = await moduleManagerPage.searchModule(page, Modules.psCashOnDelivery); + const isModuleVisible = await boModuleManagerPage.searchModule(page, Modules.psCashOnDelivery); expect(isModuleVisible).to.eq(true); }); it('should display the reset modal and cancel it', async function () { await testContext.addContextItem(this, 'testIdentifier', 'resetModuleAndCancel', baseContext); - const textResult = await moduleManagerPage.setActionInModule(page, Modules.psCashOnDelivery, 'reset', true); + const textResult = await boModuleManagerPage.setActionInModule(page, Modules.psCashOnDelivery, 'reset', true); expect(textResult).to.eq(''); - const isModuleVisible = await moduleManagerPage.isModuleVisible(page, Modules.psCashOnDelivery); + const isModuleVisible = await boModuleManagerPage.isModuleVisible(page, Modules.psCashOnDelivery); expect(isModuleVisible).to.eq(true); - const isModalVisible = await moduleManagerPage.isModalActionVisible(page, Modules.psCashOnDelivery, 'reset'); + const isModalVisible = await boModuleManagerPage.isModalActionVisible(page, Modules.psCashOnDelivery, 'reset'); expect(isModalVisible).to.eq(false); }); it('should reset the module', async function () { await testContext.addContextItem(this, 'testIdentifier', 'resetModule', baseContext); - const successMessage = await moduleManagerPage.setActionInModule(page, Modules.psCashOnDelivery, 'reset'); - expect(successMessage).to.eq(moduleManagerPage.resetModuleSuccessMessage(Modules.psCashOnDelivery.tag)); + const successMessage = await boModuleManagerPage.setActionInModule(page, Modules.psCashOnDelivery, 'reset'); + expect(successMessage).to.eq(boModuleManagerPage.resetModuleSuccessMessage(Modules.psCashOnDelivery.tag)); }); it('should go to Front Office', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToFo', baseContext); - page = await moduleManagerPage.viewMyShop(page); - await homePage.changeLanguage(page, 'en'); + page = await boModuleManagerPage.viewMyShop(page); + await foClassicHomePage.changeLanguage(page, 'en'); - const isHomePage = await homePage.isHomePage(page); + const isHomePage = await foClassicHomePage.isHomePage(page); expect(isHomePage).to.eq(true); }); it('should go to login page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToLoginPageFO', baseContext); - await homePage.goToLoginPage(page); + await foClassicHomePage.goToLoginPage(page); - const pageTitle = await foLoginPage.getPageTitle(page); - expect(pageTitle).to.contains(foLoginPage.pageTitle); + const pageTitle = await foClassicLoginPage.getPageTitle(page); + expect(pageTitle).to.contains(foClassicLoginPage.pageTitle); }); it('should sign in with default customer', async function () { await testContext.addContextItem(this, 'testIdentifier', 'sighInFO', baseContext); - await foLoginPage.customerLogin(page, dataCustomers.johnDoe); + await foClassicLoginPage.customerLogin(page, dataCustomers.johnDoe); - const isCustomerConnected = await foLoginPage.isCustomerConnected(page); + const isCustomerConnected = await foClassicLoginPage.isCustomerConnected(page); expect(isCustomerConnected).to.eq(true); }); it('should add the first product to the cart', async function () { await testContext.addContextItem(this, 'testIdentifier', 'addProductToCart', baseContext); - await foLoginPage.goToHomePage(page); + await foClassicLoginPage.goToHomePage(page); // Add first product to cart by quick view await homePage.quickViewProduct(page, 1); await quickViewModal.addToCartByQuickView(page); await blockCartModal.proceedToCheckout(page); - const pageTitle = await cartPage.getPageTitle(page); - expect(pageTitle).to.eq(cartPage.pageTitle); + const pageTitle = await foClassicCartPage.getPageTitle(page); + expect(pageTitle).to.eq(foClassicCartPage.pageTitle); }); it('should proceed to checkout and check Step Address', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkAddressStep', baseContext); - await cartPage.clickOnProceedToCheckout(page); + await foClassicCartPage.clickOnProceedToCheckout(page); - const isCheckoutPage = await checkoutPage.isCheckoutPage(page); + const isCheckoutPage = await foClassicCheckoutPage.isCheckoutPage(page); expect(isCheckoutPage).to.eq(true); - const isStepPersonalInformationComplete = await checkoutPage.isStepCompleted( + const isStepPersonalInformationComplete = await foClassicCheckoutPage.isStepCompleted( page, - checkoutPage.personalInformationStepForm, + foClassicCheckoutPage.personalInformationStepForm, ); expect(isStepPersonalInformationComplete).to.eq(true); }); @@ -149,14 +151,14 @@ describe('Cash on delivery (COD) module - Reset module', async () => { it('should validate Step Address and go to Delivery Step', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkDeliveryStep', baseContext); - const isStepAddressComplete = await checkoutPage.goToDeliveryStep(page); + const isStepAddressComplete = await foClassicCheckoutPage.goToDeliveryStep(page); expect(isStepAddressComplete).to.eq(true); }); it('should go to payment step', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToPaymentStep', baseContext); - const isStepDeliveryComplete = await checkoutPage.goToPaymentStep(page); + const isStepDeliveryComplete = await foClassicCheckoutPage.goToPaymentStep(page); expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); }); @@ -164,7 +166,7 @@ describe('Cash on delivery (COD) module - Reset module', async () => { await testContext.addContextItem(this, 'testIdentifier', 'checkPaymentModule', baseContext); // Payment step - Choose payment step - const isVisible = await checkoutPage.isPaymentMethodExist(page, Modules.psCashOnDelivery.tag); + const isVisible = await foClassicCheckoutPage.isPaymentMethodExist(page, Modules.psCashOnDelivery.tag); expect(isVisible).to.eq(true); }); }); diff --git a/tests/UI/campaigns/modules/ps_cashondelivery/02_configuration/01_placeOrderWithIt.ts b/tests/UI/campaigns/modules/ps_cashondelivery/02_configuration/01_placeOrderWithIt.ts index 7c6e3667be83f..409d2fb8d6c4e 100644 --- a/tests/UI/campaigns/modules/ps_cashondelivery/02_configuration/01_placeOrderWithIt.ts +++ b/tests/UI/campaigns/modules/ps_cashondelivery/02_configuration/01_placeOrderWithIt.ts @@ -6,25 +6,25 @@ import testContext from '@utils/testContext'; import loginCommon from '@commonTests/BO/loginBO'; // Import pages -// Import BO pages -import dashboardPage from '@pages/BO/dashboard'; -import ordersPage from '@pages/BO/orders'; // Import FO pages -import {cartPage} from '@pages/FO/classic/cart'; -import {checkoutPage} from '@pages/FO/classic/checkout'; -import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmation'; import {homePage} from '@pages/FO/classic/home'; -import {loginPage as foLoginPage} from '@pages/FO/classic/login'; import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; - import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + // Import BO pages + boDashboardPage, + boOrdersPage, + // Import FO pages + foClassicCartPage, + foClassicCheckoutPage, + foClassicCheckoutOrderConfirmationPage, + foClassicHomePage, + foClassicLoginPage, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -51,55 +51,55 @@ describe('Cash on delivery (COD) module - Place an order with it', async () => { it('should go to FO home page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToFO', baseContext); - await homePage.goToFo(page); + await foClassicHomePage.goToFo(page); - const isHomePage = await homePage.isHomePage(page); + const isHomePage = await foClassicHomePage.isHomePage(page); expect(isHomePage).to.eq(true); }); it('should go to login page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToLoginPageFO', baseContext); - await homePage.goToLoginPage(page); + await foClassicHomePage.goToLoginPage(page); - const pageTitle = await foLoginPage.getPageTitle(page); - expect(pageTitle).to.contains(foLoginPage.pageTitle); + const pageTitle = await foClassicLoginPage.getPageTitle(page); + expect(pageTitle).to.contains(foClassicLoginPage.pageTitle); }); it('should sign in with default customer', async function () { await testContext.addContextItem(this, 'testIdentifier', 'sighInFO', baseContext); - await foLoginPage.customerLogin(page, dataCustomers.johnDoe); + await foClassicLoginPage.customerLogin(page, dataCustomers.johnDoe); - const isCustomerConnected = await foLoginPage.isCustomerConnected(page); + const isCustomerConnected = await foClassicLoginPage.isCustomerConnected(page); expect(isCustomerConnected).to.eq(true); }); it('should add the first product to the cart', async function () { await testContext.addContextItem(this, 'testIdentifier', 'addProductToCart', baseContext); - await foLoginPage.goToHomePage(page); + await foClassicLoginPage.goToHomePage(page); // Add first product to cart by quick view await homePage.quickViewProduct(page, 1); await quickViewModal.addToCartByQuickView(page); await blockCartModal.proceedToCheckout(page); - const pageTitle = await cartPage.getPageTitle(page); - expect(pageTitle).to.eq(cartPage.pageTitle); + const pageTitle = await foClassicCartPage.getPageTitle(page); + expect(pageTitle).to.eq(foClassicCartPage.pageTitle); }); it('should proceed to checkout and check Step Address', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkAddressStep', baseContext); - await cartPage.clickOnProceedToCheckout(page); + await foClassicCartPage.clickOnProceedToCheckout(page); - const isCheckoutPage = await checkoutPage.isCheckoutPage(page); + const isCheckoutPage = await foClassicCheckoutPage.isCheckoutPage(page); expect(isCheckoutPage).to.eq(true); - const isStepPersonalInformationComplete = await checkoutPage.isStepCompleted( + const isStepPersonalInformationComplete = await foClassicCheckoutPage.isStepCompleted( page, - checkoutPage.personalInformationStepForm, + foClassicCheckoutPage.personalInformationStepForm, ); expect(isStepPersonalInformationComplete).to.eq(true); }); @@ -107,14 +107,14 @@ describe('Cash on delivery (COD) module - Place an order with it', async () => { it('should validate Step Address and go to Delivery Step', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkDeliveryStep', baseContext); - const isStepAddressComplete = await checkoutPage.goToDeliveryStep(page); + const isStepAddressComplete = await foClassicCheckoutPage.goToDeliveryStep(page); expect(isStepAddressComplete).to.eq(true); }); it('should go to payment step', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToPaymentStep', baseContext); - const isStepDeliveryComplete = await checkoutPage.goToPaymentStep(page); + const isStepDeliveryComplete = await foClassicCheckoutPage.goToPaymentStep(page); expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); }); @@ -122,13 +122,13 @@ describe('Cash on delivery (COD) module - Place an order with it', async () => { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.cashOnDelivery.moduleName); + await foClassicCheckoutPage.choosePaymentAndOrder(page, dataPaymentMethods.cashOnDelivery.moduleName); // Check the confirmation message - const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); - expect(cardTitle).to.contains(orderConfirmationPage.orderConfirmationCardTitle); + const cardTitle = await foClassicCheckoutOrderConfirmationPage.getOrderConfirmationCardTitle(page); + expect(cardTitle).to.contains(foClassicCheckoutOrderConfirmationPage.orderConfirmationCardTitle); - orderReference = await orderConfirmationPage.getOrderReferenceValue(page); + orderReference = await foClassicCheckoutOrderConfirmationPage.getOrderReferenceValue(page); expect(orderReference.length).to.be.gt(0); }); }); @@ -141,34 +141,34 @@ describe('Cash on delivery (COD) module - Place an order with it', async () => { it('should go to \'Orders > Orders\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToOrdersPage', baseContext); - await dashboardPage.goToSubMenu( + await boDashboardPage.goToSubMenu( page, - dashboardPage.ordersParentLink, - dashboardPage.ordersLink, + boDashboardPage.ordersParentLink, + boDashboardPage.ordersLink, ); - const pageTitle = await ordersPage.getPageTitle(page); - expect(pageTitle).to.contains(ordersPage.pageTitle); + const pageTitle = await boOrdersPage.getPageTitle(page); + expect(pageTitle).to.contains(boOrdersPage.pageTitle); }); it('should reset all filters and get number of orders', async function () { await testContext.addContextItem(this, 'testIdentifier', 'resetFiltersFirst', baseContext); - const numberOfOrders = await ordersPage.resetAndGetNumberOfLines(page); + const numberOfOrders = await boOrdersPage.resetAndGetNumberOfLines(page); expect(numberOfOrders).to.be.above(0); }); it('should check the last order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'checkLastOrder', baseContext); - const rowOrderReference = await ordersPage.getTextColumn(page, 'reference', 1); + const rowOrderReference = await boOrdersPage.getTextColumn(page, 'reference', 1); expect(rowOrderReference).to.be.equal(orderReference); - const rowOrderPayment = await ordersPage.getTextColumn(page, 'payment', 1); - expect(rowOrderPayment).to.be.equal(PaymentMethods.cashOnDelivery.displayName); + const rowOrderPayment = await boOrdersPage.getTextColumn(page, 'payment', 1); + expect(rowOrderPayment).to.be.equal(dataPaymentMethods.cashOnDelivery.displayName); - const rowOrderStatus = await ordersPage.getTextColumn(page, 'osname', 1); - expect(rowOrderStatus).to.be.equal(OrderStatuses.awaitingCashOnDelivery.name); + const rowOrderStatus = await boOrdersPage.getTextColumn(page, 'osname', 1); + expect(rowOrderStatus).to.be.equal(dataOrderStatuses.awaitingCashOnDelivery.name); }); }); }); diff --git a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/01_enableDisableProductAvailability.ts b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/01_enableDisableProductAvailability.ts index fe1ccb13ce54f..0cdc951d18ad9 100644 --- a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/01_enableDisableProductAvailability.ts +++ b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/01_enableDisableProductAvailability.ts @@ -35,12 +35,12 @@ import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmatio import Modules from '@data/demo/modules'; import ProductData from '@data/faker/product'; import MailDevEmail from '@data/types/maildevEmail'; -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -408,7 +408,7 @@ describe('Mail alerts module - Customer notifications - Enable/Disable product a await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); // Check the confirmation message const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); @@ -450,10 +450,10 @@ describe('Mail alerts module - Customer notifications - Enable/Disable product a expect(pageTitle).to.contains(ordersPage.pageTitle); }); - it(`should change the order status to '${OrderStatuses.delivered.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.delivered.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await ordersPage.setOrderStatus(page, 1, OrderStatuses.delivered); + const result = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.delivered); expect(result).to.equal(ordersPage.successfulUpdateMessage); }); diff --git a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/02_enableDisableOrderEdit.ts b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/02_enableDisableOrderEdit.ts index f3193dd9d9bd3..5a562dd316d70 100644 --- a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/02_enableDisableOrderEdit.ts +++ b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/01_customerNotifications/02_enableDisableOrderEdit.ts @@ -17,7 +17,6 @@ import {moduleManager} from '@pages/BO/modules/moduleManager'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import Modules from '@data/demo/modules'; @@ -25,6 +24,7 @@ import Modules from '@data/demo/modules'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -62,7 +62,7 @@ describe('Mail alerts module - Enable/Disable return', async () => { quantity: 3, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create first order diff --git a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/01_enableDisableNewOrder.ts b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/01_enableDisableNewOrder.ts index 527ef02002b56..6d4c5eb27e5ff 100644 --- a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/01_enableDisableNewOrder.ts +++ b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/01_enableDisableNewOrder.ts @@ -23,7 +23,6 @@ import {orderConfirmationPage} from '@pages/FO/classic/checkout/orderConfirmatio import {moduleManager} from '@pages/BO/modules/moduleManager'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import Modules from '@data/demo/modules'; @@ -31,6 +30,7 @@ import Modules from '@data/demo/modules'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -71,7 +71,7 @@ describe('Mail alerts module - Enable/Disable new order', async () => { quantity: 3, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-Condition : Setup config SMTP diff --git a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/04_enableDisableReturn.ts b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/04_enableDisableReturn.ts index a40fe3b312970..93d63b02f9fb3 100644 --- a/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/04_enableDisableReturn.ts +++ b/tests/UI/campaigns/modules/ps_emailalerts/02_configuration/02_merchantNotifications/04_enableDisableReturn.ts @@ -25,8 +25,6 @@ import {orderHistoryPage} from '@pages/FO/classic/myAccount/orderHistory'; import {moduleManager} from '@pages/BO/modules/moduleManager'; // Import data -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import OrderData from '@data/faker/order'; import Modules from '@data/demo/modules'; @@ -34,6 +32,8 @@ import Modules from '@data/demo/modules'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -75,7 +75,7 @@ describe('Mail alerts module - Enable/Disable return', async () => { quantity: 3, }, ], - paymentMethod: PaymentMethods.wirePayment, + paymentMethod: dataPaymentMethods.wirePayment, }); // Pre-condition: Create first order @@ -155,7 +155,7 @@ describe('Mail alerts module - Enable/Disable return', async () => { }); }); - describe(`BO: Change the first created orders status to '${OrderStatuses.delivered.name}'`, async () => { + describe(`BO: Change the first created orders status to '${dataOrderStatuses.delivered.name}'`, async () => { it('should go to \'Orders > Orders\' page', async function () { await testContext.addContextItem(this, 'testIdentifier', 'goToOrdersPage', baseContext); @@ -183,15 +183,15 @@ describe('Mail alerts module - Enable/Disable return', async () => { expect(orderReference).to.not.eq(null); }); - it(`should change the order status to '${OrderStatuses.delivered.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.delivered.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus', baseContext); - const result = await ordersPage.setOrderStatus(page, 1, OrderStatuses.delivered); + const result = await ordersPage.setOrderStatus(page, 1, dataOrderStatuses.delivered); expect(result).to.equal(ordersPage.successfulUpdateMessage); }); }); - describe(`BO: Change the second created orders status to '${OrderStatuses.delivered.name}'`, async () => { + describe(`BO: Change the second created orders status to '${dataOrderStatuses.delivered.name}'`, async () => { it('should get the second order ID', async function () { await testContext.addContextItem(this, 'testIdentifier', 'getOrderID2', baseContext); @@ -206,10 +206,10 @@ describe('Mail alerts module - Enable/Disable return', async () => { expect(orderReference).to.not.eq(null); }); - it(`should change the order status to '${OrderStatuses.delivered.name}' and check it`, async function () { + it(`should change the order status to '${dataOrderStatuses.delivered.name}' and check it`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'updateOrderStatus2', baseContext); - const result = await ordersPage.setOrderStatus(page, 2, OrderStatuses.delivered); + const result = await ordersPage.setOrderStatus(page, 2, dataOrderStatuses.delivered); expect(result).to.equal(ordersPage.successfulUpdateMessage); }); }); diff --git a/tests/UI/campaigns/regression/checkout/100PercentDiscount_FO.ts b/tests/UI/campaigns/regression/checkout/100PercentDiscount_FO.ts index ad28f925e719c..31e9b49a5a418 100644 --- a/tests/UI/campaigns/regression/checkout/100PercentDiscount_FO.ts +++ b/tests/UI/campaigns/regression/checkout/100PercentDiscount_FO.ts @@ -20,8 +20,12 @@ import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; // Import data import CartRuleData from '@data/faker/cartRule'; -import CustomerData from '@data/faker/customer'; -import AddressData from '@data/faker/address'; + +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -50,8 +54,8 @@ describe('Regression - Checkout: Create 100% discount with free shipping discoun discountPercent: 100, freeShipping: true, }); - const customerData: CustomerData = new CustomerData({password: ''}); - const addressData: AddressData = new AddressData({country: 'France'}); + const customerData: FakerCustomer = new FakerCustomer({password: ''}); + const addressData: FakerAddress = new FakerAddress({country: 'France'}); // before and after functions before(async function () { diff --git a/tests/UI/campaigns/regression/currencies/computingPrecision_FO.ts b/tests/UI/campaigns/regression/currencies/computingPrecision_FO.ts index ab777eb245e0f..8820461f45b77 100644 --- a/tests/UI/campaigns/regression/currencies/computingPrecision_FO.ts +++ b/tests/UI/campaigns/regression/currencies/computingPrecision_FO.ts @@ -27,15 +27,15 @@ import {productPage} from '@pages/FO/classic/product'; import {searchResultsPage} from '@pages/FO/classic/searchResults'; // Import data -import Currencies from '@data/demo/currencies'; -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import CartRuleData from '@data/faker/cartRule'; import OrderData from '@data/faker/order'; import { // Import data + dataCurrencies, dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -187,11 +187,11 @@ describe( expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code '${Currencies.euro.isoCode}'`, async function () { + it(`should filter by iso code '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterCurrenciesToChangePrecision', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.euro.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.euro.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); @@ -304,7 +304,7 @@ describe( expect(isStepDeliveryComplete, 'Step Address is not complete').to.eq(true); // Payment step - Choose payment step - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const cardTitle = await orderConfirmationPage.getOrderConfirmationCardTitle(page); // Check the confirmation message @@ -450,11 +450,11 @@ describe( expect(pageTitle).to.contains(currenciesPage.pageTitle); }); - it(`should filter by iso code '${Currencies.euro.isoCode}'`, async function () { + it(`should filter by iso code '${dataCurrencies.euro.isoCode}'`, async function () { await testContext.addContextItem(this, 'testIdentifier', 'filterCurrenciesToReset', baseContext); // Filter - await currenciesPage.filterTable(page, 'input', 'iso_code', Currencies.euro.isoCode); + await currenciesPage.filterTable(page, 'input', 'iso_code', dataCurrencies.euro.isoCode); // Check number of currencies const numberOfCurrenciesAfterFilter = await currenciesPage.getNumberOfElementInGrid(page); diff --git a/tests/UI/campaigns/sanity/02_ordersBO/02_editOrder.ts b/tests/UI/campaigns/sanity/02_ordersBO/02_editOrder.ts index 343ab6a62c67d..c2368b711ceaf 100644 --- a/tests/UI/campaigns/sanity/02_ordersBO/02_editOrder.ts +++ b/tests/UI/campaigns/sanity/02_ordersBO/02_editOrder.ts @@ -10,8 +10,10 @@ import dashboardPage from '@pages/BO/dashboard'; import ordersPage from '@pages/BO/orders'; import orderPageProductsBlock from '@pages/BO/orders/view/productsBlock'; -// Import data -import OrderStatuses from '@data/demo/orderStatuses'; +import { + // Import data + dataOrderStatuses, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -75,8 +77,8 @@ describe('BO - Orders - Orders : Edit Order BO', async () => { it('should modify the order status and check the validation', async function () { await testContext.addContextItem(this, 'testIdentifier', 'editOrderStatus', baseContext); - const orderStatus = await orderPageProductsBlock.modifyOrderStatus(page, OrderStatuses.paymentAccepted.name); - expect(orderStatus).to.equal(OrderStatuses.paymentAccepted.name); + const orderStatus = await orderPageProductsBlock.modifyOrderStatus(page, dataOrderStatuses.paymentAccepted.name); + expect(orderStatus).to.equal(dataOrderStatuses.paymentAccepted.name); }); // Logout from BO diff --git a/tests/UI/campaigns/sanity/06_checkoutFO/01_orderProduct.ts b/tests/UI/campaigns/sanity/06_checkoutFO/01_orderProduct.ts index 7e6c921c43380..114e00425268a 100644 --- a/tests/UI/campaigns/sanity/06_checkoutFO/01_orderProduct.ts +++ b/tests/UI/campaigns/sanity/06_checkoutFO/01_orderProduct.ts @@ -12,12 +12,12 @@ import {quickViewModal} from '@pages/FO/classic/modal/quickView'; import {blockCartModal} from '@pages/FO/classic/modal/blockCart'; // Import data -import PaymentMethods from '@data/demo/paymentMethods'; import Products from '@data/demo/products'; import { // Import data dataCustomers, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; import {expect} from 'chai'; @@ -145,7 +145,7 @@ describe('BO - Checkout : Order a product and check order confirmation', async ( it('should Pay by back wire and confirm order', async function () { await testContext.addContextItem(this, 'testIdentifier', 'confirmOrder', baseContext); - await checkoutPage.choosePaymentAndOrder(page, PaymentMethods.wirePayment.moduleName); + await checkoutPage.choosePaymentAndOrder(page, dataPaymentMethods.wirePayment.moduleName); const pageTitle = await orderConfirmationPage.getPageTitle(page); expect(pageTitle).to.equal(orderConfirmationPage.pageTitle); diff --git a/tests/UI/commonTests/BO/customers/address.ts b/tests/UI/commonTests/BO/customers/address.ts index 311d92ba52969..509fd7f40f2b4 100644 --- a/tests/UI/commonTests/BO/customers/address.ts +++ b/tests/UI/commonTests/BO/customers/address.ts @@ -10,8 +10,10 @@ import addressesPage from '@pages/BO/customers/addresses'; import addAddressPage from '@pages/BO/customers/addresses/add'; import dashboardPage from '@pages/BO/dashboard'; -// Import data -import AddressData from '@data/faker/address'; +import { + // Import data + FakerAddress, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -25,7 +27,7 @@ let numberOfAddresses: number = 0; * @param addressData {AddressData} Data to set to create customer * @param baseContext {string} String to identify the test */ -function createAddressTest(addressData: AddressData, baseContext: string = 'commonTests-createAddressTest'): void { +function createAddressTest(addressData: FakerAddress, baseContext: string = 'commonTests-createAddressTest'): void { describe('PRE-TEST: Create address', async () => { // before and after functions before(async function () { diff --git a/tests/UI/commonTests/BO/customers/customer.ts b/tests/UI/commonTests/BO/customers/customer.ts index bd2b5883d33fe..be98692da63ec 100644 --- a/tests/UI/commonTests/BO/customers/customer.ts +++ b/tests/UI/commonTests/BO/customers/customer.ts @@ -10,8 +10,10 @@ import customersPage from '@pages/BO/customers'; import addCustomerPage from '@pages/BO/customers/add'; import dashboardPage from '@pages/BO/dashboard'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -22,10 +24,10 @@ let numberOfCustomers: number; /** * Function to create customer - * @param customerData {CustomerData} Data to set to create customer + * @param customerData {FakerCustomer} Data to set to create customer * @param baseContext {string} String to identify the test */ -function createCustomerTest(customerData: CustomerData, baseContext: string = 'commonTests-createCustomerTest'): void { +function createCustomerTest(customerData: FakerCustomer, baseContext: string = 'commonTests-createCustomerTest'): void { describe('PRE-TEST: Create customer', async () => { // before and after functions before(async function () { @@ -72,10 +74,10 @@ function createCustomerTest(customerData: CustomerData, baseContext: string = 'c /** * Function to create B2B customer - * @param customerData {CustomerData} Data to set to create customer + * @param customerData {FakerCustomer} Data to set to create customer * @param baseContext {string} String to identify the test */ -function createCustomerB2BTest(customerData: CustomerData, baseContext: string = 'commonTests-createCustomerB2BTest'): void { +function createCustomerB2BTest(customerData: FakerCustomer, baseContext: string = 'commonTests-createCustomerB2BTest'): void { describe('PRE-TEST: Create B2B customer', async () => { // before and after functions before(async function () { @@ -122,10 +124,10 @@ function createCustomerB2BTest(customerData: CustomerData, baseContext: string = /** * Function to delete customer - * @param customerData {CustomerData} Data to set to delete customer + * @param customerData {FakerCustomer} Data to set to delete customer * @param baseContext {string} String to identify the test */ -function deleteCustomerTest(customerData: CustomerData, baseContext: string = 'commonTests-deleteCustomerTest'): void { +function deleteCustomerTest(customerData: FakerCustomer, baseContext: string = 'commonTests-deleteCustomerTest'): void { describe('POST-TEST: Delete customer', async () => { // before and after functions before(async function () { diff --git a/tests/UI/commonTests/BO/international/currency.ts b/tests/UI/commonTests/BO/international/currency.ts index 294d2d6a767ec..6e7ef39d2b85d 100644 --- a/tests/UI/commonTests/BO/international/currency.ts +++ b/tests/UI/commonTests/BO/international/currency.ts @@ -11,8 +11,9 @@ import currenciesPage from '@pages/BO/international/currencies'; import addCurrencyPage from '@pages/BO/international/currencies/add'; import localizationPage from '@pages/BO/international/localization'; -// Import data -import type CurrencyData from '@data/faker/currency'; +import { + type FakerCurrency, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -22,10 +23,10 @@ let page: Page; /** * Function to create currency - * @param currencyData {CurrencyData} Data to set to create currency + * @param currencyData {FakerCurrency} Data to set to create currency * @param baseContext {string} String to identify the test */ -function createCurrencyTest(currencyData: CurrencyData, baseContext: string = 'commonTests-createCurrencyTest'): void { +function createCurrencyTest(currencyData: FakerCurrency, baseContext: string = 'commonTests-createCurrencyTest'): void { describe('PRE-TEST: Create currency', async () => { // before and after functions before(async function () { @@ -86,10 +87,10 @@ function createCurrencyTest(currencyData: CurrencyData, baseContext: string = 'c /** * Function to delete currency - * @param currencyData {CurrencyData} Data to set to delete currency + * @param currencyData {FakerCurrency} Data to set to delete currency * @param baseContext {string} String to identify the test */ -function deleteCurrencyTest(currencyData: CurrencyData, baseContext: string = 'commonTests-deleteCurrencyTest'): void { +function deleteCurrencyTest(currencyData: FakerCurrency, baseContext: string = 'commonTests-deleteCurrencyTest'): void { describe('POST-TEST: Delete currency', async () => { // before and after functions before(async function () { diff --git a/tests/UI/commonTests/BO/modules/moduleManager.ts b/tests/UI/commonTests/BO/modules/moduleManager.ts index 4de8061d03ac3..18e81af786582 100644 --- a/tests/UI/commonTests/BO/modules/moduleManager.ts +++ b/tests/UI/commonTests/BO/modules/moduleManager.ts @@ -8,12 +8,16 @@ import dashboardPage from '@pages/BO/dashboard'; import {moduleManager as moduleManagerPage} from '@pages/BO/modules/moduleManager'; import Modules from '@data/demo/modules'; -import ModuleData from '@data/faker/module'; + +import { + // Import data + type FakerModule, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; -function installModule(module: ModuleData, baseContext: string = 'commonTests-installModule'): void { +function installModule(module: FakerModule, baseContext: string = 'commonTests-installModule'): void { describe(`Install module ${module.name}`, async () => { let browserContext: BrowserContext; let page: Page; @@ -79,7 +83,7 @@ function installModule(module: ModuleData, baseContext: string = 'commonTests-in }); } -function uninstallModule(module: ModuleData, baseContext: string = 'commonTests-uninstallHummingbird'): void { +function uninstallModule(module: FakerModule, baseContext: string = 'commonTests-uninstallHummingbird'): void { describe(`Uninstall module ${module.name}`, async () => { let browserContext: BrowserContext; let page: Page; diff --git a/tests/UI/commonTests/FO/classic/account.ts b/tests/UI/commonTests/FO/classic/account.ts index a017d17b945f9..e790862a0d9cc 100644 --- a/tests/UI/commonTests/FO/classic/account.ts +++ b/tests/UI/commonTests/FO/classic/account.ts @@ -10,20 +10,24 @@ import {myAccountPage} from '@pages/FO/classic/myAccount'; import {addressesPage} from '@pages/FO/classic/myAccount/addresses'; import {addAddressPage} from '@pages/FO/classic/myAccount/addAddress'; +import { + // Import data + FakerAddress, + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; -import type AddressData from '@data/faker/address'; -import type CustomerData from '@data/faker/customer'; let browserContext: BrowserContext; let page: Page; /** * Function to create account in FO - * @param customerData {CustomerData} Data to set when creating the account + * @param customerData {FakerCustomer} Data to set when creating the account * @param baseContext {string} String to identify the test */ -function createAccountTest(customerData: CustomerData, baseContext: string = 'commonTests-createAccountTest'): void { +function createAccountTest(customerData: FakerCustomer, baseContext: string = 'commonTests-createAccountTest'): void { describe('PRE-TEST: Create account on FO', async () => { // before and after functions before(async function () { @@ -79,8 +83,8 @@ function createAccountTest(customerData: CustomerData, baseContext: string = 'co } function createAddressTest( - customerLoginData: CustomerData, - addressData: AddressData, + customerLoginData: FakerCustomer, + addressData: FakerAddress, baseContext: string = 'commonTests-createAddressTest', ): void { describe('PRE-TEST: Create address on FO', async () => { diff --git a/tests/UI/commonTests/FO/classic/loginFO.ts b/tests/UI/commonTests/FO/classic/loginFO.ts index 36146e77344b3..0799ccb71ce8d 100644 --- a/tests/UI/commonTests/FO/classic/loginFO.ts +++ b/tests/UI/commonTests/FO/classic/loginFO.ts @@ -5,15 +5,17 @@ import testContext from '@utils/testContext'; import {loginPage} from '@pages/FO/classic/login'; import {myAccountPage} from '@pages/FO/classic/myAccount'; -// Import data -import type CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {Context} from 'mocha'; import type {Page} from 'playwright'; export default { - async loginFO(mochaContext: Context, page: Page, customer: CustomerData): Promise { + async loginFO(mochaContext: Context, page: Page, customer: FakerCustomer): Promise { await testContext.addContextItem(mochaContext, 'testIdentifier', 'loginFO'); await loginPage.goTo(page, global.FO.URL); diff --git a/tests/UI/commonTests/FO/hummingbird/account.ts b/tests/UI/commonTests/FO/hummingbird/account.ts index b16aab32e14b1..a085b53fdb8f9 100644 --- a/tests/UI/commonTests/FO/hummingbird/account.ts +++ b/tests/UI/commonTests/FO/hummingbird/account.ts @@ -7,8 +7,10 @@ import homePage from '@pages/FO/hummingbird/home'; import foLoginPage from '@pages/FO/hummingbird/login'; import foCreateAccountPage from '@pages/FO/hummingbird/myAccount/add'; -// Import data -import type CustomerData from '@data/faker/customer'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; import {expect} from 'chai'; import type {BrowserContext, Page} from 'playwright'; @@ -18,10 +20,10 @@ let page: Page; /** * Function to create account in FO - * @param customerData {CustomerData} Data to set when creating the account + * @param customerData {FakerCustomer} Data to set when creating the account * @param baseContext {string} String to identify the test */ -function createAccountTest(customerData: CustomerData, baseContext: string = 'commonTests-createAccountTest'): void { +function createAccountTest(customerData: FakerCustomer, baseContext: string = 'commonTests-createAccountTest'): void { describe('PRE-TEST: Create account on FO', async () => { // before and after functions before(async function () { diff --git a/tests/UI/data/demo/address.ts b/tests/UI/data/demo/address.ts index fc11174ac6e84..6b92877b1dc59 100644 --- a/tests/UI/data/demo/address.ts +++ b/tests/UI/data/demo/address.ts @@ -1,7 +1,10 @@ -import AddressData from '@data/faker/address'; +import { + // Import data + FakerAddress, +} from '@prestashop-core/ui-testing'; export default { - first: new AddressData({ + first: new FakerAddress({ id: 1, firstName: 'Anonymous', lastName: 'Anonymous', @@ -10,7 +13,7 @@ export default { city: 'Anonymous', country: 'France', }), - second: new AddressData({ + second: new FakerAddress({ id: 2, name: 'Mon adresse', firstName: 'John', @@ -23,7 +26,7 @@ export default { country: 'France', phone: '0102030405', }), - third: new AddressData({ + third: new FakerAddress({ id: 5, dni: '', alias: 'My address', diff --git a/tests/UI/data/demo/carriers.ts b/tests/UI/data/demo/carriers.ts index fff05e021ddb5..48804be794cd0 100644 --- a/tests/UI/data/demo/carriers.ts +++ b/tests/UI/data/demo/carriers.ts @@ -1,7 +1,10 @@ -import CarrierData from '@data/faker/carrier'; +import { + // Import data + FakerCarrier, +} from '@prestashop-core/ui-testing'; export default { - default: new CarrierData({ + default: new FakerCarrier({ id: 1, name: 'Click and collect', delay: 'Pick up in-store', @@ -9,7 +12,7 @@ export default { freeShipping: true, position: 1, }), - myCarrier: new CarrierData({ + myCarrier: new FakerCarrier({ id: 2, name: 'My carrier', delay: 'Delivery next day!', @@ -19,7 +22,7 @@ export default { freeShipping: false, position: 2, }), - cheapCarrier: new CarrierData({ + cheapCarrier: new FakerCarrier({ id: 3, name: 'My cheap carrier', delay: 'Buy more to pay less!', @@ -27,7 +30,7 @@ export default { freeShipping: false, position: 3, }), - lightCarrier: new CarrierData({ + lightCarrier: new FakerCarrier({ id: 4, name: 'My light carrier', delay: 'The lighter the cheaper!', diff --git a/tests/UI/data/demo/countries.ts b/tests/UI/data/demo/countries.ts deleted file mode 100644 index 61d722dce9f44..0000000000000 --- a/tests/UI/data/demo/countries.ts +++ /dev/null @@ -1,60 +0,0 @@ -import CountryData from '@data/faker/country'; - -export default { - france: new CountryData({ - id: 8, - name: 'France', - isoCode: 'FR', - callPrefix: '33', - zone: 'Europe', - active: true, - }), - netherlands: new CountryData({ - id: 13, - name: 'Netherlands', - isoCode: 'NL', - callPrefix: '31', - zone: 'Europe', - active: false, - }), - unitedKingdom: new CountryData({ - id: 17, - name: 'United Kingdom', - isoCode: 'GB', - callPrefix: '44', - zone: 'Europe', - active: false, - }), - germany: new CountryData({ - id: 1, - name: 'Germany', - isoCode: 'DE', - callPrefix: '49', - zone: 'Europe', - active: false, - }), - afghanistan: new CountryData({ - id: 231, - name: 'Afghanistan', - isoCode: 'AF', - callPrefix: '93', - zone: 'Asia', - active: false, - }), - unitedStates: new CountryData({ - id: 21, - name: 'United States', - isoCode: 'US', - callPrefix: '1', - zone: 'North America', - active: false, - }), - canada: new CountryData({ - id: 4, - name: 'Canada', - isoCode: 'CA', - callPrefix: '1', - zone: 'North America', - active: false, - }), -}; diff --git a/tests/UI/data/demo/currencies.ts b/tests/UI/data/demo/currencies.ts deleted file mode 100644 index a4881ea5365b1..0000000000000 --- a/tests/UI/data/demo/currencies.ts +++ /dev/null @@ -1,139 +0,0 @@ -import CurrencyData from '@data/faker/currency'; - -export default { - euro: new CurrencyData({ - name: 'Euro', - frName: 'euro', - symbol: '€', - isoCode: 'EUR', - exchangeRate: 1, - decimals: 2, - enabled: true, - }), - mad: new CurrencyData({ - name: 'Moroccan Dirham', - frName: 'dirham marocain', - symbol: 'MAD', - isoCode: 'MAD', - exchangeRate: 10.560000, - decimals: 2, - enabled: true, - }), - toman: new CurrencyData({ - name: 'Iranian toman', - frName: 'Toman iranien', - symbol: 'TMN', - isoCode: 'TMN', - exchangeRate: 4666.539, - decimals: 2, - enabled: true, - }), - chileanPeso: new CurrencyData({ - name: 'Chilean Peso', - frName: 'peso chilien', - symbol: '$', - isoCode: 'CLP', - exchangeRate: 862.172868, - decimals: 0, - enabled: true, - }), - dzd: new CurrencyData({ - name: 'Algerian Dinar', - frName: 'dinar algérien', - symbol: 'DZD', - isoCode: 'DZD', - exchangeRate: 162.6, - decimals: 2, - enabled: true, - }), - tnd: new CurrencyData({ - name: 'Tunisian Dinar', - frName: 'dinar tunisien', - symbol: 'TND', - isoCode: 'TND', - exchangeRate: 3.29, - decimals: 3, - enabled: true, - }), - try: new CurrencyData({ - name: 'Turkish Lira', - frName: 'livre turque', - symbol: '₺', - isoCode: 'TRY', - exchangeRate: 9.08, - decimals: 2, - enabled: true, - }), - usd: new CurrencyData({ - name: 'US Dollar', - frName: 'dollar des États-Unis', - symbol: '$', - isoCode: 'USD', - exchangeRate: 1.22, - decimals: 2, - enabled: true, - }), - aed: new CurrencyData({ - name: 'United Arab Emirates Dirham', - frName: 'dirham des Émirats arabes unis', - symbol: 'AED', - isoCode: 'AED', - exchangeRate: 4.51, - decimals: 2, - enabled: true, - }), - lyd: new CurrencyData({ - name: 'Libyan Dinar', - frName: 'dinar libyen', - symbol: 'LYD', - isoCode: 'LYD', - exchangeRate: 5.45, - decimals: 3, - enabled: true, - }), - lsl: new CurrencyData({ - name: 'Lesotho Loti', - frName: 'loti lesothan', - symbol: 'LSL', - isoCode: 'LSL', - exchangeRate: 18.06, - decimals: 2, - enabled: true, - }), - all: new CurrencyData({ - name: 'Albanian Lek', - frName: 'lek albanais', - symbol: 'ALL', - isoCode: 'ALL', - exchangeRate: 123.38, - decimals: 0, - enabled: true, - }), - gbp: new CurrencyData({ - name: 'British Pound', - frName: 'livre sterling', - symbol: 'GBP', - isoCode: 'GBP', - exchangeRate: 0.87, - decimals: 2, - enabled: true, - }), - jpy: new CurrencyData({ - name: 'Japanese Yen', - frName: 'yen japonais', - symbol: 'JPY', - isoCode: 'JPY', - exchangeRate: 140.59, - decimals: 0, - enabled: true, - }), - pyg: new CurrencyData({ - name: 'Paraguayan Guarani', - frName: 'guaraní paraguayen', - symbol: 'PYG', - isoCode: 'PYG', - exchangeRate: 7942.22, - decimals: 0, - enabled: true, - }), -}; diff --git a/tests/UI/data/demo/modules.ts b/tests/UI/data/demo/modules.ts index 5b4e122125be6..d4f8956fcd39d 100644 --- a/tests/UI/data/demo/modules.ts +++ b/tests/UI/data/demo/modules.ts @@ -1,66 +1,69 @@ -import ModuleData from '@data/faker/module'; +import { + // Import data + FakerModule, +} from '@prestashop-core/ui-testing'; export default { - blockwishlist: new ModuleData({ + blockwishlist: new FakerModule({ tag: 'blockwishlist', name: 'Wishlist', }), - psApiResources: new ModuleData({ + psApiResources: new FakerModule({ tag: 'ps_apiresources', name: 'PrestaShop API Resources', }), - psCashOnDelivery: new ModuleData({ + psCashOnDelivery: new FakerModule({ tag: 'ps_cashondelivery', name: 'Cash on delivery (COD)', }), - psCategoryProducts: new ModuleData({ + psCategoryProducts: new FakerModule({ tag: 'ps_categoryproducts', name: 'Products in the same category', }), - psCheckPayment: new ModuleData({ + psCheckPayment: new FakerModule({ tag: 'ps_checkpayment', name: 'Payments by check', }), - psEmailAlerts: new ModuleData({ + psEmailAlerts: new FakerModule({ tag: 'ps_emailalerts', name: 'Mail alerts', releaseZip: 'https://github.com/PrestaShop/ps_emailalerts/releases/download/v3.0.0/ps_emailalerts.zip', }), - psEmailSubscription: new ModuleData({ + psEmailSubscription: new FakerModule({ tag: 'ps_emailsubscription', name: 'Newsletter subscription', }), - psFacetedSearch: new ModuleData({ + psFacetedSearch: new FakerModule({ tag: 'ps_facetedsearch', name: 'Faceted search', releaseZip: 'https://github.com/PrestaShop/ps_facetedsearch/releases/download/v3.14.1/ps_facetedsearch.zip', }), - psNewProducts: new ModuleData({ + psNewProducts: new FakerModule({ tag: 'ps_newproducts', name: 'New products', }), - psThemeCusto: new ModuleData({ + psThemeCusto: new FakerModule({ tag: 'ps_themecusto', name: 'Theme Customization', releaseZip: 'https://github.com/PrestaShop/ps_themecusto/releases/download/v1.2.3/ps_themecusto.zip', }), - contactForm: new ModuleData({ + contactForm: new FakerModule({ tag: 'contactform', name: 'Contact form', }), - themeCustomization: new ModuleData({ + themeCustomization: new FakerModule({ tag: 'ps_themecusto', name: 'Theme Customization', }), - availableQuantities: new ModuleData({ + availableQuantities: new FakerModule({ tag: 'statsstock', name: 'Available quantities', }), - mainMenu: new ModuleData({ + mainMenu: new FakerModule({ tag: 'ps_mainmenu', name: 'Main menu', }), - keycloak: new ModuleData({ + keycloak: new FakerModule({ tag: 'keycloak_connector_demo', name: 'Keycloak OAuth2 connector demo', releaseZip: 'https://github.com/PrestaShop/keycloak_connector_demo/releases/download/v1.0.4/keycloak_connector_demo.zip', diff --git a/tests/UI/data/demo/orderStatuses.ts b/tests/UI/data/demo/orderStatuses.ts deleted file mode 100644 index 1c4dbcbcca082..0000000000000 --- a/tests/UI/data/demo/orderStatuses.ts +++ /dev/null @@ -1,100 +0,0 @@ -import OrderStatusData from '@data/faker/orderStatus'; - -export default { - awaitingCheckPayment: new OrderStatusData({ - id: 1, - name: 'Awaiting check payment', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: false, - emailTemplate: 'cheque', - }), - paymentAccepted: new OrderStatusData({ - id: 2, - name: 'Payment accepted', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: true, - emailTemplate: 'payment', - }), - processingInProgress: new OrderStatusData({ - id: 3, - name: 'Processing in progress', - sendEmailOn: true, - deliveryOn: true, - invoiceOn: true, - emailTemplate: 'preparation', - }), - shipped: new OrderStatusData({ - id: 4, - name: 'Shipped', - sendEmailOn: true, - deliveryOn: true, - invoiceOn: true, - emailTemplate: 'shipped', - }), - delivered: new OrderStatusData({ - id: 5, - name: 'Delivered', - sendEmailOn: false, - deliveryOn: true, - invoiceOn: true, - emailTemplate: '', - }), - canceled: new OrderStatusData({ - id: 6, - name: 'Canceled', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: false, - emailTemplate: 'order_canceled', - }), - refunded: new OrderStatusData({ - id: 7, - name: 'Refunded', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: true, - emailTemplate: 'refund', - }), - paymentError: new OrderStatusData({ - id: 8, - name: 'Payment error', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: false, - emailTemplate: 'payment_error', - }), - awaitingBankWire: new OrderStatusData({ - id: 10, - name: 'Awaiting bank wire payment', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: false, - emailTemplate: 'bankwire', - }), - awaitingCashOnDelivery: new OrderStatusData({ - id: 13, - name: 'Awaiting Cash On Delivery validation', - sendEmailOn: false, - deliveryOn: false, - invoiceOn: false, - emailTemplate: 'cashondelivery', - }), - onBackorderNotPaid: new OrderStatusData({ - id: 12, - name: 'On backorder (not paid)', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: false, - emailTemplate: 'outofstock', - }), - onBackorderPaid: new OrderStatusData({ - id: 9, - name: 'On backorder (paid)', - sendEmailOn: true, - deliveryOn: false, - invoiceOn: true, - emailTemplate: 'outofstock', - }), -}; diff --git a/tests/UI/data/demo/orders.ts b/tests/UI/data/demo/orders.ts index b66f1683be72f..2677b4709919e 100644 --- a/tests/UI/data/demo/orders.ts +++ b/tests/UI/data/demo/orders.ts @@ -1,10 +1,10 @@ -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; import OrderData from '@data/faker/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, } from '@prestashop-core/ui-testing'; export default { @@ -15,8 +15,8 @@ export default { delivery: 'United States', customer: dataCustomers.johnDoe, totalPaid: 61.80, - paymentMethod: PaymentMethods.checkPayment, - status: OrderStatuses.canceled, + paymentMethod: dataPaymentMethods.checkPayment, + status: dataOrderStatuses.canceled, }), secondOrder: new OrderData({ id: 2, @@ -25,8 +25,8 @@ export default { delivery: 'United States', customer: dataCustomers.johnDoe, totalPaid: 69.90, - paymentMethod: PaymentMethods.checkPayment, - status: OrderStatuses.awaitingCheckPayment, + paymentMethod: dataPaymentMethods.checkPayment, + status: dataOrderStatuses.awaitingCheckPayment, }), thirdOrder: new OrderData({ id: 3, @@ -35,8 +35,8 @@ export default { delivery: 'United States', customer: dataCustomers.johnDoe, totalPaid: 14.90, - paymentMethod: PaymentMethods.checkPayment, - status: OrderStatuses.paymentError, + paymentMethod: dataPaymentMethods.checkPayment, + status: dataOrderStatuses.paymentError, }), fourthOrder: new OrderData({ id: 4, @@ -45,8 +45,8 @@ export default { delivery: 'United States', customer: dataCustomers.johnDoe, totalPaid: 14.90, - paymentMethod: PaymentMethods.checkPayment, - status: OrderStatuses.awaitingCheckPayment, + paymentMethod: dataPaymentMethods.checkPayment, + status: dataOrderStatuses.awaitingCheckPayment, }), fifthOrder: new OrderData({ id: 5, @@ -55,7 +55,7 @@ export default { delivery: 'United States', customer: dataCustomers.johnDoe, totalPaid: 20.90, - paymentMethod: PaymentMethods.wirePayment, - status: OrderStatuses.awaitingCheckPayment, + paymentMethod: dataPaymentMethods.wirePayment, + status: dataOrderStatuses.awaitingCheckPayment, }), }; diff --git a/tests/UI/data/demo/paymentMethods.ts b/tests/UI/data/demo/paymentMethods.ts deleted file mode 100644 index df04e02053507..0000000000000 --- a/tests/UI/data/demo/paymentMethods.ts +++ /dev/null @@ -1,19 +0,0 @@ -import PaymentMethodData from '@data/faker/paymentMethod'; - -export default { - cashOnDelivery: new PaymentMethodData({ - moduleName: 'ps_cashondelivery', - name: 'Cash on delivery (COD)', - displayName: 'Cash on delivery (COD)', - }), - checkPayment: new PaymentMethodData({ - moduleName: 'ps_checkpayment', - name: 'Payment by check', - displayName: 'Payments by check', - }), - wirePayment: new PaymentMethodData({ - moduleName: 'ps_wirepayment', - name: 'Bank wire', - displayName: 'Bank transfer', - }), -}; diff --git a/tests/UI/data/demo/states.ts b/tests/UI/data/demo/states.ts deleted file mode 100644 index b89894e150f32..0000000000000 --- a/tests/UI/data/demo/states.ts +++ /dev/null @@ -1,28 +0,0 @@ -import StateData from '@data/faker/state'; - -export default { - california: new StateData({ - id: 8, - name: 'California', - isoCode: 'CA', - country: 'United States', - zone: 'North America', - status: true, - }), - bari: new StateData({ - id: 134, - name: 'Bari', - isoCode: 'BA', - country: 'Italy', - zone: 'Europe', - status: true, - }), - bihar: new StateData({ - id: 8, - name: 'Bihar', - isoCode: 'BR', - country: 'India', - zone: 'Asia', - status: true, - }), -}; diff --git a/tests/UI/data/demo/tax.ts b/tests/UI/data/demo/tax.ts deleted file mode 100644 index 8ed04be25fee9..0000000000000 --- a/tests/UI/data/demo/tax.ts +++ /dev/null @@ -1,16 +0,0 @@ -import TaxData from '@data/faker/tax'; - -export default { - DefaultFrTax: new TaxData({ - id: 1, - name: 'TVA FR 20%', - rate: '20', - enabled: true, - }), - VatUkTax: new TaxData({ - id: 15, - name: 'VAT UK 20%', - rate: '20', - enabled: true, - }), -}; diff --git a/tests/UI/data/demo/taxRule.ts b/tests/UI/data/demo/taxRule.ts index 1983cd34cb30c..52676df245a73 100644 --- a/tests/UI/data/demo/taxRule.ts +++ b/tests/UI/data/demo/taxRule.ts @@ -1,23 +1,25 @@ -import TaxRuleData from '@data/faker/taxRule'; +import { + FakerTaxRule, +} from '@prestashop-core/ui-testing'; export default [ - new TaxRuleData({ + new FakerTaxRule({ id: 1, name: 'FR Taux standard (20%)', }), - new TaxRuleData({ + new FakerTaxRule({ id: 2, name: 'FR Taux réduit (10%)', }), - new TaxRuleData({ + new FakerTaxRule({ id: 3, name: 'FR Taux réduit (5.5%)', }), - new TaxRuleData({ + new FakerTaxRule({ id: 4, name: 'FR Taux super réduit (2.1%)', }), - new TaxRuleData({ + new FakerTaxRule({ id: 5, name: 'EU VAT For Virtual Products', }), diff --git a/tests/UI/data/demo/taxRuleBehaviour.ts b/tests/UI/data/demo/taxRuleBehaviour.ts deleted file mode 100644 index 4ff8d4b64182e..0000000000000 --- a/tests/UI/data/demo/taxRuleBehaviour.ts +++ /dev/null @@ -1 +0,0 @@ -export default ['This tax only', 'Combine', 'One after another']; diff --git a/tests/UI/data/demo/zones.ts b/tests/UI/data/demo/zones.ts deleted file mode 100644 index c0cf962e1c483..0000000000000 --- a/tests/UI/data/demo/zones.ts +++ /dev/null @@ -1,44 +0,0 @@ -import ZoneData from '@data/faker/zone'; - -export default { - europe: new ZoneData({ - id: 1, - name: 'Europe', - status: true, - }), - northAmerica: new ZoneData({ - id: 2, - name: 'North America', - status: true, - }), - asia: new ZoneData({ - id: 3, - name: 'Asia', - status: true, - }), - africa: new ZoneData({ - id: 4, - name: 'Africa', - status: true, - }), - oceania: new ZoneData({ - id: 5, - name: 'Oceania', - status: true, - }), - southAmerica: new ZoneData({ - id: 6, - name: 'South America', - status: true, - }), - europeNonEu: new ZoneData({ - id: 7, - name: 'Europe (non-EU)', - status: true, - }), - centralAmericaAntilla: new ZoneData({ - id: 8, - name: 'Central America/Antilla', - status: true, - }), -}; diff --git a/tests/UI/data/faker/address.ts b/tests/UI/data/faker/address.ts deleted file mode 100644 index db069d5a67412..0000000000000 --- a/tests/UI/data/faker/address.ts +++ /dev/null @@ -1,113 +0,0 @@ -import Countries from '@data/demo/countries'; -import States from '@data/demo/states'; -import type CountryData from '@data/faker/country'; -import type StateData from '@data/faker/state'; -import type AddressCreator from '@data/types/address'; - -import {fakerFR as faker} from '@faker-js/faker'; - -const countriesNames: string[] = Object.values(Countries).map((country: CountryData) => country.name); -const statesNames: string[] = Object.values(States).map((state: StateData) => state.name); - -/** - * Create new address to use in customer address form on BO and FO - * @class - */ -export default class AddressData { - public readonly id: number; - - public readonly name: string; - - public readonly firstName: string; - - public readonly lastName: string; - - public readonly email: string; - - public readonly dni: string; - - public readonly alias: string; - - public readonly company: string; - - public readonly vatNumber: string; - - public readonly address: string; - - public readonly secondAddress: string; - - public readonly postalCode: string; - - public readonly city: string; - - public readonly country: string; - - public readonly state: string; - - public readonly phone: string; - - public readonly other: string; - - /** - * Constructor for class AddressData - * @param addressToCreate {AddressCreator} Could be used to force the value of some members - */ - constructor(addressToCreate: AddressCreator = {}) { - /** @type {string} Tax identification number of the customer */ - this.id = addressToCreate.id || 0; - - /** @type {string} Address Name */ - this.name = addressToCreate.name || faker.word.noun(); - - /** @type {string} Customer firstname */ - this.firstName = addressToCreate.firstName || faker.person.firstName(); - - /** @type {string} Customer lastname */ - this.lastName = addressToCreate.lastName || faker.person.lastName(); - - /** @type {string} Related customer email */ - this.email = addressToCreate.email || faker.internet.email( - { - firstName: this.firstName, - lastName: this.lastName, - provider: 'prestashop.com', - }, - ); - - /** @type {string} Tax identification number of the customer */ - this.dni = addressToCreate.dni || ''; - - /** @type {string} Address alias or name */ - this.alias = addressToCreate.alias || faker.location.streetAddress().substring(0, 30); - - /** @type {string} Company name if it's a company address */ - this.company = (addressToCreate.company || faker.company.name()).substring(0, 63); - - /** @type {string} Tax identification number if it's a company */ - this.vatNumber = addressToCreate.vatNumber || ''; - - /** @type {string} Address first line */ - this.address = addressToCreate.address || faker.location.streetAddress(); - - /** @type {string} Address second line */ - this.secondAddress = addressToCreate.secondAddress || faker.location.secondaryAddress(); - - /** @type {string} Address postal code (default to this format #####) */ - this.postalCode = addressToCreate.postalCode || faker.location.zipCode('#####'); - - /** @type {string} Address city name */ - this.city = addressToCreate.city || faker.location.city(); - - /** @type {string} Address country name */ - this.country = addressToCreate.country || faker.helpers.arrayElement(countriesNames); - - /** @type {string} Address state name */ - this.state = addressToCreate.state || faker.helpers.arrayElement(statesNames); - - /** @type {string} Phone number */ - this.phone = addressToCreate.phone || faker.phone.number(); - - /** @type {string} Other information to add on address */ - this.other = addressToCreate.other || ''; - } -} diff --git a/tests/UI/data/faker/brandAddress.ts b/tests/UI/data/faker/brandAddress.ts index 41b01a28e9d3d..66b4e59c33549 100644 --- a/tests/UI/data/faker/brandAddress.ts +++ b/tests/UI/data/faker/brandAddress.ts @@ -1,10 +1,13 @@ -import Countries from '@data/demo/countries'; -import CountryData from '@data/faker/country'; import BrandAddressCreator from '@data/types/brandAddress'; +import { + // Import data + dataCountries, + type FakerCountry, +} from '@prestashop-core/ui-testing'; import {fakerFR as faker} from '@faker-js/faker'; -const countriesNames: string[] = Object.values(Countries).map((country: CountryData) => country.name); +const countriesNames: string[] = Object.values(dataCountries).map((country: FakerCountry) => country.name); /** * Create new brand address to use in brand address form on BO diff --git a/tests/UI/data/faker/carrier.ts b/tests/UI/data/faker/carrier.ts deleted file mode 100644 index 2af775f7b62c1..0000000000000 --- a/tests/UI/data/faker/carrier.ts +++ /dev/null @@ -1,144 +0,0 @@ -import TaxRules from '@data/demo/taxRule'; -import Zones from '@data/demo/zones'; -import TaxRuleData from '@data/faker/taxRule'; -import ZoneData from '@data/faker/zone'; -import CarrierCreator from '@data/types/carrier'; - -import {faker} from '@faker-js/faker'; - -const taxes: string[] = Object.values(TaxRules).map((tax: TaxRuleData) => tax.name); -const zonesID: number[] = Object.values(Zones).map((zone: ZoneData) => zone.id); -const outOfRangeBehavior: string[] = ['Apply the cost of the highest defined range', 'Disable carrier']; -const billing: string[] = ['According to total price', 'According to total weight']; - -/** - * Create new carrier to use in carrier form on BO - * @class - */ -export default class CarrierData { - public readonly id: number; - - public readonly position: number; - - public readonly name: string; - - public readonly transitName: string; - - public readonly delay: string; - - public readonly speedGrade: number; - - public readonly trakingURL: string; - - public readonly handlingCosts: boolean; - - public readonly freeShipping: boolean; - - public readonly billing: string; - - public readonly taxRule: string; - - public readonly outOfRangeBehavior: string; - - public readonly rangeSup: number; - - public readonly allZones: boolean; - - public readonly allZonesValue: number; - - public readonly zoneID: number; - - public readonly maxWidth: number; - - public readonly maxHeight: number; - - public readonly maxDepth: number; - - public readonly maxWeight: number; - - public readonly enable: boolean; - - public readonly price: number; - - public readonly priceText: string; - - public readonly priceTTC: number; - - /** - * Constructor for class CarrierData - * @param carrierToCreate {CarrierCreator} Could be used to force the value of some members - */ - constructor(carrierToCreate: CarrierCreator = {}) { - /** @type {number} ID of the carrier */ - this.id = carrierToCreate.id || 0; - - /** @type {number} Position of the carrier */ - this.position = carrierToCreate.position || 0; - - /** @type {string} Name of the carrier */ - this.name = carrierToCreate.name || faker.company.name(); - - /** @type {string} Transit name of the carrier */ - this.transitName = carrierToCreate.transitName || faker.company.name(); - - /** @type {string} Delay of the carrier */ - this.delay = carrierToCreate.delay || ''; - - /** @type {number} Shipping delay, 0 for longest and 9 for shortest */ - this.speedGrade = carrierToCreate.speedGrade || faker.number.int({min: 1, max: 9}); - - /** @type {string} Url of carrier tracking */ - this.trakingURL = carrierToCreate.trakingURL || 'https://example.com/track.php?num=20'; - - /** @type {boolean} True to include handling costs on the price */ - this.handlingCosts = carrierToCreate.handlingCosts === undefined ? true : carrierToCreate.handlingCosts; - - /** @type {boolean} True to make shipping free */ - this.freeShipping = carrierToCreate.freeShipping === undefined ? true : carrierToCreate.freeShipping; - - /** @type {string} Billing method of the carrier */ - this.billing = carrierToCreate.billing || faker.helpers.arrayElement(billing); - - /** @type {string} Tax rule of the carrier */ - this.taxRule = carrierToCreate.taxRule || faker.helpers.arrayElement(taxes); - - /** @type {string} Behavior when no defined range matches the customer carts */ - this.outOfRangeBehavior = carrierToCreate.outOfRangeBehavior || faker.helpers.arrayElement(outOfRangeBehavior); - - /** @type {number} Superior range for the carrier */ - this.rangeSup = carrierToCreate.rangeSup || faker.number.int({min: 1, max: 100}); - - /** @type {boolean} True to apply it to all zones */ - this.allZones = carrierToCreate.allZones === undefined ? true : carrierToCreate.allZones; - - /** @type {number} Value to set when all zones is checked */ - this.allZonesValue = carrierToCreate.allZonesValue || faker.number.int({min: 1, max: 100}); - - /** @type {number} ID of the zone on carrier form */ - this.zoneID = carrierToCreate.zoneID || faker.helpers.arrayElement(zonesID); - - /** @type {number} Max width that the carrier can handle */ - this.maxWidth = carrierToCreate.maxWidth || faker.number.int({min: 1, max: 100}); - - /** @type {number} Max height that the carrier can handle */ - this.maxHeight = carrierToCreate.maxHeight || faker.number.int({min: 1, max: 100}); - - /** @type {number} Max depth that the carrier can handle */ - this.maxDepth = carrierToCreate.maxDepth || faker.number.int({min: 1, max: 100}); - - /** @type {number} Max weight that the carrier can handle */ - this.maxWeight = carrierToCreate.maxWeight || faker.number.int({min: 1, max: 100}); - - /** @type {boolean} Status of the carrier */ - this.enable = carrierToCreate.enable === undefined ? true : carrierToCreate.enable; - - /** @type {number} Price HT */ - this.price = carrierToCreate.price || 0; - - /** @type {string} */ - this.priceText = carrierToCreate.priceText || this.price.toString(); - - /** @type {number} Price TTC */ - this.priceTTC = carrierToCreate.priceTTC || 0; - } -} diff --git a/tests/UI/data/faker/cartRule.ts b/tests/UI/data/faker/cartRule.ts index 1a9ce362ef2fd..bdf2159a7637f 100644 --- a/tests/UI/data/faker/cartRule.ts +++ b/tests/UI/data/faker/cartRule.ts @@ -7,8 +7,12 @@ import type { CartRuleProductSelection, } from '@data/types/cartRule'; +import { + // Import data + FakerCustomer, +} from '@prestashop-core/ui-testing'; + import {faker} from '@faker-js/faker'; -import CustomerData from '@data/faker/customer'; const productsNames: string[] = Object.values(Products).map((product: ProductData) => product.name); @@ -33,7 +37,7 @@ export default class CartRuleData { public readonly status: boolean; - public readonly customer: CustomerData | null; + public readonly customer: FakerCustomer | null; public readonly dateFrom: string | null; diff --git a/tests/UI/data/faker/catalogPriceRule.ts b/tests/UI/data/faker/catalogPriceRule.ts index 3bb7a95c3eeb5..c143c4824ea26 100644 --- a/tests/UI/data/faker/catalogPriceRule.ts +++ b/tests/UI/data/faker/catalogPriceRule.ts @@ -1,17 +1,17 @@ -import Countries from '@data/demo/countries'; -import type CountryData from '@data/faker/country'; -import type GroupData from '@data/faker/group'; import type CatalogPriceRuleCreator from '@data/types/catalogPriceRule'; import { // Import data + dataCountries, dataGroups, + type FakerCountry, + type FakerGroup, } from '@prestashop-core/ui-testing'; import {faker} from '@faker-js/faker'; -const countriesNames: string[] = Object.values(Countries).map((country: CountryData) => country.name); -const groupAccessNames: string[] = Object.values(dataGroups).map((group: GroupData) => group.name); +const countriesNames: string[] = Object.values(dataCountries).map((country: FakerCountry) => country.name); +const groupAccessNames: string[] = Object.values(dataGroups).map((group: FakerGroup) => group.name); const currencies: string[] = ['All currencies', 'Euro']; const reductionType: string[] = ['Amount', 'Percentage']; diff --git a/tests/UI/data/faker/category.ts b/tests/UI/data/faker/category.ts index 89e1af4ce052b..56a03f2fbcc5d 100644 --- a/tests/UI/data/faker/category.ts +++ b/tests/UI/data/faker/category.ts @@ -1,9 +1,9 @@ -import type GroupData from '@data/faker/group'; import type {CategoryCreator} from '@data/types/category'; import { // Import data dataGroups, + type FakerGroup, } from '@prestashop-core/ui-testing'; import {faker} from '@faker-js/faker'; @@ -27,7 +27,7 @@ export default class CategoryData { public readonly metaDescription: string; - public readonly groupAccess: GroupData; + public readonly groupAccess: FakerGroup; public readonly coverImage: string | null; @@ -63,7 +63,7 @@ export default class CategoryData { /** @type {string} Meta description of the category */ this.metaDescription = faker.lorem.sentence(); - /** @type {GroupData} Customer group that could access to the category */ + /** @type {FakerGroup} Customer group that could access to the category */ this.groupAccess = categoryToCreate.groupAccess || faker.helpers.arrayElement([dataGroups.customer, dataGroups.guest, dataGroups.visitor]); diff --git a/tests/UI/data/faker/country.ts b/tests/UI/data/faker/country.ts deleted file mode 100644 index fa364faa4a0fa..0000000000000 --- a/tests/UI/data/faker/country.ts +++ /dev/null @@ -1,83 +0,0 @@ -import Currencies from '@data/demo/currencies'; -import Zones from '@data/demo/zones'; -import CurrencyData from '@data/faker/currency'; -import ZoneData from '@data/faker/zone'; -import CountryCreator from '@data/types/country'; - -import {faker} from '@faker-js/faker'; - -const zones: string[] = Object.values(Zones).map((zone: ZoneData) => zone.name); -const currencies: string[] = Object.values(Currencies).map((currency: CurrencyData) => currency.name); - -/** - * Create new country to use on creation form on country page on BO - * @class - */ -export default class CountryData { - public readonly id: number; - - public readonly name: string; - - public readonly isoCode: string; - - public readonly callPrefix: string; - - public readonly currency: string; - - public readonly zone: string; - - public readonly needZipCode: boolean; - - public readonly zipCodeFormat: string; - - public readonly active: boolean; - - public readonly containsStates: boolean; - - public readonly needIdentificationNumber: boolean; - - public readonly displayTaxNumber: boolean; - - /** - * Constructor for class CountryData - * @param countryToCreate {CountryCreator} Could be used to force the value of some members - */ - constructor(countryToCreate: CountryCreator = {}) { - /** @type {number} ID of the country */ - this.id = countryToCreate.id || 0; - - /** @type {string} Name of the country */ - this.name = countryToCreate.name || `test${faker.location.country()}`; - - /** @type {string} Country iso code */ - this.isoCode = countryToCreate.isoCode || faker.location.countryCode(); - - /** @type {string} Country call Prefix */ - this.callPrefix = countryToCreate.callPrefix || '0'; - - /** @type {string} Currency used in the country */ - this.currency = countryToCreate.currency || faker.helpers.arrayElement(currencies); - - /** @type {string} In which zone the country belongs */ - this.zone = countryToCreate.zone || faker.helpers.arrayElement(zones); - - /** @type {boolean} True if the country used zip codes */ - this.needZipCode = countryToCreate.needZipCode === undefined ? false : countryToCreate.needZipCode; - - /** @type {string} Format of the zip code if used */ - this.zipCodeFormat = countryToCreate.zipCodeFormat || ''; - - /** @type {string} Status of the country */ - this.active = countryToCreate.active === undefined ? false : countryToCreate.active; - - /** @type {boolean} True if the country have states */ - this.containsStates = countryToCreate.containsStates === undefined ? false : countryToCreate.containsStates; - - /** @type {boolean} True if need identification number for the country */ - this.needIdentificationNumber = countryToCreate.needIdentificationNumber === undefined - ? false : countryToCreate.needIdentificationNumber; - - /** @type {boolean} True to display tax number when located on the country */ - this.displayTaxNumber = countryToCreate.displayTaxNumber === undefined ? false : countryToCreate.displayTaxNumber; - } -} diff --git a/tests/UI/data/faker/currency.ts b/tests/UI/data/faker/currency.ts deleted file mode 100644 index 1a77b83874ec5..0000000000000 --- a/tests/UI/data/faker/currency.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type {CurrencyCreator} from '@data/types/currency'; - -import {faker} from '@faker-js/faker'; - -/** - * Create new currency to use in currency form on BO - * @class - */ -export default class CurrencyData { - public readonly name: string; - - public readonly frName: string; - - public readonly symbol: string; - - public readonly isoCode: string; - - public readonly exchangeRate: number; - - public readonly decimals: number; - - public readonly enabled: boolean; - - /** - * Constructor for class CurrencyData - * @param currencyToCreate {CurrencyCreator} Could be used to force the value of some members - */ - constructor(currencyToCreate: CurrencyCreator = {}) { - /** @type {string} Name of the currency */ - this.name = currencyToCreate.name || faker.finance.currencyName(); - - /** @type {string} */ - this.frName = currencyToCreate.frName || this.name; - - /** @type {string} */ - this.symbol = currencyToCreate.symbol || faker.finance.currencySymbol(); - - /** @type {string} */ - this.isoCode = currencyToCreate.isoCode || faker.finance.currencyCode(); - - /** @type {number} */ - this.exchangeRate = currencyToCreate.exchangeRate || 1; - - /** @type {number} */ - this.decimals = currencyToCreate.decimals || 2; - - /** @type {boolean} */ - this.enabled = currencyToCreate.enabled === undefined ? true : currencyToCreate.enabled; - } -} diff --git a/tests/UI/data/faker/customer.ts b/tests/UI/data/faker/customer.ts deleted file mode 100644 index f07f9ed678dd3..0000000000000 --- a/tests/UI/data/faker/customer.ts +++ /dev/null @@ -1,121 +0,0 @@ -import type GroupData from '@data/faker/group'; -import type TitleData from '@data/faker/title'; -import type CustomerCreator from '@data/types/customer'; - -import { - // Import data - dataGroups, - dataTitles, -} from '@prestashop-core/ui-testing'; - -import {faker} from '@faker-js/faker'; - -const genders: string[] = Object.values(dataTitles).map((title: TitleData) => title.name); -const groups: string[] = Object.values(dataGroups).map((group: GroupData) => group.name); -const risksRating: string[] = ['None', 'Low', 'Medium', 'High']; - -/** - * Create new customer to use on creation form on customer page on BO and FO - * @class - */ -export default class CustomerData { - public readonly id: number; - - public readonly socialTitle: string; - - public readonly firstName: string; - - public readonly lastName: string; - - public email: string; - - public password: string; - - public readonly birthDate: Date; - - public readonly yearOfBirth: string; - - public readonly monthOfBirth: string; - - public readonly dayOfBirth: string; - - public readonly enabled: boolean; - - public readonly partnerOffers: boolean; - - public readonly newsletter: boolean; - - public readonly defaultCustomerGroup: string; - - public readonly company: string; - - public readonly allowedOutstandingAmount: number; - - public readonly riskRating: string; - - /** - * Constructor for class CustomerData - * @param customerToCreate {CustomerCreator} Could be used to force the value of some members - */ - constructor(customerToCreate: CustomerCreator = {}) { - /** @type {number} ID of the customer */ - this.id = customerToCreate.id || 0; - - /** @type {string} Social title of the customer (Mr, Mrs) */ - this.socialTitle = customerToCreate.socialTitle || faker.helpers.arrayElement(genders); - - /** @type {string} Firstname of the customer */ - this.firstName = customerToCreate.firstName || faker.person.firstName(); - - /** @type {string} Lastname of the customer */ - this.lastName = customerToCreate.lastName || faker.person.lastName(); - - /** @type {string} Email for the customer account */ - this.email = customerToCreate.email || faker.internet.email( - { - firstName: this.firstName, - lastName: this.lastName, - provider: 'prestashop.com', - }, - ); - - /** @type {string} Password for the customer account */ - this.password = customerToCreate.password === undefined ? faker.internet.password() : customerToCreate.password; - - /** @type {Date} Birthdate of the customer */ - this.birthDate = customerToCreate.birthDate || faker.date.between({from: '1950-01-01', to: '2000-12-31'}); - - /** @type {string} Year of the birth 'yyyy' */ - this.yearOfBirth = customerToCreate.yearOfBirth || this.birthDate.getFullYear().toString(); - - /** @type {string} Month of the birth 'mm' */ - this.monthOfBirth = customerToCreate.monthOfBirth || (`0${this.birthDate.getMonth() + 1}`).slice(-2); - - /** @type {string} Day of the birth 'dd' */ - this.dayOfBirth = customerToCreate.dayOfBirth || (`0${this.birthDate.getDate()}`).slice(-2).toString(); - - /** @type {boolean} Status of the customer */ - this.enabled = customerToCreate.enabled === undefined ? true : customerToCreate.enabled; - - /** @type {boolean} True to enable partner offers */ - this.partnerOffers = customerToCreate.partnerOffers === undefined ? true : customerToCreate.partnerOffers; - - /** @type {string} Default group for the customer */ - this.defaultCustomerGroup = customerToCreate.defaultCustomerGroup || faker.helpers.arrayElement(groups); - - /** @type {boolean} True to enable sending newsletter to the customer */ - this.newsletter = customerToCreate.newsletter === undefined ? false : customerToCreate.newsletter; - - /** @type {string} Company for the customer */ - this.company = customerToCreate.company || faker.company.name(); - - /** @type {Number} Allowed outstanding amount for the customer */ - this.allowedOutstandingAmount = customerToCreate.allowedOutstandingAmount || faker.number.int({ - min: 0, - max: 100, - }); - - /** @type {string} Risk rating for the customer */ - this.riskRating = customerToCreate.riskRating || faker.helpers.arrayElement(risksRating); - } -} diff --git a/tests/UI/data/faker/module.ts b/tests/UI/data/faker/module.ts deleted file mode 100644 index c7483f1803eca..0000000000000 --- a/tests/UI/data/faker/module.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type ModuleDataCreator from '@data/types/module'; - -/** - * @class - */ -export default class ModuleData { - public readonly tag: string; - - public readonly name: string; - - public readonly releaseZip: string; - - /** - * Constructor for class ModuleData - * @param valueToCreate {ModuleDataCreator} Could be used to force the value of some members - */ - constructor(valueToCreate: ModuleDataCreator = {}) { - /** @type {string} Technical Name of the module */ - this.tag = valueToCreate.tag || ''; - - /** @type {string} Name of the module */ - this.name = valueToCreate.name || ''; - - /** @type {string} Release URL */ - this.releaseZip = valueToCreate.releaseZip || ''; - } -} diff --git a/tests/UI/data/faker/order.ts b/tests/UI/data/faker/order.ts index 9bdeb3b8b68ca..d53c56aa054fd 100644 --- a/tests/UI/data/faker/order.ts +++ b/tests/UI/data/faker/order.ts @@ -1,14 +1,14 @@ -import OrderStatuses from '@data/demo/orderStatuses'; -import PaymentMethods from '@data/demo/paymentMethods'; -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; -import OrderStatusData from '@data/faker/orderStatus'; -import PaymentMethodData from '@data/faker/paymentMethod'; import {OrderCreator, OrderDeliveryOption, OrderProduct} from '@data/types/order'; import { // Import data dataCustomers, + dataOrderStatuses, + dataPaymentMethods, + FakerAddress, + FakerCustomer, + type FakerOrderStatus, + type FakerPaymentMethod, } from '@prestashop-core/ui-testing'; import {faker} from '@faker-js/faker'; @@ -26,17 +26,17 @@ export default class OrderData { public readonly delivery: string; - public readonly customer: CustomerData; + public readonly customer: FakerCustomer; public readonly totalPaid: number; - public readonly paymentMethod: PaymentMethodData; + public readonly paymentMethod: FakerPaymentMethod; - public readonly status: OrderStatusData; + public readonly status: FakerOrderStatus; - public readonly deliveryAddress: AddressData; + public readonly deliveryAddress: FakerAddress; - public readonly invoiceAddress: AddressData; + public readonly invoiceAddress: FakerAddress; public readonly products: OrderProduct[]; @@ -67,23 +67,23 @@ export default class OrderData { /** @type {string} */ this.delivery = valueToCreate.delivery || 'France'; - /** @type {CustomerData} */ + /** @type {FakerCustomer} */ this.customer = valueToCreate.customer || dataCustomers.johnDoe; /** @type {number} */ this.totalPaid = valueToCreate.totalPaid || 0; - /** @type {PaymentMethodData} */ - this.paymentMethod = valueToCreate.paymentMethod || PaymentMethods.checkPayment; + /** @type {FakerPaymentMethod} */ + this.paymentMethod = valueToCreate.paymentMethod || dataPaymentMethods.checkPayment; - /** @type {OrderStatusData|null} */ - this.status = valueToCreate.status || OrderStatuses.paymentAccepted; + /** @type {FakerOrderStatus|null} */ + this.status = valueToCreate.status || dataOrderStatuses.paymentAccepted; - /** @type {AddressData} */ - this.deliveryAddress = valueToCreate.deliveryAddress || new AddressData(); + /** @type {FakerCustomer} */ + this.deliveryAddress = valueToCreate.deliveryAddress || new FakerAddress(); - /** @type {AddressData} */ - this.invoiceAddress = valueToCreate.invoiceAddress || new AddressData(); + /** @type {FakerCustomer} */ + this.invoiceAddress = valueToCreate.invoiceAddress || new FakerAddress(); /** @type {OrderProduct[]} */ this.products = valueToCreate.products || []; diff --git a/tests/UI/data/faker/orderStatus.ts b/tests/UI/data/faker/orderStatus.ts deleted file mode 100644 index 6ffc6192cce36..0000000000000 --- a/tests/UI/data/faker/orderStatus.ts +++ /dev/null @@ -1,82 +0,0 @@ -import OrderStatusCreator from '@data/types/orderStatus'; - -import {faker} from '@faker-js/faker'; - -/** - * Create new order status to use on creation form on order status page on BO - * @class - */ -export default class OrderStatusData { - public readonly id: number; - - public readonly name: string; - - public readonly color: string; - - public readonly logableOn: boolean; - - public readonly invoiceOn: boolean; - - public readonly hiddenOn: boolean; - - public readonly sendEmailOn: boolean; - - public readonly pdfInvoiceOn: boolean; - - public readonly pdfDeliveryOn: boolean; - - public readonly shippedOn: boolean; - - public readonly paidOn: boolean; - - public readonly deliveryOn: boolean; - - public readonly emailTemplate: string; - - /** - * Constructor for class OrderStatusData - * @param orderStatusToCreate {OrderStatusCreator} Could be used to force the value of some members - */ - constructor(orderStatusToCreate: OrderStatusCreator = {}) { - /** @type {number} Name of the status */ - this.id = orderStatusToCreate.id || 0; - - /** @type {string} Name of the status (Max 32 characters) */ - this.name = orderStatusToCreate.name || (`order_status_${faker.lorem.word({ - length: {min: 1, max: 19}, - })}`).substring(0, 32); - - /** @type {string} Hexadecimal value for the status color */ - this.color = orderStatusToCreate.color || faker.internet.color(); - - /** @type {boolean} True to consider order is valid */ - this.logableOn = orderStatusToCreate.logableOn === undefined ? true : orderStatusToCreate.logableOn; - - /** @type {boolean} True to allow a customer to download and view PDF versions of the invoices */ - this.invoiceOn = orderStatusToCreate.invoiceOn === undefined ? true : orderStatusToCreate.invoiceOn; - - /** @type {boolean} True to hide this status in all customer orders. */ - this.hiddenOn = orderStatusToCreate.hiddenOn === undefined ? true : orderStatusToCreate.hiddenOn; - - /** @type {boolean} True to email the customer when his/her order status has changed */ - this.sendEmailOn = orderStatusToCreate.sendEmailOn === undefined ? true : orderStatusToCreate.sendEmailOn; - - /** @type {boolean} True to attach invoice PDF to email */ - this.pdfInvoiceOn = orderStatusToCreate.pdfInvoiceOn === undefined ? true : orderStatusToCreate.pdfInvoiceOn; - - /** @type {boolean} True to attach delivery slip PDF to email */ - this.pdfDeliveryOn = orderStatusToCreate.pdfDeliveryOn === undefined ? true : orderStatusToCreate.pdfDeliveryOn; - - /** @type {boolean} True to set the order as shipped */ - this.shippedOn = orderStatusToCreate.shippedOn === undefined ? true : orderStatusToCreate.shippedOn; - - /** @type {boolean} True to set the order as paid */ - this.paidOn = orderStatusToCreate.paidOn === undefined ? true : orderStatusToCreate.paidOn; - - /** @type {boolean} True to show delivery PDF */ - this.deliveryOn = orderStatusToCreate.deliveryOn === undefined ? true : orderStatusToCreate.deliveryOn; - - /** @type {string} Email Template */ - this.emailTemplate = orderStatusToCreate.emailTemplate === undefined ? '' : orderStatusToCreate.emailTemplate; - } -} diff --git a/tests/UI/data/faker/paymentMethod.ts b/tests/UI/data/faker/paymentMethod.ts deleted file mode 100644 index 9997502324641..0000000000000 --- a/tests/UI/data/faker/paymentMethod.ts +++ /dev/null @@ -1,29 +0,0 @@ -import type PaymentMethodCreator from '@data/types/paymentMethod'; - -import {faker} from '@faker-js/faker'; - -/** - * @class - */ -export default class PaymentMethodData { - public readonly name: string; - - public readonly displayName: string; - - public readonly moduleName: string; - - /** - * Constructor for class PaymentMethodData - * @param valueToCreate {PaymentMethodCreator} Could be used to force the value of some members - */ - constructor(valueToCreate: PaymentMethodCreator = {}) { - /** @type {string} */ - this.name = valueToCreate.name || faker.word.noun(); - - /** @type {string} */ - this.displayName = valueToCreate.displayName || this.name; - - /** @type {string} */ - this.moduleName = valueToCreate.moduleName || this.name; - } -} diff --git a/tests/UI/data/faker/shoppingCart.ts b/tests/UI/data/faker/shoppingCart.ts index ef331225d4f23..a7bd36ab5a9eb 100644 --- a/tests/UI/data/faker/shoppingCart.ts +++ b/tests/UI/data/faker/shoppingCart.ts @@ -1,12 +1,12 @@ // Import data import Carriers from '@data/demo/carriers'; -import type CarrierData from '@data/faker/carrier'; -import type CustomerData from '@data/faker/customer'; import type {ShoppingCartCreator} from '@data/types/shoppingCart'; import { // Import data dataCustomers, + FakerCarrier, + type FakerCustomer, } from '@prestashop-core/ui-testing'; /** @@ -18,9 +18,9 @@ export default class ShoppingCartData { public readonly orderID: number; - public readonly customer: CustomerData; + public readonly customer: FakerCustomer; - public readonly carrier: CarrierData; + public readonly carrier: FakerCarrier; public readonly online: boolean; @@ -35,10 +35,10 @@ export default class ShoppingCartData { /** @type {number} Order ID */ this.orderID = valueToCreate.orderID || 0; - /** @type {CustomerData} Customer */ + /** @type {FakerCustomer} Customer */ this.customer = valueToCreate.customer || dataCustomers.johnDoe; - /** @type {CarrierData} Carrier */ + /** @type {FakerCarrier} Carrier */ this.carrier = valueToCreate.carrier || Carriers.myCarrier; /** @type {boolean} */ diff --git a/tests/UI/data/faker/state.ts b/tests/UI/data/faker/state.ts deleted file mode 100644 index 5826dda3206ac..0000000000000 --- a/tests/UI/data/faker/state.ts +++ /dev/null @@ -1,53 +0,0 @@ -import Zones from '@data/demo/zones'; -import ZoneData from '@data/faker/zone'; -import type StateCreator from '@data/types/state'; - -import {faker} from '@faker-js/faker'; - -const zones: string[] = Object.values(Zones).map((zone: ZoneData) => zone.name); -const countriesWithState: string[] = [ - 'Argentina', 'Australia', 'Canada', 'India', 'Indonesia', 'Italy', 'Japan', 'Mexico', 'United States', -]; -const statesIsoCodes: string[] = ['IR', 'PK', 'BP', 'BV', 'ZM', 'ZL', 'HM', 'HL', 'BK']; - -/** - * Create new state to use on state creation form on BO - * @class - */ -export default class StateData { - public readonly id: number; - - public readonly name: string; - - public readonly isoCode: string; - - public readonly country: string; - - public readonly zone: string; - - public readonly status: boolean; - - /** - * Constructor for class StateData - * @param stateToCreate {StateCreator} Could be used to force the value of some members - */ - constructor(stateToCreate: StateCreator = {}) { - /** @type {number} ID of the state */ - this.id = stateToCreate.id || 0; - - /** @type {string} Name of the state */ - this.name = stateToCreate.name || `test ${faker.location.state()}`; - - /** @type {string} Iso code of the state */ - this.isoCode = stateToCreate.isoCode || faker.helpers.arrayElement(statesIsoCodes); - - /** @type {string} Country of the state */ - this.country = stateToCreate.country || faker.helpers.arrayElement(countriesWithState); - - /** @type {string} Zone of the state */ - this.zone = stateToCreate.zone || faker.helpers.arrayElement(zones); - - /** @type {boolean} Status of the state */ - this.status = stateToCreate.status === undefined ? false : stateToCreate.status; - } -} diff --git a/tests/UI/data/faker/supplier.ts b/tests/UI/data/faker/supplier.ts index 8a0ecd1a80f81..69fae8df4b639 100644 --- a/tests/UI/data/faker/supplier.ts +++ b/tests/UI/data/faker/supplier.ts @@ -1,10 +1,13 @@ -import Countries from '@data/demo/countries'; -import type CountryData from '@data/faker/country'; import SupplierCreator from '@data/types/supplier'; +import { + // Import data + dataCountries, + type FakerCountry, +} from '@prestashop-core/ui-testing'; import {fakerFR as faker} from '@faker-js/faker'; -const countriesNames: string[] = Object.values(Countries).map((country: CountryData) => country.name); +const countriesNames: string[] = Object.values(dataCountries).map((country: FakerCountry) => country.name); /** * Create new supplier to use on supplier creation form on BO diff --git a/tests/UI/data/faker/tax.ts b/tests/UI/data/faker/tax.ts deleted file mode 100644 index f6b007719b7be..0000000000000 --- a/tests/UI/data/faker/tax.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Import data -import TaxCreator from '@data/types/tax'; - -import {faker} from '@faker-js/faker'; - -/** - * Create new tax to use on tax form on BO - * @class - */ -export default class TaxData { - public readonly id: number; - - public readonly rate: string; - - public readonly name: string; - - public readonly frName: string; - - public readonly enabled: boolean; - - /** - * Constructor for class TaxData - * @param taxToCreate {TaxCreator} Could be used to force the value of some members - */ - constructor(taxToCreate: TaxCreator = {}) { - /** @type {number} Name of the tax */ - this.id = taxToCreate.id || 0; - - /** @type {string} Tax of the rate */ - this.rate = taxToCreate.rate || faker.number.int({min: 1, max: 40}).toString(); - - /** @type {string} Name of the tax */ - this.name = taxToCreate.name || `TVA test ${this.rate}%`; - - /** @type {string} French name of the tax */ - this.frName = taxToCreate.frName || this.name; - - /** @type {boolean} Status of the tax */ - this.enabled = taxToCreate.enabled === undefined ? true : taxToCreate.enabled; - } -} diff --git a/tests/UI/data/faker/taxRule.ts b/tests/UI/data/faker/taxRule.ts deleted file mode 100644 index d05f81d12ea50..0000000000000 --- a/tests/UI/data/faker/taxRule.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Import data -import Countries from '@data/demo/countries'; -import tax from '@data/demo/tax'; -import type CountryData from '@data/faker/country'; -import TaxRuleBehaviour from '@data/demo/taxRuleBehaviour'; -import TaxRuleCreator from '@data/types/taxRule'; - -import {faker} from '@faker-js/faker'; - -const countriesNames: string[] = Object.values(Countries).map((country: CountryData) => country.name); - -/** - * Create new tax rule to use on tax rule form on BO - * @class - */ -export default class TaxRuleData { - public readonly id: number; - - public readonly country: string; - - public readonly zipCode: string; - - public readonly behaviour: string; - - public readonly name: string; - - public readonly description: string; - - /** - * Constructor for class TaxRuleData - * @param taxRulesToCreate {TaxRuleCreator} Could be used to force the value of some members - */ - constructor(taxRulesToCreate: TaxRuleCreator = {}) { - /** @type {number} ID */ - this.id = taxRulesToCreate.id || 0; - - /** @type {string} Country to apply the tax */ - this.country = taxRulesToCreate.country || faker.helpers.arrayElement(countriesNames); - - /** @type {string} Postal code of the country */ - this.zipCode = taxRulesToCreate.zipCode || faker.location.zipCode(); - - /** @type {string} Behavior of the tax rule */ - this.behaviour = taxRulesToCreate.behaviour || faker.helpers.arrayElement(TaxRuleBehaviour); - - /** @type {string} Name of the tax to use on the rule */ - this.name = taxRulesToCreate.name || tax.DefaultFrTax.name; - - /** @type {string} Description of the tax rule */ - this.description = taxRulesToCreate.description || faker.lorem.sentence(); - } -} diff --git a/tests/UI/data/faker/title.ts b/tests/UI/data/faker/title.ts deleted file mode 100644 index 084c25d1df791..0000000000000 --- a/tests/UI/data/faker/title.ts +++ /dev/null @@ -1,54 +0,0 @@ -// Import data -import TitleCreator from '@data/types/title'; - -import {faker} from '@faker-js/faker'; - -const genders: string[] = ['Male', 'Female', 'Neutral']; - -/** - * Create new title to use on title form on BO - * @class - */ -export default class TitleData { - public readonly id: number; - - public readonly name: string; - - public readonly frName: string; - - public readonly gender: string; - - public readonly imageName: string; - - public readonly imageWidth: number; - - public readonly imageHeight: number; - - /** - * Constructor for class TitleData - * @param titleToCreate {TitleCreator} Could be used to force the value of some members - */ - constructor(titleToCreate: TitleCreator = {}) { - /** @type {number} ID of the title */ - this.id = titleToCreate.id || 0; - - // Title name should contain at most 20 characters - /** @type {string} Name of the title */ - this.name = titleToCreate.name || (faker.lorem.word()).substring(0, 19).trim(); - - /** @type {string} French name of the title */ - this.frName = titleToCreate.frName || this.name; - - /** @type {string} Gender type of the title */ - this.gender = titleToCreate.gender || faker.helpers.arrayElement(genders); - - /** @type {string} Name of the image to add to the title */ - this.imageName = titleToCreate.imageName || faker.system.commonFileName('png'); - - /** @type {number} Width of the image */ - this.imageWidth = titleToCreate.imageWidth || 16; - - /** @type {number} Height of the image */ - this.imageHeight = titleToCreate.imageHeight || 16; - } -} diff --git a/tests/UI/data/faker/zone.ts b/tests/UI/data/faker/zone.ts deleted file mode 100644 index f923112155f4a..0000000000000 --- a/tests/UI/data/faker/zone.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Import data -import ZoneCreator from '@data/types/zone'; - -import {faker} from '@faker-js/faker'; - -/** - * Create new zone to use on zone form on BO - * @class - */ -export default class ZoneData { - public readonly id: number; - - public readonly name: string; - - public readonly status: boolean; - - /** - * Constructor for class ZoneData - * @param zoneToCreate {Object} Could be used to force the value of some members - */ - constructor(zoneToCreate: ZoneCreator = {}) { - /** @type {number} */ - this.id = zoneToCreate.id || 0; - - /** @type {string} Name of the zone */ - this.name = zoneToCreate.name || `test ${faker.lorem.word()}`; - - /** @type {boolean} Status of the zone */ - this.status = zoneToCreate.status === undefined ? true : zoneToCreate.status; - } -} diff --git a/tests/UI/data/import/addresses.ts b/tests/UI/data/import/addresses.ts index 708c59b82a3c4..f4c49df3ad67a 100644 --- a/tests/UI/data/import/addresses.ts +++ b/tests/UI/data/import/addresses.ts @@ -1,16 +1,16 @@ -import Countries from '@data/demo/countries'; -import CountryData from '@data/faker/country'; import ImportData from '@data/faker/import'; import type {ImportAddress} from '@data/types/import'; import { // Import data + dataCountries, dataCustomers, + type FakerCountry, } from '@prestashop-core/ui-testing'; import {fakerFR as faker} from '@faker-js/faker'; -const countriesNames = Object.values(Countries).map((country: CountryData) => country.name); +const countriesNames = Object.values(dataCountries).map((country: FakerCountry) => country.name); const records: ImportAddress[] = []; diff --git a/tests/UI/data/import/customers.ts b/tests/UI/data/import/customers.ts index fd82e5bbf6c7d..2e676888f3cfe 100644 --- a/tests/UI/data/import/customers.ts +++ b/tests/UI/data/import/customers.ts @@ -1,15 +1,15 @@ -import type GroupData from '@data/faker/group'; import ImportData from '@data/faker/import'; import type {ImportCustomer} from '@data/types/import'; import { // Import data dataGroups, + type FakerGroup, } from '@prestashop-core/ui-testing'; import {faker} from '@faker-js/faker'; -const groups: string[] = Object.values(dataGroups).map((group: GroupData) => group.name); +const groups: string[] = Object.values(dataGroups).map((group: FakerGroup) => group.name); const records: ImportCustomer[] = []; diff --git a/tests/UI/data/types/cart.d.ts b/tests/UI/data/types/cart.d.ts deleted file mode 100644 index 9343fb566797b..0000000000000 --- a/tests/UI/data/types/cart.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -type CartProductDetails = { - name: string - price: number - quantity: number - cartProductsCount: number - cartSubtotal: number - cartShipping: string - totalTaxIncl: number -}; - -export default CartProductDetails; diff --git a/tests/UI/data/types/cartRule.d.ts b/tests/UI/data/types/cartRule.d.ts index 831322174256b..1afae4bed90a1 100644 --- a/tests/UI/data/types/cartRule.d.ts +++ b/tests/UI/data/types/cartRule.d.ts @@ -1,6 +1,10 @@ -import type CustomerData from '@data/faker/customer'; import type ProductData from '@data/faker/product'; +import { + // Import data + type FakerCustomer, +} from '@prestashop-core/ui-testing'; + type CartRuleCreator = { name?: string description?: string @@ -10,7 +14,7 @@ type CartRuleCreator = { partialUse?: boolean priority?: number status?: boolean - customer?: CustomerData | null + customer?: FakerCustomer | null dateFrom?: string | null dateTo?: string | null minimumAmount?: CartRuleMinimalAmount diff --git a/tests/UI/data/types/category.d.ts b/tests/UI/data/types/category.d.ts index ff184f4d9d39a..8c5426f32f055 100644 --- a/tests/UI/data/types/category.d.ts +++ b/tests/UI/data/types/category.d.ts @@ -1,6 +1,10 @@ -import type GroupData from '@data/faker/group'; import CategoryData from '@data/faker/category'; +import { + // Import data + type FakerGroup, +} from '@prestashop-core/ui-testing'; + type CategoryCreator = { id?: number position?: number @@ -9,7 +13,7 @@ type CategoryCreator = { description?: string metaTitle?: string metaDescription?: string - groupAccess?: GroupData + groupAccess?: FakerGroup coverImage?: string thumbnailImage?: string children?: CategoryData[] diff --git a/tests/UI/data/types/order.d.ts b/tests/UI/data/types/order.d.ts index b654ba5ec5974..c367c06ae7bbd 100644 --- a/tests/UI/data/types/order.d.ts +++ b/tests/UI/data/types/order.d.ts @@ -1,20 +1,24 @@ import type ProductData from '@data/faker/product'; -import type AddressData from '@data/faker/address'; -import type CustomerData from '@data/faker/customer'; -import type PaymentMethodData from '@data/faker/paymentMethod'; -import type OrderStatusData from '@data/faker/orderStatus'; + +import { + // Import data + type FakerAddress, + type FakerCustomer, + type FakerOrderStatus, + type FakerPaymentMethod, +} from '@prestashop-core/ui-testing'; type OrderCreator = { id?: number reference?: string newClient?: boolean - customer?: CustomerData + customer?: FakerCustomer totalPaid?: number - paymentMethod?: PaymentMethodData - status?: OrderStatusData + paymentMethod?: FakerPaymentMethod + status?: FakerOrderStatus delivery?: string - deliveryAddress?: AddressData - invoiceAddress?: AddressData + deliveryAddress?: FakerAddress + invoiceAddress?: FakerAddress products?: OrderProduct[] discountPercentValue?: number discountGiftValue?: number diff --git a/tests/UI/data/types/playwright.d.ts b/tests/UI/data/types/playwright.d.ts deleted file mode 100644 index c8e05a1a714e6..0000000000000 --- a/tests/UI/data/types/playwright.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -type PageWaitForSelectorOptionsState = 'attached' | 'detached' | 'visible' | 'hidden'; - -type WaitForNavigationWaitUntil = 'load'|'domcontentloaded'|'networkidle'|'commit'; - -export { - PageWaitForSelectorOptionsState, - WaitForNavigationWaitUntil, -}; diff --git a/tests/UI/data/types/shoppingCart.d.ts b/tests/UI/data/types/shoppingCart.d.ts index df606eb63ec60..6a80f1e6fdb8e 100644 --- a/tests/UI/data/types/shoppingCart.d.ts +++ b/tests/UI/data/types/shoppingCart.d.ts @@ -1,11 +1,14 @@ -import type CarrierData from '@data/faker/carrier'; -import type CustomerData from '@data/faker/customer'; +import { + // Import data + type FakerCarrier, + type FakerCustomer, +} from '@prestashop-core/ui-testing'; type ShoppingCartCreator = { id?: number orderID?: number - customer?: CustomerData - carrier?: CarrierData + customer?: FakerCustomer + carrier?: FakerCarrier online?: boolean } diff --git a/tests/UI/package-lock.json b/tests/UI/package-lock.json index 67cdc0a5f3309..f1744bd2f97c9 100644 --- a/tests/UI/package-lock.json +++ b/tests/UI/package-lock.json @@ -10,7 +10,7 @@ "license": "OSL-3.0", "dependencies": { "@faker-js/faker": "^8.4.1", - "@prestashop-core/ui-testing": "^0.0.6", + "@prestashop-core/ui-testing": "^0.0.11", "@s3pweb/keycloak-admin-client-cjs": "^21.0.1", "@xmldom/xmldom": "^0.8.10", "chai": "^4.4.1", @@ -442,9 +442,9 @@ } }, "node_modules/@prestashop-core/ui-testing": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/@prestashop-core/ui-testing/-/ui-testing-0.0.6.tgz", - "integrity": "sha512-aq8oyemHtYXbCFP7bjKytFaJXq2dbc67kQNAzEGKgrOSuOPCTB1UO9CQ6x5aG90MasSBHMlj4sTOZaJuFALUtw==", + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/@prestashop-core/ui-testing/-/ui-testing-0.0.11.tgz", + "integrity": "sha512-2LbQ4i1yiFS20Bdr/WHTyEzXsXlxEdaMjxyWyW+Y+ZmfbDWB8MDNUP40RpQtO6jgMOvZYTnkae+gZ3kG8rNfAA==", "dependencies": { "@faker-js/faker": "^8.3.1", "@playwright/test": "^1.40.1", @@ -8497,9 +8497,9 @@ } }, "@prestashop-core/ui-testing": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/@prestashop-core/ui-testing/-/ui-testing-0.0.6.tgz", - "integrity": "sha512-aq8oyemHtYXbCFP7bjKytFaJXq2dbc67kQNAzEGKgrOSuOPCTB1UO9CQ6x5aG90MasSBHMlj4sTOZaJuFALUtw==", + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/@prestashop-core/ui-testing/-/ui-testing-0.0.11.tgz", + "integrity": "sha512-2LbQ4i1yiFS20Bdr/WHTyEzXsXlxEdaMjxyWyW+Y+ZmfbDWB8MDNUP40RpQtO6jgMOvZYTnkae+gZ3kG8rNfAA==", "requires": { "@faker-js/faker": "^8.3.1", "@playwright/test": "^1.40.1", diff --git a/tests/UI/package.json b/tests/UI/package.json index 48f98aefce73f..12b2ca9e8a0ab 100644 --- a/tests/UI/package.json +++ b/tests/UI/package.json @@ -108,7 +108,7 @@ "homepage": "https://github.com/PrestaShop/PrestaShop/tree/develop/tests/UI#readme", "dependencies": { "@faker-js/faker": "^8.4.1", - "@prestashop-core/ui-testing": "^0.0.6", + "@prestashop-core/ui-testing": "^0.0.11", "@s3pweb/keycloak-admin-client-cjs": "^21.0.1", "@xmldom/xmldom": "^0.8.10", "chai": "^4.4.1", diff --git a/tests/UI/pages/BO/customers/add.ts b/tests/UI/pages/BO/customers/add.ts index 809f02e13fe20..ea6768f2ca31a 100644 --- a/tests/UI/pages/BO/customers/add.ts +++ b/tests/UI/pages/BO/customers/add.ts @@ -1,6 +1,9 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type CustomerData from '@data/faker/customer'; +import { + // Import data + type FakerCustomer, +} from '@prestashop-core/ui-testing'; import type {Frame, Page} from 'playwright'; @@ -100,10 +103,10 @@ class AddCustomer extends BOBasePage { /** * Fill form for add/edit customer * @param page {Frame|Page} Browser tab - * @param customerData {CustomerData} Data to set on new customer form + * @param customerData {FakerCustomer} Data to set on new customer form * @return {Promise} */ - async fillCustomerForm(page: Frame|Page, customerData: CustomerData): Promise { + async fillCustomerForm(page: Frame|Page, customerData: FakerCustomer): Promise { // Click on label for social input await this.setHiddenCheckboxValue(page, this.socialTitleInput(customerData.socialTitle === 'Mr.' ? 0 : 1)); @@ -124,10 +127,10 @@ class AddCustomer extends BOBasePage { /** * Fill form for add/edit B2B customer * @param page {Page} Browser tab - * @param customerData {CustomerData} Data to set on new customer form + * @param customerData {FakerCustomer} Data to set on new customer form * @return {Promise} */ - async fillB2BCustomerForm(page: Page, customerData: CustomerData): Promise { + async fillB2BCustomerForm(page: Page, customerData: FakerCustomer): Promise { // Click on label for social input await this.setHiddenCheckboxValue(page, this.socialTitleInput(customerData.socialTitle === 'Mr.' ? 0 : 1)); @@ -151,11 +154,11 @@ class AddCustomer extends BOBasePage { /** * Fill form for add/edit customer and get successful message after saving * @param page {Frame|Page} Browser tab - * @param customerData {CustomerData} Data to set on new customer form + * @param customerData {FakerCustomer} Data to set on new customer form * @param waitForNavigation {boolean} True if we need save and waitForNavigation, false if not * @return {Promise} */ - async createEditCustomer(page: Frame|Page, customerData: CustomerData, waitForNavigation: boolean = true): Promise { + async createEditCustomer(page: Frame|Page, customerData: FakerCustomer, waitForNavigation: boolean = true): Promise { // Fill form await this.fillCustomerForm(page, customerData); @@ -171,10 +174,10 @@ class AddCustomer extends BOBasePage { /** * Fill form for add/edit B2B customer and get successful message after saving * @param page {Page} Browser tab - * @param customerData {CustomerData} Data to set on new customer form + * @param customerData {FakerCustomer} Data to set on new customer form * @return {Promise} */ - async createEditB2BCustomer(page: Page, customerData: CustomerData): Promise { + async createEditB2BCustomer(page: Page, customerData: FakerCustomer): Promise { // Fill form await this.fillB2BCustomerForm(page, customerData); diff --git a/tests/UI/pages/BO/customers/addresses/add.ts b/tests/UI/pages/BO/customers/addresses/add.ts index 8f0184abdc0e0..5c88b971afc5f 100644 --- a/tests/UI/pages/BO/customers/addresses/add.ts +++ b/tests/UI/pages/BO/customers/addresses/add.ts @@ -1,6 +1,8 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type AddressData from '@data/faker/address'; +import { + type FakerAddress, +} from '@prestashop-core/ui-testing'; import type {Frame, Page} from 'playwright'; @@ -91,14 +93,14 @@ class AddAddress extends BOBasePage { /** * Fill form for add/edit address * @param page {Frame|Page} Browser tab - * @param addressData {AddressData} Data to set on new address form + * @param addressData {FakerAddress} Data to set on new address form * @param save {boolean} True if we need to save the new address, false if not * @param waitForNavigation {boolean} True if we need to wait for navigation after save, false if not * @returns {Promise} */ async createEditAddress( page: Frame|Page, - addressData: AddressData, + addressData: FakerAddress, save: boolean = true, waitForNavigation: boolean = true, ): Promise { diff --git a/tests/UI/pages/BO/design/themeAndLogo/pagesConfiguration/index.ts b/tests/UI/pages/BO/design/themeAndLogo/pagesConfiguration/index.ts index ef65976776ed5..729e13b836834 100644 --- a/tests/UI/pages/BO/design/themeAndLogo/pagesConfiguration/index.ts +++ b/tests/UI/pages/BO/design/themeAndLogo/pagesConfiguration/index.ts @@ -1,8 +1,10 @@ // Import pages import themeAndLogoBasePage from '@pages/BO/design/themeAndLogo/themeAndLogo/themeAndLogoBasePage'; -// Import data -import ModuleData from '@data/faker/module'; +import { + // Import data + type FakerModule, +} from '@prestashop-core/ui-testing'; import {Page} from 'playwright'; @@ -71,7 +73,7 @@ class PagesConfigurationPage extends themeAndLogoBasePage { * @param action {string} Action install/uninstall/enable/disable/reset * @return {Promise} */ - async setActionInModule(page: Page, module: ModuleData, action: string): Promise { + async setActionInModule(page: Page, module: FakerModule, action: string): Promise { await this.closeGrowlMessage(page); if (await this.elementVisible(page, this.actionModuleButton(module.tag, action), 1000)) { diff --git a/tests/UI/pages/BO/international/currencies/add.ts b/tests/UI/pages/BO/international/currencies/add.ts index ae2a3d81c86e4..bfe6843d6a4a6 100644 --- a/tests/UI/pages/BO/international/currencies/add.ts +++ b/tests/UI/pages/BO/international/currencies/add.ts @@ -1,8 +1,11 @@ import LocalizationBasePage from '@pages/BO/international/localization/localizationBasePage'; -import type CurrencyData from '@data/faker/currency'; import {CurrencyFormat} from '@data/types/currency'; +import { + type FakerCurrency, +} from '@prestashop-core/ui-testing'; + import type {Page} from 'playwright'; /** @@ -117,10 +120,10 @@ class AddCurrency extends LocalizationBasePage { /** * Add official currency * @param page {Page} Browser tab - * @param currencyData {CurrencyData} Data to set on add currency form + * @param currencyData {FakerCurrency} Data to set on add currency form * @returns {Promise}, successful text message that appears */ - async addOfficialCurrency(page: Page, currencyData: CurrencyData): Promise { + async addOfficialCurrency(page: Page, currencyData: FakerCurrency): Promise { // Select currency await this.selectByValue(page, this.currencySelect, currencyData.isoCode); await this.waitForVisibleSelector(page, `${this.currencyLoadingModal}.show`); @@ -173,10 +176,10 @@ class AddCurrency extends LocalizationBasePage { /** * Create unofficial currency * @param page {Page} Browser tab - * @param currencyData {CurrencyData} Data to set on add currency form + * @param currencyData {FakerCurrency} Data to set on add currency form * @returns {Promise} */ - async createUnOfficialCurrency(page: Page, currencyData: CurrencyData): Promise { + async createUnOfficialCurrency(page: Page, currencyData: FakerCurrency): Promise { await this.setCheckedWithIcon(page, this.alternativeCurrencyCheckBox); await this.setValue(page, this.currencyNameInput(1), currencyData.name); await this.setValue(page, this.isoCodeInput, currencyData.isoCode); diff --git a/tests/UI/pages/BO/international/currencies/index.ts b/tests/UI/pages/BO/international/currencies/index.ts index b0839b072581c..c9cff38dbe99d 100644 --- a/tests/UI/pages/BO/international/currencies/index.ts +++ b/tests/UI/pages/BO/international/currencies/index.ts @@ -1,6 +1,8 @@ import LocalizationBasePage from '@pages/BO/international/localization/localizationBasePage'; -import CurrencyData from '@data/faker/currency'; +import { + FakerCurrency, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -257,10 +259,10 @@ class Currencies extends LocalizationBasePage { * Get currency row from table * @param page {Page} Browser tab * @param row {number} Row on table - * @returns {Promise} + * @returns {Promise} */ - async getCurrencyFromTable(page: Page, row: number): Promise { - return new CurrencyData({ + async getCurrencyFromTable(page: Page, row: number): Promise { + return new FakerCurrency({ name: await this.getTextColumnFromTableCurrency(page, row, 'name'), symbol: await this.getTextColumnFromTableCurrency(page, row, 'symbol'), isoCode: await this.getTextColumnFromTableCurrency(page, row, 'iso_code'), diff --git a/tests/UI/pages/BO/international/locations/add.ts b/tests/UI/pages/BO/international/locations/add.ts index 07fcc03327619..2af2815ed3946 100644 --- a/tests/UI/pages/BO/international/locations/add.ts +++ b/tests/UI/pages/BO/international/locations/add.ts @@ -1,6 +1,8 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type ZoneData from '@data/faker/zone'; +import { + type FakerZone, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -42,10 +44,10 @@ class AddZone extends BOBasePage { /** * Fill form for add/edit zone * @param page {Page} Browser tab - * @param zoneData {ZoneData} Data to set on new/edit zone page + * @param zoneData {FakerZone} Data to set on new/edit zone page * @returns {Promise} */ - async createEditZone(page: Page, zoneData: ZoneData): Promise { + async createEditZone(page: Page, zoneData: FakerZone): Promise { await this.setValue(page, this.nameInput, zoneData.name); await this.setChecked(page, this.statusToggle(zoneData.status ? 1 : 0)); diff --git a/tests/UI/pages/BO/international/locations/countries/add.ts b/tests/UI/pages/BO/international/locations/countries/add.ts index 04175e6fcfb4a..b318f89fee0df 100644 --- a/tests/UI/pages/BO/international/locations/countries/add.ts +++ b/tests/UI/pages/BO/international/locations/countries/add.ts @@ -1,6 +1,9 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type CountryData from '@data/faker/country'; +import { + // Import data + type FakerCountry, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -78,10 +81,10 @@ class AddCountry extends BOBasePage { /** * Fill form for add/edit country * @param page {Page} Browser tab - * @param countryData {CountryData} Data to set on new country form + * @param countryData {FakerCountry} Data to set on new country form * @returns {Promise} */ - async createEditCountry(page: Page, countryData: CountryData): Promise { + async createEditCountry(page: Page, countryData: FakerCountry): Promise { await this.setValue(page, this.nameInputEn, countryData.name); await this.setValue(page, this.isoCodeInput, countryData.isoCode); await this.setValue(page, this.callPrefixInput, countryData.callPrefix.toString()); diff --git a/tests/UI/pages/BO/international/locations/states/add.ts b/tests/UI/pages/BO/international/locations/states/add.ts index d9491d57e7368..599ab4e1c429e 100644 --- a/tests/UI/pages/BO/international/locations/states/add.ts +++ b/tests/UI/pages/BO/international/locations/states/add.ts @@ -1,6 +1,8 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type StateData from '@data/faker/state'; +import { + type FakerState, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -51,10 +53,10 @@ class AddState extends BOBasePage { /** * Fill form for add/edit state * @param page {Page} Browser tab - * @param stateData {StateData} Data to set on new/edit state form + * @param stateData {FakerState} Data to set on new/edit state form * @returns {Promise} */ - async createEditState(page: Page, stateData: StateData): Promise { + async createEditState(page: Page, stateData: FakerState): Promise { // Fill form await this.setValue(page, this.nameInput, stateData.name); await this.setValue(page, this.isoCodeInput, stateData.isoCode); diff --git a/tests/UI/pages/BO/international/taxes/add.ts b/tests/UI/pages/BO/international/taxes/add.ts index 70788733e93d0..57cebd495b557 100644 --- a/tests/UI/pages/BO/international/taxes/add.ts +++ b/tests/UI/pages/BO/international/taxes/add.ts @@ -1,6 +1,8 @@ import BOBasePage from '@pages/BO/BObasePage'; -import TaxData from '@data/faker/tax'; +import { + FakerTax, +} from '@prestashop-core/ui-testing'; import {Page} from 'playwright'; @@ -75,10 +77,10 @@ class AddTax extends BOBasePage { /** * Fill form for add/edit tax * @param page {Page} Browser tab - * @param taxData {TaxData} Data to set on new/edit tax page + * @param taxData {FakerTax} Data to set on new/edit tax page * @returns {Promise} */ - async createEditTax(page: Page, taxData: TaxData): Promise { + async createEditTax(page: Page, taxData: FakerTax): Promise { await this.changeInputLanguage(page, 'en'); await this.setValue(page, this.nameEnInput, taxData.name); await this.changeInputLanguage(page, 'fr'); diff --git a/tests/UI/pages/BO/international/taxes/taxRules/add.ts b/tests/UI/pages/BO/international/taxes/taxRules/add.ts index 1eeb424577d2b..b97e995174402 100644 --- a/tests/UI/pages/BO/international/taxes/taxRules/add.ts +++ b/tests/UI/pages/BO/international/taxes/taxRules/add.ts @@ -1,8 +1,11 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type TaxRuleData from '@data/faker/taxRule'; import type TaxRulesGroupData from '@data/faker/taxRulesGroup'; +import { + type FakerTaxRule, +} from '@prestashop-core/ui-testing'; + import type {Page} from 'playwright'; /** @@ -88,10 +91,10 @@ class AddTaxRules extends BOBasePage { /** * Fill form for add/edit tax rules group * @param page {Page} Browser tab - * @param taxRuleData {TaxRuleData} Data to set on new/edit tax rule data + * @param taxRuleData {FakerTaxRule} Data to set on new/edit tax rule data * @returns {Promise} */ - async createEditTaxRules(page: Page, taxRuleData: TaxRuleData): Promise { + async createEditTaxRules(page: Page, taxRuleData: FakerTaxRule): Promise { await this.selectByVisibleText(page, this.countrySelect, taxRuleData.country); await this.selectByVisibleText(page, this.behaviourSelect, taxRuleData.behaviour); await this.selectByVisibleText(page, this.taxSelect, taxRuleData.name); diff --git a/tests/UI/pages/BO/modules/blockwishlist/index.ts b/tests/UI/pages/BO/modules/blockwishlist/index.ts deleted file mode 100644 index 20906c1c14b2d..0000000000000 --- a/tests/UI/pages/BO/modules/blockwishlist/index.ts +++ /dev/null @@ -1,52 +0,0 @@ -import {ModuleConfiguration} from '@pages/BO/modules/moduleConfiguration'; - -import type {Page} from 'playwright'; - -/** - * Module configuration page for module : blockwishlist, contains selectors and functions for the page - * @class - * @extends ModuleConfiguration - */ -class Blockwishlist extends ModuleConfiguration { - public readonly pageTitle: string; - - private readonly headTabs: string; - - private readonly headTab: string; - - private readonly headTabNamed: (name: string) => string; - - /** - * @constructs - */ - constructor() { - super(); - - this.pageTitle = `Configuration • ${global.INSTALL.SHOP_NAME}`; - - // Selectors - this.headTabs = '#head_tabs'; - this.headTab = `${this.headTabs} .nav-item`; - this.headTabNamed = (name: string) => `${this.headTab} #subtab-Wishlist${name}AdminController`; - } - - // Methods - /** - * @param page {Page} - * @returns Promise - */ - async goToStatisticsTab(page: Page): Promise { - await this.clickAndWaitForURL(page, this.headTabNamed('Statistics')); - } - - /** - * @param page {Page} - * @param name {'Configuration'|'Statistics'} - * @returns Promise - */ - async isTabActive(page: Page, name: 'Configuration'|'Statistics'): Promise { - return this.elementVisible(page, `${this.headTabNamed(name)}.active.current`, 1000); - } -} - -export default new Blockwishlist(); diff --git a/tests/UI/pages/BO/modules/blockwishlist/statistics.ts b/tests/UI/pages/BO/modules/blockwishlist/statistics.ts deleted file mode 100644 index bfdcc53502b86..0000000000000 --- a/tests/UI/pages/BO/modules/blockwishlist/statistics.ts +++ /dev/null @@ -1,58 +0,0 @@ -import {ModuleConfiguration} from '@pages/BO/modules/moduleConfiguration'; - -import type {Page} from 'playwright'; - -/** - * Module configuration page for module : blockwishlist, contains selectors and functions for the page - * @class - * @extends ModuleConfiguration - */ -class BlockwishlistStatistics extends ModuleConfiguration { - public readonly pageTitle: string; - - private readonly rowTopBar: string; - - private readonly refreshStatsButton: string; - - private readonly gridTable: string; - - private readonly gridTableBody: string; - - private readonly gridTableEmptyRow: string; - - /** - * @constructs - */ - constructor() { - super(); - - this.pageTitle = `Statistics • ${global.INSTALL.SHOP_NAME}`; - - // Selectors - this.rowTopBar = '.row.wishlist-stats-topbar'; - this.refreshStatsButton = `${this.rowTopBar} button.js-refresh`; - this.gridTable = '#statistics_all_time_grid_table'; - this.gridTableBody = `${this.gridTable} tbody`; - this.gridTableEmptyRow = `${this.gridTableBody} tr.empty_row`; - } - - // Methods - /** - * @param page {Page} - * @returns Promise - */ - async getTextForEmptyTable(page: Page): Promise { - return this.getTextContent(page, this.gridTableEmptyRow); - } - - /** - * @param page {Page} - * @returns Promise - */ - async refreshStatistics(page: Page): Promise { - await page.locator(this.refreshStatsButton).click(); - await page.waitForTimeout(2000); - } -} - -export default new BlockwishlistStatistics(); diff --git a/tests/UI/pages/BO/modules/moduleManager/index.ts b/tests/UI/pages/BO/modules/moduleManager/index.ts index a3195016b3d6f..114ba40cceb10 100644 --- a/tests/UI/pages/BO/modules/moduleManager/index.ts +++ b/tests/UI/pages/BO/modules/moduleManager/index.ts @@ -1,6 +1,9 @@ import BOBasePage from '@pages/BO/BObasePage'; -import ModuleData from '@data/faker/module'; +import { + // Import data + type FakerModule, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -225,10 +228,10 @@ class ModuleManager extends BOBasePage { /** * Search Module in Page module Catalog * @param page {Page} Browser tab - * @param module {ModuleData} Tag of the Module + * @param module {FakerModule} Tag of the Module * @return {Promise} */ - async searchModule(page: Page, module: ModuleData): Promise { + async searchModule(page: Page, module: FakerModule): Promise { await this.reloadPage(page); await page.locator(this.searchModuleTagInput).fill(module.tag); await page.locator(this.searchModuleButton).click(); @@ -239,20 +242,20 @@ class ModuleManager extends BOBasePage { /** * Return if the module is visible * @param page {Page} Browser tab - * @param module {ModuleData} Tag of the Module + * @param module {FakerModule} Tag of the Module * @return {Promise} */ - async isModuleVisible(page: Page, module: ModuleData): Promise { + async isModuleVisible(page: Page, module: FakerModule): Promise { return this.elementVisible(page, this.moduleBlock(module.tag), 10000); } /** * Get module name * @param page {Page} Browser tab - * @param module {ModuleData} Tag of the Module + * @param module {FakerModule} Tag of the Module * @return {Promise} */ - async getModuleName(page: Page, module: ModuleData): Promise { + async getModuleName(page: Page, module: FakerModule): Promise { return this.getAttributeContent(page, `${this.moduleBlock(module.tag)} [data-original-title]`, 'data-original-title'); } @@ -409,7 +412,7 @@ class ModuleManager extends BOBasePage { /** * Uninstall/install/enable/disable/reset module * @param page {Page} Browser tab - * @param module {ModuleData} Module data to install/uninstall + * @param module {FakerModule} Module data to install/uninstall * @param action {string} Action install/uninstall/enable/disable/reset * @param cancel {boolean} Cancel the action * @param forceDeletion {boolean} Delete module folder after uninstall @@ -417,7 +420,7 @@ class ModuleManager extends BOBasePage { */ async setActionInModule( page: Page, - module: ModuleData, + module: FakerModule, action: string, cancel: boolean = false, forceDeletion: boolean = false, @@ -453,9 +456,9 @@ class ModuleManager extends BOBasePage { /** Returns the main action module action * @param page {Page} Browser tab - * @param module {ModuleData} Module data + * @param module {FakerModule} Module data */ - async getMainActionInModule(page: Page, module: ModuleData): Promise { + async getMainActionInModule(page: Page, module: FakerModule): Promise { const actions: string[] = [ 'enable', 'disable', @@ -477,11 +480,11 @@ class ModuleManager extends BOBasePage { /** * Returns if the action module modal is visible * @param page {Page} Browser tab - * @param module {ModuleData} Module data to install/uninstall + * @param module {FakerModule} Module data to install/uninstall * @param action {string} Action install/uninstall/enable/disable/reset * @return {Promise} */ - async isModalActionVisible(page: Page, module: ModuleData, action: string): Promise { + async isModalActionVisible(page: Page, module: FakerModule, action: string): Promise { return this.elementVisible(page, this.modalConfirmAction(module.tag, action)); } diff --git a/tests/UI/pages/BO/orders/add.ts b/tests/UI/pages/BO/orders/add.ts index 4aeaf5e149b14..2313421ffc91f 100644 --- a/tests/UI/pages/BO/orders/add.ts +++ b/tests/UI/pages/BO/orders/add.ts @@ -3,9 +3,13 @@ import BOBasePage from '@pages/BO/BObasePage'; import addCustomerPage from '@pages/BO/customers/add'; // Import data -import type CustomerData from '@data/faker/customer'; import type ProductData from '@data/faker/product'; -import type OrderStatusData from '@data/faker/orderStatus'; + +import { + // Import data + type FakerCustomer, + type FakerOrderStatus, +} from '@prestashop-core/ui-testing'; import type {Frame, Page} from 'playwright'; import OrderData from '@data/faker/order'; @@ -412,14 +416,14 @@ class AddOrder extends BOBasePage { /** * Click on add new customer and new customer iFrame * @param page {Page} Browser tab - * @param customerData {CustomerData} Customer data fake object + * @param customerData {FakerCustomer} Customer data fake object * @returns {Promise} */ - async addNewCustomer(page: Page, customerData: CustomerData): Promise { + async addNewCustomer(page: Page, customerData: FakerCustomer): Promise { await page.locator(this.addCustomerLink).click(); await this.waitForVisibleSelector(page, this.iframe); - const customerFrame = await page.frame({url: /sell\/customers\/new/gmi}); + const customerFrame = page.frame({url: /sell\/customers\/new/gmi}); if (!customerFrame) { throw new Error('The customerFrame doesn\'t exist!'); @@ -1185,10 +1189,10 @@ class AddOrder extends BOBasePage { /** * Set order status * @param page {Page} Browser tab - * @param orderStatus {OrderStatusData} Order status to choose + * @param orderStatus {FakerOrderStatus} Order status to choose * @returns {Promise} */ - async setOrderStatus(page: Page, orderStatus: OrderStatusData): Promise { + async setOrderStatus(page: Page, orderStatus: FakerOrderStatus): Promise { await this.selectByVisibleText(page, this.orderStatusSelect, orderStatus.name); } @@ -1212,10 +1216,10 @@ class AddOrder extends BOBasePage { * Set summary block * @param page {Page} Browser tab * @param paymentMethodModuleName {string} Payment method to choose - * @param orderStatus {OrderStatusData} Order status to choose + * @param orderStatus {FakerOrderStatus} Order status to choose * @returns {Promise} */ - async setSummaryAndCreateOrder(page: Page, paymentMethodModuleName: string, orderStatus: OrderStatusData): Promise { + async setSummaryAndCreateOrder(page: Page, paymentMethodModuleName: string, orderStatus: FakerOrderStatus): Promise { await this.setPaymentMethod(page, paymentMethodModuleName); await this.setOrderStatus(page, orderStatus); await this.clickOnCreateOrderButton(page); diff --git a/tests/UI/pages/BO/orders/index.ts b/tests/UI/pages/BO/orders/index.ts index 21047f60849e8..be2e70d87ef19 100644 --- a/tests/UI/pages/BO/orders/index.ts +++ b/tests/UI/pages/BO/orders/index.ts @@ -1,6 +1,8 @@ import BOBasePage from '@pages/BO/BObasePage'; -import type OrderStatusData from '@data/faker/orderStatus'; +import { + type FakerOrderStatus, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -407,10 +409,10 @@ class Order extends BOBasePage { * Set order status * @param page {Page} Browser tab * @param row {number} Order row in table - * @param status {OrderStatusData} Order status on table + * @param status {FakerOrderStatus} Order status on table * @returns {Promise} */ - async setOrderStatus(page: Page, row: number, status: OrderStatusData): Promise { + async setOrderStatus(page: Page, row: number, status: FakerOrderStatus): Promise { await Promise.all([ page.locator(this.updateStatusInTableButton(row)).click(), this.waitForVisibleSelector(page, `${this.updateStatusInTableDropdown(row)}.show`), diff --git a/tests/UI/pages/BO/orders/view/customerBlock.ts b/tests/UI/pages/BO/orders/view/customerBlock.ts index dab726af28758..9686ca07be9ad 100644 --- a/tests/UI/pages/BO/orders/view/customerBlock.ts +++ b/tests/UI/pages/BO/orders/view/customerBlock.ts @@ -1,8 +1,10 @@ import addAddressPage from '@pages/BO/customers/addresses/add'; import {ViewOrderBasePage} from '@pages/BO/orders/view/viewOrderBasePage'; -// Import data -import AddressData from '@data/faker/address'; +import { + // Import data + FakerAddress, +} from '@prestashop-core/ui-testing'; import type {Frame, Page} from 'playwright'; /** @@ -172,7 +174,7 @@ class CustomerBlock extends ViewOrderBasePage { * @param addressData {AddressData} Shipping address data to edit * @returns {Promise} */ - async editExistingShippingAddress(page: Page, addressData: AddressData): Promise { + async editExistingShippingAddress(page: Page, addressData: FakerAddress): Promise { await this.waitForSelectorAndClick(page, this.shippingAddressToolTipLink); await this.waitForSelectorAndClick(page, this.editShippingAddressButton); @@ -209,7 +211,7 @@ class CustomerBlock extends ViewOrderBasePage { * @param addressData {AddressData} Invoice address data to edit * @returns {Promise} */ - async editExistingInvoiceAddress(page: Page, addressData: AddressData): Promise { + async editExistingInvoiceAddress(page: Page, addressData: FakerAddress): Promise { await this.waitForSelectorAndClick(page, this.invoiceAddressToolTipLink); await this.waitForSelectorAndClick(page, this.editInvoiceAddressButton); diff --git a/tests/UI/pages/BO/shipping/carriers/add.ts b/tests/UI/pages/BO/shipping/carriers/add.ts index 6f2596085acb9..9aff0c48796da 100644 --- a/tests/UI/pages/BO/shipping/carriers/add.ts +++ b/tests/UI/pages/BO/shipping/carriers/add.ts @@ -1,8 +1,10 @@ // Import BO pages import BOBasePage from '@pages/BO/BObasePage'; -// Import data -import CarrierData from '@data/faker/carrier'; +import { + // Import data + FakerCarrier, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -115,10 +117,10 @@ class AddCarrier extends BOBasePage { /** * Fill carrier form in create or edit page and save * @param page {Page} Browser tab - * @param carrierData {CarrierData} Carrier information + * @param carrierData {FakerCarrier} Carrier information * @return {Promise} */ - async createEditCarrier(page: Page, carrierData: CarrierData): Promise { + async createEditCarrier(page: Page, carrierData: FakerCarrier): Promise { // Set general settings await this.setValue(page, this.nameInput, carrierData.name); await this.setValue(page, this.transitTimeInput, carrierData.transitName); diff --git a/tests/UI/pages/BO/shipping/preferences/index.ts b/tests/UI/pages/BO/shipping/preferences/index.ts index ac0533414c46f..289ab86af1ef1 100644 --- a/tests/UI/pages/BO/shipping/preferences/index.ts +++ b/tests/UI/pages/BO/shipping/preferences/index.ts @@ -1,7 +1,10 @@ import BOBasePage from '@pages/BO/BObasePage'; import type {Page} from 'playwright'; -import CarrierData from '@data/faker/carrier'; +import { + // Import data + FakerCarrier, +} from '@prestashop-core/ui-testing'; class Preferences extends BOBasePage { public readonly pageTitle: string; @@ -62,10 +65,10 @@ class Preferences extends BOBasePage { /** * Set default carrier in carrier options form * @param page {Page} Browser tab - * @param carrier {CarrierData} List of carriers + * @param carrier {FakerCarrier} List of carriers * @return {Promise} */ - async setDefaultCarrier(page: Page, carrier: CarrierData): Promise { + async setDefaultCarrier(page: Page, carrier: FakerCarrier): Promise { await this.selectByVisibleText( page, this.defaultCarrierSelect, diff --git a/tests/UI/pages/BO/shopParameters/customerSettings/groups/add.ts b/tests/UI/pages/BO/shopParameters/customerSettings/groups/add.ts index ed72898d308bd..0a11607f6be9e 100644 --- a/tests/UI/pages/BO/shopParameters/customerSettings/groups/add.ts +++ b/tests/UI/pages/BO/shopParameters/customerSettings/groups/add.ts @@ -1,7 +1,11 @@ import BOBasePage from '@pages/BO/BObasePage'; +import { + // Import data + type FakerGroup, +} from '@prestashop-core/ui-testing'; + import type {Page} from 'playwright'; -import GroupData from '@data/faker/group'; /** * Add group page, contains functions that can be used on the page @@ -81,10 +85,10 @@ class AddGroup extends BOBasePage { /** * Fill group form and get successful message * @param page {Page} Browser tab - * @param groupData {GroupData} Data to set on create/edit form + * @param groupData {FakerGroup} Data to set on create/edit form * @return {Promise} */ - async createEditGroup(page: Page, groupData: GroupData): Promise { + async createEditGroup(page: Page, groupData: FakerGroup): Promise { await this.changeLanguage(page, 1); await this.setValue(page, this.nameInput(1), groupData.name); diff --git a/tests/UI/pages/BO/shopParameters/customerSettings/titles/add.ts b/tests/UI/pages/BO/shopParameters/customerSettings/titles/add.ts index bf5e5f7c63404..f92cbc705a173 100644 --- a/tests/UI/pages/BO/shopParameters/customerSettings/titles/add.ts +++ b/tests/UI/pages/BO/shopParameters/customerSettings/titles/add.ts @@ -1,8 +1,9 @@ // Import pages import BOBasePage from '@pages/BO/BObasePage'; -// Import data -import TitleData from '@data/faker/title'; +import { + type FakerTitle, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -86,10 +87,10 @@ class AddTitle extends BOBasePage { /** * Fill title form and get successful message * @param page {Page} Browser tab - * @param titleData {TitleData} Data to set on create/edit title form + * @param titleData {FakerTitle} Data to set on create/edit title form * @return {Promise} */ - async createEditTitle(page: Page, titleData: TitleData): Promise { + async createEditTitle(page: Page, titleData: FakerTitle): Promise { const genders: string[] = ['Male', 'Female', 'Neutral']; await this.changeLanguage(page, 'en'); diff --git a/tests/UI/pages/BO/shopParameters/orderSettings/statuses/add.ts b/tests/UI/pages/BO/shopParameters/orderSettings/statuses/add.ts index ede7179bc1c8b..2cdba696188e5 100644 --- a/tests/UI/pages/BO/shopParameters/orderSettings/statuses/add.ts +++ b/tests/UI/pages/BO/shopParameters/orderSettings/statuses/add.ts @@ -1,6 +1,8 @@ import BOBasePage from '@pages/BO/BObasePage'; -import OrderStatusData from '@data/faker/orderStatus'; +import { + type FakerOrderStatus, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -68,10 +70,10 @@ class AddOrderStatus extends BOBasePage { /** * Fill order status form in create or edit page and save * @param page {Page} Browser tab - * @param orderStatusData {OrderStatusData} Data to set on order status form + * @param orderStatusData {FakerOrderStatus} Data to set on order status form * @return {Promise} */ - async setOrderStatus(page: Page, orderStatusData: OrderStatusData): Promise { + async setOrderStatus(page: Page, orderStatusData: FakerOrderStatus): Promise { await this.setValue(page, this.nameInput, orderStatusData.name); // Set color diff --git a/tests/UI/pages/FO/classic/checkout/index.ts b/tests/UI/pages/FO/classic/checkout/index.ts index cbfa76c1f39d8..1db78a2a9ab3b 100644 --- a/tests/UI/pages/FO/classic/checkout/index.ts +++ b/tests/UI/pages/FO/classic/checkout/index.ts @@ -1,10 +1,12 @@ // Import pages import FOBasePage from '@pages/FO/FObasePage'; -// Import data -import AddressData from '@data/faker/address'; -import CustomerData from '@data/faker/customer'; -import CarrierData from '@data/faker/carrier'; +import { + // Import data + FakerAddress, + FakerCarrier, + FakerCustomer, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; import {ProductDetailsBasic} from '@data/types/product'; @@ -578,10 +580,10 @@ class CheckoutPage extends FOBasePage { /** * Fill personal information form and click on continue * @param page {Page} Browser tab - * @param customerData {CustomerData} Guest Customer's information to fill on form + * @param customerData {FakerCustomer} Guest Customer's information to fill on form * @return {Promise} */ - async setGuestPersonalInformation(page: Page, customerData: CustomerData): Promise { + async setGuestPersonalInformation(page: Page, customerData: FakerCustomer): Promise { await this.setChecked(page, this.checkoutGuestGenderInput(customerData.socialTitle === 'Mr.' ? 1 : 2)); await this.setValue(page, this.checkoutGuestFirstnameInput, customerData.firstName); @@ -722,7 +724,7 @@ class CheckoutPage extends FOBasePage { * @param address {AddressData} Address's information to fill form with * @returns {Promise} */ - async fillAddressForm(page: Page, address: AddressData): Promise { + async fillAddressForm(page: Page, address: FakerAddress): Promise { if (await this.elementVisible(page, this.addressStepAliasInput)) { await this.setValue(page, this.addressStepAliasInput, address.alias); } @@ -746,7 +748,7 @@ class CheckoutPage extends FOBasePage { * @param page {Page} Browser tab * @param invoiceAddress {AddressData} Address's information to fill form with */ - async setInvoiceAddress(page: Page, invoiceAddress: AddressData): Promise { + async setInvoiceAddress(page: Page, invoiceAddress: FakerAddress): Promise { await this.fillAddressForm(page, invoiceAddress); if (await this.elementVisible(page, this.addressStepContinueButton, 2000)) { @@ -765,7 +767,7 @@ class CheckoutPage extends FOBasePage { * @param invoiceAddress {AddressData|null} Address's information to add (for invoice) * @returns {Promise} */ - async setAddress(page: Page, deliveryAddress: AddressData, invoiceAddress: AddressData | null = null): Promise { + async setAddress(page: Page, deliveryAddress: FakerAddress, invoiceAddress: FakerAddress | null = null): Promise { // Set delivery address await this.fillAddressForm(page, deliveryAddress); @@ -986,10 +988,10 @@ class CheckoutPage extends FOBasePage { * @param page {Page} Browser tab * @param carrierID {number} The carrier row in list */ - async getCarrierData(page: Page, carrierID: number = 1): Promise { + async getCarrierData(page: Page, carrierID: number = 1): Promise { const priceText: string = await this.getTextContent(page, this.deliveryStepCarrierPrice(carrierID)); - return new CarrierData({ + return new FakerCarrier({ name: await this.getTextContent(page, this.deliveryStepCarrierName(carrierID)), delay: await this.getTextContent(page, this.deliveryStepCarrierDelay(carrierID)), price: parseFloat(priceText), diff --git a/tests/UI/pages/FO/classic/login/index.ts b/tests/UI/pages/FO/classic/login/index.ts index 75dcc3b1ea367..f951156f4b4ce 100644 --- a/tests/UI/pages/FO/classic/login/index.ts +++ b/tests/UI/pages/FO/classic/login/index.ts @@ -1,8 +1,10 @@ // Import pages import FOBasePage from '@pages/FO/FObasePage'; -// Import data -import type CustomerData from '@data/faker/customer'; +import { + // Import data + type FakerCustomer, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -63,11 +65,11 @@ class LoginPage extends FOBasePage { /** * Login in FO * @param page {Page} Browser tab - * @param customer {CustomerData} Customer's information (email and password) + * @param customer {FakerCustomer} Customer's information (email and password) * @param waitForNavigation {boolean} true to wait for navigation after the click on button * @return {Promise} */ - async customerLogin(page: Page, customer: CustomerData, waitForNavigation: boolean = true): Promise { + async customerLogin(page: Page, customer: FakerCustomer, waitForNavigation: boolean = true): Promise { await this.setValue(page, this.emailInput, customer.email); await this.setValue(page, this.passwordInput, customer.password); if (waitForNavigation) { diff --git a/tests/UI/pages/FO/classic/modal/blockCart.ts b/tests/UI/pages/FO/classic/modal/blockCart.ts index 695d6b50689c0..bc42d4f4750bb 100644 --- a/tests/UI/pages/FO/classic/modal/blockCart.ts +++ b/tests/UI/pages/FO/classic/modal/blockCart.ts @@ -2,9 +2,12 @@ import FOBasePage from '@pages/FO/FObasePage'; // Import data -import CartProductDetails from '@data/types/cart'; import {ProductAttribute} from '@data/types/product'; +import { + type CartProductDetails, +} from '@prestashop-core/ui-testing'; + import type {Page} from 'playwright'; /** diff --git a/tests/UI/pages/FO/classic/myAccount/add.ts b/tests/UI/pages/FO/classic/myAccount/add.ts index 121e06c7173ad..51a0b90addf4e 100644 --- a/tests/UI/pages/FO/classic/myAccount/add.ts +++ b/tests/UI/pages/FO/classic/myAccount/add.ts @@ -1,8 +1,10 @@ // Import FO pages import FOBasePage from '@pages/FO/FObasePage'; -// Import data -import CustomerData from '@data/faker/customer'; +import { + // Import data + type FakerCustomer, +} from '@prestashop-core/ui-testing'; import type {Page} from 'playwright'; @@ -84,10 +86,10 @@ class CreateAccountPage extends FOBasePage { /** * Create new customer account * @param page {Page} Browser tab - * @param customer {object} Customer's information (email and password) + * @param customer {FakerCustomer} Customer's information (email and password) * @returns {Promise} */ - async createAccount(page: Page, customer: CustomerData): Promise { + async createAccount(page: Page, customer: FakerCustomer): Promise { await this.waitForSelectorAndClick(page, this.genderRadioButton(customer.socialTitle === 'Mr.' ? 1 : 2)); await this.setValue(page, this.firstNameInput, customer.firstName); await this.setValue(page, this.lastNameInput, customer.lastName); diff --git a/tests/UI/pages/FO/classic/myAccount/addAddress.ts b/tests/UI/pages/FO/classic/myAccount/addAddress.ts index d714c0a45cfc6..66e40bc31b0fb 100644 --- a/tests/UI/pages/FO/classic/myAccount/addAddress.ts +++ b/tests/UI/pages/FO/classic/myAccount/addAddress.ts @@ -1,8 +1,12 @@ // Import pages import FOBasePage from '@pages/FO/FObasePage'; +import { + // Import data + FakerAddress, +} from '@prestashop-core/ui-testing'; + import type {Page} from 'playwright'; -import AddressData from '@data/faker/address'; /** * Add address page, contains functions that can be used on the page @@ -91,7 +95,7 @@ class AddAddressPage extends FOBasePage { * @param addressData {AddressData} Address's information to fill on form * @returns {Promise} */ - async setAddress(page: Page, addressData: AddressData): Promise { + async setAddress(page: Page, addressData: FakerAddress): Promise { // Set alias if added (optional) if (addressData.alias) { await this.setValue(page, this.aliasInput, addressData.alias); diff --git a/tests/UI/pages/commonPage.ts b/tests/UI/pages/commonPage.ts index 7ca1aff65657c..8503a27b6f18a 100755 --- a/tests/UI/pages/commonPage.ts +++ b/tests/UI/pages/commonPage.ts @@ -1,5 +1,8 @@ // Import data -import type {PageWaitForSelectorOptionsState, WaitForNavigationWaitUntil} from '@data/types/playwright'; +import { + type PageWaitForSelectorOptionsState, + type WaitForNavigationWaitUntil, +} from '@prestashop-core/ui-testing'; import type { BrowserContext, ElementHandle, JSHandle, FileChooser, Frame, Page, Locator,