From 57885609ed93b060ae97abe2fdfb1d78a67b53e7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 27 Mar 2024 14:48:04 +0100 Subject: [PATCH 01/10] Added @data/demo/products --- src/data/demo/products.ts | 6 +++--- src/data/faker/product.ts | 12 ++++++------ src/data/faker/productReview.ts | 10 +++++----- src/data/types/{product.ts => product.d.ts} | 1 + 4 files changed, 15 insertions(+), 14 deletions(-) rename src/data/types/{product.ts => product.d.ts} (99%) diff --git a/src/data/demo/products.ts b/src/data/demo/products.ts index 3b7f079a9..c3f3516e4 100644 --- a/src/data/demo/products.ts +++ b/src/data/demo/products.ts @@ -9,9 +9,9 @@ export default { category: 'Men', summary: 'Regular fit, round neckline, short sleeves. Made of extra long staple pima cotton.', description: 'Symbol of lightness and delicacy, the hummingbird evokes curiosity and joy. Studio Design\' ' - + 'PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese ' - + 'origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional ' - + 'color rendering and a color, guaranteed overtime.', + + 'PolyFaune collection features classic products with colorful patterns, inspired by the traditional japanese ' + + 'origamis. To wear with a chino or jeans. The sublimation textile printing process provides an exceptional ' + + 'color rendering and a color, guaranteed overtime.', retailPrice: 28.68, tax: 20, price: 23.90, 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/faker/productReview.ts b/src/data/faker/productReview.ts index aa77e0597..71a065d46 100644 --- a/src/data/faker/productReview.ts +++ b/src/data/faker/productReview.ts @@ -14,17 +14,17 @@ export default class FakerProductReview { public reviewRating: number; /** - * Constructor for class ProductReview - * @param productReviewToCreate {ProductReviewCreator} Could be used to add a review on a product - */ + * Constructor for class ProductReview + * @param productReviewToCreate {ProductReviewCreator} Could be used to add a review on a product + */ constructor(productReviewToCreate: ProductReviewCreator = {}) { /** @type {string} Title of the review */ this.reviewTitle = productReviewToCreate.reviewTitle - || faker.lorem.sentence(faker.number.int({min: 3, max: 7})); + || faker.lorem.sentence(faker.number.int({min: 3, max: 7})); /** @type {string} Content of the review */ this.reviewContent = productReviewToCreate.reviewContent - || faker.lorem.sentences(faker.number.int({min: 3, max: 10})); + || faker.lorem.sentences(faker.number.int({min: 3, max: 10})); /** @type {number} Rating of the review */ this.reviewRating = productReviewToCreate.reviewRating || faker.number.int({min: 1, max: 5}); diff --git a/src/data/types/product.ts b/src/data/types/product.d.ts similarity index 99% rename from src/data/types/product.ts rename to src/data/types/product.d.ts index e18b79673..5b9cff4ae 100644 --- a/src/data/types/product.ts +++ b/src/data/types/product.d.ts @@ -279,4 +279,5 @@ export type { ProductFeatures, ProductFiles, ProductCustomizations, + ProductOrderConfirmation, }; From b8b0b950862d38d9bc7d66fc960f4bb78bbc2815 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Thu, 28 Mar 2024 09:48:51 +0100 Subject: [PATCH 02/10] `@pages/FO/classic/product` : Fixed selector for PS < 9 --- src/pages/FO/classic/product/index.ts | 7 ++++ .../8.1.0/pages/FO/classic/product/index.ts | 37 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 src/versions/8.1.0/pages/FO/classic/product/index.ts diff --git a/src/pages/FO/classic/product/index.ts b/src/pages/FO/classic/product/index.ts index 47f5e0511..9fb40370c 100644 --- a/src/pages/FO/classic/product/index.ts +++ b/src/pages/FO/classic/product/index.ts @@ -1,7 +1,14 @@ import type {FoProductPageInterface} from '@interfaces/FO/product'; +import testContext from '@utils/test'; +import semver from 'semver'; + +const psVersion = testContext.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoProductPageInterface { + if (semver.lt(psVersion, '9.0.0')) { + return require('@versions/8.1.0/pages/FO/classic/product'); + } return require('@versions/develop/pages/FO/classic/product').productPage; } /* eslint-enable global-require, @typescript-eslint/no-var-requires */ diff --git a/src/versions/8.1.0/pages/FO/classic/product/index.ts b/src/versions/8.1.0/pages/FO/classic/product/index.ts new file mode 100644 index 000000000..ebe43668e --- /dev/null +++ b/src/versions/8.1.0/pages/FO/classic/product/index.ts @@ -0,0 +1,37 @@ +import type {FoProductPageInterface} from '@interfaces/FO/product/index'; +import type {Page} from '@playwright/test'; +import {ProductPage} from '@versions/develop/pages/FO/classic/product/index'; + +/** + * @class + * @extends ProductPage + */ +class ProductPageVersion extends ProductPage implements FoProductPageInterface { + private readonly productCategoryProductsBlock: string; + + /** + * @constructs + * Setting up texts and selectors to use on order confirmation page + */ + constructor(theme: string = 'classic') { + super(theme); + + // Selectors + this.productCategoryProductsBlock = '#content-wrapper section.featured-products'; + } + + /** + * Has products block + * @param blockName {'categoryproducts'} The block name in the page + * @param page {Page} Browser tab + * @return {Promise} + */ + async hasProductsBlock(page: Page, blockName: 'categoryproducts'): Promise { + if (blockName === 'categoryproducts') { + return (await page.locator(this.productCategoryProductsBlock).count()) > 0; + } + return false; + } +} + +module.exports = new ProductPageVersion(); From 7d029cf3c4606731a5fc97cb23a444522b50b91d Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 12:05:21 +0100 Subject: [PATCH 03/10] @pages/BO/login : Fixed submitLogin in < 1.7.2 --- src/pages/BO/login/index.ts | 5 ++- src/versions/1.7.2/pages/BO/login/index.ts | 41 ++++++++++++++++++++ src/versions/1.7.8/pages/BO/login/index.ts | 5 ++- src/versions/develop/pages/BO/login/index.ts | 2 +- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/versions/1.7.2/pages/BO/login/index.ts diff --git a/src/pages/BO/login/index.ts b/src/pages/BO/login/index.ts index d1a59619a..c16105f15 100644 --- a/src/pages/BO/login/index.ts +++ b/src/pages/BO/login/index.ts @@ -6,8 +6,11 @@ const psVersion = testContext.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): LoginPageInterface { + if (semver.lt(psVersion, '7.3.0')) { + return require('@versions/1.7.2/pages/BO/login'); + } if (semver.lt(psVersion, '8.0.0')) { - return require('@versions/1.7.8/pages/BO/login'); + return require('@versions/1.7.8/pages/BO/login').loginPage; } if (semver.lt(psVersion, '9.0.0')) { return require('@versions/8.1/pages/BO/login').loginPage; diff --git a/src/versions/1.7.2/pages/BO/login/index.ts b/src/versions/1.7.2/pages/BO/login/index.ts new file mode 100644 index 000000000..f626ca4bf --- /dev/null +++ b/src/versions/1.7.2/pages/BO/login/index.ts @@ -0,0 +1,41 @@ +// Import pages +import type {LoginPageInterface} from '@interfaces/BO/login'; +import {Page} from '@playwright/test'; +import {LoginPage} from '@versions/1.7.8/pages/BO/login'; + +/** + * Order confirmation page, contains functions that can be used on the page + * @class + * @extends OrderConfirmationPage + */ +class LoginPageVersion extends LoginPage implements LoginPageInterface { + private readonly errorModalButton: string; + + /** + * @constructs + * Setting up texts and selectors to use on order confirmation page + */ + constructor() { + super(); + + this.submitLoginButton = 'form#login_form button[name="submitLogin"]'; + + // + this.errorModalButton = '#error-modal .modal-dialog .alert button[data-dismiss="modal"]' + } + + /** + * Fill login form and success login + * @param page {Page} Browser tab + * @param email {string} String of employee email + * @param password {string} String of employee password + * @returns {Promise} + */ + async successLogin(page: Page, email: string, password: string): Promise { + await super.successLogin(page, email, password); + + await page.locator(this.errorModalButton).click(); + } +} + +module.exports = new LoginPageVersion(); diff --git a/src/versions/1.7.8/pages/BO/login/index.ts b/src/versions/1.7.8/pages/BO/login/index.ts index eb56ae0ee..2b8b1ee23 100644 --- a/src/versions/1.7.8/pages/BO/login/index.ts +++ b/src/versions/1.7.8/pages/BO/login/index.ts @@ -8,7 +8,7 @@ import {LoginPage} from '@versions/8.1/pages/BO/login'; * @class * @extends OrderConfirmationPage */ -class Login extends LoginPage implements LoginPageInterface { +class LoginPageVersion extends LoginPage implements LoginPageInterface { private readonly onboardingCloseButton: string; private readonly onboardingStopButton: string; @@ -50,4 +50,5 @@ class Login extends LoginPage implements LoginPageInterface { } } -module.exports = new Login(); +const loginPage = new LoginPageVersion(); +export {loginPage, LoginPageVersion as LoginPage}; diff --git a/src/versions/develop/pages/BO/login/index.ts b/src/versions/develop/pages/BO/login/index.ts index 45525efd2..8a42c9122 100644 --- a/src/versions/develop/pages/BO/login/index.ts +++ b/src/versions/develop/pages/BO/login/index.ts @@ -32,7 +32,7 @@ class LoginPage extends BOBasePage implements LoginPageInterface { private readonly passwordInput: string; - private readonly submitLoginButton: string; + protected submitLoginButton: string; protected alertDangerDiv: string; From 11a4f08da0f92d3e4be36ffefa67bb78a3e6e532 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 12:05:59 +0100 Subject: [PATCH 04/10] @pages/BO/modules/moduleManager : Fixed title page in < 1.7.4 --- src/pages/BO/modules/moduleManager/index.ts | 3 +++ .../pages/BO/modules/moduleManager/index.ts | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts diff --git a/src/pages/BO/modules/moduleManager/index.ts b/src/pages/BO/modules/moduleManager/index.ts index 5a91e3bee..cd4b7c23a 100644 --- a/src/pages/BO/modules/moduleManager/index.ts +++ b/src/pages/BO/modules/moduleManager/index.ts @@ -2,6 +2,9 @@ import type {ModuleManagerPageInterface} from '@interfaces/BO/modules/moduleMana /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): ModuleManagerPageInterface { + if (semver.lt(psVersion, '1.7.5')) { + return require('@versions/1.7.4/pages/BO/modules/moduleManager'); + } return require('@versions/develop/pages/BO/modules/moduleManager').moduleManagerPage; } /* eslint-enable global-require, @typescript-eslint/no-var-requires */ diff --git a/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts b/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts new file mode 100644 index 000000000..6b6e0c64a --- /dev/null +++ b/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts @@ -0,0 +1,20 @@ +// Import pages +import type {ModuleManagerPageInterface} from '@interfaces/BO/modules/moduleManager'; +import {ModuleManagerPage} from '@versions/develop/pages/BO/modules/moduleManager'; + +/** + * @class + * @extends ModuleManagerPage + */ +class ModuleManagerVersion extends ModuleManagerPage implements ModuleManagerPageInterface { + /** + * @constructs + */ + constructor() { + super(); + + this.pageTitle = 'Manage installed modules •'; + } +} + +module.exports = new ModuleManagerVersion(); From eaed602ecfdc4c6f891938430b06884901de039e Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 12:10:38 +0100 Subject: [PATCH 05/10] @pages/BO/modules/moduleManager : Fixed version --- src/pages/BO/modules/moduleManager/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/BO/modules/moduleManager/index.ts b/src/pages/BO/modules/moduleManager/index.ts index cd4b7c23a..3d9a4b928 100644 --- a/src/pages/BO/modules/moduleManager/index.ts +++ b/src/pages/BO/modules/moduleManager/index.ts @@ -2,7 +2,7 @@ import type {ModuleManagerPageInterface} from '@interfaces/BO/modules/moduleMana /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): ModuleManagerPageInterface { - if (semver.lt(psVersion, '1.7.5')) { + if (semver.lt(psVersion, '7.5.0')) { return require('@versions/1.7.4/pages/BO/modules/moduleManager'); } return require('@versions/develop/pages/BO/modules/moduleManager').moduleManagerPage; From 0b68348a4c3babfb50b7599b68bd6bacffb3f579 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 12:27:39 +0100 Subject: [PATCH 06/10] @pages/BO/modules/moduleManager/selection : Added for 1.7.4 --- src/index.ts | 1 + .../BO/modules/moduleManager/selection.ts | 9 +++ .../BO/modules/moduleManager/selection.ts | 16 +++++ .../BO/modules/moduleManager/selection.ts | 65 +++++++++++++++++++ .../BO/modules/moduleManager/selection.ts | 42 ++++++++++++ 5 files changed, 133 insertions(+) create mode 100644 src/interfaces/BO/modules/moduleManager/selection.ts create mode 100644 src/pages/BO/modules/moduleManager/selection.ts create mode 100644 src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts create mode 100644 src/versions/mock/pages/BO/modules/moduleManager/selection.ts diff --git a/src/index.ts b/src/index.ts index b9fdafedd..a8a4c4b96 100644 --- a/src/index.ts +++ b/src/index.ts @@ -203,6 +203,7 @@ export {default as boLocalizationPage} from '@pages/BO/international/localizatio export {default as boLoginPage} from '@pages/BO/login'; export {default as boModuleManagerPage} from '@pages/BO/modules/moduleManager'; export {default as boModuleManagerAlertsPage} from '@pages/BO/modules/moduleManager/alerts'; +export {default as boModuleManagerSelectionPage} from '@pages/BO/modules/moduleManager/selection'; export {default as boModuleManagerUninstalledModulesPage} from '@pages/BO/modules/moduleManager/uninstalledModules'; export {default as boNewExperimentalFeaturesPage} from '@pages/BO/advancedParameters/newExperimentalFeatures'; export {default as boOrdersPage} from '@pages/BO/orders'; diff --git a/src/interfaces/BO/modules/moduleManager/selection.ts b/src/interfaces/BO/modules/moduleManager/selection.ts new file mode 100644 index 000000000..5541ac89f --- /dev/null +++ b/src/interfaces/BO/modules/moduleManager/selection.ts @@ -0,0 +1,9 @@ +import {BOBasePagePageInterface} from '@interfaces/BO'; +import type {Page} from '@playwright/test'; + +export interface ModuleManagerSelectionPageInterface extends BOBasePagePageInterface { + readonly installMessageSuccessful: (moduleTag: string) => string; + + goToTabSelection(page: Page): Promise; + installModule(page: Page, moduleTag: string): Promise; +} diff --git a/src/pages/BO/modules/moduleManager/selection.ts b/src/pages/BO/modules/moduleManager/selection.ts new file mode 100644 index 000000000..452a04d01 --- /dev/null +++ b/src/pages/BO/modules/moduleManager/selection.ts @@ -0,0 +1,16 @@ +import type {ModuleManagerSelectionPageInterface} from '@interfaces/BO/modules/moduleManager/selection'; +import testContext from '@utils/testContext'; +import semver from 'semver'; + +const psVersion = testContext.getPSVersion(); + +/* eslint-disable global-require, @typescript-eslint/no-var-requires */ +function requirePage(): ModuleManagerSelectionPageInterface { + if (semver.gte(psVersion, '7.5.0')) { + return require('@versions/mock/pages/BO/modules/moduleManager/selection'); + } + return require('@versions/1.7.4/pages/BO/modules/moduleManager/selection'); +} +/* eslint-enable global-require, @typescript-eslint/no-var-requires */ + +export default requirePage(); diff --git a/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts b/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts new file mode 100644 index 000000000..358568848 --- /dev/null +++ b/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts @@ -0,0 +1,65 @@ +import {ModuleManagerSelectionPageInterface} from '@interfaces/BO/modules/moduleManager/selection'; +import BOBasePage from '@pages/BO/BOBasePage'; +import {Page} from '@playwright/test'; + +/** + * @class + * @extends BOBasePage + */ +class SelectionPage extends BOBasePage implements ModuleManagerSelectionPageInterface { + public readonly installMessageSuccessful: (moduleTag: string) => string; + + private readonly subTabUninstalledModules: string; + + private readonly searchInput: string; + + private readonly searchButton: string; + + private readonly installModuleButton: (moduleName: string) => string; + + /** + * @constructs + * Setting up titles and selectors to use on module catalog page + */ + constructor() { + super(); + + this.installMessageSuccessful = (moduleTag: string) => `Install action on module ${moduleTag} succeeded.`; + + // Selectors + this.subTabUninstalledModules = '#subtab-AdminModulesCatalog'; + this.searchInput = '#search-input-group input.pstaggerAddTagInput'; + this.searchButton = '#module-search-button'; + this.installModuleButton = (moduleTag: string) => `div[data-tech-name="${moduleTag}"] button.module_action_menu_install`; + } + + /* + Methods + */ + /** + * Go to the "Selection" tab + * @param {Page} page + * @returns {Promise} + */ + async goToTabSelection(page: Page): Promise { + await this.waitForSelectorAndClick(page, this.subTabUninstalledModules); + await this.waitForVisibleSelector(page, `${this.subTabUninstalledModules}.active`, 2000); + } + + /** + * Install the module and return if installed + * @param {Page} page + * @param {string} moduleTag + * @returns {Promise} + */ + async installModule(page: Page, moduleTag: string): Promise { + await page.locator(this.searchInput).fill(moduleTag); + await page.locator(this.searchButton).click(); + await this.elementVisible(page, this.installModuleButton(moduleTag), 3000) + await page.locator(this.installModuleButton(moduleTag)).click(); + + return this.elementNotVisible(page, this.installModuleButton(moduleTag), 3000); + } +} + +module.exports = new SelectionPage(); diff --git a/src/versions/mock/pages/BO/modules/moduleManager/selection.ts b/src/versions/mock/pages/BO/modules/moduleManager/selection.ts new file mode 100644 index 000000000..7d6d12ea5 --- /dev/null +++ b/src/versions/mock/pages/BO/modules/moduleManager/selection.ts @@ -0,0 +1,42 @@ +import {ModuleManagerSelectionPageInterface} from '@interfaces/BO/modules/moduleManager/selection'; +import BOBasePage from '@pages/BO/BOBasePage'; + +/** + * Mock Page for unsupported version + * @class + * @extends BOBasePage + */ +class SelectionPageMock extends BOBasePage implements ModuleManagerSelectionPageInterface { + public readonly installMessageSuccessful: (moduleTag: string) => string; + + /** + * @constructs + * Setting up titles and selectors to use on module catalog page + */ + constructor() { + super(); + + this.installMessageSuccessful = () => ''; + } + + /* + Methods + */ + /** + * Go to the "Selection" tab + * @returns {Promise} + */ + async goToTabSelection(): Promise { + // do nothing. + } + + /** + * Install the module and return if installed + * @returns {Promise} + */ + async installModule(): Promise { + return true; + } +} + +module.exports = new SelectionPageMock(); From fb5c337a5e4037aadd6f8acdf9f1e5938399ce70 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 15:40:46 +0100 Subject: [PATCH 07/10] @pages/BO/modules/moduleManager : Fixed install < 1.7.4 --- src/pages/BO/BOBasePage.ts | 11 ++++++++++- .../1.7.4/pages/BO/modules/moduleManager/index.ts | 9 +++++++++ .../develop/pages/BO/modules/moduleManager/index.ts | 4 ++-- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/pages/BO/BOBasePage.ts b/src/pages/BO/BOBasePage.ts index b2185caa8..2e62714b3 100644 --- a/src/pages/BO/BOBasePage.ts +++ b/src/pages/BO/BOBasePage.ts @@ -1072,7 +1072,16 @@ 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 = testContext.getPSVersion(); + let {growlMessageBlock} = this; + + if (semver.lt(psVersion, '8.0.0') && semver.gt(psVersion, '7.4.99')) { + growlMessageBlock = `${this.growlDiv} .growl-message`; + } + if (semver.lt(psVersion, '7.5.0')) { + growlMessageBlock = `${this.growlDefaultDiv} .growl-message`; + } + return page.textContent(growlMessageBlock, {timeout}); } /** diff --git a/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts b/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts index 6b6e0c64a..f42d604c6 100644 --- a/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts +++ b/src/versions/1.7.4/pages/BO/modules/moduleManager/index.ts @@ -14,6 +14,15 @@ class ModuleManagerVersion extends ModuleManagerPage implements ModuleManagerPag super(); this.pageTitle = 'Manage installed modules •'; + + // Modules list selectors + this.modulesListBlock = '#modules-list-container-native'; + this.allModulesBlock = `${this.modulesListBlock} .module-item-list`; + this.moduleBlock = (moduleTag: string) => `${this.allModulesBlock}[data-tech-name=${moduleTag}]`; + + // Module actions in dropdown selectors + this.actionModuleButtonInDropdownList = (action: string) => 'div.form-action-button-container.show' + + ` button.module_action_menu_${action}`; } } diff --git a/src/versions/develop/pages/BO/modules/moduleManager/index.ts b/src/versions/develop/pages/BO/modules/moduleManager/index.ts index 33a0d64d5..178ce7086 100644 --- a/src/versions/develop/pages/BO/modules/moduleManager/index.ts +++ b/src/versions/develop/pages/BO/modules/moduleManager/index.ts @@ -55,7 +55,7 @@ class ModuleManagerPage extends BOBasePage implements ModuleManagerPageInterface private readonly bulkActionsModalConfirmButton: string; - private readonly modulesListBlock: string; + protected modulesListBlock: string; private readonly modulesListBlockTitle: string; @@ -81,7 +81,7 @@ class ModuleManagerPage extends BOBasePage implements ModuleManagerPageInterface private readonly actionsDropdownButton: (moduleTag: string) => string; - private readonly actionModuleButtonInDropdownList: (action: string) => string; + protected actionModuleButtonInDropdownList: (action: string) => string; private readonly modalConfirmAction: (moduleTag: string, action: string) => string; From 5ed783bcda295b7a587329c0b800cbef69b8456a Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 15:47:31 +0100 Subject: [PATCH 08/10] @pages/FO/FOBasePage : Use Locator or string --- src/pages/FO/FOBasePage.ts | 30 +++++++++++++++++++++++------- src/pages/commonPage.ts | 36 +++++++++++++++++++++++++++--------- 2 files changed, 50 insertions(+), 16 deletions(-) diff --git a/src/pages/FO/FOBasePage.ts b/src/pages/FO/FOBasePage.ts index c90e1804e..0727b77d8 100644 --- a/src/pages/FO/FOBasePage.ts +++ b/src/pages/FO/FOBasePage.ts @@ -1,8 +1,9 @@ // Import pages import {FOBasePagePageInterface} from '@interfaces/FO'; import CommonPage from '@pages/commonPage'; - -import type {Page} from 'playwright'; +import testContext from '@utils/testContext'; +import type {Locator, Page} from 'playwright'; +import semver from 'semver'; /** * FO parent page, contains functions that can be used on all FO page @@ -44,7 +45,9 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte private readonly languageSelectorList: string; - private readonly languageSelectorMenuItemLink: (language: string) => string; + private readonly languageSelectorMenuItemLink: string; + + private readonly languageSelectorMenuItemLinkLang: (language: string) => string; private readonly currencySelectorDiv: string; @@ -174,8 +177,9 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte this.defaultLanguageSpan = `${this.languageSelectorDiv} button span`; this.languageSelectorExpandIcon = `${this.languageSelectorDiv} i.expand-more`; this.languageSelectorList = `${this.languageSelectorDiv} .js-dropdown.open`; - this.languageSelectorMenuItemLink = (language) => `${this.languageSelectorDiv} ul li ` - + `a[data-iso-code='${language}']`; + this.languageSelectorMenuItemLink = `${this.languageSelectorDiv} ul li a`; + this.languageSelectorMenuItemLinkLang = (language) => this.languageSelectorMenuItemLink + + `[data-iso-code='${language}']`; this.currencySelectorDiv = '#_desktop_currency_selector'; this.defaultCurrencySpan = `${this.currencySelectorDiv} button span`; this.currencySelectorExpandIcon = `${this.currencySelectorDiv} i.expand-more`; @@ -409,7 +413,7 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte page.locator(this.languageSelectorExpandIcon).click(), this.waitForVisibleSelector(page, this.languageSelectorList), ]); - await this.clickAndWaitForLoadState(page, this.languageSelectorMenuItemLink(lang)); + await this.clickAndWaitForLoadState(page, this.getLanguageSelector(page, lang)); } /** @@ -434,7 +438,7 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte */ async languageExists(page: Page, lang: string = 'en'): Promise { await page.locator(this.languageSelectorExpandIcon).click(); - return this.elementVisible(page, this.languageSelectorMenuItemLink(lang), 1000); + return this.elementVisible(page, this.getLanguageSelector(page, lang), 1000); } /** @@ -818,6 +822,18 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte async getRestrictedText(page: Page): Promise { return page.locator(this.restrictedText).textContent(); } + + private getLanguageSelector(page: Page, lang: string): string|Locator { + const psVersion = testContext.getPSVersion(); + // >= 1.7.5.0 + if (semver.gte(psVersion, '7.5.0')) { + return this.languageSelectorMenuItemLinkLang(lang); + } + + return page.locator(this.languageSelectorMenuItemLink).filter({ + hasText: lang == 'en' ? 'English' : 'Français', + }); + } } module.exports = FOBasePage; diff --git a/src/pages/commonPage.ts b/src/pages/commonPage.ts index 146a08ccd..1c42c66e0 100644 --- a/src/pages/commonPage.ts +++ b/src/pages/commonPage.ts @@ -170,13 +170,17 @@ export default class CommonPage implements CommonPageInterface { /** * Is element visible * @param page {Frame|Page} Browser tab - * @param selector {string} String to locate the element + * @param selector {string|Locator} String to locate the element * @param timeout {number} Time to wait on milliseconds before throwing an error * @returns {Promise} True if visible, false if not */ - async elementVisible(page: Frame | Page, selector: string, timeout: number = 10): Promise { + async elementVisible(page: Frame | Page, selector: string|Locator, timeout: number = 10): Promise { try { - await this.waitForVisibleSelector(page, selector, timeout); + if (typeof selector === 'string') { + await this.waitForVisibleSelector(page, selector, timeout); + } else { + await this.waitForVisibleLocator(selector, timeout); + } return true; } catch (error) { return false; @@ -416,42 +420,56 @@ export default class CommonPage implements CommonPageInterface { /** * Go to Page and wait for load State * @param page {Frame|Page} Browser tab - * @param selector {string} String to locate the element + * @param selector {string|Locator} String to locate the element * @param state {'load'|'domcontentloaded'|'networkidle'} The event to wait after click * @param timeout {number} Time to wait for navigation * @return {Promise} */ async clickAndWaitForLoadState( page: Frame | Page, - selector: string, + selector: string|Locator, state: 'load' | 'domcontentloaded' | 'networkidle' = 'networkidle', timeout: number = 30000, ): Promise { + let locator: Locator; + if (typeof selector === 'string') { + locator = page.locator(selector); + } else { + locator = selector; + } + await Promise.all([ page.waitForLoadState(state, {timeout}), - page.locator(selector).click(), + locator.click(), ]); } /** * Go to Page and wait for change URL * @param page {Frame|Page} Browser tab - * @param selector {string} String to locate the element + * @param selector {string|Locator} String to locate the element * @param waitUntil {WaitForNavigationWaitUntil} The event to wait after click * @param timeout {number} Time to wait for navigation * @return {Promise} */ async clickAndWaitForURL( page: Frame | Page, - selector: string, + selector: string|Locator, waitUntil: WaitForNavigationWaitUntil = 'networkidle', timeout: number = 30000, ): Promise { + let locator: Locator; + if (typeof selector === 'string') { + locator = page.locator(selector); + } else { + locator = selector; + } + const currentUrl: string = page.url(); await Promise.all([ page.waitForURL((url: URL): boolean => url.toString() !== currentUrl, {waitUntil, timeout}), - page.locator(selector).first().click(), + locator.click(), ]); } From 9bd36481a054ba1ceb191c011af1f3fdab6b6932 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 15:55:43 +0100 Subject: [PATCH 09/10] Fixed ESLint --- src/pages/FO/FOBasePage.ts | 7 ++++--- src/pages/commonPage.ts | 4 +++- src/versions/1.7.2/pages/BO/login/index.ts | 2 +- .../1.7.4/pages/BO/modules/moduleManager/selection.ts | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pages/FO/FOBasePage.ts b/src/pages/FO/FOBasePage.ts index 0727b77d8..7e937a48a 100644 --- a/src/pages/FO/FOBasePage.ts +++ b/src/pages/FO/FOBasePage.ts @@ -178,8 +178,8 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte this.languageSelectorExpandIcon = `${this.languageSelectorDiv} i.expand-more`; this.languageSelectorList = `${this.languageSelectorDiv} .js-dropdown.open`; this.languageSelectorMenuItemLink = `${this.languageSelectorDiv} ul li a`; - this.languageSelectorMenuItemLinkLang = (language) => this.languageSelectorMenuItemLink - + `[data-iso-code='${language}']`; + this.languageSelectorMenuItemLinkLang = (language) => `${this.languageSelectorMenuItemLink + }[data-iso-code='${language}']`; this.currencySelectorDiv = '#_desktop_currency_selector'; this.defaultCurrencySpan = `${this.currencySelectorDiv} button span`; this.currencySelectorExpandIcon = `${this.currencySelectorDiv} i.expand-more`; @@ -825,13 +825,14 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte private getLanguageSelector(page: Page, lang: string): string|Locator { const psVersion = testContext.getPSVersion(); + // >= 1.7.5.0 if (semver.gte(psVersion, '7.5.0')) { return this.languageSelectorMenuItemLinkLang(lang); } return page.locator(this.languageSelectorMenuItemLink).filter({ - hasText: lang == 'en' ? 'English' : 'Français', + hasText: lang === 'en' ? 'English' : 'Français', }); } } diff --git a/src/pages/commonPage.ts b/src/pages/commonPage.ts index 1c42c66e0..40560f40f 100644 --- a/src/pages/commonPage.ts +++ b/src/pages/commonPage.ts @@ -432,12 +432,13 @@ export default class CommonPage implements CommonPageInterface { timeout: number = 30000, ): Promise { let locator: Locator; + if (typeof selector === 'string') { locator = page.locator(selector); } else { locator = selector; } - + await Promise.all([ page.waitForLoadState(state, {timeout}), locator.click(), @@ -459,6 +460,7 @@ export default class CommonPage implements CommonPageInterface { timeout: number = 30000, ): Promise { let locator: Locator; + if (typeof selector === 'string') { locator = page.locator(selector); } else { diff --git a/src/versions/1.7.2/pages/BO/login/index.ts b/src/versions/1.7.2/pages/BO/login/index.ts index f626ca4bf..f6fc87f6a 100644 --- a/src/versions/1.7.2/pages/BO/login/index.ts +++ b/src/versions/1.7.2/pages/BO/login/index.ts @@ -21,7 +21,7 @@ class LoginPageVersion extends LoginPage implements LoginPageInterface { this.submitLoginButton = 'form#login_form button[name="submitLogin"]'; // - this.errorModalButton = '#error-modal .modal-dialog .alert button[data-dismiss="modal"]' + this.errorModalButton = '#error-modal .modal-dialog .alert button[data-dismiss="modal"]'; } /** diff --git a/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts b/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts index 358568848..f8bfb15eb 100644 --- a/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts +++ b/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts @@ -55,7 +55,7 @@ class SelectionPage extends BOBasePage implements ModuleManagerSelectionPageInte async installModule(page: Page, moduleTag: string): Promise { await page.locator(this.searchInput).fill(moduleTag); await page.locator(this.searchButton).click(); - await this.elementVisible(page, this.installModuleButton(moduleTag), 3000) + await this.elementVisible(page, this.installModuleButton(moduleTag), 3000); await page.locator(this.installModuleButton(moduleTag)).click(); return this.elementNotVisible(page, this.installModuleButton(moduleTag), 3000); From a3b412f132617c0706283c0598f2d31e5a539216 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 30 Apr 2024 15:32:00 +0200 Subject: [PATCH 10/10] @pages/BO/modules/moduleManager : Add router to go to the ModuleManager --- src/index.ts | 1 + .../BO/modules/moduleManager/selection.ts | 2 + src/interfaces/BO/router.ts | 6 +++ src/pages/BO/BOBasePage.ts | 31 ++++++++----- src/pages/BO/BORouterPage.ts | 35 +++++++++++++++ .../BO/modules/moduleManager/selection.ts | 5 ++- src/pages/FO/FOBasePage.ts | 4 +- .../BO/modules/moduleManager/selection.ts | 43 +++++++++++++++++++ .../BO/modules/moduleManager/selection.ts | 28 +++++++++--- .../pages/BO/modules/moduleManager/index.ts | 2 +- .../BO/modules/moduleManager/selection.ts | 11 +++++ 11 files changed, 148 insertions(+), 20 deletions(-) create mode 100644 src/interfaces/BO/router.ts create mode 100644 src/pages/BO/BORouterPage.ts create mode 100644 src/versions/1.7.3/pages/BO/modules/moduleManager/selection.ts diff --git a/src/index.ts b/src/index.ts index a8a4c4b96..911833943 100644 --- a/src/index.ts +++ b/src/index.ts @@ -223,6 +223,7 @@ export {default as boProductsCreateTabSEOPage} from '@pages/BO/catalog/products/ 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'; +export {default as boRouterPage} from '@pages/BO/BORouterPage'; export {default as boSearchPage} from '@pages/BO/shopParameters/search'; export {default as boSearchAliasCreatePage} from '@pages/BO/shopParameters/search/alias/create'; export {default as boThemeAdvancedConfigurationPage} from '@pages/BO/design/themeAndLogo/advancedConfiguration'; diff --git a/src/interfaces/BO/modules/moduleManager/selection.ts b/src/interfaces/BO/modules/moduleManager/selection.ts index 5541ac89f..6784ac386 100644 --- a/src/interfaces/BO/modules/moduleManager/selection.ts +++ b/src/interfaces/BO/modules/moduleManager/selection.ts @@ -3,7 +3,9 @@ import type {Page} from '@playwright/test'; export interface ModuleManagerSelectionPageInterface extends BOBasePagePageInterface { readonly installMessageSuccessful: (moduleTag: string) => string; + readonly pageTitle: string; goToTabSelection(page: Page): Promise; + goToTabInstalledModules(page: Page): Promise; installModule(page: Page, moduleTag: string): Promise; } diff --git a/src/interfaces/BO/router.ts b/src/interfaces/BO/router.ts new file mode 100644 index 000000000..b88c91525 --- /dev/null +++ b/src/interfaces/BO/router.ts @@ -0,0 +1,6 @@ +import type {BOBasePagePageInterface} from '@interfaces/BO/index'; +import type {Frame, Page} from '@playwright/test'; + +export interface BORouterPageInterface extends BOBasePagePageInterface { + goToModuleManagerPage(page: Page): Promise; +} diff --git a/src/pages/BO/BOBasePage.ts b/src/pages/BO/BOBasePage.ts index 2e62714b3..dd9b07558 100644 --- a/src/pages/BO/BOBasePage.ts +++ b/src/pages/BO/BOBasePage.ts @@ -731,22 +731,31 @@ export default class BOBasePage extends CommonPage implements BOBasePagePageInte * @returns {Promise} */ async goToSubMenu(page: Page, parentSelector: string, linkSelector: string): Promise { - await this.clickSubMenu(page, parentSelector); - await this.scrollTo(page, linkSelector); - await this.clickAndWaitForURL(page, linkSelector); + const psVersion = testContext.getPSVersion(); - const shopVersion = testContext.getPSVersion(); let linkActiveClass: string = '-active'; - // >= 1.7.8.0 - if (semver.gte(shopVersion, '7.8.0')) { - linkActiveClass = 'link-active'; - } + // >= 1.7.4.0 + if (semver.gte(psVersion, '7.4.0')) { + await this.clickSubMenu(page, parentSelector); + await this.scrollTo(page, linkSelector); + await this.clickAndWaitForURL(page, linkSelector); - if (await this.isSidebarCollapsed(page)) { - await this.waitForHiddenSelector(page, `${linkSelector}.${linkActiveClass}`); + // >= 1.7.8.0 + if (semver.gte(psVersion, '7.8.0')) { + linkActiveClass = 'link-active'; + } + + if (await this.isSidebarCollapsed(page)) { + await this.waitForHiddenSelector(page, `${linkSelector}.${linkActiveClass}`); + } else { + await this.waitForVisibleSelector(page, `${linkSelector}.${linkActiveClass}`); + } } else { - await this.waitForVisibleSelector(page, `${linkSelector}.${linkActiveClass}`); + await page.locator(parentSelector).hover(); + await this.waitForVisibleSelector(page, linkSelector); + await this.clickAndWaitForURL(page, linkSelector); + await this.waitForVisibleSelector(page, `${parentSelector}.${linkActiveClass}`); } } diff --git a/src/pages/BO/BORouterPage.ts b/src/pages/BO/BORouterPage.ts new file mode 100644 index 000000000..9d3d76ad6 --- /dev/null +++ b/src/pages/BO/BORouterPage.ts @@ -0,0 +1,35 @@ +import {BORouterPageInterface} from '@interfaces/BO/router'; +import BOBasePage from '@pages/BO/BOBasePage'; +import boDashboardPage from '@pages/BO/dashboard/index'; +import boModuleManagerPage from '@pages/BO/modules/moduleManager/index'; +import boModuleManagerSelectionPage from '@pages/BO/modules/moduleManager/selection'; +import testContext from '@utils/testContext'; +import type {Page} from 'playwright-core'; +import semver from 'semver'; + +class BORouterPage extends BOBasePage implements BORouterPageInterface { + async goToModuleManagerPage(page: Page): Promise { + const psVersion = testContext.getPSVersion(); + const pageTitle = await this.getPageTitle(page); + const boModuleManagerLinkPageTitle = semver.lt(psVersion, '7.4.0') + ? boModuleManagerSelectionPage.pageTitle + : boModuleManagerPage.pageTitle; + + // Check if we are not already on the page + if (!pageTitle.includes(boModuleManagerLinkPageTitle)) { + await boDashboardPage.goToSubMenu( + page, + boDashboardPage.modulesParentLink, + boDashboardPage.moduleManagerLink, + ); + await boDashboardPage.closeSfToolBar(page); + } + + if (semver.lt(psVersion, '7.4.0')) { + console.log('goToTabInstalledModules'); + await boModuleManagerSelectionPage.goToTabInstalledModules(page); + } + } +} + +export default new BORouterPage(); diff --git a/src/pages/BO/modules/moduleManager/selection.ts b/src/pages/BO/modules/moduleManager/selection.ts index 452a04d01..bb7467341 100644 --- a/src/pages/BO/modules/moduleManager/selection.ts +++ b/src/pages/BO/modules/moduleManager/selection.ts @@ -9,7 +9,10 @@ function requirePage(): ModuleManagerSelectionPageInterface { if (semver.gte(psVersion, '7.5.0')) { return require('@versions/mock/pages/BO/modules/moduleManager/selection'); } - return require('@versions/1.7.4/pages/BO/modules/moduleManager/selection'); + if (semver.gte(psVersion, '7.4.0')) { + return require('@versions/1.7.4/pages/BO/modules/moduleManager/selection').selectionPage; + } + return require('@versions/1.7.3/pages/BO/modules/moduleManager/selection'); } /* eslint-enable global-require, @typescript-eslint/no-var-requires */ diff --git a/src/pages/FO/FOBasePage.ts b/src/pages/FO/FOBasePage.ts index 7e937a48a..78333749d 100644 --- a/src/pages/FO/FOBasePage.ts +++ b/src/pages/FO/FOBasePage.ts @@ -1,7 +1,7 @@ // Import pages import {FOBasePagePageInterface} from '@interfaces/FO'; import CommonPage from '@pages/commonPage'; -import testContext from '@utils/testContext'; +import utilsTest from '@utils/test'; import type {Locator, Page} from 'playwright'; import semver from 'semver'; @@ -824,7 +824,7 @@ export default class FOBasePage extends CommonPage implements FOBasePagePageInte } private getLanguageSelector(page: Page, lang: string): string|Locator { - const psVersion = testContext.getPSVersion(); + const psVersion = utilsTest.getPSVersion(); // >= 1.7.5.0 if (semver.gte(psVersion, '7.5.0')) { diff --git a/src/versions/1.7.3/pages/BO/modules/moduleManager/selection.ts b/src/versions/1.7.3/pages/BO/modules/moduleManager/selection.ts new file mode 100644 index 000000000..356bec0c6 --- /dev/null +++ b/src/versions/1.7.3/pages/BO/modules/moduleManager/selection.ts @@ -0,0 +1,43 @@ +import {ModuleManagerSelectionPageInterface} from '@interfaces/BO/modules/moduleManager/selection'; +import {Page} from '@playwright/test'; +import {SelectionPage} from '@versions/1.7.4/pages/BO/modules/moduleManager/selection'; + +/** + * @class + * @extends BOBasePage + */ +class SelectionPageVersion extends SelectionPage implements ModuleManagerSelectionPageInterface { + /** + * @constructs + * Setting up titles and selectors to use on module catalog page + */ + constructor() { + super(); + + // Selectors + this.subTabSelection = '#head_tabs a.tab:nth-child(1)'; + this.subTabInstalledModules = '#head_tabs a.tab:nth-child(2)'; + } + + /** + * Go to the "Selection" tab + * @param {Page} page + * @returns {Promise} + */ + async goToTabSelection(page: Page): Promise { + await this.waitForSelectorAndClick(page, this.subTabSelection); + await this.waitForVisibleSelector(page, `${this.subTabSelection}.current`, 2000); + } + + /** + * Go to the "Installed Modules" tab + * @param {Page} page + * @returns {Promise} + */ + async goToTabInstalledModules(page: Page): Promise { + await this.waitForSelectorAndClick(page, this.subTabInstalledModules); + await this.waitForVisibleSelector(page, `${this.subTabInstalledModules}.current`, 2000); + } +} + +module.exports = new SelectionPageVersion(); diff --git a/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts b/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts index f8bfb15eb..fdcca393a 100644 --- a/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts +++ b/src/versions/1.7.4/pages/BO/modules/moduleManager/selection.ts @@ -7,9 +7,13 @@ import {Page} from '@playwright/test'; * @extends BOBasePage */ class SelectionPage extends BOBasePage implements ModuleManagerSelectionPageInterface { + public readonly pageTitle: string; + public readonly installMessageSuccessful: (moduleTag: string) => string; - private readonly subTabUninstalledModules: string; + protected subTabSelection: string; + + protected subTabInstalledModules: string; private readonly searchInput: string; @@ -24,10 +28,13 @@ class SelectionPage extends BOBasePage implements ModuleManagerSelectionPageInte constructor() { super(); + this.pageTitle = 'Module selection'; + this.installMessageSuccessful = (moduleTag: string) => `Install action on module ${moduleTag} succeeded.`; // Selectors - this.subTabUninstalledModules = '#subtab-AdminModulesCatalog'; + this.subTabSelection = '#subtab-AdminModulesCatalog'; + this.subTabInstalledModules = '#subtab-AdminModulesManage'; this.searchInput = '#search-input-group input.pstaggerAddTagInput'; this.searchButton = '#module-search-button'; this.installModuleButton = (moduleTag: string) => `div[data-tech-name="${moduleTag}"] button.module_action_menu_install`; @@ -42,8 +49,18 @@ class SelectionPage extends BOBasePage implements ModuleManagerSelectionPageInte * @returns {Promise} */ async goToTabSelection(page: Page): Promise { - await this.waitForSelectorAndClick(page, this.subTabUninstalledModules); - await this.waitForVisibleSelector(page, `${this.subTabUninstalledModules}.active`, 2000); + await this.waitForSelectorAndClick(page, this.subTabSelection); + await this.waitForVisibleSelector(page, `${this.subTabSelection}.active`, 2000); + } + + /** + * Go to the "Selection" tab + * @param {Page} page + * @returns {Promise} + */ + async goToTabInstalledModules(page: Page): Promise { + await this.waitForSelectorAndClick(page, this.subTabInstalledModules); + await this.waitForVisibleSelector(page, `${this.subTabInstalledModules}.active`, 2000); } /** @@ -62,4 +79,5 @@ class SelectionPage extends BOBasePage implements ModuleManagerSelectionPageInte } } -module.exports = new SelectionPage(); +const selectionPage = new SelectionPage(); +export {selectionPage, SelectionPage}; diff --git a/src/versions/develop/pages/BO/modules/moduleManager/index.ts b/src/versions/develop/pages/BO/modules/moduleManager/index.ts index 178ce7086..1d83dd4bd 100644 --- a/src/versions/develop/pages/BO/modules/moduleManager/index.ts +++ b/src/versions/develop/pages/BO/modules/moduleManager/index.ts @@ -446,7 +446,7 @@ class ModuleManagerPage extends BOBasePage implements ModuleManagerPageInterface if (cancel) { await this.waitForSelectorAndClick(page, this.modalConfirmCancel(module.tag, action)); - await this.elementNotVisible(page, this.modalConfirmAction(module.tag, action), 10000); + await this.waitForHiddenSelector(page, this.modalConfirmAction(module.tag, action), 10000); return ''; } if (action === 'uninstall' && forceDeletion) { diff --git a/src/versions/mock/pages/BO/modules/moduleManager/selection.ts b/src/versions/mock/pages/BO/modules/moduleManager/selection.ts index 7d6d12ea5..a4bfdd2f9 100644 --- a/src/versions/mock/pages/BO/modules/moduleManager/selection.ts +++ b/src/versions/mock/pages/BO/modules/moduleManager/selection.ts @@ -7,6 +7,8 @@ import BOBasePage from '@pages/BO/BOBasePage'; * @extends BOBasePage */ class SelectionPageMock extends BOBasePage implements ModuleManagerSelectionPageInterface { + public readonly pageTitle: string; + public readonly installMessageSuccessful: (moduleTag: string) => string; /** @@ -16,6 +18,7 @@ class SelectionPageMock extends BOBasePage implements ModuleManagerSelectionPage constructor() { super(); + this.pageTitle = ''; this.installMessageSuccessful = () => ''; } @@ -30,6 +33,14 @@ class SelectionPageMock extends BOBasePage implements ModuleManagerSelectionPage // do nothing. } + /** + * Go to the "Installed Modules" tab + * @returns {Promise} + */ + async goToTabInstalledModules(): Promise { + // do nothing. + } + /** * Install the module and return if installed * @returns {Promise}