-
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 #427 from Progi1984/modContactFormBoMain
Migrate `@pages/BO/modules/contactform` from Core
- Loading branch information
Showing
4 changed files
with
83 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,9 @@ | ||
import {ModuleConfigurationPageInterface} from '@interfaces/BO/modules/moduleConfiguration'; | ||
import {Page} from '@playwright/test'; | ||
|
||
export interface ModuleContactFormMainPageInterface extends ModuleConfigurationPageInterface { | ||
readonly pageTitle: string; | ||
|
||
setReceiveCustomersMessageByEmail(page: Page, toEnable: boolean): Promise<string>; | ||
setSendConfirmationEmail(page: Page, toEnable: boolean): Promise<string>; | ||
} |
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 {ModuleContactFormMainPageInterface} from '@interfaces/BO/modules/contactform'; | ||
|
||
/* eslint-disable global-require, @typescript-eslint/no-require-imports */ | ||
function requirePage(): ModuleContactFormMainPageInterface { | ||
return require('@versions/develop/pages/BO/modules/contactform'); | ||
} | ||
/* eslint-enable global-require, @typescript-eslint/no-require-imports */ | ||
|
||
export default requirePage(); |
64 changes: 64 additions & 0 deletions
64
src/versions/develop/pages/BO/modules/contactform/index.ts
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,64 @@ | ||
import {type ModuleContactFormMainPageInterface} from '@interfaces/BO/modules/contactform'; | ||
import ModuleConfiguration from '@pages/BO/modules/moduleConfiguration'; | ||
import {Page} from '@playwright/test'; | ||
|
||
/** | ||
* Module configuration page for module : contactform, contains selectors and functions for the page | ||
* @class | ||
* @extends ModuleConfiguration | ||
*/ | ||
class ModuleContactFormMainPage extends ModuleConfiguration implements ModuleContactFormMainPageInterface { | ||
public readonly pageTitle: string; | ||
|
||
private readonly sendConfirmationEmailToggle: (toggle: string) => string; | ||
|
||
private readonly sendNotificationEmailToggle: (toggle: string) => string; | ||
|
||
private readonly saveButton: string; | ||
|
||
/** | ||
* @constructs | ||
* Setting up titles and selectors to use on contact form page | ||
*/ | ||
constructor() { | ||
super(); | ||
|
||
this.pageTitle = 'Contact form'; | ||
this.successfulUpdateMessage = 'The settings have been successfully updated.'; | ||
|
||
// Selectors | ||
this.sendConfirmationEmailToggle = (toggle: string) => `#CONTACTFORM_SEND_CONFIRMATION_EMAIL_${toggle}`; | ||
this.sendNotificationEmailToggle = (toggle: string) => `#CONTACTFORM_SEND_NOTIFICATION_EMAIL_${toggle}`; | ||
this.saveButton = '#module_form_submit_btn'; | ||
} | ||
|
||
/* Methods */ | ||
|
||
/** | ||
* Set send confirmation email | ||
* @param page {Page} Browser tab | ||
* @param toEnable {boolean} True if we need to enable send confirmation email | ||
* @returns {Promise<number>} | ||
*/ | ||
async setSendConfirmationEmail(page: Page, toEnable: boolean): Promise<string> { | ||
await this.setChecked(page, this.sendConfirmationEmailToggle(toEnable ? 'on' : 'off')); | ||
await this.clickAndWaitForLoadState(page, this.saveButton); | ||
|
||
return this.getAlertSuccessBlockContent(page); | ||
} | ||
|
||
/** | ||
* Set send confirmation email | ||
* @param page {Page} Browser tab | ||
* @param toEnable {boolean} True if we need to enable receive customers message by email | ||
* @returns {Promise<number>} | ||
*/ | ||
async setReceiveCustomersMessageByEmail(page: Page, toEnable: boolean): Promise<string> { | ||
await this.setChecked(page, this.sendNotificationEmailToggle(toEnable ? 'on' : 'off')); | ||
await this.clickAndWaitForLoadState(page, this.saveButton); | ||
|
||
return this.getAlertSuccessBlockContent(page); | ||
} | ||
} | ||
|
||
module.exports = new ModuleContactFormMainPage(); |