gui: a provider editor's account rows end at one edge, their settings under ⋯
The owner, 10-29, on Claude Code's editor sheet: its left and right edges
weren't the same, Make first sat alone on a line under the name, and a
band of hover pills took room it didn't show.
Each account row is now a line (dot, name, plan, what is set, then the
status and First or Make first at the right end) and the quota under it.
The settings that aren't set (models, usage cap, requests at once) and
Remove or Sign out wait under ⋯ on a line of their own, which ⋯ opens and
closes. The editor remembers that per row across redraws. A set pill stays
on the line, and a lane pill moves between them as its account starts or
stops running, but not while its menu or box is open. A signed-out
account keeps Sign in again and Remove on its line, wrapping under the
name where they don't fit. The editor's label column fits its labels,
a list's label stands on its first row, every row of the accounts box is
ruled off from the one above, and in the web layout ⋯ is always shown. New
string "Settings for {user}" is in all five languages.
core_budget_test: app.js stays in its budget (1,311,731, comments cut
down). The core's scripts go to 1,532,459. Main had 233 bytes of room
there, so the budget is raised to the exact size with no room added,
as the 10-28/29 editor entries did.
Run (on mote, at this tree, rebased on abd94e0b1):
- go test -run Budget ./internal/gui/: ok.
- node --test on account-row-line (new), account-cap, account-models,
lane-limit, codex-signout, own-signin-remove, i18n-keys and i18n:
82 pass, 0 fail.
- The full GUI set of 70 files, at base 2da7293d4 before the trim: 1227
pass, 17 fail. Every red also fails on main:
- gateway-caller-keys (#3797);
- gateway-key-models webkit en (#4081);
- key-replace 420 webkit (#4126);
- rest-try-now 420 (#4127);
- key-weight-fit en 900 in both engines (#4295, filed now). That is
the key rows' own hover squeeze, which this change leaves alone.
Broken by hand: account-row-line on main's assets (MAGPIE_ACC_ASSETS) is
red in both engines: Make first on a line of its own, and hidden pills
taking room.
Not run: the full GUI set again after the comment trim and the move to
abd94e0b1. A provider's key rows (renderKeyAccounts) keep the old hover
layout (#4295). On a phone, the sheet's two edges aren't compared,
because a phone's scroll bar takes no room. Headless WebKit draws a
classic bar there.
This commit is contained in:
@@ -2561,6 +2561,9 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
|
||||
.accts { display: grid; grid-template-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; background: var(--card); overflow: hidden; }
|
||||
.acc { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 5px 8px 5px 11px; font-size: 12.5px; text-align: left; }
|
||||
.acc + .acc, .accts .signing { border-top: 1px solid var(--line-2); }
|
||||
/* every row of the box ruled off from the one above it, a setting's too
|
||||
(the owner, 10-29: Add another sat unruled under Only switch) */
|
||||
.accts > :is(.keep-login, .switch-only, .pool-ends) + .acc { border-top: 1px solid var(--line-2); }
|
||||
.editor .accts .keep-login, .editor .accts .switch-only, .editor .accts .pool-ends { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-height: 34px; padding: 6px 11px; font-size: 12px; border-top: 1px solid var(--line-2); }
|
||||
.editor .accts .keep-login .keep-as { max-width: 240px; }
|
||||
.editor .accts .pool-ends .note { flex-basis: 100%; color: var(--fg-2); }
|
||||
@@ -2681,6 +2684,39 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
|
||||
.acc .acct-user, .acc .acct-seat { color: var(--muted); font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.acc .acct-who .n { flex: 0 1 auto; }
|
||||
.acc .plan { flex: none; }
|
||||
/* an account's first line (the owner, 10-29): its name gives way, never
|
||||
its place on the right, so First and Make first end every row at the
|
||||
same edge. What is set shows on it; the rest waits under ⋯ on a line
|
||||
of its own, so nothing on it takes room it doesn't show */
|
||||
.acc-line { flex: 1 0 100%; display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 22px; }
|
||||
.acc-line > .plan { flex: 0 3 auto; min-width: 3em; overflow: hidden; text-overflow: ellipsis; }
|
||||
.acc-line > :not(.acct-who, .n, .plan, .grow, .amodels, .acap, .alane, .text, .using) { flex-shrink: 0; }
|
||||
.acc-line > .using, .acc-line > .text { white-space: nowrap; }
|
||||
/* and only where even that is too narrow (a long German Make first beside
|
||||
a 240px row) the button's own words end in an ellipsis, last of all */
|
||||
.acc-line > :is(.using, .text:not(.quiet)) { flex-shrink: .001; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
|
||||
.acc-line > .acct-who, .acc-line > .n { min-width: 4.5em; }
|
||||
/* a signed-out account keeps both ways out on its line: where they don't
|
||||
fit beside the name they wrap under it, Remove still at the right end */
|
||||
.acc.signed-out .acc-line { flex-wrap: wrap; row-gap: 4px; }
|
||||
.acc.signed-out .acc-line > .text.quiet:last-child { margin-left: auto; }
|
||||
.acc-line > :is(.amodels, .acap, .alane) { flex-shrink: .01; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* the pills sit closer to one another than to the name */
|
||||
.acc-line > :is(.amodels, .acap, .alane) + :is(.amodels, .acap, .alane) { margin-left: -4px; }
|
||||
/* a pill set when the row was drawn that is no longer (requests running
|
||||
that ended) takes no room till the row is drawn again */
|
||||
.acc-line > :is(.amodels:not(.set), .acap:not(.set), .alane:not(.set)):not(.open):not(:focus-visible) { max-width: 0; padding-left: 0; padding-right: 0; margin-left: -9px; box-shadow: none; opacity: 0; }
|
||||
/* ⋯: a hover brings it out, beside what ends the row */
|
||||
.acc .acc-more { flex: none; display: inline-grid; place-items: center; width: 22px; height: 20px; padding: 0; border: 0; border-radius: 5px; background: none; color: var(--muted); cursor: default; opacity: 0; transition: opacity .15s, background .12s, color .12s; }
|
||||
.acc:hover .acc-more, .acc .acc-more:focus-visible, .acc.tools-open .acc-more { opacity: 1; }
|
||||
.acc .acc-more:hover { color: var(--fg); background: var(--pill-hover); }
|
||||
.acc.tools-open .acc-more { color: var(--fg); background: var(--pill); }
|
||||
/* and its line, under the quota, lined up with it */
|
||||
.acc .acc-tools { flex-basis: 100%; display: none; align-items: center; flex-wrap: wrap; gap: 6px; padding-left: 25px; min-width: 0; }
|
||||
.acc.tools-open .acc-tools { display: flex; }
|
||||
.acc .acc-tools > :is(.amodels, .acap, .alane, .text.quiet) { opacity: 1; }
|
||||
/* Remove ends the line, and where the line wraps it ends the next */
|
||||
.acc .acc-tools > .text.quiet { margin-left: auto; }
|
||||
/* a key's row (#841): what shows only on hover takes no room till then,
|
||||
so a key's weight never squeezes its name away; the room it takes on
|
||||
hover is the row's free room, else the masked key's, and the models
|
||||
@@ -2971,7 +3007,10 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
|
||||
.sheet .custom-foot .custom:hover, .sheet .custom-foot .custom.on { background: var(--accent-soft); }
|
||||
.sheet .custom-foot .hint { font-size: 12px; color: var(--muted); }
|
||||
/* the provider editor, in a dialog */
|
||||
.editor { padding: 16px 18px 14px; display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 10px 14px; align-items: start; }
|
||||
/* the label column is as wide as its longest label, so that label starts
|
||||
at the padding and the fields end the same way on the right (the
|
||||
owner, 10-29: a 72px column left the left edge twice the right) */
|
||||
.editor { padding: 16px 18px 14px; display: grid; grid-template-columns: fit-content(132px) minmax(0, 1fr); gap: 10px 14px; align-items: start; }
|
||||
.editor .ehead { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding-bottom: 8px; margin-bottom: 2px; border-bottom: 1px solid var(--line-2); }
|
||||
.editor .ehead .ic { width: 20px; height: 20px; }
|
||||
.editor .icon-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||
@@ -2986,6 +3025,7 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
|
||||
.editor .ehead b { font-weight: 600; }
|
||||
.editor .ehead .note { font-size: 12px; color: var(--muted); }
|
||||
.editor label { font-size: 12px; color: var(--fg-2); text-align: right; padding-top: 5px; }
|
||||
.editor label.by-list { padding-top: 11px; }
|
||||
.editor .hint { font-size: 11px; color: var(--fg-2); margin-top: 4px; }
|
||||
/* a provider's own proxy (#237): the address beside the options, its room
|
||||
kept while it is hidden so a pick never changes the dialog's height */
|
||||
@@ -3068,6 +3108,9 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
|
||||
.editor .extra-body .why { font-size: 12px; line-height: 1.45; color: var(--red); overflow-wrap: anywhere; }
|
||||
.editor .extra-body .why:empty { display: none; }
|
||||
.segs { position: relative; display: inline-flex; padding: 2px; border-radius: 7px; background: var(--pill); align-self: flex-start; }
|
||||
/* an editor's choices wrap where its sheet is narrow, never pushing the
|
||||
sheet into a sideways scroll (German Routing at the 560px window) */
|
||||
.editor .segs { max-width: 100%; flex-wrap: wrap; }
|
||||
.opt { position: relative; z-index: 1; white-space: nowrap; height: 22px; padding: 0 10px; border-radius: 5px; font-size: 12px; color: var(--muted); transition: color .18s var(--ease), transform .14s var(--ease); }
|
||||
.opt.on { color: var(--fg); }
|
||||
/* how often magpie checks for updates, while it doesn't by itself */
|
||||
@@ -3875,6 +3918,7 @@ body.panel .modal { padding: 16px 12px; }
|
||||
/* nothing hovers on a phone: what a row shows on hover is shown, and a
|
||||
key's row gives it back the room it folds away till a hover (#841) */
|
||||
body.web .acc :is(.text.quiet, .proto, .amodels, .alane) { opacity: 1; }
|
||||
body.web .acc .acc-more { opacity: 1; }
|
||||
body.web .accts.keys .acc > :is(.amodels, .proto, .alane, .text.quiet) { max-width: none !important; padding: 0 7px !important; flex-shrink: 0 !important; }
|
||||
body.web .accts.keys .acc > .alane:not(.set) { margin-left: 0 !important; }
|
||||
body.web #gatewayKeys .acc > .key-quotas { max-width: none !important; padding: 0 7px !important; margin-left: 0 !important; flex-shrink: 0; }
|
||||
|
||||
+47
-23
@@ -7540,7 +7540,7 @@ function partnerTile(pr) {
|
||||
|
||||
let fieldIDs = 0;
|
||||
function field(label, control, hint) {
|
||||
const l = el("label", "", label);
|
||||
const l = el("label", control.classList?.contains("accts") ? "by-list" : "", label); // on a list's first row
|
||||
const wrap = el("div");
|
||||
wrap.append(control);
|
||||
const inputSelector = "input, select, textarea";
|
||||
@@ -12266,6 +12266,7 @@ let signing = null; // the sign-in under way: { id, agent, url, state, installin
|
||||
const stopSignIn = () => { if (signing?.id) api("signin/" + signing.id + "/cancel", {}).catch(() => {}); };
|
||||
const signingOpen = () => signing?.state === "waiting" || signing?.state === "installing";
|
||||
let justAdded = ""; // the account that just came in, to greet it
|
||||
const accountToolsOpen = new Set(); // rows whose ⋯ is open
|
||||
|
||||
// o: { user } signing that account in again, { proxy } the one picked to
|
||||
// sign in through (#1663): none picked, the one the account's requests go
|
||||
@@ -13179,10 +13180,16 @@ function renderAccounts(a, p) {
|
||||
dot.title = on ? t("Stop using this account") : t("Use this account too");
|
||||
dot.onclick = () => accountAction("login/" + (on ? "off" : "on"), { agent: a.agent, user: l.user });
|
||||
}
|
||||
row.append(dot, accountNameButton(p, l.user), el("span", "plan", accountPlan({ agent: a.agent, builtin: a.builtin, plan: l.plan })));
|
||||
// one line, First or Make first at its right end (the owner, 10-29)
|
||||
const line = el("div", "acc-line");
|
||||
row.append(line);
|
||||
line.append(dot, accountNameButton(p, l.user), el("span", "plan", accountPlan({ agent: a.agent, builtin: a.builtin, plan: l.plan })));
|
||||
// its own models (#474), when there is another account to send the rest to
|
||||
const [amPill, amBox] = ls.length > 1 || accountModelsOf(p, l.user).length ? accountModels(p, l.user, false, l.user) : [];
|
||||
if (amPill) row.append(amPill);
|
||||
// what is set shows on it; the rest waits under ⋯ on a line below
|
||||
const tools = el("div", "acc-tools");
|
||||
const pill = (x) => (x.classList.contains("set") ? line : tools).append(x);
|
||||
if (amPill) pill(amPill);
|
||||
// its usage cap: the share of each window it is used to at most
|
||||
const cap = accountCapOf(p, l.user);
|
||||
// Claude Code or Codex signed in to it asks its vendor itself, not
|
||||
@@ -13190,76 +13197,90 @@ function renderAccounts(a, p) {
|
||||
// holds back only what goes through magpie (𝕏 on Discord: a 90% cap
|
||||
// and the five hours run to 100%)
|
||||
const direct = l.active && !several && (a.agent === "claude" || a.agent === "codex") ? a.agentName : "";
|
||||
if (p) row.append(accountCapPill(p, l.user, cap, direct));
|
||||
if (p) pill(accountCapPill(p, l.user, cap, direct));
|
||||
// and each window's own, set on its meter (willz on Discord)
|
||||
const capFor = (w) => windowCapOf(p, l.user, w);
|
||||
// how many requests it has out at once, and waiting (#892)
|
||||
if (p) row.append(laneLimitPill(p, l.user, p.id + "@" + String(l.user).toLowerCase(), l.user));
|
||||
if (p) pill(laneLimitPill(p, l.user, p.id + "@" + String(l.user).toLowerCase(), l.user));
|
||||
const held = capHeldOf(quota?.[l.user], capFor);
|
||||
if (held) row.append(capHeldNote(held, held.cap, several, direct));
|
||||
row.append(el("span", "grow"));
|
||||
if (held) line.append(capHeldNote(held, held.cap, several, direct));
|
||||
line.append(el("span", "grow"));
|
||||
if (unusable(l)) {
|
||||
row.classList.add("signed-out");
|
||||
row.append(el("span", "using", t("Sign-in required")));
|
||||
line.append(el("span", "using", t("Sign-in required")));
|
||||
const again = el("button", "text", t("Sign in again"));
|
||||
again.onclick = () => startSignIn(a.agent, false, undefined, { user: l.user });
|
||||
row.append(again);
|
||||
line.append(again);
|
||||
// the one Claude Code is signed in to can't be forgotten (ForgetLogin)
|
||||
if (!l.active) {
|
||||
row.append(forgetOf());
|
||||
line.append(forgetOf());
|
||||
}
|
||||
} else if (signedOut(l)) {
|
||||
row.classList.add("signed-out");
|
||||
row.append(el("span", "using", t("Sign-in required")));
|
||||
line.append(el("span", "using", t("Sign-in required")));
|
||||
const again = el("button", "text", t("Sign in again"));
|
||||
again.onclick = () => startSignIn(a.agent, false, againSite(l), { user: l.user });
|
||||
row.append(again, forgetOf(true));
|
||||
line.append(again, forgetOf(true));
|
||||
} else if (l.active && kept && l.user !== firstUser) {
|
||||
// signed in to, kept so, and tried at its place in the order
|
||||
const signed = el("span", "using", l.paused ? t("Paused") : t("Signed in"));
|
||||
signed.title = t("{agent} is kept signed in to this account; requests through magpie go to the accounts in their order", { agent: a.agentName });
|
||||
row.append(signed);
|
||||
if (on) row.append(makeFirst(l));
|
||||
line.append(signed);
|
||||
if (on) line.append(makeFirst(l));
|
||||
} else if (l.active) {
|
||||
const using = el("span", "using", l.paused ? t("Paused") : back ? t("First for now") : several ? t("First") : t("In use"));
|
||||
if (back && !l.paused) using.title = t("{user} was nearly used up, so magpie signed {agent} in to this one; it goes back to {user} once that has room again", { user: back.user, agent: a.agentName });
|
||||
row.append(using);
|
||||
line.append(using);
|
||||
if (a.agent === "qoder" || a.agent === "qoder-cn" || l.own) {
|
||||
row.append(forgetOf(l.own));
|
||||
line.append(forgetOf(l.own));
|
||||
} else if (a.agent === "codex" && ls.length === 1) {
|
||||
// Codex's only account: no other to sign it in to first, so it is
|
||||
// signed out, as codex logout does (ForgetLogin)
|
||||
const out = el("button", "text quiet", t("Sign out"));
|
||||
out.title = t("Signs Codex out of this account, as codex logout does");
|
||||
out.onclick = () => askSignOutLogin(a, l);
|
||||
row.append(out);
|
||||
line.append(out);
|
||||
} else if (a.agent === "codex") {
|
||||
// Codex is signed in to another of its accounts first, then this
|
||||
// one goes (ForgetLogin), rather than Codex signed out
|
||||
row.append(forgetOf(t("Codex is signed in to another of its accounts, and magpie forgets this one; the account itself is untouched")));
|
||||
line.append(forgetOf(t("Codex is signed in to another of its accounts, and magpie forgets this one; the account itself is untouched")));
|
||||
}
|
||||
} else {
|
||||
const forget = forgetOf(true);
|
||||
if (l === back) {
|
||||
const again = el("span", "using", t("First again once it has room"));
|
||||
again.title = t("magpie signs {agent} back in to this account once it has room again", { agent: a.agentName });
|
||||
row.append(again);
|
||||
line.append(again);
|
||||
}
|
||||
if (kept) {
|
||||
// the sign-in stays where it is kept: Make first is the order's,
|
||||
// and an account not in use is ticked on by its dot
|
||||
row.append(forget);
|
||||
if (l.user === firstUser) row.append(el("span", "using", t("First")));
|
||||
else if (on) row.append(makeFirst(l));
|
||||
line.append(forget);
|
||||
if (l.user === firstUser) line.append(el("span", "using", t("First")));
|
||||
else if (on) line.append(makeFirst(l));
|
||||
} else {
|
||||
const use = el("button", "text", on ? t("Make first") : t("Use"));
|
||||
use.title = sub?.own ? t("The gateway uses this account first") : t("Sign {agent} in to this account", { agent: a.agentName });
|
||||
use.onclick = () => { use.classList.add("busy"); accountAction("login/switch", { agent: a.agent, user: l.user }, sub?.own ? t("The gateway now uses {user} first", { user: l.user }) : t("{agent} is now signed in as {user}", { agent: a.agentName, user: l.user })); };
|
||||
row.append(forget, use);
|
||||
line.append(forget, use);
|
||||
}
|
||||
}
|
||||
row.append(accountQuota(l.lapsed ? { [l.user]: { error: t(l.lapsed) } } : quota, l.user, capFor, p ? (m, w) => windowCapMeter(m, p, l.user, w) : null));
|
||||
row.classList.add("with-aq"); // not :has(.aq), which Safari 15.0 lacks (#220)
|
||||
// Remove goes under ⋯ too, but beside Sign in again while signed out
|
||||
if (!row.classList.contains("signed-out")) tools.append(...line.querySelectorAll(":scope > .text.quiet"));
|
||||
if (tools.childElementCount) {
|
||||
const key = (p?.id || a.agent) + "@" + String(l.user).toLowerCase(), more = el("button", "acc-more");
|
||||
more.type = "button";
|
||||
more.append(svg(DOTS, 14, 2.4));
|
||||
more.title = t("Settings for {user}", { user: l.user });
|
||||
more.setAttribute("aria-label", more.title);
|
||||
const shown = (v) => { row.classList.toggle("tools-open", v); more.setAttribute("aria-expanded", v); v ? accountToolsOpen.add(key) : accountToolsOpen.delete(key); };
|
||||
shown(accountToolsOpen.has(key) || !!amBox);
|
||||
more.onclick = () => shown(!row.classList.contains("tools-open"));
|
||||
line.querySelector(".grow").after(more);
|
||||
row.append(tools);
|
||||
}
|
||||
if (amBox) row.append(amBox);
|
||||
list.append(row);
|
||||
}
|
||||
@@ -14056,6 +14077,9 @@ function laneText(pill) {
|
||||
if (pill.textContent !== text) pill.textContent = text;
|
||||
lanesTick ||= setInterval(refreshLanes, 2e3);
|
||||
pill.classList.toggle("set", own != null || limit + busy > 0);
|
||||
// set or running on its account's line, else under ⋯, not while open
|
||||
const row = pill.closest(".acc"), tools = row?.querySelector(".acc-tools"), line = row?.querySelector(".acc-line"), on = pill.classList.contains("set");
|
||||
if (tools && line && !pill.classList.contains("open") && pill !== document.activeElement && pill.parentElement === (on ? tools : line)) on ? line.querySelector(".grow").before(pill) : tools.insertBefore(pill, tools.querySelector(".text.quiet"));
|
||||
pill.classList.toggle("busy-lane", !!(limit && busy >= limit));
|
||||
pill.classList.toggle("queued", !!waiting);
|
||||
const whose = own != null ? t("its own") : t("the provider's");
|
||||
|
||||
@@ -2239,6 +2239,7 @@ const I18N = {
|
||||
"Edit as JSON": "以 JSON 编辑",
|
||||
"Collapse to one line": "折叠为单行",
|
||||
"Remove": "移除",
|
||||
"Settings for {user}": "{user} 的设置",
|
||||
"Web pages": "网页",
|
||||
"Web page origin": "网页来源",
|
||||
"Web pages that may call magpie": "允许调用 magpie 的网页",
|
||||
@@ -6343,6 +6344,7 @@ const I18N = {
|
||||
"Edit as JSON": "以 JSON 編輯",
|
||||
"Collapse to one line": "摺疊為單行",
|
||||
"Remove": "移除",
|
||||
"Settings for {user}": "{user} 的設定",
|
||||
"Web pages": "網頁",
|
||||
"Web page origin": "網頁來源",
|
||||
"Web pages that may call magpie": "允許呼叫 magpie 的網頁",
|
||||
@@ -10426,6 +10428,7 @@ const I18N = {
|
||||
"Edit as JSON": "JSON で編集",
|
||||
"Collapse to one line": "1行に折りたたむ",
|
||||
"Remove": "削除",
|
||||
"Settings for {user}": "{user} の設定",
|
||||
"Web pages": "Web ページ",
|
||||
"Web page origin": "Web ページのオリジン",
|
||||
"Web pages that may call magpie": "magpie を呼び出せる Web ページ",
|
||||
@@ -14539,6 +14542,7 @@ const I18N = {
|
||||
"Edit as JSON": "Als JSON bearbeiten",
|
||||
"Collapse to one line": "Auf eine Zeile reduzieren",
|
||||
"Remove": "Entfernen",
|
||||
"Settings for {user}": "Einstellungen für {user}",
|
||||
"Web pages": "Webseiten",
|
||||
"Web page origin": "Herkunft der Webseite",
|
||||
"Web pages that may call magpie": "Webseiten, die magpie aufrufen dürfen",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@
|
||||
// A subscription account can be used up to a share of each usage window
|
||||
// only — a new Claude account kept to 70% of its five hours and its week,
|
||||
// asked on Discord to lower the risk of a ban. Its row has a pill: a capped
|
||||
// one says its cap, always shown; one without says No cap, on hover. A
|
||||
// one says its cap, always shown; one without says No cap, under its ⋯. A
|
||||
// click opens the app's own menu of shares (no native select): a share, No
|
||||
// cap, or Other… for one typed in place, each posted to provider/accountcap
|
||||
// with the account and the cap (0: none). Each meter the cap counts has a
|
||||
@@ -143,15 +143,17 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.equal(await pill(page, "me@example.com").evaluate((e) => getComputedStyle(e).opacity), "1");
|
||||
assert.equal(await row(page, "me@example.com").locator(".acap-held").textContent(), w.held);
|
||||
assert.deepEqual(await row(page, "me@example.com").locator(".aq-cap").evaluateAll((ms) => ms.map((m) => m.style.left)), ["70%", "70%"]);
|
||||
// the spare has none: No cap on hover only, no note, no mark
|
||||
// the spare has none: No cap under its ⋯ only, no note, no mark
|
||||
assert.equal(await pill(page, "Spare@Example.com").textContent(), w.none);
|
||||
await page.mouse.move(0, 0);
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(await pill(page, "Spare@Example.com").evaluate((e) => getComputedStyle(e).opacity), "0");
|
||||
assert.equal(await pill(page, "Spare@Example.com").isVisible(), false);
|
||||
assert.equal(await row(page, "Spare@Example.com").locator(".acap-held, .aq-cap").count(), 0);
|
||||
|
||||
// the spare's pill opens the app's menu; 80% is posted
|
||||
await row(page, "Spare@Example.com").hover();
|
||||
await still(page, "Spare@Example.com", row(page, "Spare@Example.com").locator(".acc-more"));
|
||||
assert.equal(await pill(page, "Spare@Example.com").isVisible(), true);
|
||||
await still(page, "Spare@Example.com", pill(page, "Spare@Example.com"));
|
||||
await menu(page).waitFor();
|
||||
assert.equal(await menu(page).locator(".pm-head").textContent(), w.menu);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Each account of a subscription, and each key, can be kept for some of the
|
||||
// provider's models only (#474: 增加账号级别的模型选项). Its row has a badge:
|
||||
// one kept for some says how many, always shown; one serving every model
|
||||
// says All models, on hover. A click opens the provider's models under the
|
||||
// says All models, under its ⋯. A click opens the provider's models under the
|
||||
// row as chips; Save posts provider/accountmodels with the account (or the
|
||||
// key's id) and the models picked, All models posts none. A click moves
|
||||
// nothing and the page stays where it is. A subscription with one account
|
||||
@@ -123,23 +123,30 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.equal(await row(page, id).evaluate((e) => Math.round(e.getBoundingClientRect().top)), before, `${id}'s row moved`);
|
||||
assert.equal(await scrolled(page), sc, "a click scrolled");
|
||||
};
|
||||
// an unset badge waits under its row's ⋯
|
||||
const reveal = async (page, id) => {
|
||||
if (await pill(page, id).isVisible()) return;
|
||||
await row(page, id).hover();
|
||||
await row(page, id).locator(".acc-more").click();
|
||||
};
|
||||
const posted = async (posts, n) => {
|
||||
for (let i = 0; i < 60 && posts.length === n; i++) await new Promise((r) => setTimeout(r, 50));
|
||||
return posts.at(-1);
|
||||
};
|
||||
|
||||
test(`${engine} ${lang}: a Codex account is kept for some models, and given all again`, async (t) => {
|
||||
const { page, errors, posts } = await open(t, "Codex", ".editor .accts .acc .amodels");
|
||||
// the one kept for gpt-6-mini says so, always; the other says All models on hover only
|
||||
const { page, errors, posts } = await open(t, "Codex", ".editor .accts .acc .amodels.set");
|
||||
// the one kept for gpt-6-mini says so, always; the other says All models under ⋯ only
|
||||
assert.equal(await pill(page, "Spare@Example.com").textContent(), w.one);
|
||||
assert.equal(await pill(page, "Spare@Example.com").getAttribute("title"), w.only);
|
||||
assert.equal(await pill(page, "Spare@Example.com").evaluate((e) => getComputedStyle(e).opacity), "1");
|
||||
assert.equal(await pill(page, "me@example.com").textContent(), w.all);
|
||||
await page.mouse.move(0, 0);
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(await pill(page, "me@example.com").evaluate((e) => getComputedStyle(e).opacity), "0");
|
||||
assert.equal(await pill(page, "me@example.com").isVisible(), false);
|
||||
|
||||
// me: the provider's models it serves agents, none picked; Save waits for one
|
||||
await reveal(page, "me@example.com");
|
||||
await still(page, "me@example.com", pill(page, "me@example.com"));
|
||||
assert.deepEqual(await chips(page, "me@example.com"), ["gpt-6", "gpt-6-mini"]);
|
||||
const save = panel(page, "me@example.com").getByRole("button", { name: w.save, exact: true });
|
||||
@@ -208,7 +215,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
};
|
||||
|
||||
test(`${engine} ${lang}: the editor's Save saves an account's unsaved picks first`, async (t) => {
|
||||
const { page, errors, posts } = await open(t, "Codex", ".editor .accts .acc .amodels");
|
||||
const { page, errors, posts } = await open(t, "Codex", ".editor .accts .acc .amodels.set");
|
||||
await pill(page, "Spare@Example.com").click();
|
||||
await panel(page, "Spare@Example.com").locator(".mchip", { hasText: /^gpt-6$/ }).click();
|
||||
assert.deepEqual(await chips(page, "Spare@Example.com"), ["gpt-6*", "gpt-6-mini*"]);
|
||||
@@ -225,6 +232,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
test(`${engine} ${lang}: the editor's Save saves a key's unsaved picks first`, async (t) => {
|
||||
const { page, errors, posts } = await open(t, "Relay", ".editor .accts .acc");
|
||||
await row(page, "bbbbbbbbbb").hover();
|
||||
await reveal(page, "bbbbbbbbbb");
|
||||
await pill(page, "bbbbbbbbbb").click();
|
||||
await panel(page, "bbbbbbbbbb").locator(".mchip", { hasText: "Cheap one" }).click();
|
||||
const n = posts.length;
|
||||
@@ -235,7 +243,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
});
|
||||
|
||||
test(`${engine} ${lang}: a picker with every model unpicked holds the editor's Save`, async (t) => {
|
||||
const { page, errors, posts } = await open(t, "Codex", ".editor .accts .acc .amodels");
|
||||
const { page, errors, posts } = await open(t, "Codex", ".editor .accts .acc .amodels.set");
|
||||
await pill(page, "Spare@Example.com").click();
|
||||
await panel(page, "Spare@Example.com").locator(".mchip", { hasText: "gpt-6-mini" }).click();
|
||||
const n = posts.length;
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// A provider editor's accounts (the owner, 10-29: Make first sat alone on a
|
||||
// line under the name, a band of hover pills took room they didn't show,
|
||||
// and the sheet's left edge was twice its right). Each account's first
|
||||
// line ends with what it is (First) or what it does (Make first) at the
|
||||
// same right edge, on one line; nothing on it takes room it doesn't show,
|
||||
// so its quota sits right under it. Its settings (models, cap, requests at
|
||||
// once) and its Remove wait under ⋯, on a line of their own that ⋯ opens
|
||||
// and closes; one that is set stays on the first line. The sheet's two
|
||||
// edges match in the app, its scroll bar counted in. Every row of the accounts box is
|
||||
// ruled off from the one above. In every language, at the window's
|
||||
// narrowest and in a phone's browser. MAGPIE_ACC_ASSETS runs it on older
|
||||
// assets.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
const { test } = require("node:test");
|
||||
const { chromium, webkit } = require("playwright");
|
||||
|
||||
const assets = path.resolve(process.env.MAGPIE_ACC_ASSETS || path.resolve(__dirname, "../assets"));
|
||||
const claude = () => ({
|
||||
id: "claude", name: "Claude Code", icon: "claude-color", chat: "", responses: "", anthropic: "", catalog: "", routing: "",
|
||||
models: [{ id: "claude-opus-5-5", name: "Claude Opus 5.5", on: true }], agents: [], fallback: [], headers: {}, keyList: [],
|
||||
account: {
|
||||
agent: "claude", agentName: "Claude Code", user: "first@example.com", plan: "team",
|
||||
logins: [
|
||||
{ user: "first@example.com", org: "Example", plan: "team", active: true, on: true },
|
||||
{ user: "spare@example.com", plan: "max", on: true },
|
||||
{ user: "capped@example.com", plan: "pro", on: true },
|
||||
],
|
||||
},
|
||||
accountCaps: { "capped@example.com": 70 },
|
||||
});
|
||||
const serve = (lang, web) => async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
const json = (data) => route.fulfill({ json: data });
|
||||
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:${JSON.stringify(lang)},theme:"dark",web:${web}};` });
|
||||
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
|
||||
if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "dark" } });
|
||||
if (url.pathname === "/api/providers") return json({ providers: [claude()], presets: [], excluded: [], gateway: { running: true, window: true } });
|
||||
if (url.pathname === "/api/groups") return json({ groups: [] });
|
||||
if (url.pathname === "/api/plugins") return json({ plugins: [] });
|
||||
if (url.pathname === "/api/login/usage") return json({
|
||||
"first@example.com": { windows: [{ label: "5h", used: 10, limit: 100 }, { label: "Weekly", used: 20, limit: 100 }] },
|
||||
"spare@example.com": { error: "unavailable" },
|
||||
"capped@example.com": { windows: [{ label: "5h", used: 30, limit: 100 }] },
|
||||
});
|
||||
if (url.pathname.startsWith("/api/")) return json({});
|
||||
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
|
||||
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
|
||||
try { await route.fulfill({ body: await fs.readFile(file), contentType }); } catch { await route.fulfill({ status: 404, body: "" }); }
|
||||
};
|
||||
|
||||
// each first line: its height, how far its last child ends from its
|
||||
// right, and what on it is there but drawn at no width or not at all
|
||||
const lines = (page) => page.evaluate(() => [...document.querySelectorAll(".editor .accts .acc")].filter((r) => r.dataset.accountId).map((r) => {
|
||||
const line = r.querySelector(".acc-line") || r, b = line.getBoundingClientRect();
|
||||
const kids = [...line.children].filter((c) => !c.classList.contains("grow"));
|
||||
const last = kids[kids.length - 1].getBoundingClientRect();
|
||||
const hidden = kids.filter((c) => { const k = c.getBoundingClientRect(), s = getComputedStyle(c); return k.width > 1 && (+s.opacity === 0 || s.visibility === "hidden") && !c.classList.contains("acc-more"); }).map((c) => c.className);
|
||||
const q = r.querySelector(".aq")?.getBoundingClientRect();
|
||||
return { who: r.dataset.accountId, h: Math.round(b.height), right: Math.round(b.right - last.right) + 0, hidden, last: kids[kids.length - 1].textContent, gap: q ? Math.round(q.top - b.bottom) : 0 };
|
||||
}));
|
||||
|
||||
const langs = ["en", "zh", "zh-TW", "ja", "de"];
|
||||
for (const [engine, browserType] of [["chromium", chromium], ["webkit", webkit]]) {
|
||||
test(engine + ": an account's first line ends at one edge, its settings under ⋯", async (t) => {
|
||||
const browser = await browserType.launch();
|
||||
t.after(() => browser.close());
|
||||
for (const [web, width] of [[false, 1000], [false, 560], [true, 390]]) for (const lang of langs) {
|
||||
const at = `${lang} ${web ? "web " : ""}${width}`;
|
||||
const context = await browser.newContext({ viewport: { width, height: 900 }, reducedMotion: "reduce" });
|
||||
const page = await context.newPage();
|
||||
await page.route("**/*", serve(lang, web));
|
||||
await page.goto("http://magpie.test/?view=providers");
|
||||
await page.locator(".row.provider", { hasText: "Claude Code" }).first().click();
|
||||
const rows = page.locator(".editor .accts .acc[data-account-id]");
|
||||
await rows.nth(2).waitFor();
|
||||
await page.mouse.move(1, 1);
|
||||
const scrollY = await page.evaluate(() => document.querySelector(".modal .ebody")?.scrollTop ?? 0);
|
||||
|
||||
for (const l of await lines(page)) {
|
||||
assert.equal(l.right, 0, `${at}: ${l.who}'s line ends with what ends it`);
|
||||
assert.deepEqual(l.hidden, [], `${at}: nothing on ${l.who}'s line takes room it doesn't show`);
|
||||
// one line: the tallest thing on it, a phone's touch-sized button
|
||||
assert.ok(l.h <= (web ? 48 : 24), `${at}: ${l.who}'s line is one line (${l.h}px)`);
|
||||
assert.ok(l.gap <= 8, `${at}: ${l.who}'s quota sits under its line (${l.gap}px)`);
|
||||
}
|
||||
const [first, spare, capped] = await lines(page);
|
||||
assert.ok(first.last.length && spare.last.length, `${at}: First and Make first end their lines`);
|
||||
// a cap that is set stays on the line, beside the name
|
||||
assert.equal(await rows.nth(2).locator(".acc-line > .acap.set").count(), 1, `${at}: a set cap stays on its line`);
|
||||
assert.equal(capped.right, 0);
|
||||
|
||||
// ⋯ opens the settings line, and closes it
|
||||
const more = rows.nth(1).locator(".acc-more");
|
||||
const tools = rows.nth(1).locator(".acc-tools");
|
||||
assert.equal(await tools.isVisible(), false, `${at}: the settings wait under ⋯`);
|
||||
await rows.nth(1).hover();
|
||||
await more.click();
|
||||
assert.equal(await more.getAttribute("aria-expanded"), "true");
|
||||
for (const sel of [".amodels", ".acap", ".alane", ".text.quiet"]) assert.ok(await tools.locator(sel).isVisible(), `${at}: ⋯ shows ${sel}`);
|
||||
const tb = await tools.boundingBox(), lb = await rows.nth(1).locator(".acc-line").boundingBox();
|
||||
assert.ok(tb.y >= lb.y + lb.height, `${at}: the settings are on a line of their own`);
|
||||
assert.ok(tb.x + tb.width <= lb.x + lb.width + 1, `${at}: the settings line stays in the row`);
|
||||
await more.click();
|
||||
assert.equal(await tools.isVisible(), false, `${at}: ⋯ closes them`);
|
||||
assert.equal(await page.evaluate(() => document.querySelector(".modal .ebody")?.scrollTop ?? 0), scrollY, `${at}: a click moves nothing`);
|
||||
|
||||
// every row of the box ruled off from the one above
|
||||
const unruled = await page.evaluate(() => [...document.querySelectorAll(".editor .accts > *")].slice(1).filter((x) => x.offsetHeight && parseFloat(getComputedStyle(x).borderTopWidth) < 1).map((x) => x.className));
|
||||
assert.deepEqual(unruled, [], `${at}: every row is ruled off`);
|
||||
|
||||
// the sheet doesn't scroll sideways, and in the app, whose scroll bar
|
||||
// magpie draws, its edges match (a phone's bar takes no room)
|
||||
const m = await page.evaluate(() => {
|
||||
const body = document.querySelector(".modal .ebody"), b = body.getBoundingClientRect(), cs = getComputedStyle(body);
|
||||
return { wide: body.scrollWidth - body.clientWidth, left: parseFloat(cs.paddingLeft), right: b.right - body.getBoundingClientRect().left - body.clientWidth - parseFloat(cs.borderLeftWidth) + parseFloat(cs.paddingRight), bar: body.offsetWidth - body.clientWidth };
|
||||
});
|
||||
assert.ok(m.wide <= 0, `${at}: the sheet doesn't scroll sideways (${m.wide}px)`);
|
||||
if (!web && m.bar > 0) assert.ok(Math.abs(m.left - m.right) <= 1, `${at}: its left edge ${m.left}px, its right ${m.right}px`);
|
||||
await context.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -70,11 +70,15 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
return { page, errors, posts };
|
||||
};
|
||||
|
||||
// an account's Remove and Sign out wait under its ⋯
|
||||
const more = async (row) => { await row.hover(); if (await row.locator(".acc-more").count()) await row.locator(".acc-more").click(); };
|
||||
|
||||
test(`${engine} ${lang}: Codex's only account signs out, asked first`, async (t) => {
|
||||
const { page, errors, posts } = await open(t, one);
|
||||
const top = await page.evaluate(() => document.scrollingElement.scrollTop);
|
||||
const row = page.locator(".editor .acc", { hasText: "me@example.com" });
|
||||
const out = row.getByRole("button", { name: w.out, exact: true });
|
||||
await more(row);
|
||||
assert.equal(await out.count(), 1, "the only account has Sign out");
|
||||
assert.ok(await out.getAttribute("title"));
|
||||
|
||||
@@ -118,6 +122,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
const { page, errors, posts } = await open(t, two);
|
||||
for (const user of ["me@example.com", "work@example.com"]) {
|
||||
const row = page.locator(".editor .acc", { hasText: user });
|
||||
await more(row);
|
||||
assert.equal(await row.getByRole("button", { name: w.out, exact: true }).count(), 0, user);
|
||||
}
|
||||
const remove = page.locator(".editor .acc", { hasText: "me@example.com" }).getByRole("button", { name: w.remove, exact: true });
|
||||
@@ -142,6 +147,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
|
||||
test(`${engine} ${lang}: a refusal says what to do, in the reader's language`, async (t) => {
|
||||
const { page, errors } = await open(t, one, true);
|
||||
await more(page.locator(".editor .acc", { hasText: "me@example.com" }));
|
||||
await page.locator(".editor .acc", { hasText: "me@example.com" }).getByRole("button", { name: w.out, exact: true }).click();
|
||||
const ask = page.locator("#modal .forget-ask");
|
||||
await ask.getByRole("button", { name: w.out, exact: true }).click();
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// routing group and agent. Its row has a pill: what runs and waits under
|
||||
// it while requests are out (the gateway's lanes, read again every two
|
||||
// seconds and written into the pill in place), else its limit; a row with
|
||||
// none says so on hover only. A click opens the app's own menu (no native
|
||||
// none says so under the account's ⋯ only. A click opens the app's own menu (no native
|
||||
// select): the provider's, no limit, a number, or Other… typed in place,
|
||||
// each posted to provider/accountconcurrency. The editor has the queue's
|
||||
// length and wait under Concurrency, saved with it and refused when not a
|
||||
@@ -103,7 +103,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
await page.route("**/*", serve(lang, posts, lanes));
|
||||
await page.goto("http://magpie.test/?view=providers");
|
||||
await page.locator(".row.provider", { hasText: name }).first().click();
|
||||
await page.locator(".editor .accts .acc .alane").first().waitFor();
|
||||
await page.locator(".editor .accts .acc .alane").first().waitFor({ state: "attached" });
|
||||
await page.waitForTimeout(300);
|
||||
return { page, errors, posts };
|
||||
};
|
||||
@@ -128,6 +128,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
return posts.at(-1);
|
||||
};
|
||||
const opacity = (l) => l.evaluate((e) => getComputedStyle(e).opacity);
|
||||
// an account's unset settings wait under its ⋯
|
||||
const more = async (page, id) => { await row(page, id).hover(); await row(page, id).locator(".acc-more").click(); };
|
||||
|
||||
test(`${engine} ${lang}: a key's limit on requests at once shows what runs and waits, and is set from the app's menu`, async (t) => {
|
||||
const lanes = { now: { "relay#k1": { busy: 1, waiting: 2, limit: 1 } }, reads: 0 };
|
||||
@@ -189,7 +191,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test(`${engine} ${lang}: an account's own limit is shown, and one with none only on hover`, async (t) => {
|
||||
test(`${engine} ${lang}: an account's own limit is shown, and one with none only under ⋯`, async (t) => {
|
||||
const lanes = { now: {}, reads: 0 };
|
||||
const { page, errors, posts } = await open(t, "Codex", lanes);
|
||||
assert.equal(await pill(page, "Spare@Example.com").textContent(), w.four);
|
||||
@@ -197,10 +199,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
await page.mouse.move(0, 0);
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(await opacity(pill(page, "Spare@Example.com")), "1");
|
||||
assert.equal(await opacity(pill(page, "me@example.com")), "0", "none set: on hover only");
|
||||
await row(page, "me@example.com").hover();
|
||||
assert.equal(await pill(page, "me@example.com").isVisible(), false, "none set: under ⋯ only");
|
||||
await more(page, "me@example.com");
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(await opacity(pill(page, "me@example.com")), "1");
|
||||
assert.equal(await pill(page, "me@example.com").isVisible(), true);
|
||||
await still(page, "me@example.com", pill(page, "me@example.com"));
|
||||
const n = posts.length;
|
||||
await item(page, "2").click();
|
||||
@@ -219,7 +222,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.equal(await me.textContent(), w.running);
|
||||
await page.mouse.move(0, 0);
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(await opacity(me), "1", "running: shown without a hover");
|
||||
assert.equal(await me.isVisible(), true, "running: shown on its line, ⋯ closed");
|
||||
assert.equal(await me.evaluate((e) => e.parentElement.classList.contains("acc-line")), true);
|
||||
// the rest of the row's pill look, no colour of a full lane
|
||||
assert.equal(await me.evaluate((e) => e.classList.contains("busy-lane") || e.classList.contains("queued")), false);
|
||||
const el = await me.elementHandle();
|
||||
@@ -228,7 +232,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
assert.equal(await me.textContent(), w.none);
|
||||
assert.equal(await el.evaluate((e) => e.isConnected), true, "the same pill, rewritten in place");
|
||||
await page.waitForTimeout(250);
|
||||
assert.equal(await opacity(me), "0", "idle with no limit: on hover only again");
|
||||
assert.equal(await me.isVisible(), false, "idle with no limit: under ⋯ again");
|
||||
assert.equal(await pill(page, "Spare@Example.com").textContent(), w.four);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
@@ -60,6 +60,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
return { page, errors };
|
||||
};
|
||||
|
||||
// an account's Remove waits under its ⋯
|
||||
const more = async (row) => { await row.hover(); if (await row.locator(".acc-more").count()) await row.locator(".acc-more").click(); };
|
||||
|
||||
test(`${engine} ${lang}: kiro-cli's own sign-in behind another can be removed, hidden`, async (t) => {
|
||||
const posts = [];
|
||||
const { page, errors } = await open(t, [
|
||||
@@ -67,6 +70,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
{ user: "Kiro account", plan: "KIRO FREE", on: true, own: true },
|
||||
], posts);
|
||||
const mine = page.locator(".accts .acc", { hasText: "me@example.com" });
|
||||
await more(mine);
|
||||
await more(page.locator(`.accts .acc[data-account-id="Kiro account"]`));
|
||||
assert.equal(await mine.getByRole("button", { name: remove[lang], exact: true }).count(), 0, "the first of magpie's has no Remove");
|
||||
const own = page.locator(".accts .acc", { hasText: "Kiro account" }).getByRole("button", { name: remove[lang], exact: true });
|
||||
assert.equal(await own.getAttribute("title"), title[lang]);
|
||||
@@ -81,6 +86,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
test(`${engine} ${lang}: kiro-cli's own sign-in in use first can be removed too`, async (t) => {
|
||||
const posts = [];
|
||||
const { page, errors } = await open(t, [{ user: "Kiro account", plan: "KIRO FREE", active: true, on: true, own: true }], posts);
|
||||
await more(page.locator(`.accts .acc[data-account-id="Kiro account"]`));
|
||||
const own = page.locator(".accts .acc", { hasText: "Kiro account" }).getByRole("button", { name: remove[lang], exact: true });
|
||||
assert.equal(await own.getAttribute("title"), title[lang]);
|
||||
await own.click();
|
||||
|
||||
Reference in New Issue
Block a user