27 行
1.2 KiB
TypeScript
27 行
1.2 KiB
TypeScript
import { existsSync } from "node:fs";
|
|
|
|
import { test, expect } from "../helpers/fixtures";
|
|
import { EMPLOYEE, login, logout } from "../helpers/auth";
|
|
import { openInvoicePool, uploadLiveInvoiceAndWait } from "../helpers/liveInvoiceOcr";
|
|
|
|
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 openInvoicePool(page);
|
|
|
|
const result = await uploadLiveInvoiceAndWait(page, invoiceFilePath);
|
|
if (result.status === "ocr_failed") {
|
|
throw new Error(`live 腾讯 OCR 失败:${result.bannerText || result.detailText}`);
|
|
}
|
|
|
|
await expect(page.getByTestId("invoice-detail-panel")).not.toContainText("发票号:---");
|
|
await expect(page.getByTestId("invoice-detail-panel")).not.toContainText("总金额:-");
|
|
|
|
await logout(page, EMPLOYEE.name);
|
|
});
|