Skip to content
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 @@ -463,6 +463,7 @@ export {default as foHummingbirdTermsAndConditionsOfUsePage} from '@pages/FO/hum

// Export Modules
export {default as modAutoupgradeBoMain} from '@pages/BO/modules/autoupgrade';
export {default as modAutoupgradeBoModal} from '@pages/BO/modules/autoupgrade/modal';
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';
Expand Down
1 change: 0 additions & 1 deletion src/interfaces/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export interface DashboardPageInterface extends BOBasePagePageInterface {
clickOnReturnExchangeLink(page: Page): Promise<void>;
clickOnTotalSubscribersLink(page: Page): Promise<void>;
clickOnVisitsLink(page: Page): Promise<void>;
closeDialogUpdateNotification(page: Page): Promise<boolean>;
closeHelpCard(page: Page): Promise<boolean>;
getFormActivityOverviewValue(page: Page, inputName: string): Promise<string>;
getBestSellersTabTitle(page: Page): Promise<string>;
Expand Down
11 changes: 11 additions & 0 deletions src/interfaces/BO/modules/autoupgrade/modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {ModuleConfigurationPageInterface} from '@interfaces/BO/modules/moduleConfiguration';
import type {Page} from '@playwright/test';

export interface ModuleAutoupgradeModalPageInterface extends ModuleConfigurationPageInterface {
clickOnUpdateButton(page:Page):Promise<void>;
closeDialogUpdateNotification(page: Page): Promise<boolean>;
getPSVersionFromTheModal(page:Page):Promise<string>;
getSupportLinkFromModal(page:Page):Promise<string>;
getUpdateLinkFromModal(page:Page):Promise<string>;
openUpdateLinkFromTheModal(page:Page):Promise<Page>;
}
10 changes: 10 additions & 0 deletions src/pages/BO/modules/autoupgrade/modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type {ModuleAutoupgradeModalPageInterface} from '@interfaces/BO/modules/autoupgrade/modal';

/* eslint-disable global-require, @typescript-eslint/no-require-imports */
function requirePage(): ModuleAutoupgradeModalPageInterface {
return require('@versions/develop/pages/BO/modules/autoupgrade/modal').autoupgradeModal;
}

/* eslint-enable global-require, @typescript-eslint/no-require-imports */

export default requirePage();
24 changes: 0 additions & 24 deletions src/versions/develop/pages/BO/dashboard/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ class Dashboard extends BOBasePage implements DashboardPageInterface {

private readonly helpCardDocumentTitle: string;

private readonly dialogUpdateNotification: string;

private readonly remindMeLaterButton: string;

private readonly remindMeLaterSevenDaysButton: string;

/**
* @constructs
* Setting up titles and selectors to use on dashboard page
Expand All @@ -174,10 +168,6 @@ class Dashboard extends BOBasePage implements DashboardPageInterface {
this.helpCardButton = '#toolbar-nav a.btn-help';
this.helpCardDocument = '#help-container div.page-wrap';
this.helpCardDocumentTitle = '#help-container section.article h1';
// Selectors of update dialog
this.dialogUpdateNotification = '#dialog-update-notification';
this.remindMeLaterButton = '#remin-me-later-update';
this.remindMeLaterSevenDaysButton = `${this.remindMeLaterButton} button[value='7_days']`;
// Selectors of Products and sales block
this.recentOrdersTitle = '#dash_recent_orders div.panel-heading';
this.recentOrdersTable = '#table_recent_orders';
Expand Down Expand Up @@ -765,20 +755,6 @@ class Dashboard extends BOBasePage implements DashboardPageInterface {
async getHelpDocumentTitle(page: Page): Promise<string> {
return this.getTextContent(page, this.helpCardDocumentTitle);
}

/**
* Close dialog update notification
* @param page {Page} Browser tab
* @returns {Promise<boolean>}
*/
async closeDialogUpdateNotification(page: Page): Promise<boolean> {
if (await this.elementVisible(page, this.dialogUpdateNotification, 5000)) {
await page.locator(this.remindMeLaterButton).click();
await page.locator(this.remindMeLaterSevenDaysButton).click();
}

return this.elementNotVisible(page, this.dialogUpdateNotification, 5000);
}
}

module.exports = new Dashboard();
106 changes: 106 additions & 0 deletions src/versions/develop/pages/BO/modules/autoupgrade/modal.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import {ModuleAutoupgradeModalPageInterface} from '@interfaces/BO/modules/autoupgrade/modal';
import type {Page} from '@playwright/test';
import {ModuleConfigurationPage} from '@versions/develop/pages/BO/modules/moduleConfiguration';

/**
* Module configuration page for module : Autoupgrade, contains selectors and functions for the page
* @class
* @extends ModuleConfiguration
*/
class AutoupgradeModal extends ModuleConfigurationPage implements ModuleAutoupgradeModalPageInterface {
private readonly dialogUpdateNotification: string;

private readonly remindMeLaterButton: string;

private readonly remindMeLaterSevenDaysButton: string;

private readonly dialogNotificationSection: string;

private readonly updateLink: string;

private readonly supportLink: string;

private readonly psVersionLink: string;

private readonly updateButton: string;

/**
* @constructs
*/
constructor() {
super();

// Selectors of update dialog
this.dialogUpdateNotification = '#dialog-update-notification';
this.remindMeLaterButton = '#remin-me-later-update';
this.remindMeLaterSevenDaysButton = `${this.remindMeLaterButton} button[value='7_days']`;
this.dialogNotificationSection = 'div.dialog-notification__section';
this.updateLink = `${this.dialogNotificationSection}:nth-child(1) .dialog-notification__link`;
this.supportLink = `${this.dialogNotificationSection}:nth-child(4) .dialog-notification__link`;
this.psVersionLink = `${this.dialogNotificationSection}.dialog-notification__section-content`;
this.updateButton = '.dialog-notification__button.btn-primary';
}

// Methods of update
/**
* Close dialog update notification
* @param page {Page} Browser tab
* @returns {Promise<boolean>}
*/
async closeDialogUpdateNotification(page: Page): Promise<boolean> {
if (await this.elementVisible(page, this.dialogUpdateNotification, 5000)) {
await page.locator(this.remindMeLaterButton).click();
await page.locator(this.remindMeLaterSevenDaysButton).click();
}

return this.elementNotVisible(page, this.dialogUpdateNotification, 5000);
}

/**
* Get update link from modal
* @param page {Page} Browser tab
* @returns {Promise<string>}
*/
async getUpdateLinkFromModal(page: Page): Promise<string> {
return this.getAttributeContent(page, this.updateLink, 'href');
}

/**
* Get support link from modal
* @param page {Page} Browser tab
* @returns {Promise<string>}
*/
async getSupportLinkFromModal(page: Page): Promise<string> {
return this.getAttributeContent(page, this.supportLink, 'href');
}

/**
* Open update link from the modal
* @param page {Page} Browser tab
* @returns {Promise<Page}
*/
async openUpdateLinkFromTheModal(page: Page): Promise<Page> {
return this.openLinkWithTargetBlank(page, this.updateLink, '.post-title');
}

/**
* Get PS version from the modal
* @param page {Page} Browser tab
* @returns {Promise<string>}
*/
async getPSVersionFromTheModal(page: Page): Promise<string> {
return this.getTextContent(page, this.psVersionLink);
}

/**
* Click on update button
* @param page {Page} Browser tab
* @returns {Promise<void>}
*/
async clickOnUpdateButton(page: Page): Promise<void> {
await this.clickAndWaitForURL(page, this.updateButton);
}
}

const autoupgradeModal = new AutoupgradeModal();
export {autoupgradeModal, AutoupgradeModal};