Repository navigation
Expand file tree
/
Copy pathtesting.html
More file actions
19 lines (19 loc) · 6.7 KB
/
Copy pathtesting.html
File metadata and controls
19 lines (19 loc) · 6.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Shifter Proxy Extension — Browser Tests</title><meta name="description" content="Shifter browser proxy extension for Residential and ISP proxies. Chrome and Firefox setup, location targeting, sticky sessions, privacy, and development."><style>*{box-sizing:border-box}html{scroll-behavior:smooth;color-scheme:light}body{margin:0;background:#ffffff;color:#1f2328;font:16px/1.65 system-ui,-apple-system,sans-serif}header,main,footer{max-width:1040px;margin:auto;padding:26px 40px}header{color:#59636e;font-size:12px;letter-spacing:1.5px;font-weight:600;border-bottom:1px solid #d1d9e0}main{padding-top:20px}h1,h2,h3{color:#1f2328;line-height:1.3}h1{font-size:34px;letter-spacing:-.9px;margin:28px 0 16px}h2{margin-top:42px;padding-bottom:10px;border-bottom:1px solid #d1d9e0;font-size:24px}h3{margin-top:28px;font-size:19px}p{margin:16px 0}p[align=center]{text-align:center}p[align=center] img{display:block;width:100%;max-width:960px;height:auto;margin:0 auto}h1[align=center]{text-align:center}a{color:#0969da;text-underline-offset:3px;text-decoration:none}a:hover{text-decoration:underline}code{font:13px/1.7 ui-monospace,SFMono-Regular,Consolas,monospace;overflow-wrap:anywhere;background:#eff1f3;border-radius:4px;padding:2px 5px}pre{padding:20px;overflow:auto;background:#f6f8fa;border:1px solid #d1d9e0;border-radius:8px}pre code{white-space:pre;overflow-wrap:normal;padding:0;background:none}.table{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:14px}th,td{padding:12px 14px;border:1px solid #d1d9e0;text-align:left;vertical-align:top}th{background:#f6f8fa;color:#1f2328}tr:nth-child(even){background:#f6f8fa}li{margin:6px 0}footer{border-top:1px solid #d1d9e0;color:#59636e;font-size:13px}h2,h3{scroll-margin-top:18px}@media(max-width:650px){header,main,footer{padding:18px}h1{font-size:27px}table{min-width:540px}}@media print{html{color-scheme:light}body{background:white;color:#172235}header,main,footer{max-width:none;padding:12px}h1,h2,h3,th{color:#172235}h2,h3{break-after:avoid}pre,th,tr:nth-child(even){background:#f1f4f8}a{color:#1756a5}}</style></head><body><main><h1 id="end-to-end-tests">End-to-end tests</h1>
<p>Runs the real extension (popup, background worker, proxy, login answering, WebRTC policy) in <strong>Chrome for Testing</strong> (same engine as Chrome, Edge and Brave) and <strong>Firefox</strong>, against a stand-in Shifter:</p>
<ul><li><code>fake-shifter.mjs</code>: the <code>/api/v1</code> endpoints on <code>127.0.0.1:18080</code>, and a login-protected HTTP proxy gateway on <code>:18081–18083</code> (like 443 / 80 / 8080; see <a href="#running-scripts-side-by-side">Running scripts side by side</a> for other ports) that logs the username of every request. <code>fra/ams/lon.localhost</code> stand in for the regional entry points.</li><li><code>suite.mjs</code>: the checks (sign-in, plan, traffic, connect, username format, WebRTC, strict, bypass list, New IP ×8 on an open site, cookies kept, latency, 15 s IP re-check, disconnect).</li><li><code>drivers.mjs</code>: how each browser is launched and the popup found.</li><li><code>run.mjs</code>: builds <code>build-test/</code> (stand-in API) and <code>build-test-live/</code> (real API, one bad-key check), then runs everything.</li><li><code>build.mjs</code>: <code>buildExtension({ browser, env, outDir })</code>, the one way the scripts build the extension (holding the build lock below); returns the build folder.</li></ul>
<pre><code>cd e2e
npm install # also downloads Chrome for Testing + Firefox (~400 MB, once)
npm run setup # only if your npm skipped install scripts
npm test # chrome + firefox, ~2 min
npm test -- firefox # one browser
npm test -- --offline # skip the real shifter.io check
npm test -- --live-only # only the real shifter.io check (no stand-in server)</code></pre>
<p>Exit code 1 when any check fails. Test builds contain a hook (open the popup in a tab on install) and a stand-in API address; <code>build/</code> never does.</p>
<h2 id="workspace-regression">Workspace regression</h2>
<p>Run <code>node e2e/workspaces.mjs</code> from the repository root, optionally followed by <code>chrome</code> or <code>firefox</code>. The test uses local API and TLS gateway fixtures with synthetic credentials. It verifies workspace ordering and empty states, all member roles, team traffic and connection credentials, the ISP picker, team-only accounts, revoked access, and compatibility with responses that lack workspace metadata. Requests must opt in with exactly <code>workspaces=all</code>; usage remains unfiltered. Test builds and certificates live in a unique temporary directory and are removed in a finally block; isolated browser profiles are closed after each browser.</p>
<h2 id="running-scripts-side-by-side">Running scripts side by side</h2>
<p>Every script (<code>npm test</code>, <code>toolbar.mjs</code>, <code>usage.mjs</code>, <code>workspaces.mjs</code>, <code>cookies.mjs</code>) can run at the same time as the others in one checkout:</p>
<ul><li><strong>Ports.</strong> <code>E2E_PORT_BASE</code> sets the stand-in API port, and the gateway uses the next three (<code>base+1</code> to <code>base+3</code>). Unset, it is 18080, so the ports are the ones above. Give each script running at the same time its own base, at least 4 apart. A value that is not an integer port from 1 to 65532 stops the script with an error. The TLS fixtures in <code>cookies.mjs</code> and <code>workspaces.mjs</code> take a free port of their own.</li><li><strong>Build lock.</strong> WXT rewrites <code>.wxt/tsconfig.json</code> on every build whose output folder differs, so two builds (or a build and <code>tsc</code>) at the same moment can read a half-written file. <code>build.mjs</code> therefore builds holding a lock, <code>node_modules/.cache/wxt-build.lock</code> (a folder holding the owner's pid), made by <code>scripts/wxt-lock.mjs</code>. Builds take turns (2 to 4 s each); the browser tests themselves still run in parallel. A lock left by a process that is no longer running is taken over. After 5 minutes of waiting the script fails; it never builds unlocked. If that happens with no build running, remove the folder.</li><li><strong>Other commands.</strong> <code>node scripts/wxt-lock.mjs <command> [args...]</code> runs any command (for example <code>npm run compile</code>) holding the same lock and exits with its exit code (128 + the signal number if it was killed). Its tests: <code>node --test scripts/wxt-lock.test.mjs</code>.</li></ul>
<pre><code>E2E_PORT_BASE=18100 node e2e/usage.mjs chrome &
E2E_PORT_BASE=18110 node e2e/workspaces.mjs chrome &
wait</code></pre></main></body></html>