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

boDesignPositionsPage : Added getHookTitle method #398

Merged
merged 1 commit into from
Feb 10, 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/interfaces/BO/design/positions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface BODesignPositionsPageInterface extends BOBasePagePageInterface
getHookId(page: Page, hookRow: number): Promise<number>;
getHookName(page: Page, hookRow: number): Promise<string>;
getHookStatus(page: Page, hookRow: number): Promise<boolean>;
getHookTitle(page: Page, hookRow: number): Promise<string>;
getModuleFilter(page: Page): Promise<string>;
getModulesInHook(page: Page, hookName: string): Promise<string>;
getNumberOfHooks(page: Page): Promise<number>;
Expand Down
17 changes: 15 additions & 2 deletions src/versions/develop/pages/BO/design/positions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {Page} from '@playwright/test';
* @class
* @extends BOBasePage
*/
class PositionsPage extends BOBasePage implements BODesignPositionsPageInterface {
class BODesignPositionsPage extends BOBasePage implements BODesignPositionsPageInterface {
public readonly pageTitle: string;

public readonly messageModuleAddedFromHook: string;
Expand Down Expand Up @@ -46,6 +46,8 @@ class PositionsPage extends BOBasePage implements BODesignPositionsPageInterface

private readonly hookHeaderNameSpan: (hookRow: number) => string;

private readonly hookHeaderHelpboxSpan: (hookRow: number) => string;

private readonly hookHeaderDescriptionDiv: (hookRow: number) => string;

private readonly hookRowName: (hookName: string) => string;
Expand Down Expand Up @@ -91,6 +93,7 @@ class PositionsPage extends BOBasePage implements BODesignPositionsPageInterface
this.hookHeader = (hookRow: number) => `${this.hookRowNth(hookRow)} header`;
this.hookHeaderStatusInput = (hookRow: number) => `${this.hookHeader(hookRow)} span.hook-status input.hook-switch-action`;
this.hookHeaderNameSpan = (hookRow: number) => `${this.hookHeader(hookRow)} span.hook-name`;
this.hookHeaderHelpboxSpan = (hookRow: number) => `${this.hookHeader(hookRow)} span.help-box`;
this.hookHeaderDescriptionDiv = (hookRow: number) => `${this.hookHeader(hookRow)} div.hook_description`;
this.hookRowName = (hookName: string) => `${this.modulePositionFormHookSection} a[name=${hookName}]`;
this.hookRowModulesList = (hookName: string) => `${this.hookRowName(hookName)} ~ section.module-list ul`;
Expand Down Expand Up @@ -206,6 +209,16 @@ class PositionsPage extends BOBasePage implements BODesignPositionsPageInterface
return this.getTextContent(page, this.hookHeaderDescriptionDiv(hookRow));
}

/**
* Return the hook title
* @param page {Page} Browser tab
* @param hookRow {number} Hook Row
* @returns {Promise<string>}
*/
async getHookTitle(page: Page, hookRow: number): Promise<string> {
return this.getAttributeContent(page, this.hookHeaderHelpboxSpan(hookRow), 'data-content');
}

/**
* Return the hook status
* @param page {Page} Browser tab
Expand Down Expand Up @@ -257,4 +270,4 @@ class PositionsPage extends BOBasePage implements BODesignPositionsPageInterface
}
}

module.exports = new PositionsPage();
module.exports = new BODesignPositionsPage();