settings: a saved proxy's Test says its latency and exit region, from Settings and the provider editor (IcyLiqu1d on X)
IcyLiqu1d asked for sub2api-style proxy management: test each saved proxy's region and latency, then pick a provider's proxy from the list. - A saved proxy's row in Settings, once tested, reads "Reachable, 42 ms · Japan": the exit's country from Cloudflare's trace page (the endpoint the quick check already uses), named in the reader's language by Intl.DisplayNames; the exit IP is in the tooltip. A failure says why. - The latency is the round trip through the proxy, from the request written to the answer's first byte (httptrace). The whole request's time counted a new connection's dial, tunnel and TLS on a first Test and not on a second, which reuses the pooled connection. - The provider editor's Saved mode has a Test beside the proxy picked; its answer is said where the picker's hint is, red on failure, until another proxy or mode is chosen. - An editor opened before Settings was read drew its picker with no saved proxies (Saved mode missing, or "A proxy that is gone" for one chosen). It now reads the settings and draws the picker again. - Nothing is tested until Test is clicked; nothing runs in the background. Run (at this head's tree, rebased onc687dbdc6): - mote: go test ./internal/gui -count=1 -timeout 45m: ok (182.9s); -run 'TestSavedProxy|TestProxyCheck' -race ok. - mote: GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... ok; gofmt -l clean; TestCoreScriptBudget room 21 bytes, no raise. - mica: provider-proxy-pick-test (new, 20 cases: chromium and webkit, en zh zh-TW ja de, 900 and 420px) 20/20; saved-proxies, saved-ssh-proxy, provider-proxy, i18n-keys, old-webkit pass. - mica: whole GUI suite, still running at push: 3736 tests in, 127 red, none in a proxy or provider file. The reds are files red on origin/main: agent-details-ready and data-folder were run alone atc687dbdc6, 14 pass 42 fail (#6369, #6373, #6876); account-refresh-holds, account-arrange (#6003, #5814), api-key-theme (#6444) and the rest are the files another session is rerunning on mote as main's reds. - Broken by hand: the round-trip branch off, TestSavedProxyLatencyIs TheRoundTrip went red ("took 1601 ms", the fake's 1.5s dial counted). Tests reach no network: a local fake proxy answers the trace page, the trace URL is .invalid, and the dial delay is injected. Not tried: a real proxy's exit (the region comes from Cloudflare's loc=). Not changed: the global proxy check in Settings still shows the raw country code (ip (JP)).
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3769,6 +3769,9 @@ body:not(.side-nav) #addSheet > .row-head.stuck::before { opacity: 1; box-shadow
|
||||
.editor .proxy-row input.proxy-url.off { display: none; }
|
||||
.editor .proxy-row .gone { display: none; }
|
||||
.editor .proxy-row .proxy-saved { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
|
||||
.editor .proxy-row .proxy-test { flex: none; }
|
||||
.editor .proxy-row .proxy-saved[hidden] + .proxy-test { display: none; }
|
||||
.editor .proxy-pick .hint.err { color: var(--red); }
|
||||
.saved-proxy .sub { overflow-wrap: anywhere; }
|
||||
.proxy-form { flex-wrap: wrap; }
|
||||
.proxy-form .proxy-controls { justify-content: flex-end; flex: 1 1 100%; }
|
||||
|
||||
@@ -7862,6 +7862,8 @@ function proxyPicker() {
|
||||
const row = el("div", "proxy-row");
|
||||
row.append(seg, addr, saved);
|
||||
box.append(row, login, hint);
|
||||
// its Test is in proxies.js (IcyLiqu1d on X)
|
||||
(!prefs || savedProxyList().length) && import("./proxies.js").then(() => proxyPickTest(box, saved, hint), () => {});
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,14 +16,59 @@ function proxyWhy(o) {
|
||||
}
|
||||
// a check's failure, said as magpie explained it when it could
|
||||
const proxyFailed = (out) => (out.why ? proxyWhy(out) : out.error || "");
|
||||
function testSavedProxy(id) {
|
||||
// the country or region a check left from, by the trace page's ISO code,
|
||||
// named in the reader's language (IcyLiqu1d on X); a code Intl doesn't
|
||||
// know (Cloudflare's XX, T1) as it came
|
||||
function proxyRegion(loc) {
|
||||
try { return new Intl.DisplayNames([intlLang()], { type: "region" }).of(loc) || loc; } catch { return loc || ""; }
|
||||
}
|
||||
// a check as one line: the latency and where it left from, or why it failed
|
||||
function proxyCheckLine(out) {
|
||||
if (!out.ok) return t("Unreachable: {error}", { error: proxyFailed(out) });
|
||||
return [t("Reachable, {ms} ms", { ms: out.ms }), out.loc && proxyRegion(out.loc)].filter(Boolean).join(" · ");
|
||||
}
|
||||
// testSavedProxy asks the server to test one saved proxy, only when a
|
||||
// Test (or a Save) is clicked; then draws with what it found
|
||||
function testSavedProxy(id, draw = renderSettings) {
|
||||
proxyChecks[id] = { busy: true };
|
||||
renderSettings();
|
||||
api("proxies/test", { id })
|
||||
draw();
|
||||
return api("proxies/test", { id })
|
||||
.then((o) => { proxyChecks[id] = { out: o }; })
|
||||
.catch((e) => { proxyChecks[id] = { out: { ok: false, error: t(e.message) } }; })
|
||||
.finally(renderSettings);
|
||||
.finally(draw);
|
||||
}
|
||||
// proxyPickTest: the provider editor's Test beside its saved proxy. What
|
||||
// it found is said where the picker's hint is, until another mode or
|
||||
// proxy is chosen. An editor opened before Settings was read draws its
|
||||
// picker again once the saved proxies are in, their names and Saved mode
|
||||
// with them.
|
||||
window.proxyPickTest = function (box, saved, hint) {
|
||||
if (!prefs) return void loadSettings().then(() => box.isConnected && savedProxyList().length && box.replaceWith(proxyPicker()), () => {});
|
||||
if (!savedProxyList().length || saved.nextElementSibling?.classList.contains("proxy-test")) return;
|
||||
const test = el("button", "text proxy-test", t("Test"));
|
||||
test.type = "button";
|
||||
let ref = "";
|
||||
const draw = () => {
|
||||
const chk = proxyChecks[ref.slice(1)];
|
||||
test.disabled = !!chk?.busy;
|
||||
test.textContent = chk?.busy ? t("Testing…") : t("Test");
|
||||
if (!chk?.out || draft?.proxyMode !== "saved" || draft.proxyRef !== ref) return;
|
||||
hint.textContent = hint.title = proxyCheckLine(chk.out);
|
||||
hint.classList.toggle("err", !chk.out.ok);
|
||||
};
|
||||
test.onclick = () => {
|
||||
ref = draft?.proxyRef || "";
|
||||
if (ref) testSavedProxy(ref.slice(1), draw);
|
||||
};
|
||||
// another proxy chosen (the button's name) or another mode (its
|
||||
// hidden) puts the hint back
|
||||
new MutationObserver(() => {
|
||||
hint.textContent = t(PROXY_HINT[draft?.proxyMode || ""]);
|
||||
hint.title = "";
|
||||
hint.classList.remove("err");
|
||||
}).observe(saved, { childList: true, characterData: true, subtree: true, attributeFilter: ["hidden"] });
|
||||
saved.after(test);
|
||||
};
|
||||
window.renderSavedProxies = function (s) {
|
||||
const box = $("#proxiesList");
|
||||
box.replaceChildren();
|
||||
@@ -46,9 +91,11 @@ window.renderSavedProxies = function (s) {
|
||||
const addr = ssh ? bareSSH(p.url) : p.url;
|
||||
const line = [ssh ? "SSH " + (p.user ? p.user + "@" : "") + addr : p.user ? p.user + "@" + p.url : p.url];
|
||||
if (chk?.busy) line.push(t("Testing…"));
|
||||
else if (out) line.push(out.ok ? t("Reachable, {ms} ms", { ms: out.ms }) : t("Unreachable: {error}", { error: proxyFailed(out) }));
|
||||
else if (out) line.push(proxyCheckLine(out));
|
||||
if (p.uses?.length) line.push(t("Used by {n}", { n: p.uses.length }));
|
||||
sub.textContent = sub.title = line.join(" · ");
|
||||
sub.textContent = line.join(" · ");
|
||||
// the exit's own address, for whoever checks it against the proxy's
|
||||
sub.title = [sub.textContent, !chk?.busy && out?.ok && out.ip].filter(Boolean).join(" · ");
|
||||
sub.classList.toggle("err", !!out && !out.ok && !chk?.busy);
|
||||
const val = el("div", "val");
|
||||
const test = el("button", "text", chk?.busy ? t("Testing…") : t("Test"));
|
||||
|
||||
@@ -6,8 +6,10 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptrace"
|
||||
"strings"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/yetone/magpie/internal/netproxy"
|
||||
@@ -357,9 +359,24 @@ func sshTested(p settings.NamedProxy, out proxyTestJSON) proxyTestJSON {
|
||||
return out
|
||||
}
|
||||
|
||||
// testProxy asks the trace page through addr. Its Ms is the latency
|
||||
// through the proxy: from the request written to the answer's first
|
||||
// byte, one round trip to the trace page and back through the proxy.
|
||||
// The whole request's time would count a new connection's dial, tunnel
|
||||
// and TLS on a first Test and not on the next one, which reuses it.
|
||||
func testProxy(ctx context.Context, addr string) proxyTestJSON {
|
||||
// the transport calls these from its own goroutines
|
||||
start := time.Now()
|
||||
var wrote, first atomic.Int64
|
||||
ctx = httptrace.WithClientTrace(ctx, &httptrace.ClientTrace{
|
||||
WroteRequest: func(httptrace.WroteRequestInfo) { wrote.Store(int64(time.Since(start))) },
|
||||
GotFirstResponseByte: func() { first.Store(int64(time.Since(start))) },
|
||||
})
|
||||
leg := throughLeg(netproxy.With(ctx, addr), proxyTestClient)
|
||||
out := proxyTestJSON{Ms: leg.Ms, IP: leg.IP, Loc: leg.Loc, At: time.Now().Unix()}
|
||||
if w, f := wrote.Load(), first.Load(); w > 0 && f > w {
|
||||
out.Ms = max(time.Duration(f-w).Milliseconds(), 1)
|
||||
}
|
||||
switch {
|
||||
case leg.Error != "":
|
||||
out.Error = redactProxyErr(leg.Error)
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/yetone/magpie/internal/netproxy"
|
||||
"github.com/yetone/magpie/internal/netproxy/sshtest"
|
||||
@@ -141,6 +145,50 @@ func TestSavedProxyTest(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// A proxy's latency is the round trip through it to the trace page, the
|
||||
// same on a first Test, which dials, as on the next, which doesn't: a
|
||||
// slow dial is left out, a slow answer is in. The exit's country comes
|
||||
// with it.
|
||||
func TestSavedProxyLatencyIsTheRoundTrip(t *testing.T) {
|
||||
call, _ := proxiesRig(t)
|
||||
const answer, dialing = 100 * time.Millisecond, 1500 * time.Millisecond
|
||||
proxy := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
time.Sleep(answer)
|
||||
fmt.Fprint(rw, "fl=1\nip=203.0.113.9\nloc=JP\n")
|
||||
}))
|
||||
t.Cleanup(proxy.Close)
|
||||
old := proxyTraceURL
|
||||
proxyTraceURL = "http://trace.example.invalid/cdn-cgi/trace"
|
||||
t.Cleanup(func() { proxyTraceURL = old })
|
||||
base := &http.Transport{Proxy: netproxy.Func}
|
||||
dial := (&net.Dialer{}).DialContext
|
||||
var dials atomic.Int32
|
||||
base.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||
dials.Add(1)
|
||||
time.Sleep(dialing)
|
||||
return dial(ctx, network, addr)
|
||||
}
|
||||
t.Cleanup(base.CloseIdleConnections)
|
||||
oldClient := proxyTestClient
|
||||
proxyTestClient = &http.Client{Transport: netproxy.Dispatch(base)}
|
||||
t.Cleanup(func() { proxyTestClient = oldClient })
|
||||
call("/api/proxies/save", `{"name":"Tokyo","url":"`+proxy.URL+`"}`)
|
||||
id := settings.Load().Proxies[0].ID
|
||||
for i := range 2 {
|
||||
_, body := call("/api/proxies/test", `{"id":"`+id+`"}`)
|
||||
var out proxyTestJSON
|
||||
if err := json.Unmarshal([]byte(body), &out); err != nil || !out.OK || out.Loc != "JP" || out.IP != "203.0.113.9" {
|
||||
t.Fatalf("test %d: %s", i, body)
|
||||
}
|
||||
if out.Ms < answer.Milliseconds() || out.Ms >= dialing.Milliseconds() {
|
||||
t.Fatalf("test %d took %d ms; want the answer's %v and not the dial's %v", i, out.Ms, answer, dialing)
|
||||
}
|
||||
}
|
||||
if dials.Load() == 0 {
|
||||
t.Fatal("the proxy was never dialled, so its dial wasn't left out")
|
||||
}
|
||||
}
|
||||
|
||||
// An SSH server is saved from its host, user and password: the save logs
|
||||
// in first, so a refused login is said there and nothing is kept, and a
|
||||
// kept one shows the host key it trusts. Its test goes through the
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// A provider's saved proxy is tested from its editor (IcyLiqu1d on X): a
|
||||
// Test beside the saved proxy picked, shown only in Saved mode, asks
|
||||
// /api/proxies/test for that proxy and nothing before it is clicked. The
|
||||
// answer, its latency and the exit's region in the reader's language, or
|
||||
// why it failed, is said where the picker's hint is, until another proxy
|
||||
// or mode is chosen. In every language, both engines, wide and narrow.
|
||||
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(__dirname, "../assets");
|
||||
const relay = {
|
||||
id: "relay", name: "Relay", icon: "generic", chat: "https://relay.example.com/v1", responses: "", anthropic: "", catalog: "",
|
||||
models: [{ id: "model-a", name: "Model A", on: true }], agents: [], fallback: [], headers: {},
|
||||
key: { set: true, masked: "sk-…one" }, keyList: [], balanceToken: { takes: false, set: false }, proxy: "@px1",
|
||||
};
|
||||
const proxies = [
|
||||
{ id: "px1", name: "Tokyo", url: "http://10.0.0.1:8080", uses: [{ provider: "relay" }] },
|
||||
{ id: "px2", name: "Down", url: "socks5://10.0.0.9:1080" },
|
||||
];
|
||||
|
||||
function serve(lang, posts) {
|
||||
const providers = { providers: [relay], presets: [], excluded: [], gateway: { running: true, window: true } };
|
||||
const settings = { theme: "light", lang, proxy: "", proxySource: "off", proxies, version: "test", dir: "/test", lanURLs: [] };
|
||||
return async (route) => {
|
||||
const req = route.request(), url = new URL(req.url());
|
||||
const json = (data) => route.fulfill({ json: data });
|
||||
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
|
||||
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 });
|
||||
if (url.pathname === "/api/settings") return json(settings);
|
||||
if (url.pathname === "/api/providers") return json(providers);
|
||||
if (url.pathname === "/api/groups") return json({ groups: [] });
|
||||
if (url.pathname === "/api/proxies/test") {
|
||||
const { id } = req.postDataJSON();
|
||||
posts.push({ test: id });
|
||||
return json(id === "px1" ? { ok: true, ms: 42, ip: "203.0.113.9", loc: "JP", at: 1 } : { ok: false, error: "connect: connection refused", at: 1 });
|
||||
}
|
||||
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)];
|
||||
await route.fulfill({ body: await fs.readFile(file), contentType });
|
||||
};
|
||||
}
|
||||
|
||||
// the region the trace page's JP names, as the reader's language says it
|
||||
const japan = { en: "Japan", zh: "日本", "zh-TW": "日本", ja: "日本", de: "Japan" };
|
||||
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
for (const lang of Object.keys(japan)) {
|
||||
for (const width of [900, 420]) {
|
||||
test(`${engine} ${lang} ${width}px: a provider's saved proxy is tested from its editor`, async (t) => {
|
||||
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
|
||||
t.after(() => browser.close());
|
||||
const page = await (await browser.newContext({ viewport: { width, height: 800 }, reducedMotion: "reduce" })).newPage();
|
||||
page.setDefaultTimeout(5000);
|
||||
page.setDefaultNavigationTimeout(60000);
|
||||
const errors = [], posts = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.route("**/*", serve(lang, posts));
|
||||
await page.goto("http://magpie.test/?view=providers");
|
||||
await page.locator(".row.provider", { hasText: "Relay" }).click();
|
||||
const adv = page.locator(".editor details.advanced");
|
||||
await adv.waitFor({ state: "attached" });
|
||||
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
|
||||
const row = page.locator(".editor .proxy-row");
|
||||
const test = row.locator("button.proxy-test");
|
||||
const hint = page.locator(".editor .proxy-pick .hint");
|
||||
const tr = (k, v) => page.evaluate(([k, v]) => t(k, v), [k, v]);
|
||||
await test.waitFor();
|
||||
await row.locator("button.proxy-saved").getByText("Tokyo", { exact: true }).waitFor();
|
||||
assert.equal(await test.textContent(), await tr("Test"));
|
||||
assert.deepEqual(posts, [], "nothing is tested before Test is clicked");
|
||||
const savedHint = await tr("Requests to it go through this saved proxy, kept in Settings");
|
||||
assert.equal(await hint.textContent(), savedHint);
|
||||
|
||||
const grey = await hint.evaluate((e) => getComputedStyle(e).color);
|
||||
// the latency and the exit's region, in the reader's language
|
||||
await test.click();
|
||||
const ok = (await tr("Reachable, {ms} ms", { ms: 42 })) + " · " + japan[lang];
|
||||
await page.waitForFunction(([s]) => document.querySelector(".editor .proxy-pick .hint")?.textContent === s, [ok]);
|
||||
assert.deepEqual(posts, [{ test: "px1" }]);
|
||||
assert.equal(await hint.evaluate((e) => e.classList.contains("err")), false);
|
||||
assert.equal(await test.isDisabled(), false);
|
||||
|
||||
// another proxy chosen puts the hint back; its failure says why, in red
|
||||
await row.locator("button.proxy-saved").click();
|
||||
await page.locator(".proto-menu .pm-item", { hasText: "Down" }).click();
|
||||
await page.waitForFunction(([s]) => document.querySelector(".editor .proxy-pick .hint")?.textContent === s, [savedHint]);
|
||||
await test.click();
|
||||
const bad = await tr("Unreachable: {error}", { error: "connect: connection refused" });
|
||||
await page.waitForFunction(([s]) => document.querySelector(".editor .proxy-pick .hint")?.textContent === s, [bad]);
|
||||
assert.deepEqual(posts.at(-1), { test: "px2" });
|
||||
assert.equal(await hint.evaluate((e) => e.classList.contains("err")), true);
|
||||
assert.notEqual(await hint.evaluate((e) => getComputedStyle(e).color), grey, "a failure isn't the hint's grey");
|
||||
|
||||
// another mode: the Test goes, the hint is that mode's
|
||||
await page.locator(".editor .proxy-mode .opt").first().click();
|
||||
await page.waitForFunction(() => !document.querySelector(".editor .proxy-pick .hint")?.classList.contains("err"));
|
||||
assert.equal(await test.isVisible(), false, "Test is for a saved proxy only");
|
||||
assert.equal(await hint.textContent(), await tr("Follows the proxy in Settings"));
|
||||
|
||||
const over = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
|
||||
assert(over <= 0, `the page scrolls sideways by ${over}px`);
|
||||
assert.equal(posts.length, 2, "one request a click");
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// Named proxies (@tsingchao on X): Settings > Network keeps a list of them,
|
||||
// each with a Test, and the global proxy picks one as "@id" in a Saved mode.
|
||||
// each with a Test that says its latency and the exit's region (IcyLiqu1d
|
||||
// on X), and the global proxy picks one as "@id" in a Saved mode.
|
||||
// A saved proxy in use can't be deleted; a password is typed, never shown.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
@@ -31,7 +32,7 @@ function server(lang, posts) {
|
||||
if (req.method() === "POST") { const body = req.postDataJSON(); posts.push(body); cur = { ...cur, ...body, proxies: cur.proxies }; }
|
||||
return json(cur);
|
||||
}
|
||||
if (url.pathname === "/api/proxies/test") { posts.push({ test: req.postDataJSON().id }); return json({ ok: true, ms: 42, at: 1 }); }
|
||||
if (url.pathname === "/api/proxies/test") { posts.push({ test: req.postDataJSON().id }); return json({ ok: true, ms: 42, ip: "203.0.113.9", loc: "JP", at: 1 }); }
|
||||
if (url.pathname === "/api/proxies/save") {
|
||||
const b = req.postDataJSON();
|
||||
posts.push({ save: b });
|
||||
@@ -49,11 +50,11 @@ function server(lang, posts) {
|
||||
}
|
||||
|
||||
const labels = {
|
||||
en: { test: "Test", add: "Add proxy", name: "Name", save: "Save", del: "Delete", saved: "Saved", ok: "Reachable, 42 ms", pass: "Password (optional)" },
|
||||
zh: { test: "测试", add: "添加代理", name: "名称", save: "保存", del: "删除", saved: "已保存", ok: "可连接,42 毫秒", pass: "密码(可选)" },
|
||||
"zh-TW": { test: "測試", add: "新增代理", name: "名稱", save: "儲存", del: "刪除", saved: "已儲存", ok: "可連線,42 毫秒", pass: "密碼(選填)" },
|
||||
ja: { test: "テスト", add: "プロキシを追加", name: "名前", save: "保存", del: "削除", saved: "保存しました", ok: "接続できます、42 ms", pass: "パスワード(任意)" },
|
||||
de: { test: "Testen", add: "Proxy hinzufügen", name: "Name", save: "Speichern", del: "Löschen", saved: "Gespeichert", ok: "Erreichbar, 42 ms", pass: "Passwort (optional)" },
|
||||
en: { test: "Test", add: "Add proxy", name: "Name", save: "Save", del: "Delete", saved: "Saved", ok: "Reachable, 42 ms · Japan", pass: "Password (optional)" },
|
||||
zh: { test: "测试", add: "添加代理", name: "名称", save: "保存", del: "删除", saved: "已保存", ok: "可连接,42 毫秒 · 日本", pass: "密码(可选)" },
|
||||
"zh-TW": { test: "測試", add: "新增代理", name: "名稱", save: "儲存", del: "刪除", saved: "已儲存", ok: "可連線,42 毫秒 · 日本", pass: "密碼(選填)" },
|
||||
ja: { test: "テスト", add: "プロキシを追加", name: "名前", save: "保存", del: "削除", saved: "保存しました", ok: "接続できます、42 ms · 日本", pass: "パスワード(任意)" },
|
||||
de: { test: "Testen", add: "Proxy hinzufügen", name: "Name", save: "Speichern", del: "Löschen", saved: "Gespeichert", ok: "Erreichbar, 42 ms · Japan", pass: "Passwort (optional)" },
|
||||
};
|
||||
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
@@ -84,6 +85,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
|
||||
// Test shows the answer
|
||||
await rows.nth(1).getByRole("button", { name: l.test, exact: true }).click();
|
||||
await rows.nth(1).getByText(l.ok).waitFor();
|
||||
// the exit's address is there for whoever checks it, not in the line
|
||||
assert.match(await rows.nth(1).locator(".sub").getAttribute("title"), /203\.0\.113\.9$/);
|
||||
assert.equal(posts.filter((p) => p.test).length, 1, "a test only when Test is clicked");
|
||||
|
||||
// adding: a blank password isn't sent as one
|
||||
await list.getByRole("button", { name: l.add, exact: true }).click();
|
||||
|
||||
Reference in New Issue
Block a user