From b328a7790b2883bf7ba29357597536f673436fa9 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 3 Nov 2026 05:11:56 +0800 Subject: [PATCH] gui tests: balance-fix types the account token into its own box, not the proxy's password (#4683) 9c8636a35 (#3382) gave the Proxy field a login, so a new custom provider's Advanced fold has a "Password (optional)" box before the account balance token. The test took the second password input as the token, typed it into the proxy's password, and the Balance URL hint never came: every "Sub2API balance shortcut" case and "a token on a new custom provider with no Balance URL" were red at main in both engines, not only under load or on Linux (#4683, #4682). The token box is now found by its own placeholder, in each language. The app is unchanged. Run on mote: balance-fix.test.cjs, chromium + webkit, every language and width: 100/100 ok at this head; at main 5ec237568 the same file was red in every Sub2API case and the /api/user/self case. Found by a debug run listing the editor's password inputs. Not tried: other tests that pick a password input by position (grepped: only balance-fix does in the editor). --- internal/gui/tests/balance-fix.test.cjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/gui/tests/balance-fix.test.cjs b/internal/gui/tests/balance-fix.test.cjs index feb8ef3be..cc138af72 100644 --- a/internal/gui/tests/balance-fix.test.cjs +++ b/internal/gui/tests/balance-fix.test.cjs @@ -169,7 +169,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.goto("http://magpie.test/?view=providers"); await page.locator("#providers .row.provider").first().waitFor(); await page.evaluate(() => { adding = true; editing = { custom: true }; draft = null; renderProviders(); }); - const tok = page.locator(".editor input[type=password]").nth(1); + // the token's own box: the Proxy field's password comes before it (#4683) + const tok = page.getByPlaceholder(await page.evaluate(() => t("optional · the account's system access token")), { exact: true }); await page.locator(".editor input[type=url]").first().fill("https://relay.example.com/v1"); const fix = page.locator(".editor .bal-fix"); assert.equal(await fix.textContent(), "", "no token, no hint"); @@ -250,7 +251,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await page.locator(".editor .bal-fix").textContent(), "", "no token, no warning"); // the account's token is under Advanced await page.locator(".editor details.advanced > summary").click(); - await page.locator(".editor input[type=password]").nth(1).fill("eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.c2ln"); + const tokHint = await page.evaluate(() => t("optional · the account's system access token")); + await page.getByPlaceholder(tokHint, { exact: true }).fill("eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.c2ln"); } else { await page.locator(".row.provider", { hasText: "Relay" }).click(); }