From 4ac87fa574b308d42e29234515b2076fc0cecdd5 Mon Sep 17 00:00:00 2001 From: CieanYau Date: Fri, 6 Nov 2026 03:13:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E8=81=94=E8=AE=A2=E5=8D=95=E8=BD=AC?= =?UTF-8?q?=E8=B4=A6=E5=87=AD=E8=AF=81=E4=B8=8A=E4=BC=A0=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E4=B8=8E=E5=8F=AF=E8=A7=81=E6=A0=87=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/pages/orders/[id].vue | 5 ++- tests/review-style-fields.e2e.test.mjs | 57 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/app/pages/orders/[id].vue b/app/pages/orders/[id].vue index 581a041..bbd13fd 100644 --- a/app/pages/orders/[id].vue +++ b/app/pages/orders/[id].vue @@ -990,7 +990,9 @@ var ue = { (a[16] ||= createElementVNode( `h3`, - null, + { + id: `bank-voucher-label`, + }, `银行转账凭证`, -1, )), @@ -1054,6 +1056,7 @@ var ue = { `input`, { id: `bank-voucher-files`, + "aria-labelledby": `bank-voucher-label`, type: `file`, accept: `image/*,.pdf`, multiple: ``, diff --git a/tests/review-style-fields.e2e.test.mjs b/tests/review-style-fields.e2e.test.mjs index 14912a8..3686900 100644 --- a/tests/review-style-fields.e2e.test.mjs +++ b/tests/review-style-fields.e2e.test.mjs @@ -231,6 +231,63 @@ test( }), ); +test( + "bank voucher uploads are named from the visible order heading", + { timeout: 25000 }, + (t) => + scenario(t, {}, async (page) => { + const requests = await boundary(page, { + "/order/42": { + order: { + id: 42, + amount: "20.00", + amount_unpaid: "20.00", + credit: "0.00", + type: "new", + status: "WaitUpload", + gateway: "artificial", + create_time: 1700000000, + items: [{ id: 1, product_name: "本地测试实例", amount: "20.00" }], + }, + customfields: { is_pre_invoice: 0 }, + }, + "/upload": { save_name: "bank-voucher.pdf" }, + }); + await login(page, "/orders/42"); + await page + .getByRole("heading", { name: "银行转账凭证", exact: true }) + .waitFor(); + const input = page.locator("input[type=file]"); + await input.waitFor(); + const accessible = await input.ariaSnapshot(); + assert.ok( + accessible.includes("银行转账凭证"), + `The visible voucher heading must name the upload field; browser accessibility tree: ${accessible}`, + ); + await page.getByLabel("银行转账凭证", { exact: true }).setInputFiles({ + name: "bank-voucher.pdf", + mimeType: "application/pdf", + buffer: Buffer.from("local-e2e-voucher-not-financial-data"), + }); + const remove = page.getByRole("button", { + name: "移除凭证", + exact: true, + }); + await remove.waitFor(); + assert.deepEqual( + requests.filter((request) => request.path === "/upload"), + [{ path: "/upload", authenticated: true, multipart: true }], + ); + await remove.click(); + assert.equal(await remove.count(), 0); + return { + visibleHeadingNamesUpload: true, + authenticatedMultipartUpload: true, + localVoucherRemoval: true, + }; + }), +); + test( "normal kky upgrade plans and disks fit the narrow dialog container", { timeout: 30000 },