Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate @pages/BO/modules/contactform from Core #427

Merged
merged 1 commit into from
Feb 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ export {default as foHummingbirdSitemapPage} from '@pages/FO/hummingbird/sitemap
export {default as modAutoupgradeBoMain} from '@pages/BO/modules/autoupgrade';
export {default as modBlockwishlistBoMain} from '@pages/BO/modules/blockwishlist';
export {default as modBlockwishlistBoStatistics} from '@pages/BO/modules/blockwishlist/statistics';
export {default as modContactFormBoMain} from '@pages/BO/modules/contactform';
export {default as modKeycloakConnectorDemoBoMain} from '@pages/BO/modules/keycloakConnectorDemo';
export {default as modProductCommentsBoMain} from '@pages/BO/modules/productcomments';
export {default as modPsCategoryProductsBoMain} from '@pages/BO/modules/ps_categoryproducts';
Expand Down
9 changes: 9 additions & 0 deletions src/interfaces/BO/modules/contactform/index.ts
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>;
}
9 changes: 9 additions & 0 deletions src/pages/BO/modules/contactform/index.ts
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 src/versions/develop/pages/BO/modules/contactform/index.ts
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();