fix: collapse workbench trace by default

This commit is contained in:
lyon
2026-06-15 17:46:43 +08:00
parent 4fd1410a45
commit e864740d86
3 changed files with 32 additions and 10 deletions
+18 -5
View File
@@ -263,14 +263,27 @@ async function probeStatus(args) {
async function maybeLogin(page, args, actions) {
const username = page.locator("#login-username");
if (!(await username.isVisible({ timeout: Math.min(args.timeoutMs, 12000) }).catch(() => false))) {
if (await username.isVisible({ timeout: Math.min(args.timeoutMs, 12000) }).catch(() => false)) {
await username.fill(args.user);
await page.locator("#login-password").fill(args.pass);
await page.locator("#login-submit").click();
actions.push({ action: "login", user: args.user, selectorMode: "legacy-id" });
await page.locator("#command-input").waitFor({ state: "visible", timeout: args.timeoutMs });
const finalUrl = new URL(page.url());
if (finalUrl.searchParams.has("username") || finalUrl.searchParams.has("password")) {
throw new Error("login credentials leaked into URL query");
}
return;
}
const cardInputs = page.locator(".login-card input");
if ((await cardInputs.count().catch(() => 0)) < 2) {
actions.push({ action: "login", skipped: "login-form-not-visible", authState: await page.locator("body").getAttribute("data-auth-state").catch(() => null) });
return;
}
await username.fill(args.user);
await page.locator("#login-password").fill(args.pass);
await page.locator("#login-submit").click();
actions.push({ action: "login", user: args.user });
await cardInputs.nth(0).fill(args.user);
await cardInputs.nth(1).fill(args.pass);
await page.locator(".login-card button[type=submit]").click();
actions.push({ action: "login", user: args.user, selectorMode: "login-card" });
await page.locator("#command-input").waitFor({ state: "visible", timeout: args.timeoutMs });
const finalUrl = new URL(page.url());
if (finalUrl.searchParams.has("username") || finalUrl.searchParams.has("password")) {