-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStaffSubmitPage.ts
More file actions
65 lines (51 loc) · 1.94 KB
/
StaffSubmitPage.ts
File metadata and controls
65 lines (51 loc) · 1.94 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { expect, type Page } from "@playwright/test";
export class StaffSubmitPage {
constructor(private page: Page) {}
async goto(token: string) {
await this.page.goto(`/shifts/submit?token=${token}`);
}
async expectFormVisible() {
await expect(this.page.getByText("出勤する日をタップしてください")).toBeVisible();
}
async expectUnsubmittedBadge() {
await expect(this.page.getByText("未提出")).toBeVisible();
}
async expectSubmittedBadge() {
await expect(this.page.getByText("提出済み")).toBeVisible();
}
async expectCompletionVisible() {
await expect(this.page).toHaveURL(/\/shifts\/submit\/completed$/);
await expect(this.page.getByText("提出が完了しました")).toBeVisible();
}
async expectReadOnlyVisible() {
await expect(this.page.getByText("提出締切を過ぎたため変更できません")).toBeVisible();
}
async expectExpiredVisible() {
await expect(this.page.getByText("提出締切を過ぎています")).toBeVisible();
}
async expectSubmitButtonNotVisible() {
await expect(this.page.getByRole("button", { name: /提出する/ })).not.toBeVisible();
}
async toggleDay(dateText: string) {
const dateEl = this.page.getByText(dateText, { exact: true });
await dateEl.locator("..").click();
}
async clearDay(dateText: string) {
await this.page
.getByText(dateText, { exact: true })
.locator("..")
.getByRole("button", { name: "休みに戻す" })
.click();
}
async submit() {
await this.page.getByRole("button", { name: /提出する/ }).click();
}
async expectDayWorking(dateText: string) {
const row = this.page.getByText(dateText, { exact: true }).locator("..");
await expect(row.getByText("〜")).toBeVisible();
}
async expectDayOff(dateText: string) {
const row = this.page.getByText(dateText, { exact: true }).locator("..");
await expect(row.getByText("休み")).toBeVisible();
}
}