R98 A5 支持 smoke 账号复核真实 OCR
这个提交包含在:
@@ -1,5 +1,7 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
|
||||
import type { E2EUser } from "./auth";
|
||||
|
||||
export type LiveInvoiceOcrStatus = "available" | "ocr_failed";
|
||||
|
||||
export type LiveInvoiceOcrResult = {
|
||||
@@ -21,6 +23,31 @@ function extractField(detailText: string, label: string) {
|
||||
return match?.[1]?.trim() || null;
|
||||
}
|
||||
|
||||
export function resolveLiveOcrUser(fallback: E2EUser): E2EUser {
|
||||
const identifier =
|
||||
process.env.PLAYWRIGHT_OCR_LIVE_IDENTIFIER?.trim() ||
|
||||
process.env.LIVE_SMOKE_EMPLOYEE_IDENTIFIER?.trim() ||
|
||||
"";
|
||||
const password =
|
||||
process.env.PLAYWRIGHT_OCR_LIVE_PASSWORD?.trim() ||
|
||||
process.env.LIVE_SMOKE_EMPLOYEE_PASSWORD?.trim() ||
|
||||
"";
|
||||
|
||||
if (!identifier && !password) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
if (!identifier || !password) {
|
||||
throw new Error("PLAYWRIGHT_OCR_LIVE_IDENTIFIER/PASSWORD 或 LIVE_SMOKE_EMPLOYEE_* 必须成对提供");
|
||||
}
|
||||
|
||||
return {
|
||||
identifier,
|
||||
password,
|
||||
name: process.env.PLAYWRIGHT_OCR_LIVE_NAME?.trim() || "Smoke Employee",
|
||||
};
|
||||
}
|
||||
|
||||
export async function openInvoicePool(page: Page) {
|
||||
await page.goto("/invoice-pool");
|
||||
await expect(page.getByTestId("invoice-pool-table")).toBeVisible();
|
||||
|
||||
在新工单中引用
屏蔽一个用户