import { expect, type Page } from "@playwright/test"; import { TEST_IDS } from "../testIds"; export class WorkflowTaskDetailPageObject { readonly page: Page; constructor(page: Page) { this.page = page; } get overview() { return this.page.getByTestId(TEST_IDS.workflow.overview); } get summary() { return this.page.getByTestId(TEST_IDS.workflow.summary); } get approveBtn() { return this.page.getByTestId(TEST_IDS.workflow.approve); } get rejectCommentInput() { return this.page.getByTestId(TEST_IDS.workflow.rejectComment); } get rejectBtn() { return this.page.getByTestId(TEST_IDS.workflow.reject); } get returnCommentInput() { return this.page.getByTestId(TEST_IDS.workflow.returnComment); } get returnBtn() { return this.page.getByTestId(TEST_IDS.workflow.returnBtn); } get actionError() { return this.page.getByTestId(TEST_IDS.workflow.actionError); } get actionConfirmDialog() { return this.page.getByTestId("workflow-action-confirm-dialog"); } get actionConfirmSubmit() { return this.page.getByTestId("workflow-action-confirm-submit"); } get transferApproverSelect() { return this.page.getByTestId(TEST_IDS.workflow.transferApprover); } async assertLoaded() { await expect(this.overview).toBeVisible({ timeout: 15_000 }); await expect(this.summary).toBeVisible({ timeout: 15_000 }); } async approve() { await this.approveBtn.click(); await expect(this.actionConfirmDialog).toContainText("确认后将进入下一审批节点"); await this.actionConfirmSubmit.click(); } async reject(comment: string) { await this.rejectCommentInput.fill(comment); await this.rejectBtn.click(); await expect(this.actionConfirmDialog).toContainText("当前流程将终止"); await this.actionConfirmSubmit.click(); } async returnTask(comment: string) { await this.returnCommentInput.fill(comment); await this.returnBtn.click(); await expect(this.actionConfirmDialog).toContainText("回到申请人修改态"); await this.actionConfirmSubmit.click(); } }