forked from guacsec/trustify-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDetailsPageLayout.ts
More file actions
43 lines (34 loc) · 1.25 KB
/
DetailsPageLayout.ts
File metadata and controls
43 lines (34 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { expect, type Page } from "@playwright/test";
export class DetailsPageLayout {
private readonly _page: Page;
private constructor(page: Page) {
this._page = page;
}
static async build(page: Page) {
await expect(page.locator("nav[aria-label='Breadcrumb']")).toBeVisible();
return new DetailsPageLayout(page);
}
async selectTab(tabName: string) {
const tab = this._page.locator("button[role='tab']", { hasText: tabName });
await expect(tab).toBeVisible();
await tab.click();
}
async clickOnPageAction(actionName: string) {
await this._page.getByRole("button", { name: "Actions" }).click();
await this._page.getByRole("menuitem", { name: actionName }).click();
}
async verifyPageHeader(header: string) {
await expect(this._page.getByRole("heading")).toContainText(header);
}
async verifyTabIsSelected(tabName: string) {
await expect(
this._page.getByRole("tab", { name: tabName }),
).toHaveAttribute("aria-selected", "true");
}
async verifyTabIsVisible(tabName: string) {
await expect(this._page.getByRole("tab", { name: tabName })).toBeVisible();
}
async verifyTabIsNotVisible(tabName: string) {
await expect(this._page.getByRole("tab", { name: tabName })).toHaveCount(0);
}
}