R73-A5 固化 OCR Playwright 回归与试运行清单
这个提交包含在:
@@ -0,0 +1,38 @@
|
||||
import { existsSync } from "node:fs";
|
||||
|
||||
import { test, expect } from "../helpers/fixtures";
|
||||
import { EMPLOYEE, login, logout } from "../helpers/auth";
|
||||
import { openNavLink } from "../helpers/navigation";
|
||||
|
||||
test("手工 live 腾讯 OCR 辅助复核:真实 VAT 发票上传后进入可处理状态", async ({ page }) => {
|
||||
test.skip(process.env.PLAYWRIGHT_MANUAL !== "1", "仅在显式手工 Playwright 模式下执行");
|
||||
test.skip(process.env.PLAYWRIGHT_OCR_LIVE !== "1", "仅在显式 live OCR 辅助复核模式下执行");
|
||||
|
||||
const invoiceFilePath = process.env.PLAYWRIGHT_OCR_LIVE_FILE?.trim() ?? "";
|
||||
test.skip(!invoiceFilePath || !existsSync(invoiceFilePath), "需要提供存在的 PLAYWRIGHT_OCR_LIVE_FILE");
|
||||
|
||||
await login(page, EMPLOYEE);
|
||||
await (await openNavLink(page, "票据中心")).click();
|
||||
await expect(page.getByTestId("invoice-pool-table")).toBeVisible();
|
||||
|
||||
await page.getByTestId("invoice-upload-file").setInputFiles(invoiceFilePath);
|
||||
await page.getByTestId("invoice-upload-submit").click();
|
||||
|
||||
await expect.poll(async () => {
|
||||
const text = await page.getByTestId("invoice-detail-panel").innerText().catch(() => "");
|
||||
if (text.includes("状态:available")) return "available";
|
||||
if (text.includes("状态:ocr_failed")) return "ocr_failed";
|
||||
return "pending_ocr";
|
||||
}, { timeout: 180_000 }).not.toBe("pending_ocr");
|
||||
|
||||
const detailText = await page.getByTestId("invoice-detail-panel").innerText();
|
||||
if (detailText.includes("状态:ocr_failed")) {
|
||||
const bannerText = await page.getByTestId("invoice-ocr-status-banner").innerText().catch(() => "OCR 失败");
|
||||
throw new Error(`live 腾讯 OCR 失败:${bannerText}`);
|
||||
}
|
||||
|
||||
await expect(page.getByTestId("invoice-detail-panel")).not.toContainText("发票号:---");
|
||||
await expect(page.getByTestId("invoice-detail-panel")).not.toContainText("总金额:-");
|
||||
|
||||
await logout(page, EMPLOYEE.name);
|
||||
});
|
||||
在新工单中引用
屏蔽一个用户