-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #443 from Progi1984/foStoresPage
Migrate `@pages/FO/{classic|hummingbird}/stores` from Core
- Loading branch information
Showing
6 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {type FOBasePagePageInterface} from '@interfaces/FO'; | ||
import type {Page} from '@playwright/test'; | ||
|
||
export interface FoStoresPageInterface extends FOBasePagePageInterface { | ||
readonly pageTitle: string; | ||
|
||
getStoreImageMain(page: Page, idStore: number): Promise<string|null>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type {FoStoresPageInterface} from '@interfaces/FO/stores'; | ||
|
||
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ | ||
function requirePage(): FoStoresPageInterface { | ||
return require('@versions/develop/pages/FO/classic/stores').foStoresPage; | ||
} | ||
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ | ||
|
||
export default requirePage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type {FoStoresPageInterface} from '@interfaces/FO/stores'; | ||
|
||
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ | ||
function requirePage(): FoStoresPageInterface { | ||
return require('@versions/develop/pages/FO/hummingbird/stores'); | ||
} | ||
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */ | ||
|
||
export default requirePage(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import {type FoStoresPageInterface} from '@interfaces/FO/stores'; | ||
import FOBasePage from '@pages/FO/FOBasePage'; | ||
import {type Page} from '@playwright/test'; | ||
|
||
/** | ||
* Stores page, contains functions that can be used on the page | ||
* @class | ||
* @extends FOBasePage | ||
*/ | ||
class FoStoresPage extends FOBasePage implements FoStoresPageInterface { | ||
public readonly pageTitle: string; | ||
|
||
public readonly storeBlock: (idStore: number) => string; | ||
|
||
public readonly storeImage: (idStore: number) => string; | ||
|
||
/** | ||
* @constructs | ||
* Setting up texts and selectors to use on stores page | ||
*/ | ||
constructor(theme: string = 'classic') { | ||
super(theme); | ||
|
||
this.pageTitle = 'Stores'; | ||
|
||
this.storeBlock = (idStore: number) => `article#store-${idStore}`; | ||
this.storeImage = (idStore:number) => `${this.storeBlock(idStore)} div.store-picture`; | ||
} | ||
|
||
/** | ||
* Returns the URL of the main image of a store | ||
* @param page {Page} Browser tab | ||
* @param idStore {number} ID of a store | ||
* @returns {Promise<string|null>} | ||
*/ | ||
async getStoreImageMain(page: Page, idStore: number): Promise<string|null> { | ||
return this.getAttributeContent(page, `${this.storeImage(idStore)} source`, 'srcset'); | ||
} | ||
} | ||
|
||
const foStoresPage = new FoStoresPage(); | ||
export {foStoresPage, FoStoresPage}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {type FoStoresPageInterface} from '@interfaces/FO/stores'; | ||
import {FoStoresPage as FoStoresPageClassic} from '@versions/develop/pages/FO/classic/stores'; | ||
|
||
/** | ||
* @class | ||
* @extends FOBasePage | ||
*/ | ||
class FoStoresPage extends FoStoresPageClassic implements FoStoresPageInterface { | ||
/** | ||
* @constructs | ||
*/ | ||
constructor() { | ||
super('hummingbird'); | ||
} | ||
} | ||
|
||
module.exports = new FoStoresPage(); |