From 43dbc11fe535724927676e4da6f771852f966b65 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Fri, 29 Mar 2024 15:55:43 +0100 Subject: [PATCH] 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 9039c680..7a2b4cbc 100644 --- a/src/pages/FO/FOBasePage.ts +++ b/src/pages/FO/FOBasePage.ts @@ -173,8 +173,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`; @@ -793,13 +793,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 5ff131af..481291cb 100644 --- a/src/pages/commonPage.ts +++ b/src/pages/commonPage.ts @@ -418,12 +418,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(), @@ -445,6 +446,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 f626ca4b..f6fc87f6 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 35856884..f8bfb15e 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);