diff --git a/src/data/faker/product.ts b/src/data/faker/product.ts index 6aeb1b7fd..0462258e2 100644 --- a/src/data/faker/product.ts +++ b/src/data/faker/product.ts @@ -134,12 +134,12 @@ export default class FakerProduct { public deliveryTime: string; /** - * Constructor for class FakerProduct - * @param productToCreate {Object} Could be used to force the value of some members - * @todo Replace taxRule & tax by FakerTax object - * @todo Rename price to priceTaxIncluded - * @todo Check if retailPrice & finalPrice can be removed - */ + * Constructor for class FakerProduct + * @param productToCreate {Object} Could be used to force the value of some members + * @todo Replace taxRule & tax by FakerTax object + * @todo Rename price to priceTaxIncluded + * @todo Check if retailPrice & finalPrice can be removed + */ constructor(productToCreate: ProductCreator = {}) { /** @type {number} ID of the product */ this.id = productToCreate.id || 0; diff --git a/src/data/types/product.ts b/src/data/types/product.ts index e18b79673..ef51a5fcb 100644 --- a/src/data/types/product.ts +++ b/src/data/types/product.ts @@ -87,6 +87,16 @@ type ProductFiles = { file: string, } +type ProductImageInformation = { + id: number, + isCover: boolean, + position: number, + caption: { + en: string, + fr: string + }, +}; + type ProductCombinationOptions = { reference: string impactOnPriceTExc: number @@ -198,16 +208,6 @@ type ProductImageUrls = { thumbImage: string }; -type ProductImageInformation = { - id: number, - isCover: boolean, - position: number, - caption: { - en: string, - fr: string - }, -}; - type ProductPackItem = { reference: string quantity: number @@ -266,8 +266,8 @@ export type { ProductDiscount, ProductFilterMinMax, ProductHeaderSummary, - ProductImageUrls, ProductImageInformation, + ProductImageUrls, ProductInformations, ProductOrderConfirmation, ProductPackItem, diff --git a/src/index.ts b/src/index.ts index b9fdafedd..a6b6c6dc4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -218,7 +218,7 @@ export {default as boProductsCreateTabDetailsPage} from '@pages/BO/catalog/produ export {default as boProductsCreateTabOptionsPage} from '@pages/BO/catalog/products/create/tabOptions'; export {default as boProductsCreateTabPackPage} from '@pages/BO/catalog/products/create/tabPack'; export {default as boProductsCreateTabPricingPage} from '@pages/BO/catalog/products/create/tabPricing'; -export {default as boProductsCreateTabSEOPage} from '@pages/BO/catalog/products/create/tabSeo'; +export {default as boProductsCreateTabSeoPage} from '@pages/BO/catalog/products/create/tabSeo'; export {default as boProductsCreateTabShippingPage} from '@pages/BO/catalog/products/create/tabShipping'; export {default as boProductsCreateTabStocksPage} from '@pages/BO/catalog/products/create/tabStocks'; export {default as boProductsCreateTabVirtualProductPage} from '@pages/BO/catalog/products/create/tabVirtualProduct'; diff --git a/src/interfaces/BO/catalog/products/create/tabDescription.ts b/src/interfaces/BO/catalog/products/create/tabDescription.ts index 2cbf26f1b..bb69ef6ed 100644 --- a/src/interfaces/BO/catalog/products/create/tabDescription.ts +++ b/src/interfaces/BO/catalog/products/create/tabDescription.ts @@ -1,9 +1,7 @@ -import {BOBasePagePageInterface} from '@interfaces/BO'; - -import type {Page} from '@playwright/test'; - import type FakerProduct from '@data/faker/product'; import type {ProductImageInformation} from '@data/types/product'; +import {BOBasePagePageInterface} from '@interfaces/BO'; +import type {Page} from '@playwright/test'; export interface BOProductsCreateTabDescriptionPageInterface extends BOBasePagePageInterface { addNewCategory(page: Page, categories: string[]): Promise; diff --git a/src/interfaces/BO/catalog/products/create/tabDetails.ts b/src/interfaces/BO/catalog/products/create/tabDetails.ts index c3e5ca19e..7d4f3746e 100644 --- a/src/interfaces/BO/catalog/products/create/tabDetails.ts +++ b/src/interfaces/BO/catalog/products/create/tabDetails.ts @@ -1,9 +1,7 @@ -import {BOBasePagePageInterface} from '@interfaces/BO'; - -import type {Page} from '@playwright/test'; - import type FakerProduct from '@data/faker/product'; import type {ProductFeatures} from '@data/types/product'; +import {BOBasePagePageInterface} from '@interfaces/BO'; +import type {Page} from '@playwright/test'; export interface BOProductsCreateTabDetailsPageInterface extends BOBasePagePageInterface { addNewCustomizations(page: Page, productData: FakerProduct): Promise; diff --git a/src/interfaces/BO/catalog/products/create/tabOptions.ts b/src/interfaces/BO/catalog/products/create/tabOptions.ts index 490fd7d57..23542d518 100644 --- a/src/interfaces/BO/catalog/products/create/tabOptions.ts +++ b/src/interfaces/BO/catalog/products/create/tabOptions.ts @@ -1,5 +1,4 @@ import {BOBasePagePageInterface} from '@interfaces/BO'; - import type {Page} from '@playwright/test'; export interface BOProductsCreateTabOptionsPageInterface extends BOBasePagePageInterface { diff --git a/src/interfaces/BO/catalog/products/create/tabPack.ts b/src/interfaces/BO/catalog/products/create/tabPack.ts index 91f710f5b..f2fc6fee0 100644 --- a/src/interfaces/BO/catalog/products/create/tabPack.ts +++ b/src/interfaces/BO/catalog/products/create/tabPack.ts @@ -1,13 +1,11 @@ -import {BOBasePagePageInterface} from '@interfaces/BO'; - -import type {Page} from '@playwright/test'; - import type { ProductPackInformation, ProductPackItem, ProductPackOptions, ProductStockMovement, } from '@data/types/product'; +import {BOBasePagePageInterface} from '@interfaces/BO'; +import type {Page} from '@playwright/test'; export interface BOProductsCreateTabPackPageInterface extends BOBasePagePageInterface { addProductToPack(page: Page, product: string, quantity: number): Promise; diff --git a/src/interfaces/BO/catalog/products/create/tabPricing.ts b/src/interfaces/BO/catalog/products/create/tabPricing.ts index a9936ae2d..220d33293 100644 --- a/src/interfaces/BO/catalog/products/create/tabPricing.ts +++ b/src/interfaces/BO/catalog/products/create/tabPricing.ts @@ -1,9 +1,7 @@ -import {BOBasePagePageInterface} from '@interfaces/BO'; - -import type {Page} from '@playwright/test'; - import FakerProduct from '@data/faker/product'; import type {ProductSpecificPrice} from '@data/types/product'; +import {BOBasePagePageInterface} from '@interfaces/BO'; +import type {Page} from '@playwright/test'; export interface BOProductsCreateTabPricingPageInterface extends BOBasePagePageInterface { addEcoTax(page: Page, ecoTax: number): Promise diff --git a/src/interfaces/BO/catalog/products/create/tabSeo.ts b/src/interfaces/BO/catalog/products/create/tabSeo.ts index 06d86879b..e8a7b77de 100644 --- a/src/interfaces/BO/catalog/products/create/tabSeo.ts +++ b/src/interfaces/BO/catalog/products/create/tabSeo.ts @@ -1,5 +1,4 @@ import {BOBasePagePageInterface} from '@interfaces/BO'; - import type {Page} from '@playwright/test'; export interface BOProductsCreateTabSeoPageInterface extends BOBasePagePageInterface { diff --git a/src/interfaces/BO/catalog/products/create/tabShipping.ts b/src/interfaces/BO/catalog/products/create/tabShipping.ts index 7a5f9a047..020bbc145 100644 --- a/src/interfaces/BO/catalog/products/create/tabShipping.ts +++ b/src/interfaces/BO/catalog/products/create/tabShipping.ts @@ -1,9 +1,7 @@ +import type FakerProduct from '@data/faker/product'; import {BOBasePagePageInterface} from '@interfaces/BO'; - import type {Page} from '@playwright/test'; -import type FakerProduct from '@data/faker/product'; - export interface BOProductsCreateTabShippingPageInterface extends BOBasePagePageInterface { clickOnEditDeliveryTimeLink(page: Page): Promise; getValue(page: Page, inputName: string, languageId?: string): Promise; diff --git a/src/interfaces/BO/catalog/products/create/tabStocks.ts b/src/interfaces/BO/catalog/products/create/tabStocks.ts index 31b422e31..9c2ae2cd1 100644 --- a/src/interfaces/BO/catalog/products/create/tabStocks.ts +++ b/src/interfaces/BO/catalog/products/create/tabStocks.ts @@ -1,8 +1,6 @@ -import {BOBasePagePageInterface} from '@interfaces/BO'; - import type FakerProduct from '@data/faker/product'; import type {ProductStockMovement} from '@data/types/product'; - +import {BOBasePagePageInterface} from '@interfaces/BO'; import type {Page} from '@playwright/test'; export interface BOProductsCreateTabStocksPageInterface extends BOBasePagePageInterface { diff --git a/src/interfaces/BO/catalog/products/create/tabVirtualProduct.ts b/src/interfaces/BO/catalog/products/create/tabVirtualProduct.ts index 17ea1c4d9..902baa259 100644 --- a/src/interfaces/BO/catalog/products/create/tabVirtualProduct.ts +++ b/src/interfaces/BO/catalog/products/create/tabVirtualProduct.ts @@ -1,9 +1,7 @@ +import type FakerProduct from '@data/faker/product'; import {BOBasePagePageInterface} from '@interfaces/BO'; - import type {Page} from '@playwright/test'; -import type FakerProduct from '@data/faker/product'; - export interface BOProductsCreateTabVirtualProductPageInterface extends BOBasePagePageInterface { clickOnEditDefaultBehaviourLink(page: Page): Promise; getErrorMessageInDownloadFileInput(page: Page): Promise; diff --git a/src/interfaces/BO/catalog/products/index.ts b/src/interfaces/BO/catalog/products/index.ts index fcc0c8b49..f2b3feee0 100644 --- a/src/interfaces/BO/catalog/products/index.ts +++ b/src/interfaces/BO/catalog/products/index.ts @@ -1,21 +1,18 @@ -import {BOBasePagePageInterface} from '@interfaces/BO'; - -import type {Page} from '@playwright/test'; - -import {ProductFilterMinMax} from '@data/types/product'; import type FakerProduct from '@data/faker/product'; +import {type ProductFilterMinMax} from '@data/types/product'; +import {type BOBasePagePageInterface} from '@interfaces/BO'; +import {type Page} from '@playwright/test'; export interface BOProductsPageInterface extends BOBasePagePageInterface { - readonly alertDangerIDFilterValue: string; - readonly alertDangerPriceFilterValue: string; - readonly alertDangerQuantityFilterValue: string; - readonly modalCreateProduct: string; - readonly modalDialog: string; - readonly packOfProductsDescription: string; - readonly pageTitle: string; - readonly productWithCombinationsDescription: string; - readonly standardProductDescription: string; - readonly virtualProductDescription: string; + readonly alertDangerIDFilterValue: string; + readonly alertDangerPriceFilterValue: string; + readonly alertDangerQuantityFilterValue: string; + readonly modalCreateProduct: string; + readonly packOfProductsDescription: string; + readonly pageTitle: string; + readonly productWithCombinationsDescription: string; + readonly standardProductDescription: string; + readonly virtualProductDescription: string; bulkActionsProduct(page: Page, action: string): Promise; bulkSelectProducts(page: Page, products?: FakerProduct[]): Promise diff --git a/src/interfaces/FO/category/index.ts b/src/interfaces/FO/category/index.ts index bbca672ec..ddd458e98 100644 --- a/src/interfaces/FO/category/index.ts +++ b/src/interfaces/FO/category/index.ts @@ -37,7 +37,6 @@ export interface FoCategoryPageInterface extends FOBasePagePageInterface { hasSearchFilterType(page: Page, facetType: string, facetLabel?: string): Promise; isActiveFilterNotVisible(page: Page): Promise; isAddedToWishlist(page: Page, idxProduct: number): Promise; - isAddedToWishlist(page: Page, idxProduct: number): Promise; isCategoryPage(page: Page): Promise; isPagesListVisible(page: Page): Promise; isSearchFilterDropdown(page: Page, facetType: string, facetLabel?: string): Promise; diff --git a/src/interfaces/FO/product/index.ts b/src/interfaces/FO/product/index.ts index 2e661a7c3..0e98dfe90 100644 --- a/src/interfaces/FO/product/index.ts +++ b/src/interfaces/FO/product/index.ts @@ -3,7 +3,7 @@ import type { ProductAttribute, ProductDetailsBasic, ProductImageUrls, ProductInformations, } from '@data/types/product'; import {FOBasePagePageInterface} from '@interfaces/FO'; -import type {Page} from '@playwright/test'; +import {type Page} from '@playwright/test'; export interface FoProductPageInterface extends FOBasePagePageInterface { readonly messageAlertNotificationAlreadyRegistered:string; diff --git a/src/pages/BO/BOBasePage.ts b/src/pages/BO/BOBasePage.ts index b2185caa8..b512e7975 100644 --- a/src/pages/BO/BOBasePage.ts +++ b/src/pages/BO/BOBasePage.ts @@ -3,7 +3,7 @@ import {type BOBasePagePageInterface} from '@interfaces/BO'; import CommonPage from '@pages/commonPage'; import {Frame, Page} from '@playwright/test'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import type {PageFunction} from 'playwright-core/types/structs'; import semver from 'semver'; @@ -735,7 +735,7 @@ export default class BOBasePage extends CommonPage implements BOBasePagePageInte await this.scrollTo(page, linkSelector); await this.clickAndWaitForURL(page, linkSelector); - const shopVersion = testContext.getPSVersion(); + const shopVersion = utilsTest.getPSVersion(); let linkActiveClass: string = '-active'; // >= 1.7.8.0 @@ -1072,7 +1072,13 @@ export default class BOBasePage extends CommonPage implements BOBasePagePageInte * @return {Promise} */ async getGrowlMessageContent(page: Page, timeout: number = 10000): Promise { - return page.textContent(this.growlMessageBlock, {timeout}); + const psVersion = utilsTest.getPSVersion(); + let {growlMessageBlock} = this; + + if (semver.lt(psVersion, '8.0.0')) { + growlMessageBlock = `${this.growlDiv} .growl-message`; + } + return page.textContent(growlMessageBlock, {timeout}); } /** diff --git a/src/pages/BO/catalog/products/create/index.ts b/src/pages/BO/catalog/products/create/index.ts index b633f615d..96ed378df 100644 --- a/src/pages/BO/catalog/products/create/index.ts +++ b/src/pages/BO/catalog/products/create/index.ts @@ -1,8 +1,8 @@ import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): BOProductsCreatePageInterface { diff --git a/src/pages/BO/dashboard/index.ts b/src/pages/BO/dashboard/index.ts index aaf98b5de..531bf00fd 100644 --- a/src/pages/BO/dashboard/index.ts +++ b/src/pages/BO/dashboard/index.ts @@ -1,8 +1,8 @@ import type {DashboardPageInterface} from '@interfaces/BO/dashboard'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require */ function requirePage(): DashboardPageInterface { diff --git a/src/pages/BO/login/index.ts b/src/pages/BO/login/index.ts index d1a59619a..303cb24ce 100644 --- a/src/pages/BO/login/index.ts +++ b/src/pages/BO/login/index.ts @@ -1,8 +1,8 @@ import type {LoginPageInterface} from '@interfaces/BO/login'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): LoginPageInterface { diff --git a/src/pages/BO/modules/blockwishlist/index.ts b/src/pages/BO/modules/blockwishlist/index.ts index 1100e8374..404d8ad77 100644 --- a/src/pages/BO/modules/blockwishlist/index.ts +++ b/src/pages/BO/modules/blockwishlist/index.ts @@ -1,8 +1,8 @@ import type {ModuleBlockwishlistMainPageInterface} from '@interfaces/BO/modules/blockwishlist/index'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require */ function requirePage(): ModuleBlockwishlistMainPageInterface { diff --git a/src/pages/BO/modules/blockwishlist/statistics.ts b/src/pages/BO/modules/blockwishlist/statistics.ts index ed6634b3b..36375a4dc 100644 --- a/src/pages/BO/modules/blockwishlist/statistics.ts +++ b/src/pages/BO/modules/blockwishlist/statistics.ts @@ -1,8 +1,8 @@ import type {ModuleBlockwishlistStatisticsPageInterface} from '@interfaces/BO/modules/blockwishlist/statistics'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require */ function requirePage(): ModuleBlockwishlistStatisticsPageInterface { diff --git a/src/pages/BO/modules/moduleManager/uninstalledModules.ts b/src/pages/BO/modules/moduleManager/uninstalledModules.ts index 35b81d9ec..9fd80466d 100644 --- a/src/pages/BO/modules/moduleManager/uninstalledModules.ts +++ b/src/pages/BO/modules/moduleManager/uninstalledModules.ts @@ -1,8 +1,8 @@ import type {ModuleManagerUninstalledModulesPageInterface} from '@interfaces/BO/modules/moduleManager/uninstalledModules'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): ModuleManagerUninstalledModulesPageInterface { diff --git a/src/pages/BO/orders/index.ts b/src/pages/BO/orders/index.ts index 9b1119a66..7e64b1b44 100644 --- a/src/pages/BO/orders/index.ts +++ b/src/pages/BO/orders/index.ts @@ -1,8 +1,8 @@ import type {BOOrdersPageInterface} from '@interfaces/BO/orders'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): BOOrdersPageInterface { diff --git a/src/pages/FO/classic/cart/index.ts b/src/pages/FO/classic/cart/index.ts index d48bedbb5..c4b52661b 100644 --- a/src/pages/FO/classic/cart/index.ts +++ b/src/pages/FO/classic/cart/index.ts @@ -1,8 +1,8 @@ import type {FoCartPageInterface} from '@interfaces/FO/cart'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoCartPageInterface { diff --git a/src/pages/FO/classic/checkout/index.ts b/src/pages/FO/classic/checkout/index.ts index de61c0a99..9f38d37d4 100644 --- a/src/pages/FO/classic/checkout/index.ts +++ b/src/pages/FO/classic/checkout/index.ts @@ -1,8 +1,8 @@ import type {FoCheckoutPageInterface} from '@interfaces/FO/checkout'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoCheckoutPageInterface { diff --git a/src/pages/FO/classic/checkout/orderConfirmation.ts b/src/pages/FO/classic/checkout/orderConfirmation.ts index b0fce8241..0b4ab2f23 100644 --- a/src/pages/FO/classic/checkout/orderConfirmation.ts +++ b/src/pages/FO/classic/checkout/orderConfirmation.ts @@ -1,8 +1,8 @@ import type {FoCheckoutOrderConfirmationPageInterface} from '@interfaces/FO/checkout/orderConfirmation'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoCheckoutOrderConfirmationPageInterface { diff --git a/src/pages/FO/classic/home/index.ts b/src/pages/FO/classic/home/index.ts index 4727079f5..be4f7c67a 100644 --- a/src/pages/FO/classic/home/index.ts +++ b/src/pages/FO/classic/home/index.ts @@ -1,8 +1,8 @@ import type {FoHomePageInterface} from '@interfaces/FO/home'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoHomePageInterface { diff --git a/src/pages/FO/classic/login/index.ts b/src/pages/FO/classic/login/index.ts index e19b4bc05..a3785162e 100644 --- a/src/pages/FO/classic/login/index.ts +++ b/src/pages/FO/classic/login/index.ts @@ -1,8 +1,8 @@ import type {FoLoginPageInterface} from '@interfaces/FO/login'; -import testContext from '@utils/test'; +import utilsTest from '@utils/test'; import semver from 'semver'; -const psVersion = testContext.getPSVersion(); +const psVersion = utilsTest.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoLoginPageInterface { diff --git a/src/versions/develop/pages/BO/catalog/products/create/index.ts b/src/versions/develop/pages/BO/catalog/products/create/index.ts index 5e603a97d..3fb3e9a1a 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/index.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/index.ts @@ -1,8 +1,8 @@ +// Import pages import BOBasePage from '@pages/BO/BOBasePage'; - import productsPage from '@pages/BO/catalog/products'; -import virtualProductTab from '@pages/BO/catalog/products/create/tabVirtualProduct'; -import descriptionTab from '@pages/BO/catalog/products/create/tabDescription'; +import boProductsCreateTabVirtualProduct from '@pages/BO/catalog/products/create/tabVirtualProduct'; +import boProductsCreateTabDescriptionPage from '@pages/BO/catalog/products/create/tabDescription'; import detailsTab from '@pages/BO/catalog/products/create/tabDetails'; import stocksTab from '@pages/BO/catalog/products/create/tabStocks'; import pricingTab from '@pages/BO/catalog/products/create/tabPricing'; @@ -12,14 +12,14 @@ import type FakerProduct from '@data/faker/product'; import type {ProductHeaderSummary} from '@data/types/product'; import type {BOProductsCreatePageInterface} from '@interfaces/BO/catalog/products/create'; -import type {Frame, Page} from 'playwright'; +import type {Frame, Page} from '@playwright/test'; /** - * Create Product page, contains functions that can be used on the page + * Create Product V2 page, contains functions that can be used on the page * @class * @extends BOBasePage */ -class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface { +class CreateProductPage extends BOBasePage implements BOProductsCreatePageInterface { public readonly pageTitle: string; public readonly saveAndPublishButtonName: string; @@ -111,9 +111,9 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface private readonly modalConfirmTypeBtnSubmit: string; /** - * @constructs - * Setting up texts and selectors to use on create product page - */ + * @constructs + * Setting up texts and selectors to use on create product page + */ constructor() { super(); @@ -138,7 +138,7 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface this.productNameLanguageButton = `${this.productName}_dropdown`; this.productNameLanguageDropdown = `${this.productName} .dropdown .dropdown-menu`; this.productNameLanguageDropdownItem = (locale: string) => `${this.productNameLanguageDropdown} span` - + `[data-locale="${locale}"]`; + + `[data-locale="${locale}"]`; this.productTypePreview = '.product-type-preview'; this.productTypePreviewLabel = `${this.productTypePreview}-label`; this.productTypeLabel = '.product-type-preview-label'; @@ -148,7 +148,7 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface this.productHeaderQuantity = `${this.productHeaderSummary} div[data-role=quantity]`; this.productHeaderReferences = '.product-header-references'; this.productHeaderReference = (type: string) => `${this.productHeaderReferences} .product-reference` - + `[data-reference-type="${type}"] span`; + + `[data-reference-type="${type}"] span`; // Footer selectors this.footerProductDropDown = '#product_footer_actions_dropdown'; @@ -175,22 +175,22 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface // Modal : Switch Product Type this.modalSwitchType = '#switch-product-type-modal'; this.modalSwitchTypeBtnChoice = (productType: string) => `${this.modalSwitchType} button.product-type-choice` - + `[data-value="${productType}"]`; + + `[data-value="${productType}"]`; this.modalSwitchTypeBtnSubmit = `${this.modalSwitchType} .modal-footer button.btn-confirm-submit`; this.modalConfirmType = '#modal-confirm-product-type'; this.modalConfirmTypeBtnSubmit = `${this.modalConfirmType} .modal-footer button.btn-confirm-submit`; } /* - Methods - */ + Methods + */ /** - * Select stores - * @param page {Page} Browser tab - * @param storeID {number} Store ID to select - * @returns {Promise} - */ + * Select stores + * @param page {Page} Browser tab + * @param storeID {number} Store ID to select + * @returns {Promise} + */ async selectStores(page: Page, storeID: number): Promise { await this.waitForSelectorAndClick(page, this.selectStoresLink); @@ -201,11 +201,11 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Go to a tab - * @param page {Page} Browser tab - * @param tabName {'combinations'|'description'|'details'|'options'|'pricing'|'seo'|'shipping'|'stock'} Name of the tab - * @returns {Promise} - */ + * Go to a tab + * @param page {Page} Browser tab + * @param tabName {'combinations'|'description'|'details'|'options'|'pricing'|'seo'|'shipping'|'stock'} Name of the tab + * @returns {Promise} + */ async goToTab( page: Page, tabName: string, @@ -215,11 +215,11 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Is Tab active - * @param page {Page} Browser tab - * @param tabName {'combinations'|'description'|'details'|'options'|'pricing'|'seo'|'shipping'|'stock'} Name of the tab - * @returns {Promise} - */ + * Is Tab active + * @param page {Page} Browser tab + * @param tabName {'combinations'|'description'|'details'|'options'|'pricing'|'seo'|'shipping'|'stock'} Name of the tab + * @returns {Promise} + */ async isTabActive( page: Page, tabName: 'combinations' | 'description' | 'details' | 'options' | 'pricing' | 'seo' | 'shipping' | 'stock', @@ -228,11 +228,11 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Is Tab visible - * @param page {Page} Browser tab - * @param tabName {'combinations'|'description'|'details'|'options'|'pricing'|'seo'|'shipping'|'stock'} Name of the tab - * @returns {Promise} - */ + * Is Tab visible + * @param page {Page} Browser tab + * @param tabName {'combinations'|'description'|'details'|'options'|'pricing'|'seo'|'shipping'|'stock'} Name of the tab + * @returns {Promise} + */ async isTabVisible( page: Page, tabName: 'combinations' | 'description' | 'details' | 'options' | 'pricing' | 'seo' | 'shipping' | 'stock', @@ -241,10 +241,10 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Get product header summary - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get product header summary + * @param page {Page} Browser tab + * @returns {Promise} + */ async getProductHeaderSummary(page: Page): Promise { return { imageUrl: await this.getAttributeContent(page, this.productImageUrl, 'value'), @@ -270,19 +270,19 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Get product header summary - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get product header summary + * @param page {Page} Browser tab + * @returns {Promise} + */ async getProductID(page: Page): Promise { return parseInt(await this.getAttributeContent(page, this.formProductPage, 'data-product-id'), 10); } /** - * Return the product type - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Return the product type + * @param page {Page} Browser tab + * @returns {Promise} + */ async getProductType(page: Page): Promise { const typeLabel = await this.getTextContent(page, this.productTypePreviewLabel); @@ -301,11 +301,11 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Set product status - * @param page {Page} Browser tab - * @param status {boolean} The product status - * @returns {Promise} - */ + * Set product status + * @param page {Page} Browser tab + * @param status {boolean} The product status + * @returns {Promise} + */ async setProductStatus(page: Page, status: boolean): Promise { if (await this.getProductStatus(page) !== status) { await this.clickAndWaitForLoadState(page, this.productActiveSwitchButton); @@ -316,20 +316,20 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Apply changes to all stores - * @param page {Page} Browser tab - * @param status {boolean} True if we need to apply all changes - * @returns {Promise} - */ + * Apply changes to all stores + * @param page {Page} Browser tab + * @param status {boolean} True if we need to apply all changes + * @returns {Promise} + */ async applyChangesToAllStores(page: Page, status: boolean): Promise { await this.setChecked(page, this.modifyAllShopsNameSwitchButton, status, true); } /** - * Get product status - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get product status + * @param page {Page} Browser tab + * @returns {Promise} + */ async getProductStatus(page: Page): Promise { // Get value of the check input const inputValue = await this.getAttributeContent( @@ -350,7 +350,7 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface */ async setProduct(page: Page, productData: FakerProduct): Promise { // Set description - await descriptionTab.setProductDescription(page, productData); + await boProductsCreateTabDescriptionPage.setProductDescription(page, productData); // Set name await this.setProductName(page, productData.nameFR, 'fr'); await this.setProductName(page, productData.name, 'en'); @@ -361,7 +361,7 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface await detailsTab.setProductDetails(page, productData); if (productData.type === 'virtual') { - await virtualProductTab.setVirtualProduct(page, productData); + await boProductsCreateTabVirtualProduct.setVirtualProduct(page, productData); } else if (productData.type !== 'combinations') { await stocksTab.setProductStock(page, productData); } @@ -376,12 +376,12 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Set product name - * @param page {Page} Browser tab - * @param name {string} Name of the product - * @param locale {string} Locale - * @returns {Promise} - */ + * Set product name + * @param page {Page} Browser tab + * @param name {string} Name of the product + * @param locale {string} Locale + * @returns {Promise} + */ async setProductName(page: Page, name: string, locale: string = 'en'): Promise { await this.waitForSelectorAndClick(page, this.productNameLanguageButton); await this.waitForSelectorAndClick(page, this.productNameLanguageDropdownItem(locale)); @@ -393,10 +393,10 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Click on save product button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on save product button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnSaveProductButton(page: Page): Promise { await page.locator(this.saveProductButton).click(); await page.waitForLoadState(); @@ -414,19 +414,19 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Get save button name - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get save button name + * @param page {Page} Browser tab + * @returns {Promise} + */ async getSaveButtonName(page: Page): Promise { return this.getTextContent(page, this.saveProductButton); } /** - * Preview product in new tab - * @param page {Page} Browser tab - * @return {Promise} - */ + * Preview product in new tab + * @param page {Page} Browser tab + * @return {Promise} + */ async previewProduct(page: Page): Promise { await this.waitForSelectorAndClick(page, this.footerProductDropDown); const newPage = await this.openLinkWithTargetBlank(page, this.previewProductButton, 'body a'); @@ -439,33 +439,33 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Delete product - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Delete product + * @param page {Page} Browser tab + * @returns {Promise} + */ async deleteProduct(page: Page): Promise { await this.waitForSelectorAndClick(page, this.footerProductDropDown); await this.waitForSelectorAndClick(page, this.deleteProductButton); await this.waitForVisibleSelector(page, this.deleteProductFooterModal); await this.clickAndWaitForURL(page, this.deleteProductSubmitButton); - return this.getAlertSuccessBlockParagraphContent(page); + return productsPage.getAlertSuccessBlockParagraphContent(page); } /** - * Go to catalog page - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Go to catalog page + * @param page {Page} Browser tab + * @returns {Promise} + */ async goToCatalogPage(page: Page): Promise { await this.clickAndWaitForURL(page, this.goToCatalogButton); } /** - * Click on new product button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on new product button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnNewProductButton(page: Page): Promise { await this.waitForSelectorAndClick(page, this.footerProductDropDown); await this.waitForSelectorAndClick(page, this.newProductButton); @@ -474,10 +474,10 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Click on duplicate product button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on duplicate product button + * @param page {Page} Browser tab + * @returns {Promise} + */ async duplicateProduct(page: Page): Promise { await this.waitForSelectorAndClick(page, this.footerProductDropDown); await this.waitForSelectorAndClick(page, this.duplicateProductButton); @@ -488,11 +488,11 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Choose product type - * @param page {Page} Browser tab - * @param productType {string} Data to choose in product type - * @returns {Promise} - */ + * Choose product type + * @param page {Page} Browser tab + * @param productType {string} Data to choose in product type + * @returns {Promise} + */ async chooseProductType(page: Page, productType: string): Promise { const currentUrl: string = page.url(); @@ -502,11 +502,11 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Change product type - * @param page {Page} Browser tab - * @param productType {string} Data to choose in product type - * @returns {Promise} - */ + * Change product type + * @param page {Page} Browser tab + * @param productType {string} Data to choose in product type + * @returns {Promise} + */ async changeProductType(page: Page, productType: string): Promise { // Click on the type label await page.locator(this.productTypePreview).click(); @@ -523,29 +523,29 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } /** - * Is choose product iframe visible - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Is choose product iframe visible + * @param page {Page} Browser tab + * @returns {Promise} + */ async isChooseProductIframeVisible(page: Page): Promise { return !(await this.elementNotVisible(page, `${productsPage.modalCreateProduct} iframe`, 1000)); } /** - * Return the product name - * @param page {Page} Browser tab - * @param locale {string} Locale - * @returns {Promise} - */ + * Return the product name + * @param page {Page} Browser tab + * @param locale {string} Locale + * @returns {Promise} + */ async getProductName(page: Page, locale: string = 'en'): Promise { return this.getAttributeContent(page, this.productNameInput(locale), 'value'); } /** - * Get the error message when short description is too long - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get the error message when short description is too long + * @param page {Page} Browser tab + * @returns {Promise} + */ async getErrorMessageWhenSummaryIsTooLong(page: Page): Promise { await this.clickAndWaitForURL(page, this.saveProductButton); @@ -553,5 +553,5 @@ class CreateProduct extends BOBasePage implements BOProductsCreatePageInterface } } -const createProduct = new CreateProduct(); -export {createProduct, CreateProduct}; +const createProduct = new CreateProductPage(); +export {createProduct, CreateProductPage}; diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabCombinations.ts b/src/versions/develop/pages/BO/catalog/products/create/tabCombinations.ts index 36ead540b..6d2369be2 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabCombinations.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabCombinations.ts @@ -1,7 +1,4 @@ -import BOBasePage from '@pages/BO/BOBasePage'; - -// Import data -import type { +import { ProductAttributes, ProductCombinationBulk, ProductCombinationBulkRetailPrice, @@ -10,9 +7,9 @@ import type { ProductCombinationOptions, ProductStockMovement, } from '@data/types/product'; - -import type {Frame, Page} from 'playwright'; -import type {BOProductsCreateTabCombinationsPageInterface} from '@interfaces/BO/catalog/products/create/tabCombinations'; +import {BOProductsCreateTabCombinationsPageInterface} from '@interfaces/BO/catalog/products/create/tabCombinations'; +import BOBasePage from '@pages/BO/BOBasePage'; +import {expect, type Frame, type Page} from '@playwright/test'; /** * Combinations tab on product page, contains functions that can be used on the page @@ -203,9 +200,9 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati private readonly labelWhenOutOfStock: string; /** - * @constructs - * Setting up texts and selectors to use on combinations tab - */ + * @constructs + * Setting up texts and selectors to use on combinations tab + */ constructor() { super(); this.generateCombinationsMessage = (number: number) => `Generate ${number} combinations`; @@ -234,33 +231,33 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Bulk edit modal this.bulkEditModal = '#bulk-combination-form-modal'; this.bulkEditModalTitle = `${this.bulkEditModal} .modal-header .modal-title`; - // Bulk edit stocks + // Edit stocks this.bulkEditModalStocksButton = '#bulk_combination_stock_accordion_header h2 button'; this.bulkEditModalQuantitySwitchButton = (toEnable: number) => '#bulk_combination_stock_disabling_switch_delta_quantity_' - + `${toEnable}`; + + `${toEnable}`; this.bulkEditModalQuantityInput = '#bulk_combination_stock_delta_quantity_delta'; this.bulkEditModalMinimalQuantitySwitchButton = (toEnable: number) => '#bulk_combination_stock_disabling_switch_minimal' - + `_quantity_${toEnable}`; + + `_quantity_${toEnable}`; this.bulkEditModalMinimalQuantityInput = '#bulk_combination_stock_minimal_quantity'; this.bulkEditModalStockLocationSwitchButton = (toEnable: number) => '#bulk_combination_stock_disabling_switch_stock_' - + `location_${toEnable}`; + + `location_${toEnable}`; this.bulkEditModalStockLocationInput = '#bulk_combination_stock_stock_location'; this.bulkEditModalSaveButton = '#bulk-combination-form-modal div.modal-footer button.btn-confirm-submit'; // Edit retail price this.bulkEditModalRetailPriceButton = '#bulk_combination_price_accordion_header h2 button'; this.bulkEditModalCostPriceSwitchButton = (toEnable: number) => '#bulk_combination_price_disabling_switch_wholesale_' - + `price_${toEnable}`; + + `price_${toEnable}`; this.bulkEditModalCostPriceInput = '#bulk_combination_price_wholesale_price'; this.bulkEditModalImpactOnPriceTIncSwitchButton = (toEnable: number) => '#bulk_combination_price_disabling_switch_price_' - + `tax_excluded_${toEnable}`; + + `tax_excluded_${toEnable}`; this.bulkEditModalImpactOnPriceTIncInput = '#bulk_combination_price_price_tax_excluded'; this.bulkEditModalImpactOnWeightSwitchButton = (toEnable: number) => '#bulk_combination_price_disabling_switch_weight_' - + `${toEnable}`; + + `${toEnable}`; this.bulkEditModalImpactOnWeightInput = '#bulk_combination_price_weight'; - // Bulk edit specific references + // Edit specific references this.bulkEditModalSpecificReferences = '#bulk_combination_references_accordion_header h2 button'; this.bulkEditModalReferenceSwitchButton = (toEnable: number) => '#bulk_combination_references_disabling_switch_' - + `reference_${toEnable}`; + + `reference_${toEnable}`; this.bulkEditModalReferenceInput = '#bulk_combination_references_reference'; // Save progress modal this.bulkCombinationProgressModal = '#bulk-combination-progress-modal'; @@ -273,7 +270,7 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati this.filterBySizeDropDownMenu = `${this.filterBySizeBlock} div.dropdown-menu`; this.filterBySizeButton = `${this.filterBySizeBlock} [data-role=filter-by-size-btn]`; this.filterBySizeCheckboxButton = (id: number) => `${this.filterBySizeDropDownMenu} div:nth-child(${id}) ` - + '.md-checkbox-container'; + + '.md-checkbox-container'; this.clearFilterButton = 'div.combinations-filters button.combinations-filters-clear'; // Selectors of combinations table @@ -282,13 +279,13 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati this.combinationListTableColumn = (row: number, column: string) => `td input#combination_list_${row - 1}_${column}`; this.combinationListTableActionsDropDown = (row: number) => `#combination_list_${row - 1}_actions div a`; this.combinationListTableActionsColumn = (row: number, action: string) => `td button#combination_list_${row - 1}` - + `_actions_${action}`; + + `_actions_${action}`; this.combinationListTableSelectAllButton = '#bulk-all-selection-dropdown-button'; this.combinationListSelectAllDropDownMenu = '#bulk-all-selection-dropdown .dropdown-menu.show'; this.combinationListBulkSelectAll = '#bulk-all-selection-dropdown label[for="bulk-select-all"]'; this.combinationListBulkSelectAllInPage = '#bulk-select-all-in-page + i'; this.selectAllAttributeCheckboxButton = (row: number) => '#attributes-list-selector div.attributes-content' - + ` div:nth-child(${row}) div.attribute-group-header div`; + + ` div:nth-child(${row}) div.attribute-group-header div`; // Edit combination modal this.editCombinationIframe = '.combination-iframe'; @@ -304,11 +301,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati this.editCombinationCloseModal = `${this.editCombinationEditModal} div.modal-prevent-close div.modal.show`; this.editCombinationModalDiscardButton = `${this.editCombinationCloseModal} button.btn-primary`; this.combinationStockMovementsDate = (row: number) => `#combination_form_stock_quantities_stock_movements_${row - 1}_` - + 'date + span'; + + 'date + span'; this.combinationStockMovementsEmployeeName = (row: number) => '#combination_form_stock_quantities_stock_movements_' - + `${row - 1}_employee_name + span`; + + `${row - 1}_employee_name + span`; this.combinationStockMovements = (row: number) => `#combination_form_stock_quantities_stock_movements_${row - 1}` - + '_delta_quantity + span'; + + '_delta_quantity + span'; this.previousCombinationButton = `${this.editCombinationModal} button.btn-previous-combination`; this.nextCombinationButton = `${this.editCombinationModal} button.btn-next-combination`; @@ -320,7 +317,7 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Sort Selectors this.tableHead = `${this.combinationsListTable} thead`; this.sortColumnDiv = (columnNumber: number) => `${this.tableHead} th:nth-child(${columnNumber}) ` - + 'div.ps-sortable-column[data-sort-col-name]'; + + 'div.ps-sortable-column[data-sort-col-name]'; this.sortColumnSpanButton = (columnNumber: number) => `${this.sortColumnDiv(columnNumber)} span.ps-sort`; // Pagination selectors @@ -340,15 +337,15 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /* - Methods - */ + Methods + */ // Methods for create combinations /** - * Click on attributes & features link - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on attributes & features link + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnAttributesAndFeaturesLink(page: Page): Promise { await this.waitForSelectorAndClick(page, this.combinationsTabLink); @@ -356,10 +353,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on learn more button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on learn more button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnLearnMoreButton(page: Page): Promise { await this.waitForSelectorAndClick(page, this.combinationsTabLink); @@ -367,10 +364,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on generate combination button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on generate combination button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnGenerateCombinationButton(page: Page): Promise { if (await this.elementVisible(page, this.generateCombinationButton, 2000)) { await this.waitForSelectorAndClick(page, this.generateCombinationButton); @@ -382,10 +379,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on cancel button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on cancel button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnCancelButton(page: Page): Promise { await this.waitForSelectorAndClick(page, this.cancelButton); @@ -393,11 +390,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Add combination - * @param page {Page} Browser tab - * @param combination {string} Attribute to set - * @returns {Promise} - */ + * Add combination + * @param page {Page} Browser tab + * @param combination {string} Attribute to set + * @returns {Promise} + */ async selectAttribute(page: Page, combination: string): Promise { await page.locator(this.searchAttributesInput).fill(combination); await page.keyboard.press('ArrowDown'); @@ -430,11 +427,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Select all values - * @param page {Page} Browser tab - * @param attribute {string} - * @returns {Promise} - */ + * Select all values + * @param page {Page} Browser tab + * @param attribute {string} + * @returns {Promise} + */ async selectAllValues(page: Page, attribute: string): Promise { switch (attribute) { case 'size': @@ -453,10 +450,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Generate combinations - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Generate combinations + * @param page {Page} Browser tab + * @returns {Promise} + */ async generateCombinations(page: Page): Promise { await this.waitForSelectorAndClick(page, this.generateCombinationsButtonOnModal); @@ -464,10 +461,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Check if generation modal is closed - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Check if generation modal is closed + * @param page {Page} Browser tab + * @returns {Promise} + */ async generateCombinationModalIsClosed(page: Page): Promise { return this.elementNotVisible(page, this.generateCombinationsModal, 1000); } @@ -475,11 +472,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Methods for edit/delete combinations /** - * Click on edit icon - * @param page {Page} Browser tab - * @param row {number} Row in table - * @returns {Promise} - */ + * Click on edit icon + * @param page {Page} Browser tab + * @param row {number} Row in table + * @returns {Promise} + */ async clickOnEditIcon(page: Page, row: number = 1): Promise { await this.waitForSelectorAndClick(page, `${this.combinationListTableActionsColumn(row, 'edit')}`); @@ -487,12 +484,12 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Edit combination - * @param page {Page} Browser tab - * @param combinationData {ProductCombinationOptions} Data to set to edit combination - * @param row {number} Row in table - * @returns {Promise} - */ + * Edit combination + * @param page {Page} Browser tab + * @param combinationData {ProductCombinationOptions} Data to set to edit combination + * @param row {number} Row in table + * @returns {Promise} + */ async editCombination(page: Page, combinationData: ProductCombinationOptions, row: number = 1): Promise { await this.setValue(page, `${this.combinationListTableColumn(row, 'reference')}`, combinationData.reference); await this.setValue( @@ -510,12 +507,12 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Edit combination row quantity - * @param page {Page} Browser tab - * @param row {number} Row in table - * @param quantity {number} Quantity value to set in quantity input - * @returns {Promise} - */ + * Edit combination row quantity + * @param page {Page} Browser tab + * @param row {number} Row in table + * @param quantity {number} Quantity value to set in quantity input + * @returns {Promise} + */ async editCombinationRowQuantity(page: Page, row: number, quantity: number): Promise { await page.locator(`${this.combinationListTableColumn(row, 'delta_quantity_delta')}`).click(); await page.waitForTimeout(500); @@ -529,10 +526,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Save combinations form - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Save combinations form + * @param page {Page} Browser tab + * @returns {Promise} + */ async saveCombinationsForm(page: Page): Promise { await this.closeGrowlMessage(page); @@ -542,43 +539,44 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on next combination button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on next combination button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnNextCombinationButton(page: Page): Promise { await page.locator(this.nextCombinationButton).click(); await page.waitForTimeout(2000); } /** - * Click on previous combination button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on previous combination button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnPreviousCombinationButton(page: Page): Promise { await page.locator(this.previousCombinationButton).click(); await page.waitForTimeout(2000); } /** - * Get combination name from modal - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get combination name from modal + * @param page {Page} Browser tab + * @returns {Promise} + */ async getCombinationNameFromModal(page: Page): Promise { const combinationFrame: Frame | null = page.frame({url: /sell\/catalog\/products\/combinations/gmi}); + expect(combinationFrame).not.toBeNull(); return this.getTextContent(combinationFrame!, this.editCombinationNameValue); } /** - * Click on delete icon then (delete/cancel) - * @param page {Page} Browser tab - * @param action {string} Delete/cancel - * @param row {number} Row in table - * @returns {Promise} - */ + * Click on delete icon then (delete/cancel) + * @param page {Page} Browser tab + * @param action {string} Delete/cancel + * @param row {number} Row in table + * @returns {Promise} + */ async clickOnDeleteIcon(page: Page, action: string, row: number = 1): Promise { await this.waitForSelectorAndClick(page, this.combinationListTableActionsDropDown(row)); await this.waitForSelectorAndClick(page, `${this.combinationListTableActionsColumn(row, 'delete')}`); @@ -594,44 +592,47 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Edit combination from modal - * @param page {Page} Browser tab - * @param combinationData {ProductCombinationOptions} - * @returns {Promise} - */ + * Edit combination from modal + * @param page {Page} Browser tab + * @param combinationData {ProductCombinationOptions} + * @returns {Promise} + */ async editCombinationFromModal(page: Page, combinationData: ProductCombinationOptions): Promise { await page.waitForTimeout(2000); await this.waitForVisibleSelector(page, this.editCombinationIframe); const combinationFrame: Frame|null = page.frame({url: /sell\/catalog\/products\/combinations/gmi}); + expect(combinationFrame).not.toBeNull(); await this.setValue(combinationFrame!, this.editCombinationModalQuantityInput, combinationData.quantity); if (combinationData.minimalQuantity) { await this.setValue( - combinationFrame!, - this.editCombinationModalMinimalQuantityInput, - combinationData.minimalQuantity, + combinationFrame!, + this.editCombinationModalMinimalQuantityInput, + combinationData.minimalQuantity, ); } await this.setValue( - combinationFrame!, - this.editCombinationModalImpactOnPriceTExcInput, - combinationData.impactOnPriceTExc, + combinationFrame!, + this.editCombinationModalImpactOnPriceTExcInput, + combinationData.impactOnPriceTExc, ); await this.setValue(combinationFrame!, this.editCombinationModalReferenceInput, combinationData.reference); + await this.waitForSelectorAndClick(page, this.editCombinationModalSaveButton); return this.getAlertSuccessBlockParagraphContent(combinationFrame!); } /** - * Get recent stock movements - * @param page {Page} Browser tab - * @param row {number} Row in table - * @returns {Promise} - */ + * Get recent stock movements + * @param page {Page} Browser tab + * @param row {number} Row in table + * @returns {Promise} + */ async getRecentStockMovements(page: Page, row: number = 1): Promise { const combinationFrame: Frame|null = page.frame({url: /sell\/catalog\/products\/combinations/gmi}); + expect(combinationFrame).not.toBeNull(); return { dateTime: await this.getTextContent(combinationFrame!, this.combinationStockMovementsDate(row)), @@ -641,12 +642,13 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Close edit combination modal - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Close edit combination modal + * @param page {Page} Browser tab + * @returns {Promise} + */ async closeEditCombinationModal(page: Page): Promise { const combinationFrame: Frame|null = page.frame({url: /sell\/catalog\/products\/combinations/gmi}); + expect(combinationFrame).not.toBeNull(); await this.waitForSelectorAndClick(page, this.editCombinationModalCloseButton); if (await this.elementVisible(page, this.editCombinationModalDiscardButton, 2000)) { @@ -658,13 +660,13 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Methods for sort /** - * Sort table by clicking on column name - * @param page {Page} Browser tab - * @param sortBy {string} Column to sort with - * @param column {number} The number of columns - * @param sortDirection {string} Sort direction asc or desc - * @return {Promise} - */ + * Sort table by clicking on column name + * @param page {Page} Browser tab + * @param sortBy {string} Column to sort with + * @param column {number} The number of columns + * @param sortDirection {string} Sort direction asc or desc + * @return {Promise} + */ async sortTable(page: Page, sortBy: string, column: number, sortDirection: string = 'asc'): Promise { const sortColumnDiv = `${this.sortColumnDiv(column)}[data-sort-direction='${sortDirection}']`; const sortColumnSpanButton = this.sortColumnSpanButton(column); @@ -678,12 +680,12 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Get text column - * @param page {Frame|Page} Browser tab - * @param column {string} Column name to get text content - * @param row {number} Row on table - * @returns {Promise} - */ + * Get text column + * @param page {Frame|Page} Browser tab + * @param column {string} Column name to get text content + * @param row {number} Row on table + * @returns {Promise} + */ async getTextColumn(page: Page, column: string, row: number = 1): Promise { const selector: string = this.combinationListTableColumn(row, column); let text: string | null = ''; @@ -708,7 +710,7 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati text = await this.getTextContent(page, selector); break; default: - // Do nothing + // Do nothing } // click on search @@ -716,12 +718,12 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Get content from all rows - * @param page {Page} Browser tab - * @param numberOfCombinations {number} Number of combinations - * @param column {string} Column name to get all rows text content - * @return {Promise} - */ + * Get content from all rows + * @param page {Page} Browser tab + * @param numberOfCombinations {number} Number of combinations + * @param column {string} Column name to get all rows text content + * @return {Promise} + */ async getAllRowsColumnContent(page: Page, numberOfCombinations: number, column: string): Promise { const allRowsContentTable: string[] = []; @@ -735,10 +737,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Methods for pagination /** - * Get pagination label - * @param page {Page} Browser tab - * @return {Promise} - */ + * Get pagination label + * @param page {Page} Browser tab + * @return {Promise} + */ async getPaginationLabel(page: Page): Promise { await page.waitForTimeout(2000); @@ -746,11 +748,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Select pagination limit - * @param page {Page} Browser tab - * @param number {number} Value of pagination limit to select - * @returns {Promise} - */ + * Select pagination limit + * @param page {Page} Browser tab + * @param number {number} Value of pagination limit to select + * @returns {Promise} + */ async selectPaginationLimit(page: Page, number: number): Promise { await this.selectByVisibleText(page, this.paginationLimitSelect, number); @@ -758,10 +760,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on next - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on next + * @param page {Page} Browser tab + * @returns {Promise} + */ async paginationNext(page: Page): Promise { await this.waitForSelectorAndClick(page, this.paginationNextLink); @@ -769,10 +771,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on previous - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on previous + * @param page {Page} Browser tab + * @returns {Promise} + */ async paginationPrevious(page: Page): Promise { await this.waitForSelectorAndClick(page, this.paginationPreviousLink); @@ -781,10 +783,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Methods for filter combinations by size /** - * Get number of combinations displayed in list - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get number of combinations displayed in list + * @param page {Page} Browser tab + * @returns {Promise} + */ async getNumberOfCombinationsFromList(page: Page): Promise { const footerText = await this.getTextContent(page, this.paginationLabel); @@ -807,11 +809,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Filter combinations by color - * @param page {Page} Browser tab - * @param sizeID {number} Size number in list - * @returns {Promise} - */ + * Filter combinations by color + * @param page {Page} Browser tab + * @param sizeID {number} Size number in list + * @returns {Promise} + */ async filterCombinationsBySize(page: Page, sizeID: number): Promise { await this.waitForSelectorAndClick(page, this.filterBySizeButton); await this.waitForVisibleSelector(page, `${this.filterBySizeDropDownMenu}.show`); @@ -821,19 +823,19 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Get filter button name - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get filter button name + * @param page {Page} Browser tab + * @returns {Promise} + */ async getFilterBySizeButtonName(page: Page): Promise { return this.getTextContent(page, this.filterBySizeButton); } /** - * Clear filter - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Clear filter + * @param page {Page} Browser tab + * @returns {Promise} + */ async clearFilter(page: Page): Promise { await this.waitForSelectorAndClick(page, this.clearFilterButton); @@ -842,11 +844,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Methods for bulk actions /** - * Select All combinations - * @param page {Page} Browser tab - * @param allCombinations {boolean} true to select all combinations, false to select all in page - * @returns {Promise} - */ + * Select All combinations + * @param page {Page} Browser tab + * @param allCombinations {boolean} true to select all combinations, false to select all in page + * @returns {Promise} + */ async selectAllCombinations(page: Page, allCombinations: boolean = true): Promise { await this.waitForSelectorAndClick(page, this.combinationListTableSelectAllButton); @@ -859,10 +861,10 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on edit Combinations by bulk actions - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on edit Combinations by bulk actions + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnEditCombinationsByBulkActions(page: Page): Promise { await this.waitForSelectorAndClick(page, this.bulkActionsButton); await this.waitForSelectorAndClick(page, this.bulkEditButton); @@ -873,11 +875,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Bulk edit stock - * @param page {Frame|Page} Browser tab - * @param editStockData {ProductCombinationBulkStock} Data to set on bulk edit stock form - * @returns {Promise} - */ + * Bulk edit stock + * @param page {Frame|Page} Browser tab + * @param editStockData {ProductCombinationBulkStock} Data to set on bulk edit stock form + * @returns {Promise} + */ async bulkEditStock(page: Frame | Page, editStockData: ProductCombinationBulkStock): Promise { await this.waitForSelectorAndClick(page, this.bulkEditModalStocksButton); @@ -917,11 +919,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Bulk edit retail price - * @param page {Frame|Page} Browser tab - * @param editRetailPriceData {ProductCombinationBulkRetailPrice} Data to set on bulk edit retail price form - * @returns {Promise} - */ + * Bulk edit retail price + * @param page {Frame|Page} Browser tab + * @param editRetailPriceData {ProductCombinationBulkRetailPrice} Data to set on bulk edit retail price form + * @returns {Promise} + */ async bulkEditRetailPrice(page: Frame | Page, editRetailPriceData: ProductCombinationBulkRetailPrice): Promise { await this.waitForSelectorAndClick(page, this.bulkEditModalRetailPriceButton); @@ -950,11 +952,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Bulk edit references - * @param page {Frame|Page} Browser tab - * @param specificReferencesData {ProductCombinationBulkSpecificReferences} Data to set on specific references form - * @returns {Promise} - */ + * Bulk edit references + * @param page {Frame|Page} Browser tab + * @param specificReferencesData {ProductCombinationBulkSpecificReferences} Data to set on specific references form + * @returns {Promise} + */ async bulkEditSpecificPrice(page: Frame|Page, specificReferencesData: ProductCombinationBulkSpecificReferences): Promise { await this.waitForSelectorAndClick(page, this.bulkEditModalSpecificReferences); @@ -968,13 +970,14 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Edit combinations by bulk actions - * @param page {Page} Browser tab - * @param editCombinationsData {ProductCombinationBulk} Data to edit combination - * @returns {Promise} - */ + * Edit combinations by bulk actions + * @param page {Page} Browser tab + * @param editCombinationsData {ProductCombinationBulk} Data to edit combination + * @returns {Promise} + */ async editCombinationsByBulkActions(page: Page, editCombinationsData: ProductCombinationBulk): Promise { const bulkEditCombinationFrame: Frame|null = page.frame('bulk-combination-form-modal-iframe'); + expect(bulkEditCombinationFrame).not.toBeNull(); // Edit stocks if (editCombinationsData.stocks) { @@ -1001,11 +1004,11 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati // Methods for when out of stock /** - * Set option when out of stock - * @param page {Page} Browser tab - * @param option {string} Option to check - * @returns {Promise} - */ + * Set option when out of stock + * @param page {Page} Browser tab + * @param option {string} Option to check + * @returns {Promise} + */ async setOptionWhenOutOfStock(page: Page, option: string): Promise { switch (option) { case 'Deny orders': @@ -1023,33 +1026,32 @@ class CombinationsTab extends BOBasePage implements BOProductsCreateTabCombinati } /** - * Click on edit default behaviour link - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on edit default behaviour link + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnEditDefaultBehaviourLink(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.editDefaultBehaviourLink); } /** - * Set label when in stock - * @param page {Page} Browser tab - * @param label {string} Label to set when in stock in the input - * @returns {Promise} - */ + * Set label when in stock + * @param page {Page} Browser tab + * @param label {string} Label to set when in stock in the input + * @returns {Promise} + */ async setLabelWhenInStock(page: Page, label: string): Promise { await this.setValue(page, this.labelWhenInStock, label); } /** - * Set label when out of stock - * @param page {Page} Browser tab - * @param label {string} Label to set when out of stock in the input - */ + * Set label when out of stock + * @param page {Page} Browser tab + * @param label {string} Label to set when out of stock in the input + */ async setLabelWhenOutOfStock(page: Page, label: string): Promise { await this.setValue(page, this.labelWhenOutOfStock, label); } } -const combinationsTab = new CombinationsTab(); -export {combinationsTab, CombinationsTab}; +module.exports = new CombinationsTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabDescription.ts b/src/versions/develop/pages/BO/catalog/products/create/tabDescription.ts index c401bd0b1..e7c175794 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabDescription.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabDescription.ts @@ -1,10 +1,8 @@ +import {ProductImageInformation} from '@data/types/product'; +import FakerProduct from '@data/faker/product'; +import {BOProductsCreateTabDescriptionPageInterface} from '@interfaces/BO/catalog/products/create/tabDescription'; import BOBasePage from '@pages/BO/BOBasePage'; - -import type FakerProduct from '@data/faker/product'; -import type {ProductImageInformation} from '@data/types/product'; -import type {BOProductsCreateTabDescriptionPageInterface} from '@interfaces/BO/catalog/products/create/tabDescription'; - -import type {Page} from 'playwright'; +import {Page} from '@playwright/test'; /** * Description tab on product page, contains functions that can be used on the page @@ -99,9 +97,9 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio private readonly productManufacturerList: (brandRow: number) => string; /** - * @constructs - * Setting up texts and selectors to use on description tab - */ + * @constructs + * Setting up texts and selectors to use on description tab + */ constructor() { super(); @@ -121,20 +119,20 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio this.productImageDropZoneBtnLang = `${this.productImageDropZoneWindow} #product_dropzone_lang`; this.productImageDropZoneDropdown = `${this.productImageDropZoneWindow} .locale-dropdown-menu.show`; this.productImageDropZoneDropdownItem = (locale: string) => `${this.productImageDropZoneDropdown} span` - + `[data-locale="${locale}"]`; + + `[data-locale="${locale}"]`; this.productImageDropZoneCaption = `${this.productImageDropZoneWindow} #caption-textarea`; this.productImageDropZoneBtnSubmit = `${this.productImageDropZoneWindow} button.save-image-settings`; this.productImageDropZoneSelectAllLink = `${this.productImageDropZoneWindow} p.dropzone-window-select`; this.productImageDropZoneCloseButton = `${this.productImageDropZoneWindow} div.dropzone-window-header-right` - + ' i[data-original-title="Close window"]'; + + ' i[data-original-title="Close window"]'; this.productImageDropZoneZoomIcon = `${this.productImageDropZoneWindow} div.dropzone-window-header-right` - + ' i[data-original-title="Zoom on selection"]'; + + ' i[data-original-title="Zoom on selection"]'; this.productImageDropZoneZoomImage = `${this.productImageContainer} div.pswp--open.pswp--visible`; this.productImageDropZoneCloseZoom = `${this.productImageContainer} button.pswp__button--close`; this.productImageDropZoneReplaceImageSelection = `${this.productImageContainer} div.dropzone-window-header-right` - + ' i[data-original-title="Replace selection"]'; + + ' i[data-original-title="Replace selection"]'; this.productImageDropZoneDeleteImageSelection = `${this.productImageContainer} div.dropzone-window-header-right` - + ' i[data-original-title="Delete selection"]'; + + ' i[data-original-title="Delete selection"]'; this.applyDeleteImageButton = `${this.productImageContainer} footer button.btn-primary`; // Description & summary selectors this.productSummary = '#product_description_description_short'; @@ -154,37 +152,37 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio this.categoriesList = '#product_description_categories_product_categories'; this.defaultCategorySelectButton = '#select2-product_description_categories_default_category_id-container'; this.defaultCategoryList = (categoryRow: number) => '#select2-product_description_categories_default_category_id-results' - + ` li:nth-child(${categoryRow})`; + + ` li:nth-child(${categoryRow})`; this.deleteCategoryIcon = (categoryRow: number) => `#product_description_categories_product_categories_${categoryRow}_name` - + ' + a.pstaggerClosingCross:not(.d-none)'; + + ' + a.pstaggerClosingCross:not(.d-none)'; // Brand selectors this.productManufacturer = '#product_description_manufacturer'; this.productManufacturerSelectButton = '#select2-product_description_manufacturer-container'; this.productManufacturerList = (BrandRow: number) => '#select2-product_description_manufacturer-results' - + ` li:nth-child(${BrandRow})`; + + ` li:nth-child(${BrandRow})`; // Related product selectors this.relatedProductSelectButton = '#product_description_related_products_search_input'; } /* - Methods - */ + Methods + */ /** - * Get Number of images to set on the product - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get Number of images to set on the product + * @param page {Page} Browser tab + * @returns {Promise} + */ async getNumberOfImages(page: Page): Promise { return page.locator(this.productImage).count(); } /** - * Upload product image - * @param page {Page} Browser tab - * @param imagesPaths {Array} Paths of the images to add to the product - * @returns {Promise} - */ + * Upload product image + * @param page {Page} Browser tab + * @param imagesPaths {Array} Paths of the images to add to the product + * @returns {Promise} + */ async uploadProductImages(page: Page, imagesPaths: any[] = []): Promise { const filteredImagePaths = imagesPaths.filter((el) => el !== null); @@ -199,11 +197,11 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Add product images - * @param page {Page} Browser tab - * @param imagesPaths {Array} Paths of the images to add to the product - * @returns {Promise} - */ + * Add product images + * @param page {Page} Browser tab + * @param imagesPaths {Array} Paths of the images to add to the product + * @returns {Promise} + */ async addProductImages(page: Page, imagesPaths: any[] = []): Promise { const filteredImagePaths = imagesPaths.filter((el) => el !== null); @@ -222,11 +220,11 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Get Product Image Information - * @param page {Page} Browser tab - * @param numImage {number} Number of the image - * @returns {Promise} - */ + * Get Product Image Information + * @param page {Page} Browser tab + * @param numImage {number} Number of the image + * @returns {Promise} + */ async getProductImageInformation(page: Page, numImage: number): Promise { await page.locator(this.productImage).nth(numImage - 1).click(); @@ -260,17 +258,17 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Set Product Image Information - * @param page {Page} Browser tab - * @param numImage {number} Number of the image - * @param useAsCoverImage {boolean|undefined} Use as cover image - * @param captionEn {string|undefined} Caption in English - * @param captionFr {string|undefined} Caption in French - * @param selectAll {boolean|undefined} Select all - * @param toSave {boolean} True if we need to save - * @param toClose {boolean} True if we need to close - * @returns {Promise} - */ + * Set Product Image Information + * @param page {Page} Browser tab + * @param numImage {number} Number of the image + * @param useAsCoverImage {boolean|undefined} Use as cover image + * @param captionEn {string|undefined} Caption in English + * @param captionFr {string|undefined} Caption in French + * @param selectAll {boolean|undefined} Select all + * @param toSave {boolean} True if we need to save + * @param toClose {boolean} True if we need to close + * @returns {Promise} + */ async setProductImageInformation( page: Page, numImage: number, @@ -281,7 +279,7 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio toSave: boolean = true, toClose: boolean = false, ): Promise { - let returnValue: string | null = null; + let returnValue: string|null = null; // Select the image await page.locator(this.productImage).nth(numImage - 1).click(); @@ -319,10 +317,10 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Click on magnifying glass - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on magnifying glass + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnMagnifyingGlass(page: Page): Promise { await page.locator(this.productImageDropZoneZoomIcon).click(); @@ -330,10 +328,10 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Close image zoom - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Close image zoom + * @param page {Page} Browser tab + * @returns {Promise} + */ async closeImageZoom(page: Page): Promise { await page.locator(this.productImageDropZoneCloseZoom).click(); @@ -341,11 +339,11 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Replace image selection - * @param page {Page} Browser tab - * @param image {string} Browser tab - * @returns {Promise} - */ + * Replace image selection + * @param page {Page} Browser tab + * @param image {string} Browser tab + * @returns {Promise} + */ async replaceImageSelection(page: Page, image: string): Promise { await this.uploadOnFileChooser(page, this.productImageDropZoneReplaceImageSelection, [image]); await page.locator(this.productImageDropZoneBtnSubmit).click(); @@ -354,10 +352,10 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Delete image - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Delete image + * @param page {Page} Browser tab + * @returns {Promise} + */ async deleteImage(page: Page): Promise { await this.closeGrowlMessage(page); await page.locator(this.productImageDropZoneDeleteImageSelection).click(); @@ -367,12 +365,12 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Set value on tinyMce textarea - * @param page {Page} Browser tab - * @param selector {string} Value of selector to use - * @param value {string} Text to set on tinymce input - * @returns {Promise} - */ + * Set value on tinyMce textarea + * @param page {Page} Browser tab + * @param selector {string} Value of selector to use + * @param value {string} Text to set on tinymce input + * @returns {Promise} + */ async setValueOnTinymceInput(page: Page, selector: string, value: string): Promise { // Select all await page.locator(`${selector} .mce-edit-area`).first().click({clickCount: 3}); @@ -385,10 +383,10 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Set description - * @param page {Page} Browser tab - * @param description {string} Data to set in description textarea - */ + * Set description + * @param page {Page} Browser tab + * @param description {string} Data to set in description textarea + */ async setDescription(page: Page, description: string): Promise { await page.locator(this.productDescriptionTabLocale('en')).click(); await this.elementVisible(page, `${this.productDescriptionTabLocale('en')}.active`); @@ -396,11 +394,11 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Set product description - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set in description form - * @returns {Promise} - */ + * Set product description + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set in description form + * @returns {Promise} + */ async setProductDescription(page: Page, productData: FakerProduct): Promise { await this.waitForSelectorAndClick(page, this.descriptionTabLink); @@ -414,10 +412,10 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Set iframe in description - * @param page {Page} Browser tab - * @param description {string} Data to set in the description - */ + * Set iframe in description + * @param page {Page} Browser tab + * @param description {string} Data to set in the description + */ async setIframeInDescription(page: Page, description: string): Promise { await this.waitForSelectorAndClick(page, this.descriptionTabLink); await page.locator(this.productDescriptionSourceCodeLink).first().click(); @@ -426,20 +424,20 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Get Product ID Image Cover - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get Product ID Image Cover + * @param page {Page} Browser tab + * @returns {Promise} + */ async getProductIDImageCover(page: Page): Promise { return parseInt(await this.getAttributeContent(page, this.imagePreviewCover, 'data-id'), 10); } /** - * Returns the value of a form element - * @param page {Page} - * @param inputName {string} - * @param languageId {string | undefined} - */ + * Returns the value of a form element + * @param page {Page} + * @param inputName {string} + * @param languageId {string | undefined} + */ async getValue(page: Page, inputName: string, languageId?: string): Promise { switch (inputName) { case 'description': @@ -456,11 +454,11 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Add new category - * @param page {Page} Browser tab - * @param categories {string[]} Browser tab - * @returns {Promise} - */ + * Add new category + * @param page {Page} Browser tab + * @param categories {string[]} Browser tab + * @returns {Promise} + */ async addNewCategory(page: Page, categories: string[]): Promise { await page.locator(this.addCategoryButton).click(); await this.waitForVisibleSelector(page, this.addCategoryInput); @@ -475,52 +473,52 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } /** - * Get selected categories - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get selected categories + * @param page {Page} Browser tab + * @returns {Promise} + */ async getSelectedCategories(page: Page): Promise { return this.getTextContent(page, this.categoriesList); } /** - * Get selected categories - * @param page {Page} Browser tab - * @param categoryRow {number} Category row - * @returns {Promise} - */ + * Get selected categories + * @param page {Page} Browser tab + * @param categoryRow {number} Category row + * @returns {Promise} + */ async chooseDefaultCategory(page: Page, categoryRow: number): Promise { await page.locator(this.defaultCategorySelectButton).click(); await page.locator(this.defaultCategoryList(categoryRow)).click(); } /** - * Is delete category icon visible - * @param page {Page} Browser tab - * @param categoryRow {number} Category row - * @returns {Promise} - */ + * Is delete category icon visible + * @param page {Page} Browser tab + * @param categoryRow {number} Category row + * @returns {Promise} + */ async isDeleteCategoryIconVisible(page: Page, categoryRow: number): Promise { return (await page.locator(this.deleteCategoryIcon(categoryRow)).count()) !== 0; } /** - * Is delete category icon visible - * @param page {Page} Browser tab - * @param brandRow {number} Brand row - * @returns {Promise} - */ + * Is delete category icon visible + * @param page {Page} Browser tab + * @param brandRow {number} Brand row + * @returns {Promise} + */ async chooseBrand(page: Page, brandRow: number): Promise { await page.locator(this.productManufacturerSelectButton).click(); await page.locator(this.productManufacturerList(brandRow)).click(); } /** - * Add related product - * @param page {Page} Browser tab - * @param productName {string} Product name - * @returns {Promise} - */ + * Add related product + * @param page {Page} Browser tab + * @param productName {string} Product name + * @returns {Promise} + */ async addRelatedProduct(page: Page, productName: string): Promise { await page.locator(this.relatedProductSelectButton).fill(productName); await page.keyboard.press('ArrowDown'); @@ -528,5 +526,4 @@ class DescriptionTab extends BOBasePage implements BOProductsCreateTabDescriptio } } -const descriptionTab = new DescriptionTab(); -export {descriptionTab, DescriptionTab}; +module.exports = new DescriptionTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabDetails.ts b/src/versions/develop/pages/BO/catalog/products/create/tabDetails.ts index 0c0a5f8f9..6f90a839d 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabDetails.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabDetails.ts @@ -1,12 +1,9 @@ -import BOBasePage from '@pages/BO/BOBasePage'; -import createProductPage from '@pages/BO/catalog/products/create'; - -// Import data import type FakerProduct from '@data/faker/product'; import type {ProductFeatures} from '@data/types/product'; import type {BOProductsCreateTabDetailsPageInterface} from '@interfaces/BO/catalog/products/create/tabDetails'; - -import type {Frame, Page} from 'playwright'; +import BOBasePage from '@pages/BO/BOBasePage'; +import boProductsCreatePage from '@pages/BO/catalog/products/create'; +import {expect, type Frame, type Page} from '@playwright/test'; /** * Details tab on product page, contains functions that can be used on the page @@ -101,9 +98,9 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt private readonly customizationRequiredButton: (row: number, toEnable: number) => string; /** - * @constructs - * Setting up texts and selectors to use on details tab - */ + * @constructs + * Setting up texts and selectors to use on details tab + */ constructor() { super(); @@ -125,7 +122,7 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt this.addFeatureValueSelect = '#product_details_features_feature_value_id'; this.addFeatureValueButtonLang = '#product_details_features_custom_value_dropdown'; this.addFeatureValueSpanLang = (lang: string) => `${this.addFeatureValueButtonLang} + div.dropdown-menu.show` - + `> span[data-locale='${lang}']`; + + `> span[data-locale='${lang}']`; this.addFeatureValueInputLang = (langId: number) => `#product_details_features_custom_value_${langId}`; this.addFeatureButton = '#product_details_features_add_feature'; this.deleteFeatureModal = '#modal-confirm-delete-feature-value'; @@ -157,85 +154,85 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt this.customizationNameInput = (row: number) => `#product_details_customizations_customization_fields_${row}_name_1`; this.customizationTypeSelect = (row: number) => `#product_details_customizations_customization_fields_${row}_type`; this.customizationRequiredButton = (row: number, toEnable: number) => '#product_details_customizations_customization' - + `_fields_${row}_required_${toEnable}`; + + `_fields_${row}_required_${toEnable}`; this.deleteCustomizationIcon = (row: number) => `#product_details_customizations_customization_fields_${row}_remove` - + ' i.material-icons'; + + ' i.material-icons'; this.deleteCustomizationModal = '#modal-confirm-delete-customization'; this.confirmDeleteCustomizationButton = `${this.deleteCustomizationModal} div.modal-footer button.btn-confirm-submit`; } /* - Methods - */ + Methods + */ /** - * Set product details - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set in details form - * @returns {Promise} - */ + * Set product details + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set in details form + * @returns {Promise} + */ async setProductDetails(page: Page, productData: FakerProduct): Promise { await this.waitForSelectorAndClick(page, this.detailsTabLink); await this.setValue(page, this.productReferenceInput, productData.reference); } /** - * Set value for EAN 13 - * @param page {Page} Browser tab - * @param value {string} Value - * @returns {Promise} - */ + * Set value for EAN 13 + * @param page {Page} Browser tab + * @param value {string} Value + * @returns {Promise} + */ async setEAN13(page: Page, value: string): Promise { await this.setValue(page, this.productEAN13Input, value); } /** - * Set value for setISBN - * @param page {Page} Browser tab - * @param value {string} Value - * @returns {Promise} - */ + * Set value for setISBN + * @param page {Page} Browser tab + * @param value {string} Value + * @returns {Promise} + */ async setISBN(page: Page, value: string): Promise { await this.setValue(page, this.productISBNInput, value); } /** - * Set value for MPN - * @param page {Page} Browser tab - * @param value {string} Value - * @returns {Promise} - */ + * Set value for MPN + * @param page {Page} Browser tab + * @param value {string} Value + * @returns {Promise} + */ async setMPN(page: Page, value: string): Promise { await this.setValue(page, this.productMPNInput, value); } /** - * Set value for UPC - * @param page {Page} Browser tab - * @param value {string} Value - * @returns {Promise} - */ + * Set value for UPC + * @param page {Page} Browser tab + * @param value {string} Value + * @returns {Promise} + */ async setUPC(page: Page, value: string): Promise { await this.setValue(page, this.productUPCInput, value); } /** - * Get error message in references form - * @param page {Page} Browser tab - * @param inputNumber {number} Input number to get error message - * @returns {Promise} - */ + * Get error message in references form + * @param page {Page} Browser tab + * @param inputNumber {number} Input number to get error message + * @returns {Promise} + */ async getErrorMessageInReferencesForm(page: Page, inputNumber: number): Promise { - await createProductPage.clickOnSaveProductButton(page); + await boProductsCreatePage.clickOnSaveProductButton(page); return this.getTextContent(page, this.referenceFormErrorMessage(inputNumber)); } /** - * Set feature - * @param page {Page} Browser tab - * @param productFeatures {ProductFeatures[]} Data to set on feature form - * @returns {Promise} - */ + * Set feature + * @param page {Page} Browser tab + * @param productFeatures {ProductFeatures[]} Data to set on feature form + * @returns {Promise} + */ async setFeature(page: Page, productFeatures: ProductFeatures[]): Promise { for (let i: number = 0; i < productFeatures.length; i++) { await this.selectByVisibleText(page, this.addFeatureFeatureSelect, productFeatures[i].featureName, true); @@ -266,11 +263,11 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * Delete all features - * @param page {Page} Browser tab - * @param productFeatures {ProductFeatures[]} Data to delete feature - * @returns {Promise} - */ + * Delete all features + * @param page {Page} Browser tab + * @param productFeatures {ProductFeatures[]} Data to delete feature + * @returns {Promise} + */ async deleteFeatures(page: Page, productFeatures: ProductFeatures[]): Promise { for (let i: number = 0; i < productFeatures.length; i++) { // Why tr:nth-child(2) : It's one-based selector and the first row is hidden ? @@ -280,29 +277,29 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * Click on "Manage Features" - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on "Manage Features" + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickonManageFeatures(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.manageFeaturesLink); } /** - * Click on manage all files - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on manage all files + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnManageAllFiles(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.manageAllFilesLink); } /** - * Search file - * @param page {Page} Browser tab - * @param fileName {string} File name to search - * @returns {Promise} - */ + * Search file + * @param page {Page} Browser tab + * @param fileName {string} File name to search + * @returns {Promise} + */ async searchFile(page: Page, fileName: string): Promise { await this.setValue(page, this.searchFileInput, fileName); await page.waitForTimeout(2000); @@ -311,11 +308,11 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * Add new file - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set on add file form - * @returns {Promise} - */ + * Add new file + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set on add file form + * @returns {Promise} + */ async addNewFile(page: Page, productData: FakerProduct): Promise { for (let i: number = 0; i < productData.files.length; i++) { await this.waitForSelectorAndClick(page, this.addNewFileButton); @@ -323,6 +320,7 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt await this.waitForVisibleSelector(page, this.createFileFrame); const newFileFrame: Frame | null = page.frame({name: 'modal-create-product-attachment-iframe'}); + expect(newFileFrame).not.toBeNull(); await this.setValue(newFileFrame!, this.fileNameInput, productData.files[i].fileName); await this.setValue(newFileFrame!, this.fileDescriptionInput, productData.files[i].description); @@ -332,11 +330,11 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * Delete all files - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to delete file - * @returns {Promise} - */ + * Delete all files + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to delete file + * @returns {Promise} + */ async deleteFiles(page: Page, productData: FakerProduct): Promise { for (let i: number = 0; i < productData.files.length; i++) { await this.waitForSelectorAndClick(page, this.deleteFileIcon(i)); @@ -345,31 +343,31 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * Get no file attached message - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get no file attached message + * @param page {Page} Browser tab + * @returns {Promise} + */ async getNoFileAttachedMessage(page: Page): Promise { return this.getTextContent(page, this.noFileAttachedErrorAlert); } /** - * Set condition - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set condition - * @returns {Promise} - */ + * Set condition + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set condition + * @returns {Promise} + */ async setCondition(page: Page, productData: FakerProduct): Promise { await this.setChecked(page, this.displayCondition(productData.displayCondition ? 1 : 0)); await this.selectByVisibleText(page, this.productConditionSelect, productData.condition); } /** - * Add new customization - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to add customization - * @returns {Promise} - */ + * Add new customization + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to add customization + * @returns {Promise} + */ async addNewCustomizations(page: Page, productData: FakerProduct): Promise { await this.waitForSelectorAndClick(page, this.detailsTabLink); for (let i: number = 0; i < productData.customizations.length; i++) { @@ -382,11 +380,11 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * Delete all customizations - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to delete customizations - * @returns {Promise} - */ + * Delete all customizations + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to delete customizations + * @returns {Promise} + */ async deleteCustomizations(page: Page, productData: FakerProduct): Promise { for (let i: number = 0; i < productData.customizations.length; i++) { await this.waitForSelectorAndClick(page, this.deleteCustomizationIcon(i)); @@ -395,9 +393,9 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } /** - * @param page {Page} - * @param inputName {string} - */ + * @param page {Page} + * @param inputName {string} + */ async getValue(page: Page, inputName: string): Promise { switch (inputName) { case 'condition': @@ -422,5 +420,4 @@ class DetailsTab extends BOBasePage implements BOProductsCreateTabDetailsPageInt } } -const detailsTab = new DetailsTab(); -export {detailsTab, DetailsTab}; +module.exports = new DetailsTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabOptions.ts b/src/versions/develop/pages/BO/catalog/products/create/tabOptions.ts index 8824819ef..e98b47dce 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabOptions.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabOptions.ts @@ -1,7 +1,6 @@ -import BOBasePage from '@pages/BO/BOBasePage'; - -import type {Page} from 'playwright'; import type {BOProductsCreateTabOptionsPageInterface} from '@interfaces/BO/catalog/products/create/tabOptions'; +import BOBasePage from '@pages/BO/BOBasePage'; +import type {Page} from '@playwright/test'; /** * Options tab on new product page, contains functions that can be used on the page @@ -26,9 +25,9 @@ class OptionsTab extends BOBasePage implements BOProductsCreateTabOptionsPageInt private readonly supplierReferencesSection: string; /** - * @constructs - * Setting up texts and selectors to use on options tab - */ + * @constructs + * Setting up texts and selectors to use on options tab + */ constructor() { super(); @@ -44,14 +43,14 @@ class OptionsTab extends BOBasePage implements BOProductsCreateTabOptionsPageInt } /* - Methods - */ + Methods + */ /** - * Set visibility - * @param page {page} Browser tab - * @param visibility {string} Option to choose - * @returns {Promise} - */ + * Set visibility + * @param page {page} Browser tab + * @param visibility {string} Option to choose + * @returns {Promise} + */ async setVisibility(page: Page, visibility: string): Promise { switch (visibility) { case 'everywhere': @@ -72,68 +71,68 @@ class OptionsTab extends BOBasePage implements BOProductsCreateTabOptionsPageInt } /** - * Set available for order - * @param page {page} Browser tab - * @param toEnable {boolean} True if we need to enable available for order - * @returns {Promise} - */ + * Set available for order + * @param page {page} Browser tab + * @param toEnable {boolean} True if we need to enable available for order + * @returns {Promise} + */ async setAvailableForOrder(page: Page, toEnable: boolean): Promise { await this.setChecked(page, this.productAvailableForOrderRadio(toEnable ? 1 : 0)); } /** - * Set show price - * @param page {page} Browser tab - * @param toEnable {boolean} True if we need to enable show price - * @returns {Promise} - */ + * Set show price + * @param page {page} Browser tab + * @param toEnable {boolean} True if we need to enable show price + * @returns {Promise} + */ async setShowPrice(page: Page, toEnable: boolean): Promise { await this.setChecked(page, this.productShowPricesRadio(toEnable ? 1 : 0)); } /** - * Set web only - * @param page {page} Browser tab - * @param toEnable {boolean} True if we need to enable web only - * @returns {Promise} - */ + * Set web only + * @param page {page} Browser tab + * @param toEnable {boolean} True if we need to enable web only + * @returns {Promise} + */ async setWebOnly(page: Page, toEnable: boolean): Promise { await this.setChecked(page, this.productOnlineOnlyRadio(toEnable ? 1 : 0)); } /** - * Choose supplier - * @param page {page} Browser tab - * @param supplierRow {number} Supplier to choose - * @returns {Promise} - */ + * Choose supplier + * @param page {page} Browser tab + * @param supplierRow {number} Supplier to choose + * @returns {Promise} + */ async chooseSupplier(page: Page, supplierRow: number): Promise { await this.waitForSelectorAndClick(page, this.supplierAssociatedCheckBox(supplierRow)); } /** - * Is default supplier section visible - * @param page {page} Browser tab - * @returns {Promise} - */ + * Is default supplier section visible + * @param page {page} Browser tab + * @returns {Promise} + */ async isDefaultSupplierSectionVisible(page: Page): Promise { return this.elementVisible(page, this.defaultSupplierSection, 1000); } /** - * Is supplier references section visible - * @param page {page} Browser tab - * @returns {Promise} - */ + * Is supplier references section visible + * @param page {page} Browser tab + * @returns {Promise} + */ async isSupplierReferencesSectionVisible(page: Page): Promise { return this.elementVisible(page, this.supplierReferencesSection, 1000); } /** - * Returns the value of a form element - * @param page {Page} - * @param inputName {string} - */ + * Returns the value of a form element + * @param page {Page} + * @param inputName {string} + */ async getValue(page: Page, inputName: string): Promise { switch (inputName) { case 'available_for_order': @@ -150,5 +149,4 @@ class OptionsTab extends BOBasePage implements BOProductsCreateTabOptionsPageInt } } -const optionsTab = new OptionsTab(); -export {optionsTab, OptionsTab}; +module.exports = new OptionsTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabPack.ts b/src/versions/develop/pages/BO/catalog/products/create/tabPack.ts index 225c35255..6da5bc906 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabPack.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabPack.ts @@ -1,14 +1,15 @@ import BOBasePage from '@pages/BO/BOBasePage'; - -import type { - ProductPackInformation, - ProductPackItem, - ProductPackOptions, - ProductStockMovement, +import { + type ProductPackOptions, + type ProductPackInformation, + type ProductPackItem, + type ProductStockMovement, } from '@data/types/product'; -import type {BOProductsCreateTabPackPageInterface} from '@interfaces/BO/catalog/products/create/tabPack'; - -import type {Locator, Page} from 'playwright'; +import {BOProductsCreateTabPackPageInterface} from '@interfaces/BO/catalog/products/create/tabPack'; +import { + type Locator, + type Page, +} from '@playwright/test'; /** * Pack tab on product page, contains functions that can be used on the page @@ -71,9 +72,9 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface private readonly saveProductButton: string; /** - * @constructs - * Setting up texts and selectors to use on pack tab - */ + * @constructs + * Setting up texts and selectors to use on pack tab + */ constructor() { super(); @@ -85,7 +86,7 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface this.packSearchResult = `${this.searchResult} div.tt-dataset.tt-dataset-2`; this.searchResultSuggestion = `${this.packSearchResult} div.search-suggestion`; this.searchResultSuggestionRow = (productInSearchList: number) => `${this.searchResultSuggestion}:nth-child(` - + `${productInSearchList})`; + + `${productInSearchList})`; // List of products in pack selectors this.listOfProducts = '#product_stock_packed_products_list'; @@ -93,7 +94,7 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface this.productRowInList = (productInList: number) => `${this.listOfProducts} li:nth-child(${productInList})`; this.productInListLegend = (productInList: number) => `${this.productRowInList(productInList)} div.packed-product-legend`; this.deleteProductInListIcon = (productInList: number) => `${this.productInListLegend(productInList)} ` - + 'span i.entity-item-delete'; + + 'span i.entity-item-delete'; this.productInListImage = (productInList: number) => `${this.productRowInList(productInList)} div.packed-product-image img`; this.productInListName = (productInList: number) => `#product_stock_packed_products_${productInList - 1}_name`; this.productInListReference = (productInList: number) => `${this.productInListLegend(productInList)} span.reference-preview`; @@ -107,11 +108,11 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface // Stock movement table selectors this.dateTimeRowInTable = (movementRow: number) => `#product_stock_quantities_stock_movements_${movementRow}_date ` - + '+ span'; + + '+ span'; this.employeeRowInTable = (movementRow: number) => `#product_stock_quantities_stock_movements_${movementRow}_` - + 'employee_name + span'; + + 'employee_name + span'; this.quantityRowInTable = (movementRow: number) => `#product_stock_quantities_stock_movements_${movementRow}_` - + 'delta_quantity + span'; + + 'delta_quantity + span'; // Edit quantity selectors this.editQuantityBase = 'input#product_stock_quantities_delta_quantity_quantity'; @@ -124,15 +125,15 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /* - Methods - */ + Methods + */ // Methods to search product /** - * Search product to add to the pack - * @param page {Page} Browser tab - * @param productName {string} Product name to search - */ + * Search product to add to the pack + * @param page {Page} Browser tab + * @param productName {string} Product name to search + */ async searchProduct(page: Page, productName: string): Promise { await this.waitForSelectorAndClick(page, this.packTabLink); await page.locator(this.searchProductInput).fill(productName); @@ -143,18 +144,18 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /** - * Get number of searched product - * @param page {Page} Browser tab - */ + * Get number of searched product + * @param page {Page} Browser tab + */ async getNumberOfSearchedProduct(page: Page): Promise { return page.locator(`${this.packSearchResult} div`).count(); } /** - * Select product from list - * @param page {Page} Browser tab - * @param productInSearchList {number} The row of product in the search list - */ + * Select product from list + * @param page {Page} Browser tab + * @param productInSearchList {number} The row of product in the search list + */ async selectProductFromList(page: Page, productInSearchList: number): Promise { let productPosition: number = 1; @@ -168,18 +169,18 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface // Methods to get products in pack /** - * Get number of product in pack - * @param page {Page} Browser tab - */ + * Get number of product in pack + * @param page {Page} Browser tab + */ async getNumberOfProductsInPack(page: Page): Promise { return page.locator(`${this.listOfProducts} li`).count(); } /** - * Get product in pack information - * @param page {Page} Browser tab - * @param productInList {number} The row of product in pack - */ + * Get product in pack information + * @param page {Page} Browser tab + * @param productInList {number} The row of product in pack + */ async getProductInPackInformation(page: Page, productInList: number): Promise { await this.waitForVisibleSelector(page, this.listOfProducts); return { @@ -192,20 +193,20 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface // Methods to add/edit products in pack /** - * Set product in pack quantity - * @param page {Page} Browser tab - * @param productInList {number} The row of product in pack - * @param quantity {number|string} The product quantity to set - */ + * Set product in pack quantity + * @param page {Page} Browser tab + * @param productInList {number} The row of product in pack + * @param quantity {number|string} The product quantity to set + */ async setProductQuantity(page: Page, productInList: number, quantity: number|string): Promise { await this.setValue(page, this.quantityInput(productInList), quantity); } /** - * Save and get product in pack error message - * @param page {Page} Browser tab - * @param productInList {number} The row of product in pack - */ + * Save and get product in pack error message + * @param page {Page} Browser tab + * @param productInList {number} The row of product in pack + */ async saveAndGetProductInPackErrorMessage(page: Page, productInList: number): Promise { await page.locator(this.saveProductButton).click(); @@ -213,11 +214,11 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /** - * Add product to pack - * @param page {Page} Browser tab - * @param product {string} Value of product name to set on input - * @param quantity {number} Value of quantity to set on input - */ + * Add product to pack + * @param page {Page} Browser tab + * @param product {string} Value of product name to set on input + * @param quantity {number} Value of quantity to set on input + */ async addProductToPack(page: Page, product: string, quantity: number): Promise { await this.searchProduct(page, product); await this.waitForSelectorAndClick(page, this.searchResultSuggestionRow(1)); @@ -230,11 +231,11 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /** - * Add combination - * @param page {Page} Browser tab - * @param packData {ProductPackItem[]} Data of the pack - * @returns {Promise} - */ + * Add combination + * @param page {Page} Browser tab + * @param packData {ProductPackItem[]} Data of the pack + * @returns {Promise} + */ async setPackOfProducts(page: Page, packData: ProductPackItem[]): Promise { await this.waitForSelectorAndClick(page, this.packTabLink); @@ -244,10 +245,10 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /** - * Get stock movements data - * @param page {Page} Browser tab - * @param movementRow {number} Movement row in table stock movements - */ + * Get stock movements data + * @param page {Page} Browser tab + * @param movementRow {number} Movement row in table stock movements + */ async getStockMovement(page: Page, movementRow: number): Promise { return { dateTime: await this.getTextContent(page, this.dateTimeRowInTable(movementRow - 1)), @@ -258,35 +259,35 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface // Methods to delete products in pack /** - * Is delete modal visible - * @param page {Page} Browser tab - */ + * Is delete modal visible + * @param page {Page} Browser tab + */ async isDeleteModalVisible(page: Page): Promise { return !(await this.elementNotVisible(page, this.modalDeleteProduct, 3000)); } /** - * Cancel delete product from pack - * @param page {Page} Browser tab - */ + * Cancel delete product from pack + * @param page {Page} Browser tab + */ async cancelDeleteProductFromPack(page: Page): Promise { await this.waitForSelectorAndClick(page, this.cancelDeleteButtonInModal); } /** - * Confirm delete product from pack - * @param page {Page} Browser tab - */ + * Confirm delete product from pack + * @param page {Page} Browser tab + */ async confirmDeleteProductFromPack(page: Page): Promise { await this.waitForSelectorAndClick(page, this.confirmDeleteButtonInModal); } /** - * Delete product from pack - * @param page {Page} Browser tab - * @param productInList {number} The row of product in pack - * @param toDelete {boolean} True if we need to delete product, false to cancel delete - */ + * Delete product from pack + * @param page {Page} Browser tab + * @param productInList {number} The row of product in pack + * @param toDelete {boolean} True if we need to delete product, false to cancel delete + */ async deleteProduct(page: Page, productInList: number, toDelete: boolean): Promise { await this.waitForSelectorAndClick(page, this.deleteProductInListIcon(productInList)); @@ -302,10 +303,10 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface // Methods to edit pack of products /** - * Edit pack of products - * @param page {Page} Browser tab - * @param packData {ProductPackOptions} Data to edit pack of products - */ + * Edit pack of products + * @param page {Page} Browser tab + * @param packData {ProductPackOptions} Data to edit pack of products + */ async editPackOfProducts(page: Page, packData: ProductPackOptions): Promise { await this.editQuantity(page, packData.quantity); await this.setValue(page, this.minimalQuantityInput, packData.minimalQuantity); @@ -313,19 +314,19 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /** - * Edit quantity - * @param page {Page} Browser tab - * @param quantity {number} Quantity - */ + * Edit quantity + * @param page {Page} Browser tab + * @param quantity {number} Quantity + */ async editQuantity(page: Page, quantity: number): Promise { await this.setValue(page, this.editQuantityInput, quantity); } /** - * Edit quantity - * @param page {Page} Browser tab - * @param packStockType {string} Quantity - */ + * Edit quantity + * @param page {Page} Browser tab + * @param packStockType {string} Quantity + */ async editPackStockType(page: Page, packStockType: string): Promise { let locator: Locator; @@ -354,13 +355,13 @@ class PackTab extends BOBasePage implements BOProductsCreateTabPackPageInterface } /** - * Get the value of the stock - * @param page {Page} Browser tab - * @return > - */ + * Get the value of the stock + * @param page {Page} Browser tab + * @return > + */ async getStockValue(page: Page): Promise { return parseInt(await this.getAttributeContent(page, this.editQuantityBase, 'value'), 10); } } -export default new PackTab(); +module.exports = new PackTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabPricing.ts b/src/versions/develop/pages/BO/catalog/products/create/tabPricing.ts index 53c80fd3b..62ebd87ec 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabPricing.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabPricing.ts @@ -1,10 +1,8 @@ +import type FakerProduct from '@data/faker/product'; +import {type ProductSpecificPrice} from '@data/types/product'; +import {BOProductsCreateTabPricingPageInterface} from '@interfaces/BO/catalog/products/create/tabPricing'; import BOBasePage from '@pages/BO/BOBasePage'; - -import FakerProduct from '@data/faker/product'; -import type {ProductSpecificPrice} from '@data/types/product'; -import type {BOProductsCreateTabPricingPageInterface} from '@interfaces/BO/catalog/products/create/tabPricing'; - -import type {Page} from 'playwright'; +import {type Page} from '@playwright/test'; /** * Pricing tab on product page, contains functions that can be used on the page @@ -103,9 +101,9 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt private readonly catalogPriceRuleRowColumn: (row: number, column: string) => string; /** - * @constructs - * Setting up texts and selectors to use on pricing tab - */ + * @constructs + * Setting up texts and selectors to use on pricing tab + */ constructor() { super(); @@ -151,7 +149,7 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt this.startingAtInput = '#specific_price_from_quantity'; // Impact on price Bloc this.applyDiscountToInitialPrice = (value: boolean) => '#specific_price_impact_disabling_switch_reduction_' - + `${value ? '1' : '0'}`; + + `${value ? '1' : '0'}`; this.applyDiscountOfInput = '#specific_price_impact_reduction_value'; this.reductionType = '#specific_price_impact_reduction_type'; // Footer @@ -174,15 +172,15 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /* - Methods - */ + Methods + */ /** - * Set product pricing - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set in pricing form - * @returns {Promise} - */ + * Set product pricing + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set in pricing form + * @returns {Promise} + */ async setProductPricing(page: Page, productData: FakerProduct): Promise { await this.waitForSelectorAndClick(page, this.pricingTabLink); // Select tax rule by ID @@ -199,11 +197,11 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Set tax rule - * @param page {Page} Browser tab - * @param taxRule {string} Tax rule to select - * @returns {Promise} - */ + * Set tax rule + * @param page {Page} Browser tab + * @param taxRule {string} Tax rule to select + * @returns {Promise} + */ async setTaxRule(page: Page, taxRule: string): Promise { await Promise.all([ this.waitForSelectorAndClick(page, this.taxRuleSpan), @@ -213,12 +211,12 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Set retail price - * @param page {Page} Browser tab - * @param isTaxExcluded {boolean} is Tax Excluded - * @param price {number} Retail price - * @returns {Promise} - */ + * Set retail price + * @param page {Page} Browser tab + * @param isTaxExcluded {boolean} is Tax Excluded + * @param price {number} Retail price + * @returns {Promise} + */ async setRetailPrice(page: Page, isTaxExcluded: boolean, price: number): Promise { await this.setValue( page, @@ -228,33 +226,33 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Set cost price - * @param page {Page} Browser tab - * @param costPrice {number} - * @returns {Promise} - */ + * Set cost price + * @param page {Page} Browser tab + * @param costPrice {number} + * @returns {Promise} + */ async setCostPrice(page: Page, costPrice: number): Promise { await this.setValue(page, this.wholesalePriceInput, costPrice); } /** - * Set display retail price per unit - * @param page {Page} Browser tab - * @param toEnable {boolean} True if we need to check display retail price per unit - * @returns {Promise} - */ + * Set display retail price per unit + * @param page {Page} Browser tab + * @param toEnable {boolean} True if we need to check display retail price per unit + * @returns {Promise} + */ async setDisplayRetailPricePerUnit(page: Page, toEnable: true): Promise { await this.setChecked(page, this.displayRetailPricePerUnit(toEnable ? 1 : 0)); } /** - * Set retail price per unit - * @param page {Page} Browser tab - * @param isTaxExcluded {boolean} is Tax Excluded - * @param price {number} Retail price - * @param unit {string} Unit - * @returns {Promise} - */ + * Set retail price per unit + * @param page {Page} Browser tab + * @param isTaxExcluded {boolean} is Tax Excluded + * @param price {number} Retail price + * @param unit {string} Unit + * @returns {Promise} + */ async setRetailPricePerUnit(page: Page, isTaxExcluded: boolean, price: number, unit: string): Promise { await this.setValue( page, @@ -265,11 +263,11 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Get summary - * @param page {Page} Browser tab - * @returns {Promise} - */ - async getSummary(page: Page): Promise { + * Get summary + * @param page {Page} Browser tab + * @returns {Promise} + */ + async getSummary(page: Page) { await this.waitForSelectorAndClick(page, this.pricingTabLink); return { priceTaxExcludedValue: await this.getTextContent(page, this.priceTaxExcludedValue), @@ -281,28 +279,28 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Get unit price - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get unit price + * @param page {Page} Browser tab + * @returns {Promise} + */ async getUnitPriceValue(page: Page): Promise { return this.getTextContent(page, this.unitPriceValue); } /** - * Set display on sale flag - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Set display on sale flag + * @param page {Page} Browser tab + * @returns {Promise} + */ async setDisplayOnSaleFlag(page: Page): Promise { await this.waitForSelectorAndClick(page, this.pricingOnSaleCheckBox); } /** - * Click on add specific price button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on add specific price button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnAddSpecificPriceButton(page: Page): Promise { await this.waitForSelectorAndClick(page, this.pricingTabLink); @@ -313,11 +311,11 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Click on edit specific price icon - * @param page {Page} Browser tab - * @param row {number} Row to edit - * @returns {Promise} - */ + * Click on edit specific price icon + * @param page {Page} Browser tab + * @param row {number} Row to edit + * @returns {Promise} + */ async clickOnEditSpecificPriceIcon(page: Page, row: number): Promise { await this.waitForSelectorAndClick(page, this.pricingTabLink); @@ -328,11 +326,11 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Product specific price - * @param page {Page} Browser tab - * @param specificPriceData {ProductSpecificPrice} Data to set on specific price form - * @return {Promise} - */ + * Product specific price + * @param page {Page} Browser tab + * @param specificPriceData {ProductSpecificPrice} Data to set on specific price form + * @return {Promise} + */ async setSpecificPrice(page: Page, specificPriceData: ProductSpecificPrice): Promise { const addSpecificPriceFrame = page.frame({name: 'modal-specific-price-form-iframe'}); @@ -358,11 +356,11 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Delete specific price - * @param page {Page} Browser tab - * @param row {number} Row to edit - * @return {Promise} - */ + * Delete specific price + * @param page {Page} Browser tab + * @param row {number} Row to edit + * @return {Promise} + */ async deleteSpecificPrice(page: Page, row: number): Promise { await page.locator(this.deleteSpecificPriceIcon(row)).click(); await page.locator(this.deleteSpecificPriceModalConfirmButton).click(); @@ -371,19 +369,19 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Click on show catalog price rule button - * @param page {Page} Browser tab - * @return {Promise} - */ + * Click on show catalog price rule button + * @param page {Page} Browser tab + * @return {Promise} + */ async clickOnShowCatalogPriceRuleButton(page: Page): Promise { await page.locator(this.showCatalogPriceRuleButton).click(); } /** - * Click on hide catalog price rule button - * @param page {Page} Browser tab - * @return {Promise} - */ + * Click on hide catalog price rule button + * @param page {Page} Browser tab + * @return {Promise} + */ async clickOnHideCatalogPriceRulesButton(page: Page): Promise { await page.locator(this.showCatalogPriceRuleButton).click(); @@ -391,20 +389,20 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Click on manage catalog price rule link - * @param page {Page} Browser tab - * @return {Promise} - */ + * Click on manage catalog price rule link + * @param page {Page} Browser tab + * @return {Promise} + */ async clickOnManageCatalogPriceRuleLink(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.manageCatalogPriceRuleLink, 'body'); } /** - * Get catalog price rule data - * @param page {Page} Browser tab - * @param row {number} Row of catalog price rule - */ - async getCatalogPriceRuleData(page: Page, row: number) :Promise { + * Get catalog price rule data + * @param page {Page} Browser tab + * @param row {number} Row of catalog price rule + */ + async getCatalogPriceRuleData(page: Page, row: number) { return { id: await this.getTextContent(page, this.catalogPriceRuleRowColumn(row, 'catalog-price-rule-id')), name: await this.getTextContent(page, this.catalogPriceRuleRowColumn(row, 'name')), @@ -418,10 +416,10 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Returns the value of a form element - * @param page {Page} - * @param inputName {string} - */ + * Returns the value of a form element + * @param page {Page} + * @param inputName {string} + */ async getValue(page: Page, inputName: string): Promise { switch (inputName) { case 'ecotax': @@ -444,11 +442,11 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } /** - * Set ecoTax value and save - * @param page {Page} Browser tab - * @param ecoTax {string} Eco tax value to set on eco tax input - * @returns {Promise} - */ + * Set ecoTax value and save + * @param page {Page} Browser tab + * @param ecoTax {string} Eco tax value to set on eco tax input + * @returns {Promise} + */ async addEcoTax(page: Page, ecoTax: number): Promise { await this.waitForSelectorAndClick(page, this.pricingTabLink); @@ -456,5 +454,4 @@ class PricingTab extends BOBasePage implements BOProductsCreateTabPricingPageInt } } -const pricingTab = new PricingTab(); -export {pricingTab, PricingTab}; +module.exports = new PricingTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabSeo.ts b/src/versions/develop/pages/BO/catalog/products/create/tabSeo.ts index 46e9a5026..d0f2ae2ea 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabSeo.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabSeo.ts @@ -1,15 +1,12 @@ import BOBasePage from '@pages/BO/BOBasePage'; - -import type {BOProductsCreateTabSeoPageInterface} from '@interfaces/BO/catalog/products/create/tabSeo'; - -import type {Page} from 'playwright'; +import type {Page} from '@playwright/test'; /** * SEO tab on product page, contains functions that can be used on the page * @class * @extends BOBasePage */ -class SeoTab extends BOBasePage implements BOProductsCreateTabSeoPageInterface { +class SeoTab extends BOBasePage { private readonly productMetaTitleInput: string; private readonly productMetaDescriptionInput: string; @@ -31,9 +28,9 @@ class SeoTab extends BOBasePage implements BOProductsCreateTabSeoPageInterface { private readonly searchOptionTargetInput: string; /** - * @constructs - * Setting up texts and selectors to use on Shipping tab - */ + * @constructs + * Setting up texts and selectors to use on Shipping tab + */ constructor() { super(); @@ -51,72 +48,72 @@ class SeoTab extends BOBasePage implements BOProductsCreateTabSeoPageInterface { } /* - Methods - */ + Methods + */ /** - * Set meta title - * @param page {Page} Browser tab - * @param metaTitle {string} Meta title to set in the input - * @returns {Promise} - */ + * Set meta title + * @param page {Page} Browser tab + * @param metaTitle {string} Meta title to set in the input + * @returns {Promise} + */ async setMetaTitle(page: Page, metaTitle: string): Promise { await this.setValue(page, `${this.productMetaTitleInput}_1`, metaTitle); } /** - * Set meta description - * @param page {Page} Browser tab - * @param metaDescription {string} Meta description to set in the input - * @returns {Promise} - */ + * Set meta description + * @param page {Page} Browser tab + * @param metaDescription {string} Meta description to set in the input + * @returns {Promise} + */ async setMetaDescription(page: Page, metaDescription: string): Promise { await this.setValue(page, `${this.productMetaDescriptionInput}_1`, metaDescription); } /** - * Set friendly URL - * @param page {Page} Browser tab - * @param friendlyUrl {string} Friendly URL to set in the input - * @returns {Promise} - */ + * Set friendly URL + * @param page {Page} Browser tab + * @param friendlyUrl {string} Friendly URL to set in the input + * @returns {Promise} + */ async setFriendlyUrl(page: Page, friendlyUrl: string): Promise { await this.setValue(page, this.productLinkRewriteInput(1), friendlyUrl); } /** - * Get error message of friendly URL - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get error message of friendly URL + * @param page {Page} Browser tab + * @returns {Promise} + */ async getErrorMessageOfFriendlyUrl(page: Page): Promise { return this.getTextContent(page, this.alertText); } /** - * Click on generate URL from name button - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on generate URL from name button + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnGenerateUrlFromNameButton(page: Page): Promise { await page.locator(this.generateURLFromNameButton).click(); } /** - * Select redirect page - * @param page {Page} Browser tab - * @param redirectionPage {string} Redirect page to select - * @returns {Promise} - */ + * Select redirect page + * @param page {Page} Browser tab + * @param redirectionPage {string} Redirect page to select + * @returns {Promise} + */ async selectRedirectionPage(page: Page, redirectionPage: string): Promise { await this.selectByVisibleText(page, this.redirectionWhenOfflineSelect, redirectionPage); } /** - * Search option target - * @param page {Page} Browser tab - * @param target {string} Target to search - * @returns {Promise} - */ + * Search option target + * @param page {Page} Browser tab + * @param target {string} Target to search + * @returns {Promise} + */ async searchOptionTarget(page: Page, target: string): Promise { await page.locator(this.searchOptionTargetInput).fill(target); await page.waitForTimeout(1000); @@ -125,22 +122,22 @@ class SeoTab extends BOBasePage implements BOProductsCreateTabSeoPageInterface { } /** - * Set tag - * @param page {Page} Browser tab - * @param tag {string} tag to set in the input - * @returns {Promise} - */ + * Set tag + * @param page {Page} Browser tab + * @param tag {string} tag to set in the input + * @returns {Promise} + */ async setTag(page: Page, tag: string): Promise { await page.locator(this.tagInput).fill(tag); await page.keyboard.press('Enter'); } /** - * Returns the value of a form element - * @param page {Page} - * @param inputName {string} - * @param languageId {string | undefined} - */ + * Returns the value of a form element + * @param page {Page} + * @param inputName {string} + * @param languageId {string | undefined} + */ async getValue(page: Page, inputName: string, languageId?: string): Promise { switch (inputName) { case 'id_type_redirected': @@ -159,5 +156,4 @@ class SeoTab extends BOBasePage implements BOProductsCreateTabSeoPageInterface { } } -const seoTab = new SeoTab(); -export {seoTab, SeoTab}; +module.exports = new SeoTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabShipping.ts b/src/versions/develop/pages/BO/catalog/products/create/tabShipping.ts index e535ecda1..3aa79b54a 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabShipping.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabShipping.ts @@ -1,10 +1,7 @@ -import BOBasePage from '@pages/BO/BOBasePage'; - import type FakerProduct from '@data/faker/product'; - -import type {BOProductsCreateTabShippingPageInterface} from '@interfaces/BO/catalog/products/create/tabShipping'; - -import type {Page} from 'playwright'; +import {type BOProductsCreateTabShippingPageInterface} from '@interfaces/BO/catalog/products/create/tabShipping'; +import BOBasePage from '@pages/BO/BOBasePage'; +import {type Page} from '@playwright/test'; /** * Shipping tab on product page, contains functions that can be used on the page @@ -43,9 +40,9 @@ class ShippingTab extends BOBasePage implements BOProductsCreateTabShippingPageI private readonly deliveryTimeType: (type: number) => string; /** - * @constructs - * Setting up texts and selectors to use on Shipping tab - */ + * @constructs + * Setting up texts and selectors to use on Shipping tab + */ constructor() { super(); @@ -68,18 +65,18 @@ class ShippingTab extends BOBasePage implements BOProductsCreateTabShippingPageI this.productDeliveryTimeInput = 'input[name="product[shipping][delivery_time_note_type]"]'; this.allCarriersSelect = '#carrier-checkboxes-dropdown button'; this.availableCarrierCheckboxButton = (carrierID: number) => '#carrier-checkboxes-dropdown' - + ` div:nth-child(${carrierID}).md-checkbox label div`; + + ` div:nth-child(${carrierID}).md-checkbox label div`; } /* - Methods - */ + Methods + */ /** - * Set package dimension - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set in package dimension form - * @returns {Promise} - */ + * Set package dimension + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set in package dimension form + * @returns {Promise} + */ async setPackageDimension(page: Page, productData: FakerProduct): Promise { await this.waitForSelectorAndClick(page, this.shippingTabLink); await this.setValue(page, this.productDimensionsWidthInput, productData.packageDimensionWidth); @@ -89,11 +86,11 @@ class ShippingTab extends BOBasePage implements BOProductsCreateTabShippingPageI } /** - * Set delivery time - * @param page {Page} Browser tab - * @param deliveryTime {string} Delivery time value to check - * @returns {Promise} - */ + * Set delivery time + * @param page {Page} Browser tab + * @param deliveryTime {string} Delivery time value to check + * @returns {Promise} + */ async setDeliveryTime(page: Page, deliveryTime: string): Promise { switch (deliveryTime) { case 'None': @@ -111,51 +108,51 @@ class ShippingTab extends BOBasePage implements BOProductsCreateTabShippingPageI } /** - * Set delivery time in stock - * @param page {Page} Browser tab - * @param numberOfDays {string} Number of days of delivery - * @returns {Promise} - */ + * Set delivery time in stock + * @param page {Page} Browser tab + * @param numberOfDays {string} Number of days of delivery + * @returns {Promise} + */ async setDeliveryTimeInStockProducts(page: Page, numberOfDays: string): Promise { await this.setValue(page, this.deliveryTimeInStockProducts, numberOfDays); } /** - * Set delivery time out of stock - * @param page {Page} Browser tab - * @param numberOfDays {string} Number of days of delivery - * @returns {Promise} - */ + * Set delivery time out of stock + * @param page {Page} Browser tab + * @param numberOfDays {string} Number of days of delivery + * @returns {Promise} + */ async setDeliveryTimeOutOfStockProducts(page: Page, numberOfDays: string): Promise { await this.setValue(page, this.deliveryTimeOutOfStockProducts, numberOfDays); } /** - * Click on edit delivery time link - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on edit delivery time link + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnEditDeliveryTimeLink(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.editDeliveryTimeLink); } /** - * Set additional shipping costs - * @param page {Page} Browser tab - * @param shippingCosts {number} Shipping cost - * @returns {Promise} - */ + * Set additional shipping costs + * @param page {Page} Browser tab + * @param shippingCosts {number} Shipping cost + * @returns {Promise} + */ async setAdditionalShippingCosts(page: Page, shippingCosts: number): Promise { await this.waitForSelectorAndClick(page, this.shippingTabLink); await this.setValue(page, this.productAdditionalShippingCostInput, shippingCosts); } /** - * Select available carrier - * @param page {Page} Browser tab - * @param carrier {string} Carrier to choose - * @returns {Promise} - */ + * Select available carrier + * @param page {Page} Browser tab + * @param carrier {string} Carrier to choose + * @returns {Promise} + */ async selectAvailableCarrier(page: Page, carrier: string): Promise { await this.waitForSelectorAndClick(page, this.allCarriersSelect); switch (carrier) { @@ -177,11 +174,11 @@ class ShippingTab extends BOBasePage implements BOProductsCreateTabShippingPageI } /** - * Returns the value of a form element - * @param page {Page} - * @param inputName {string} - * @param languageId {string | undefined} - */ + * Returns the value of a form element + * @param page {Page} + * @param inputName {string} + * @param languageId {string | undefined} + */ async getValue(page: Page, inputName: string, languageId?: string): Promise { switch (inputName) { case 'additional_delivery_times': @@ -206,5 +203,4 @@ class ShippingTab extends BOBasePage implements BOProductsCreateTabShippingPageI } } -const shippingTab = new ShippingTab(); -export {shippingTab, ShippingTab}; +module.exports = new ShippingTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabStocks.ts b/src/versions/develop/pages/BO/catalog/products/create/tabStocks.ts index 8f7c25734..b71087917 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabStocks.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabStocks.ts @@ -1,10 +1,8 @@ -import BOBasePage from '@pages/BO/BOBasePage'; - import type FakerProduct from '@data/faker/product'; -import type {ProductStockMovement} from '@data/types/product'; -import type {BOProductsCreateTabStocksPageInterface} from '@interfaces/BO/catalog/products/create/tabStocks'; - -import type {Page} from 'playwright'; +import {type ProductStockMovement} from '@data/types/product'; +import {type BOProductsCreateTabStocksPageInterface} from '@interfaces/BO/catalog/products/create/tabStocks'; +import BOBasePage from '@pages/BO/BOBasePage'; +import {type Page} from '@playwright/test'; /** * Stocks tab on product page, contains functions that can be used on the page @@ -59,9 +57,9 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter private readonly stockMovementsLink: string; /** - * @constructs - * Setting up texts and selectors to use on stocks tab - */ + * @constructs + * Setting up texts and selectors to use on stocks tab + */ constructor() { super(); @@ -75,11 +73,11 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter this.productLowStockThresholdInput = '#product_stock_options_low_stock_threshold'; this.productLabelAvailableNowDropdown = '#product_stock_availability_available_now_label_dropdown'; this.productLabelAvailableNowDropdownItem = (locale: string) => '#product_stock_availability_available_now_label ' - + `span.dropdown-item[data-locale="${locale}"]`; + + `span.dropdown-item[data-locale="${locale}"]`; this.productLabelAvailableNowInput = (languageId: string) => `#product_stock_availability_available_now_label_${languageId}`; this.productLabelAvailableLaterDropdown = '#product_stock_availability_available_later_label_dropdown'; this.productLabelAvailableLaterDropdownItem = (locale: string) => '#product_stock_availability_available_later_label ' - + `span.dropdown-item[data-locale="${locale}"]`; + + `span.dropdown-item[data-locale="${locale}"]`; this.productLabelAvailableLaterInput = (languageId: string) => `#product_stock_availability_available_later_label_${ languageId}`; this.productAvailableDateInput = '#product_stock_availability_available_date'; @@ -98,22 +96,22 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /* - Methods - */ + Methods + */ /** - * Get Product quantity - * @param page {Page} Browser tab - */ - async getProductQuantity(page: Page): Promise { + * Get Product quantity + * @param page {Page} Browser tab + */ + async getProductQuantity(page:Page): Promise { return parseInt(await this.getTextContent(page, this.initialQuantitySpan), 10); } /** - * Set product quantity - * @param page {Page} Browser tab - * @param quantity {number} Quantity value to set on quantity input - * @returns {Promise} - */ + * Set product quantity + * @param page {Page} Browser tab + * @param quantity {number} Quantity value to set on quantity input + * @returns {Promise} + */ async setProductQuantity(page: Page, quantity: number): Promise { await this.waitForSelectorAndClick(page, this.stocksTabLink); const initialQuantity = await this.getProductQuantity(page); @@ -121,12 +119,12 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Set product stock - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set in stock form - * @returns {Promise} - */ - async setProductStock(page: Page, productData: FakerProduct): Promise { + * Set product stock + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set in stock form + * @returns {Promise} + */ + async setProductStock(page:Page, productData: FakerProduct): Promise { await this.waitForSelectorAndClick(page, this.stocksTabLink); await this.setQuantityDelta(page, productData.quantity); await this.setValue(page, this.productMinimumQuantityInput, productData.minimumQuantity); @@ -139,21 +137,21 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Set quantity delta - * @param page {Page} Browser tab - * @param quantity {number} Quantity delta - * @returns {Promise} - */ + * Set quantity delta + * @param page {Page} Browser tab + * @param quantity {number} Quantity delta + * @returns {Promise} + */ async setQuantityDelta(page: Page, quantity: number): Promise { await this.setValue(page, this.productQuantityInput, quantity); } /** - * Set option when out of stock - * @param page {Page} Browser tab - * @param option {string} Option to check - * @returns {Promise} - */ + * Set option when out of stock + * @param page {Page} Browser tab + * @param option {string} Option to check + * @returns {Promise} + */ async setOptionWhenOutOfStock(page: Page, option: string): Promise { switch (option) { case 'Deny orders': @@ -172,10 +170,10 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * @param page {Page} - * @param inputName {string} - * @param languageId {string | undefined} - */ + * @param page {Page} + * @param inputName {string} + * @param languageId {string | undefined} + */ async getValue(page: Page, inputName: string, languageId?: string): Promise { switch (inputName) { case 'available_date': @@ -198,10 +196,10 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Get stock movements data - * @param page {Page} Browser tab - * @param movementRow {number} Movement row in table stock movements - */ + * Get stock movements data + * @param page {Page} Browser tab + * @param movementRow {number} Movement row in table stock movements + */ async getStockMovement(page: Page, movementRow: number): Promise { return { dateTime: await this.getTextContent(page, this.dateTimeRowInTable(movementRow - 1)), @@ -211,37 +209,37 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Click on "View All Stock Movements" link - * @param page {Page} Browser tab - */ + * Click on "View All Stock Movements" link + * @param page {Page} Browser tab + */ async clickViewAllStockMovements(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.stockMovementsLink); } /** - * Set the Minimum quantity for sale - * @param page {Page} Browser tab - * @param minimalQuantiy {number} Minimal Quantity - */ + * Set the Minimum quantity for sale + * @param page {Page} Browser tab + * @param minimalQuantiy {number} Minimal Quantity + */ async setMinimalQuantity(page: Page, minimalQuantiy: number): Promise { await this.setValue(page, this.productMinimumQuantityInput, minimalQuantiy); } /** - * Set the Stock location - * @param page {Page} Browser tab - * @param stockLocation {number} Stock location - */ + * Set the Stock location + * @param page {Page} Browser tab + * @param stockLocation {number} Stock location + */ async setStockLocation(page: Page, stockLocation: string): Promise { await this.setValue(page, this.productStockLocationInput, stockLocation); } /** - * Enable/Disable the low stock alert by email - * @param page {Page} Browser tab - * @param statusAlert {boolean} Status - * @param thresholdValue {number} Threshold value - */ + * Enable/Disable the low stock alert by email + * @param page {Page} Browser tab + * @param statusAlert {boolean} Status + * @param thresholdValue {number} Threshold value + */ async setLowStockAlertByEmail(page: Page, statusAlert: boolean, thresholdValue: number = 0): Promise { const isLowStockAlertByEmail: boolean = (await this.getValue(page, 'low_stock_threshold_enabled') === '1'); @@ -256,11 +254,11 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Set label when in stock - * @param page {Page} Browser tab - * @param label {string} Label to set when in stock in the input - * @returns {Promise} - */ + * Set label when in stock + * @param page {Page} Browser tab + * @param label {string} Label to set when in stock in the input + * @returns {Promise} + */ async setLabelWhenInStock(page: Page, label: string): Promise { await this.waitForSelectorAndClick(page, this.productLabelAvailableNowDropdown); await page @@ -270,10 +268,10 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Set label when out of stock - * @param page {Page} Browser tab - * @param label {string} Label to set when out of stock in the input - */ + * Set label when out of stock + * @param page {Page} Browser tab + * @param label {string} Label to set when out of stock in the input + */ async setLabelWhenOutOfStock(page: Page, label: string): Promise { await this.waitForSelectorAndClick(page, this.productLabelAvailableLaterDropdown); await page @@ -283,24 +281,23 @@ class StocksTab extends BOBasePage implements BOProductsCreateTabStocksPageInter } /** - * Set availability date - * @param page {Page} Browser tab - * @param date {string} Label to set when availability date in the input - */ + * Set availability date + * @param page {Page} Browser tab + * @param date {string} Label to set when availability date in the input + */ async setAvailabilityDate(page: Page, date: string): Promise { await this.setValue(page, this.productAvailableDateInput, date); } /** - * Is quantity input visible - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Is quantity input visible + * @param page {Page} Browser tab + * @returns {Promise} + */ async isQuantityInputVisible(page: Page): Promise { await this.waitForSelectorAndClick(page, this.stocksTabLink); return this.elementVisible(page, this.productQuantityInput, 1000); } } -const stocksTab = new StocksTab(); -export {stocksTab, StocksTab}; +module.exports = new StocksTab(); diff --git a/src/versions/develop/pages/BO/catalog/products/create/tabVirtualProduct.ts b/src/versions/develop/pages/BO/catalog/products/create/tabVirtualProduct.ts index 95582a3bb..5bb4013d8 100644 --- a/src/versions/develop/pages/BO/catalog/products/create/tabVirtualProduct.ts +++ b/src/versions/develop/pages/BO/catalog/products/create/tabVirtualProduct.ts @@ -1,9 +1,7 @@ -import BOBasePage from '@pages/BO/BOBasePage'; - -import type {Page} from 'playwright'; - import type FakerProduct from '@data/faker/product'; -import type {BOProductsCreateTabVirtualProductPageInterface} from '@interfaces/BO/catalog/products/create/tabVirtualProduct'; +import {type BOProductsCreateTabVirtualProductPageInterface} from '@interfaces/BO/catalog/products/create/tabVirtualProduct'; +import BOBasePage from '@pages/BO/BOBasePage'; +import {type Page} from '@playwright/test'; /** * Virtual product tab on product page, contains functions that can be used on the page @@ -46,9 +44,9 @@ class VirtualProductTab extends BOBasePage implements BOProductsCreateTabVirtual private readonly labelWhenOutOfStock: string; /** - * @constructs - * Setting up texts and selectors to use on Virtual product tab - */ + * @constructs + * Setting up texts and selectors to use on Virtual product tab + */ constructor() { super(); @@ -75,26 +73,26 @@ class VirtualProductTab extends BOBasePage implements BOProductsCreateTabVirtual } /* - Methods - */ + Methods + */ /** - * Set product quantity - * @param page {Page} Browser tab - * @param quantity {string} Product quantity to set in the input - * @returns {Promise} - */ + * Set product quantity + * @param page {Page} Browser tab + * @param quantity {string} Product quantity to set in the input + * @returns {Promise} + */ async setProductQuantity(page: Page, quantity: number): Promise { await this.waitForSelectorAndClick(page, this.virtualProductTabLink); await this.setValue(page, this.productQuantityInput, quantity); } /** - * Set virtual product - * @param page {Page} Browser tab - * @param productData {FakerProduct} Data to set in virtual product form - * @returns {Promise} - */ + * Set virtual product + * @param page {Page} Browser tab + * @param productData {FakerProduct} Data to set in virtual product form + * @returns {Promise} + */ async setVirtualProduct(page: Page, productData: FakerProduct): Promise { await this.setProductQuantity(page, productData.quantity); await this.setValue(page, this.productMinimumQuantityInput, productData.minimumQuantity); @@ -110,21 +108,21 @@ class VirtualProductTab extends BOBasePage implements BOProductsCreateTabVirtual } /** - * Get error message in downloaded file input - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Get error message in downloaded file input + * @param page {Page} Browser tab + * @returns {Promise} + */ async getErrorMessageInDownloadFileInput(page: Page): Promise { return this.getTextContent(page, this.errorMessageInFileInput); } // Methods for when out of stock /** - * Set option when out of stock - * @param page {Page} Browser tab - * @param option {string} Option to check - * @returns {Promise} - */ + * Set option when out of stock + * @param page {Page} Browser tab + * @param option {string} Option to check + * @returns {Promise} + */ async setOptionWhenOutOfStock(page: Page, option: string): Promise { switch (option) { case 'Deny orders': @@ -142,29 +140,29 @@ class VirtualProductTab extends BOBasePage implements BOProductsCreateTabVirtual } /** - * Click on edit default behaviour link - * @param page {Page} Browser tab - * @returns {Promise} - */ + * Click on edit default behaviour link + * @param page {Page} Browser tab + * @returns {Promise} + */ async clickOnEditDefaultBehaviourLink(page: Page): Promise { return this.openLinkWithTargetBlank(page, this.editDefaultBehaviourLink); } /** - * Set label when in stock - * @param page {Page} Browser tab - * @param label {string} Label to set when in stock in the input - * @returns {Promise} - */ + * Set label when in stock + * @param page {Page} Browser tab + * @param label {string} Label to set when in stock in the input + * @returns {Promise} + */ async setLabelWhenInStock(page: Page, label: string): Promise { await this.setValue(page, this.labelWhenInStock, label); } /** - * Set label when out of stock - * @param page {Page} Browser tab - * @param label {string} Label to set when out of stock in the input - */ + * Set label when out of stock + * @param page {Page} Browser tab + * @param label {string} Label to set when out of stock in the input + */ async setLabelWhenOutOfStock(page: Page, label: string): Promise { await this.setValue(page, this.labelWhenOutOfStock, label); } diff --git a/src/versions/develop/pages/BO/catalog/products/index.ts b/src/versions/develop/pages/BO/catalog/products/index.ts index 0567c54f6..5c1d7c758 100644 --- a/src/versions/develop/pages/BO/catalog/products/index.ts +++ b/src/versions/develop/pages/BO/catalog/products/index.ts @@ -1,17 +1,15 @@ -import BOBasePage from '@pages/BO/BOBasePage'; - -import type {BOProductsPageInterface} from '@interfaces/BO/catalog/products'; - +import FakerProduct from '@data/faker/product'; import {ProductFilterMinMax} from '@data/types/product'; +import {BOProductsPageInterface} from '@interfaces/BO/catalog/products'; +import BOBasePage from '@pages/BO/BOBasePage'; import { expect, type Frame, type Page, } from '@playwright/test'; -import FakerProduct from '@data/faker/product'; /** - * Products page, contains functions that can be used on the page + * Products V2 page, contains functions that can be used on the page * @class * @extends BOBasePage */ @@ -166,7 +164,7 @@ class ProductsPage extends BOBasePage implements BOProductsPageInterface { private readonly productListTablePreviewButton: (row: number) => string; - public readonly modalCreateProduct: string; + readonly modalCreateProduct: string; private readonly modalCreateProductLoader: string; @@ -204,7 +202,7 @@ class ProductsPage extends BOBasePage implements BOProductsPageInterface { /** * @constructs - * Setting up texts and selectors to use on products V2 page + * Setting up texts and selectors to use on products page */ constructor() { super(); diff --git a/tsconfig.json b/tsconfig.json index db67b01c4..da1bcfe97 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,6 +26,9 @@ "@interfaces/*": [ "src/interfaces/*" ], + "@ops/*": [ + "src/ops/*" + ], "@pages/*": [ "src/pages/*" ],