This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
IdHub_E2E_testing/src/page-objects/AD_ViewRolesPage.ts
2024-03-04 20:57:54 +01:00

37 lines
1.1 KiB
TypeScript

import { Page, Locator } from "@playwright/test"
export class ViewRolesPage {
readonly page: Page
readonly primaryTitle: Locator
readonly secondaryTitle: Locator
readonly nameColumnTitle: Locator
readonly descriptionColumnTitle: Locator
constructor(page: Page) {
this.page = page;
this.primaryTitle = page.getByRole('heading', { name: 'Access control management' });
this.secondaryTitle = page.getByRole('heading', { name: 'Manage roles' });
this.nameColumnTitle = this.page.getByRole('button', { name: 'Name' })
this.descriptionColumnTitle = this.page.getByRole('button', { name: 'Description' })
}
async getPrimaryTitle() {
try {
return await this.primaryTitle.innerText();
} catch (error) {
console.error("Failed to get primary title:", error);
throw error;
}
}
async getSecondaryTitle() {
try {
return await this.secondaryTitle.innerText();
} catch (error) {
console.error("Failed to get secondary title:", error);
throw error;
}
}
}