diff --git a/src/pages/FO/classic/home/index.ts b/src/pages/FO/classic/home/index.ts index 4727079f..654dc5d8 100644 --- a/src/pages/FO/classic/home/index.ts +++ b/src/pages/FO/classic/home/index.ts @@ -6,11 +6,15 @@ const psVersion = testContext.getPSVersion(); /* eslint-disable global-require, @typescript-eslint/no-var-requires */ function requirePage(): FoHomePageInterface { - // >= 9.0 - if (semver.gte(psVersion, '9.0.0')) { - return require('@versions/develop/pages/FO/classic/home').homePage; + // > 1.7.7.0 + if (semver.lt(psVersion, '7.7.0')) { + return require('@versions/1.7.6/pages/FO/classic/home'); } - return require('@versions/8.1/pages/FO/classic/home'); + // > 9.0.0 + if (semver.lt(psVersion, '9.0.0')) { + return require('@versions/8.1/pages/FO/classic/home').foHomePage; + } + return require('@versions/develop/pages/FO/classic/home').foHomePage; } /* eslint-enable global-require, @typescript-eslint/no-var-requires */ diff --git a/src/versions/1.7.6/pages/FO/classic/home/index.ts b/src/versions/1.7.6/pages/FO/classic/home/index.ts new file mode 100644 index 00000000..1b745bf4 --- /dev/null +++ b/src/versions/1.7.6/pages/FO/classic/home/index.ts @@ -0,0 +1,22 @@ +// Import pages +import type {FoHomePageInterface} from '@interfaces/FO/home'; +import {FoHomePage} from '@versions/8.1/pages/FO/classic/home/index'; + +/** + * Home page, contains functions that can be used on the page + * @class + */ +class FoHomePageVersion extends FoHomePage implements FoHomePageInterface { + /** + * @constructs + * Setting up texts and selectors to use on order confirmation page + */ + constructor(theme: string = 'classic') { + super(theme); + + this.productArticle = (number: number) => `${this.productsBlockNth(2)} .products ` + + `article.product-miniature:nth-child(${number}) div`; + } +} + +module.exports = new FoHomePageVersion(); diff --git a/src/versions/8.1/pages/FO/classic/home/index.ts b/src/versions/8.1/pages/FO/classic/home/index.ts index 5368fba0..55fc4d96 100644 --- a/src/versions/8.1/pages/FO/classic/home/index.ts +++ b/src/versions/8.1/pages/FO/classic/home/index.ts @@ -1,13 +1,13 @@ // Import pages import type {FoHomePageInterface} from '@interfaces/FO/home'; -import {HomePage} from '@versions/develop/pages/FO/classic/home/index'; +import {FoHomePage} from '@versions/develop/pages/FO/classic/home/index'; /** * Order confirmation page, contains functions that can be used on the page * @class * @extends OrderConfirmationPage */ -class HomePageVersion extends HomePage implements FoHomePageInterface { +class FoHomePageVersion extends FoHomePage implements FoHomePageInterface { /** * @constructs * Setting up texts and selectors to use on order confirmation page @@ -15,8 +15,9 @@ class HomePageVersion extends HomePage implements FoHomePageInterface { constructor(theme: string = 'classic') { super(theme); - this.productArticle = (number: number) => `${this.productsBlockNth(2)} .products article:nth-child(${number}) div`; + this.productArticle = (number: number) => `${this.productsBlockNth(2)} .products div.product:nth-child(${number}) div`; } } -module.exports = new HomePageVersion(); +const foHomePage = new FoHomePageVersion(); +export {foHomePage, FoHomePageVersion as FoHomePage}; diff --git a/src/versions/develop/pages/FO/classic/home/index.ts b/src/versions/develop/pages/FO/classic/home/index.ts index 8cd99319..7eff3d22 100644 --- a/src/versions/develop/pages/FO/classic/home/index.ts +++ b/src/versions/develop/pages/FO/classic/home/index.ts @@ -8,7 +8,7 @@ import {quickViewModal as foClassicModalQuickViewPage} from '@versions/develop/p * @class * @extends FOBasePage */ -class HomePage extends FOBasePage implements FoHomePageInterface { +class FoHomePage extends FOBasePage implements FoHomePageInterface { public readonly pageTitle: string; public readonly successAddToCartMessage: string; @@ -354,11 +354,11 @@ class HomePage extends FOBasePage implements FoHomePageInterface { /** * Quick view product * @param page {Page} Browser tab - * @param row {number} Row of product to quick view + * @param id {number} Row of product to quick view * @return {Promise} */ - async quickViewProduct(page: Page, row: number): Promise { - await page.locator(this.productImg(row)).hover(); + async quickViewProduct(page: Page, id: number): Promise { + await page.locator(this.productImg(id)).hover(); let displayed: boolean = false; /* eslint-disable no-await-in-loop */ @@ -375,14 +375,14 @@ class HomePage extends FOBasePage implements FoHomePageInterface { } return window.getComputedStyle(element, ':after').getPropertyValue('display') === 'block'; }, - this.productDescriptionDiv(row), + this.productDescriptionDiv(id), ); await page.waitForTimeout(100); } /* eslint-enable no-await-in-loop */ await Promise.all([ this.waitForVisibleSelector(page, foClassicModalQuickViewPage.quickViewModalDiv), - page.locator(this.productQuickViewLink(row)).evaluate((el: HTMLElement) => el.click()), + page.locator(this.productQuickViewLink(id)).evaluate((el: HTMLElement) => el.click()), ]); } @@ -467,5 +467,5 @@ class HomePage extends FOBasePage implements FoHomePageInterface { } } -const homePage = new HomePage(); -export {homePage, HomePage}; +const foHomePage = new FoHomePage(); +export {foHomePage, FoHomePage}; diff --git a/src/versions/develop/pages/FO/hummingbird/home/index.ts b/src/versions/develop/pages/FO/hummingbird/home/index.ts index c37254b3..eb53b1c8 100644 --- a/src/versions/develop/pages/FO/hummingbird/home/index.ts +++ b/src/versions/develop/pages/FO/hummingbird/home/index.ts @@ -1,13 +1,13 @@ import {FoHomeHummingbirdPageInterface} from '@interfaces/FO/home'; import {type Page} from '@playwright/test'; -import {HomePage as HomePageVersion} from '@versions/develop/pages/FO/classic/home'; +import {FoHomePage as FoHomePageVersion} from '@versions/develop/pages/FO/classic/home'; /** * Home page, contains functions that can be used on the page * @class * @extends HomePage */ -class HomePage extends HomePageVersion implements FoHomeHummingbirdPageInterface { +class FoHomePage extends FoHomePageVersion implements FoHomeHummingbirdPageInterface { private readonly addToCartIcon: (number: number) => string; private readonly productColor: (number: number, color: string) => string; @@ -100,4 +100,4 @@ class HomePage extends HomePageVersion implements FoHomeHummingbirdPageInterface } } -module.exports = new HomePage(); +module.exports = new FoHomePage();