testsurfer 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -149
- package/dist/browser.d.ts +135 -1
- package/dist/browser.js +378 -2
- package/dist/browser.js.map +1 -1
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +140 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +12 -2
- package/dist/client.js +73 -4
- package/dist/client.js.map +1 -1
- package/dist/diff.d.ts +19 -0
- package/dist/diff.js +116 -0
- package/dist/diff.js.map +1 -0
- package/dist/events.d.ts +386 -0
- package/dist/events.js +1035 -0
- package/dist/events.js.map +1 -0
- package/dist/expect.d.ts +135 -26
- package/dist/expect.js +634 -130
- package/dist/expect.js.map +1 -1
- package/dist/frame.d.ts +88 -0
- package/dist/frame.js +194 -0
- package/dist/frame.js.map +1 -0
- package/dist/global.d.ts +12 -0
- package/dist/global.js +136 -0
- package/dist/global.js.map +1 -0
- package/dist/hooks.d.ts +28 -0
- package/dist/hooks.js +48 -0
- package/dist/hooks.js.map +1 -0
- package/dist/index.d.ts +22 -3
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/injected.d.ts +15 -0
- package/dist/injected.js +2025 -0
- package/dist/injected.js.map +1 -0
- package/dist/locator.d.ts +374 -86
- package/dist/locator.js +845 -244
- package/dist/locator.js.map +1 -1
- package/dist/media.d.ts +15 -0
- package/dist/media.js +83 -0
- package/dist/media.js.map +1 -0
- package/dist/net.d.ts +110 -0
- package/dist/net.js +498 -0
- package/dist/net.js.map +1 -0
- package/dist/page.d.ts +448 -5
- package/dist/page.js +1187 -31
- package/dist/page.js.map +1 -1
- package/dist/png.d.ts +28 -0
- package/dist/png.js +197 -0
- package/dist/png.js.map +1 -0
- package/dist/pwconfig.d.ts +66 -0
- package/dist/pwconfig.js +77 -0
- package/dist/pwconfig.js.map +1 -0
- package/dist/register.d.ts +6 -0
- package/dist/register.js +9 -0
- package/dist/register.js.map +1 -0
- package/dist/request.d.ts +29 -0
- package/dist/request.js +75 -0
- package/dist/request.js.map +1 -0
- package/dist/runner.d.ts +99 -15
- package/dist/runner.js +354 -58
- package/dist/runner.js.map +1 -1
- package/dist/screenshot.d.ts +35 -0
- package/dist/screenshot.js +171 -0
- package/dist/screenshot.js.map +1 -0
- package/dist/selector.d.ts +55 -0
- package/dist/selector.js +208 -0
- package/dist/selector.js.map +1 -0
- package/dist/selectors.d.ts +13 -0
- package/dist/selectors.js +16 -0
- package/dist/selectors.js.map +1 -0
- package/dist/serialize.d.ts +17 -0
- package/dist/serialize.js +149 -0
- package/dist/serialize.js.map +1 -0
- package/dist/shim.d.ts +15 -0
- package/dist/shim.js +211 -0
- package/dist/shim.js.map +1 -0
- package/dist/testinfo.d.ts +62 -0
- package/dist/testinfo.js +23 -0
- package/dist/testinfo.js.map +1 -0
- package/dist/values.d.ts +67 -0
- package/dist/values.js +293 -0
- package/dist/values.js.map +1 -0
- package/package.json +10 -3
- package/skills/testsurfer/SKILL.md +55 -0
package/dist/browser.js
CHANGED
|
@@ -29,6 +29,8 @@ async function negotiate(client) {
|
|
|
29
29
|
}
|
|
30
30
|
return caps;
|
|
31
31
|
}
|
|
32
|
+
import { Dialog } from "./events.js";
|
|
33
|
+
import { NetHub } from "./net.js";
|
|
32
34
|
import { Page, DEFAULT_TIMEOUTS, } from "./page.js";
|
|
33
35
|
export class Browser {
|
|
34
36
|
client;
|
|
@@ -38,6 +40,9 @@ export class Browser {
|
|
|
38
40
|
clickVia;
|
|
39
41
|
protocol;
|
|
40
42
|
baseURL;
|
|
43
|
+
testIdAttribute = null;
|
|
44
|
+
viewport = { width: 1280, height: 720 };
|
|
45
|
+
deviceScaleFactor = 1;
|
|
41
46
|
constructor(client, sessionId, timeouts, inputMode, clickVia, protocol, baseURL) {
|
|
42
47
|
this.baseURL = baseURL;
|
|
43
48
|
this.client = client;
|
|
@@ -66,19 +71,390 @@ export class Browser {
|
|
|
66
71
|
client.close();
|
|
67
72
|
throw new Error('vs_session_open returned no session id');
|
|
68
73
|
}
|
|
69
|
-
|
|
74
|
+
const browser = new Browser(client, sessionId, { ...DEFAULT_TIMEOUTS, ...options.timeouts }, options.inputMode ?? 'robotic', options.clickVia ?? (caps.flags.has('clickVia') ? 'act' : 'click-at'), {
|
|
70
75
|
actDeltas: options.protocol?.actDeltas ?? caps.flags.has('actDeltas'),
|
|
71
76
|
navInPlace: options.protocol?.navInPlace ?? caps.proto >= 1,
|
|
72
77
|
}, options.baseURL);
|
|
78
|
+
if (options.testIdAttribute)
|
|
79
|
+
browser.testIdAttribute = options.testIdAttribute;
|
|
80
|
+
if (options.viewport !== undefined)
|
|
81
|
+
browser.viewport = options.viewport;
|
|
82
|
+
if (options.deviceScaleFactor !== undefined)
|
|
83
|
+
browser.deviceScaleFactor = options.deviceScaleFactor;
|
|
84
|
+
return browser;
|
|
85
|
+
}
|
|
86
|
+
defaultCtx = null;
|
|
87
|
+
openContexts = new Set();
|
|
88
|
+
/** The context that browser.newPage() opens pages in. */
|
|
89
|
+
get defaultContext() {
|
|
90
|
+
this.defaultCtx ??= new BrowserContext(this, this.sessionId, false);
|
|
91
|
+
return this.defaultCtx;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A new context: its own vibesurfer session, closed with the context.
|
|
95
|
+
* By default the session is isolated (vibesurfer 0.2.16+): its own
|
|
96
|
+
* in-memory cookie and storage jar, discarded on close, as a
|
|
97
|
+
* Playwright context is. `{ isolated: false }` shares the engine's
|
|
98
|
+
* persistent jar (logins survive across runs).
|
|
99
|
+
*/
|
|
100
|
+
async newContext(options = {}) {
|
|
101
|
+
const flags = options.isolated === false ? {} : { isolated: true };
|
|
102
|
+
// Every http request goes through vibesurfer's proxy (0.2.16+); see
|
|
103
|
+
// src/net.ts. Popups then open as their own pages, reported on the
|
|
104
|
+
// same event stream.
|
|
105
|
+
if (options.intercept) {
|
|
106
|
+
flags['intercept'] = true;
|
|
107
|
+
flags['popups'] = true;
|
|
108
|
+
}
|
|
109
|
+
// A context opened ahead of time with the same flags, if there is one;
|
|
110
|
+
// then start the next, so a run of tests never waits for a web view.
|
|
111
|
+
// Take the spare only when it is ready and matches; never wait for
|
|
112
|
+
// one (parallel tests call this at once). Claim it before any await.
|
|
113
|
+
const key = JSON.stringify(flags);
|
|
114
|
+
const ready = this.spareReady && this.spareKey === key ? this.spareReady : null;
|
|
115
|
+
if (ready) {
|
|
116
|
+
this.spare = null;
|
|
117
|
+
this.spareReady = null;
|
|
118
|
+
}
|
|
119
|
+
else if (this.spare && this.spareKey !== key) {
|
|
120
|
+
void this.dropSpare(this.spare);
|
|
121
|
+
this.spare = null;
|
|
122
|
+
this.spareReady = null;
|
|
123
|
+
}
|
|
124
|
+
if (!this.spare && (flags['isolated'] || flags['intercept']))
|
|
125
|
+
this.warm(flags, key);
|
|
126
|
+
const spare = ready;
|
|
127
|
+
if (spare) {
|
|
128
|
+
const ctx = new BrowserContext(this, spare.sessionId, true, options.intercept ?? false);
|
|
129
|
+
ctx.warmPage = spare;
|
|
130
|
+
this.openContexts.add(ctx);
|
|
131
|
+
return ctx;
|
|
132
|
+
}
|
|
133
|
+
const resp = await this.client.call('vs_session_open', [], flags);
|
|
134
|
+
const id = resp.body[0];
|
|
135
|
+
if (!id)
|
|
136
|
+
throw new Error('vs_session_open returned no session id');
|
|
137
|
+
const ctx = new BrowserContext(this, id, true, options.intercept ?? false);
|
|
138
|
+
this.openContexts.add(ctx);
|
|
139
|
+
return ctx;
|
|
140
|
+
}
|
|
141
|
+
spare = null;
|
|
142
|
+
/** The spare, once it is open. */
|
|
143
|
+
spareReady = null;
|
|
144
|
+
spareKey = '';
|
|
145
|
+
warmer = null;
|
|
146
|
+
/** Open a session with `flags` and a blank, sized page in it, on a connection of its own. */
|
|
147
|
+
warm(flags, key) {
|
|
148
|
+
this.spareKey = key;
|
|
149
|
+
const p = (async () => {
|
|
150
|
+
const c = await (this.warmer ??= this.client.sibling());
|
|
151
|
+
const sessionId = (await c.call('vs_session_open', [], flags)).body[0];
|
|
152
|
+
if (!sessionId)
|
|
153
|
+
return null;
|
|
154
|
+
const r = await c.call('vs_open', ['about:blank'], { session: sessionId });
|
|
155
|
+
const pageId = r.body[0];
|
|
156
|
+
if (!pageId) {
|
|
157
|
+
await c.call('vs_session_close', [sessionId], {}).catch(() => { });
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
let sized = null;
|
|
161
|
+
if (this.viewport) {
|
|
162
|
+
const v = this.viewport;
|
|
163
|
+
await c.call('vs_viewport', [pageId, `${v.width}x${v.height}`], { session: sessionId, dpr: String(this.deviceScaleFactor) });
|
|
164
|
+
sized = { ...v, dpr: this.deviceScaleFactor };
|
|
165
|
+
}
|
|
166
|
+
return { sessionId, pageId, token: r.token, sized };
|
|
167
|
+
})().catch(() => null);
|
|
168
|
+
this.spare = p;
|
|
169
|
+
void p.then((s) => {
|
|
170
|
+
// Still the current spare (not dropped or replaced): mark it ready.
|
|
171
|
+
if (this.spare === p)
|
|
172
|
+
this.spareReady = s;
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
/** Close a spare nobody will take (its flags did not match). */
|
|
176
|
+
async dropSpare(spare) {
|
|
177
|
+
const s = await spare;
|
|
178
|
+
if (s)
|
|
179
|
+
await this.client.call('vs_session_close', [s.sessionId], {}).catch(() => { });
|
|
180
|
+
}
|
|
181
|
+
/** A context over this browser's own session; closing it closes its pages only. */
|
|
182
|
+
sharedContext() {
|
|
183
|
+
return new BrowserContext(this, this.sessionId, false);
|
|
184
|
+
}
|
|
185
|
+
contexts() {
|
|
186
|
+
return [...(this.defaultCtx ? [this.defaultCtx] : []), ...this.openContexts];
|
|
187
|
+
}
|
|
188
|
+
/** @internal Called by a context when it closes. */
|
|
189
|
+
forgetContext(ctx) {
|
|
190
|
+
this.openContexts.delete(ctx);
|
|
191
|
+
}
|
|
192
|
+
/** @internal Close a context's session. */
|
|
193
|
+
async closeSession(sessionId) {
|
|
194
|
+
await this.client.call('vs_session_close', [sessionId], {}).catch(() => { });
|
|
195
|
+
}
|
|
196
|
+
/** @internal A second daemon connection, for a context's event poller. */
|
|
197
|
+
openPoller() {
|
|
198
|
+
return this.client.sibling();
|
|
199
|
+
}
|
|
200
|
+
/** @internal One wire call on the browser's own connection. */
|
|
201
|
+
rawCall(prim, args, flags = {}) {
|
|
202
|
+
return this.client.call(prim, args, flags);
|
|
73
203
|
}
|
|
74
204
|
/** A new page in this session. Call page.goto(url) to load a URL. */
|
|
75
205
|
newPage() {
|
|
76
|
-
|
|
206
|
+
const page = this.makePage(this.sessionId);
|
|
207
|
+
this.defaultContext.adopt(page);
|
|
208
|
+
return page;
|
|
209
|
+
}
|
|
210
|
+
/** @internal A page bound to `sessionId`, with this browser's options. */
|
|
211
|
+
makePage(sessionId) {
|
|
212
|
+
const page = new Page(this.client, sessionId, this.timeouts, this.inputMode, this.clickVia, this.protocol, this.baseURL);
|
|
213
|
+
if (this.testIdAttribute)
|
|
214
|
+
page.testIdAttribute = this.testIdAttribute;
|
|
215
|
+
page.initialViewport(this.viewport, this.deviceScaleFactor);
|
|
216
|
+
return page;
|
|
77
217
|
}
|
|
78
218
|
/** Close the session and drop the connection. */
|
|
79
219
|
async close() {
|
|
220
|
+
for (const ctx of [...this.openContexts])
|
|
221
|
+
await ctx.close().catch(() => { });
|
|
222
|
+
// The default context shares the browser's session; closing it closes its pages and their pollers.
|
|
223
|
+
if (this.defaultCtx)
|
|
224
|
+
await this.defaultCtx.close().catch(() => { });
|
|
225
|
+
if (this.spare)
|
|
226
|
+
await this.dropSpare(this.spare);
|
|
227
|
+
this.spare = null;
|
|
228
|
+
this.spareReady = null;
|
|
229
|
+
if (this.warmer)
|
|
230
|
+
(await this.warmer.catch(() => null))?.close();
|
|
80
231
|
await this.client.call('vs_session_close', [this.sessionId], {}).catch(() => { });
|
|
81
232
|
this.client.close();
|
|
82
233
|
}
|
|
83
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* A group of pages, with routes and init scripts that apply to all of
|
|
237
|
+
* them (Playwright's BrowserContext). See Browser.newContext() for the
|
|
238
|
+
* isolation caveat.
|
|
239
|
+
*/
|
|
240
|
+
export class BrowserContext {
|
|
241
|
+
owner;
|
|
242
|
+
sessionId;
|
|
243
|
+
ownsSession;
|
|
244
|
+
open = [];
|
|
245
|
+
routes = [];
|
|
246
|
+
scripts = [];
|
|
247
|
+
/** The session runs through vibesurfer's intercepting proxy. */
|
|
248
|
+
intercept;
|
|
249
|
+
constructor(owner, sessionId, ownsSession, intercept = false) {
|
|
250
|
+
this.owner = owner;
|
|
251
|
+
this.sessionId = sessionId;
|
|
252
|
+
this.ownsSession = ownsSession;
|
|
253
|
+
this.intercept = intercept;
|
|
254
|
+
}
|
|
255
|
+
browser() {
|
|
256
|
+
return this.owner;
|
|
257
|
+
}
|
|
258
|
+
/** @internal Track a page created elsewhere as part of this context. */
|
|
259
|
+
adopt(page) {
|
|
260
|
+
this.open.push(page);
|
|
261
|
+
page.bindContext(this);
|
|
262
|
+
this.listen();
|
|
263
|
+
}
|
|
264
|
+
/** @internal A page closed; it is no longer one of the context's pages. */
|
|
265
|
+
forgetPage(page) {
|
|
266
|
+
const i = this.open.indexOf(page);
|
|
267
|
+
if (i >= 0)
|
|
268
|
+
this.open.splice(i, 1);
|
|
269
|
+
}
|
|
270
|
+
// --- Events: page, request, response, requestfinished, requestfailed, close.
|
|
271
|
+
listeners = new Map();
|
|
272
|
+
hub = null;
|
|
273
|
+
/** Proxy mode: watch the session's event stream for popups and context-level events. */
|
|
274
|
+
listen() {
|
|
275
|
+
if (!this.intercept || this.hub)
|
|
276
|
+
return;
|
|
277
|
+
this.hub = NetHub.for(this.sessionId, () => this.owner.openPoller());
|
|
278
|
+
this.hub.attachContext(this.netContext());
|
|
279
|
+
}
|
|
280
|
+
netContext() {
|
|
281
|
+
return {
|
|
282
|
+
netEmit: (name, arg) => this.emit(name, arg),
|
|
283
|
+
netPopup: (openerId, pageId, url) => this.popupOpened(openerId, pageId, url),
|
|
284
|
+
netPageClosed: (pageId) => {
|
|
285
|
+
this.open.find((p) => p.wireId() === pageId)?.closedByPage();
|
|
286
|
+
},
|
|
287
|
+
netDialog: (pageId, kind, message, defaultText, answer) => {
|
|
288
|
+
const page = this.open.find((p) => p.wireId() === pageId) ?? null;
|
|
289
|
+
const d = new Dialog(kind, message, defaultText, page, answer);
|
|
290
|
+
const contextListens = (this.listeners.get('dialog')?.size ?? 0) > 0;
|
|
291
|
+
if (page)
|
|
292
|
+
page.handleDialog(d, contextListens);
|
|
293
|
+
else if (!contextListens)
|
|
294
|
+
void d.dismiss().catch(() => { });
|
|
295
|
+
if (contextListens)
|
|
296
|
+
this.emit('dialog', d);
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
popupOpened(openerId, pageId, url) {
|
|
301
|
+
const opener = this.open.find((p) => p.wireId() === openerId) ?? null;
|
|
302
|
+
const popup = this.owner.makePage(this.sessionId);
|
|
303
|
+
this.adopt(popup);
|
|
304
|
+
const events = popup.adoptPopup(pageId, url, opener);
|
|
305
|
+
// The context's routes and init scripts apply to the popup too; its
|
|
306
|
+
// document is already on the way, so they reach it from the next one.
|
|
307
|
+
for (const r of this.routes)
|
|
308
|
+
void popup.route(r.url, r.handler, r.times === undefined ? {} : { times: r.times });
|
|
309
|
+
this.emit('page', popup);
|
|
310
|
+
opener?.emitPopup(popup);
|
|
311
|
+
return events;
|
|
312
|
+
}
|
|
313
|
+
emit(name, arg) {
|
|
314
|
+
for (const fn of [...(this.listeners.get(name) ?? [])]) {
|
|
315
|
+
try {
|
|
316
|
+
fn(arg);
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
/* a throwing listener must not stop the poller */
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
on(event, listener) {
|
|
324
|
+
let set = this.listeners.get(event);
|
|
325
|
+
if (!set)
|
|
326
|
+
this.listeners.set(event, (set = new Set()));
|
|
327
|
+
set.add(listener);
|
|
328
|
+
return this;
|
|
329
|
+
}
|
|
330
|
+
once(event, listener) {
|
|
331
|
+
const wrapped = (arg) => {
|
|
332
|
+
this.off(event, wrapped);
|
|
333
|
+
listener(arg);
|
|
334
|
+
};
|
|
335
|
+
return this.on(event, wrapped);
|
|
336
|
+
}
|
|
337
|
+
off(event, listener) {
|
|
338
|
+
this.listeners.get(event)?.delete(listener);
|
|
339
|
+
return this;
|
|
340
|
+
}
|
|
341
|
+
removeListener(event, listener) {
|
|
342
|
+
return this.off(event, listener);
|
|
343
|
+
}
|
|
344
|
+
/** The next `event` that `predicate` accepts. */
|
|
345
|
+
waitForEvent(event, optionsOrPredicate) {
|
|
346
|
+
const opts = typeof optionsOrPredicate === 'function' ? { predicate: optionsOrPredicate } : (optionsOrPredicate ?? {});
|
|
347
|
+
const timeout = opts.timeout ?? 30_000;
|
|
348
|
+
return new Promise((resolve, reject) => {
|
|
349
|
+
const timer = setTimeout(() => {
|
|
350
|
+
this.off(event, fn);
|
|
351
|
+
reject(new Error(`browserContext.waitForEvent: Timeout ${timeout}ms exceeded while waiting for event "${event}"`));
|
|
352
|
+
}, timeout);
|
|
353
|
+
const fn = (arg) => {
|
|
354
|
+
void (async () => {
|
|
355
|
+
if (opts.predicate && !(await opts.predicate(arg)))
|
|
356
|
+
return;
|
|
357
|
+
clearTimeout(timer);
|
|
358
|
+
this.off(event, fn);
|
|
359
|
+
resolve(arg);
|
|
360
|
+
})();
|
|
361
|
+
};
|
|
362
|
+
this.on(event, fn);
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
/** setExtraHTTPHeaders() for every page of the context. */
|
|
366
|
+
extraHeaders = {};
|
|
367
|
+
async setExtraHTTPHeaders(headers) {
|
|
368
|
+
this.extraHeaders = Object.fromEntries(Object.entries(headers).map(([k, v]) => [k.toLowerCase(), String(v)]));
|
|
369
|
+
for (const p of this.open)
|
|
370
|
+
await p.refreshNetwork();
|
|
371
|
+
}
|
|
372
|
+
pendingCookies = [];
|
|
373
|
+
cookieSeq = 0;
|
|
374
|
+
/**
|
|
375
|
+
* Add cookies to the context's jar: `{ name, value, url }` or
|
|
376
|
+
* `{ name, value, domain, path }`, with optional expires, httpOnly,
|
|
377
|
+
* secure and sameSite. HttpOnly cookies work too: they go in through
|
|
378
|
+
* the engine's cookie store, not document.cookie.
|
|
379
|
+
*/
|
|
380
|
+
async addCookies(cookies) {
|
|
381
|
+
const list = cookies.map((c) => {
|
|
382
|
+
const u = c.url ? new URL(c.url) : null;
|
|
383
|
+
const domain = c.domain ?? u?.hostname;
|
|
384
|
+
if (!domain)
|
|
385
|
+
throw new Error('browserContext.addCookies: a cookie needs url or domain');
|
|
386
|
+
return {
|
|
387
|
+
name: c.name,
|
|
388
|
+
value: c.value,
|
|
389
|
+
domain,
|
|
390
|
+
path: c.path ?? (u ? u.pathname.replace(/\/[^/]*$/, '/') || '/' : '/'),
|
|
391
|
+
...(c.expires !== undefined && c.expires > 0 ? { expiresUnix: Math.floor(c.expires) } : {}),
|
|
392
|
+
secure: c.secure ?? u?.protocol === 'https:',
|
|
393
|
+
httpOnly: c.httpOnly ?? false,
|
|
394
|
+
...(c.sameSite ? { sameSite: c.sameSite } : {}),
|
|
395
|
+
};
|
|
396
|
+
});
|
|
397
|
+
const first = cookies[0];
|
|
398
|
+
const origin = first?.url ? new URL(first.url).origin : `http://${list[0]?.domain ?? 'localhost'}`;
|
|
399
|
+
const blob = { version: 2, url: `${origin}/`, origin, cookies: list, localStorage: {}, sessionStorage: {} };
|
|
400
|
+
const name = `testsurfer-cookies-${this.sessionId}-${++this.cookieSeq}`;
|
|
401
|
+
await this.owner.rawCall('vs_auth', ['import', name, Buffer.from(JSON.stringify(blob)).toString('base64')], {
|
|
402
|
+
session: this.sessionId,
|
|
403
|
+
});
|
|
404
|
+
const page = this.open[0];
|
|
405
|
+
if (page)
|
|
406
|
+
await page.loadCookieBlob(name);
|
|
407
|
+
else
|
|
408
|
+
this.pendingCookies.push(name);
|
|
409
|
+
}
|
|
410
|
+
/** @internal A blank page Browser.newContext opened ahead of time; the first newPage() takes it. */
|
|
411
|
+
warmPage = null;
|
|
412
|
+
async newPage() {
|
|
413
|
+
const page = this.owner.makePage(this.sessionId);
|
|
414
|
+
const warm = this.warmPage;
|
|
415
|
+
this.warmPage = null;
|
|
416
|
+
if (warm)
|
|
417
|
+
await page.adoptBlank(warm.pageId, warm.token, warm.sized);
|
|
418
|
+
this.adopt(page);
|
|
419
|
+
for (const name of this.pendingCookies.splice(0))
|
|
420
|
+
await page.loadCookieBlob(name);
|
|
421
|
+
for (const s of this.scripts)
|
|
422
|
+
await page.addInitScript(s.script, s.arg);
|
|
423
|
+
for (const r of this.routes)
|
|
424
|
+
await page.route(r.url, r.handler, r.times === undefined ? {} : { times: r.times });
|
|
425
|
+
return page;
|
|
426
|
+
}
|
|
427
|
+
pages() {
|
|
428
|
+
return [...this.open];
|
|
429
|
+
}
|
|
430
|
+
/** Route requests of every page in this context, current and future. */
|
|
431
|
+
async route(url, handler, options = {}) {
|
|
432
|
+
this.routes.push({ url, handler, ...(options.times === undefined ? {} : { times: options.times }) });
|
|
433
|
+
for (const p of this.open)
|
|
434
|
+
await p.route(url, handler, options);
|
|
435
|
+
}
|
|
436
|
+
async unrouteAll() {
|
|
437
|
+
this.routes.length = 0;
|
|
438
|
+
for (const p of this.open)
|
|
439
|
+
await p.unrouteAll();
|
|
440
|
+
}
|
|
441
|
+
/** An init script for every page in this context, current and future. */
|
|
442
|
+
async addInitScript(script, arg) {
|
|
443
|
+
this.scripts.push({ script, arg });
|
|
444
|
+
for (const p of this.open)
|
|
445
|
+
await p.addInitScript(script, arg);
|
|
446
|
+
}
|
|
447
|
+
/** Close every page, and the session when the context opened one. */
|
|
448
|
+
async close() {
|
|
449
|
+
for (const p of this.open.splice(0))
|
|
450
|
+
await p.close().catch(() => { });
|
|
451
|
+
this.hub?.detachContext();
|
|
452
|
+
this.hub = null;
|
|
453
|
+
this.emit('close', this);
|
|
454
|
+
if (this.ownsSession) {
|
|
455
|
+
await this.owner.closeSession(this.sessionId);
|
|
456
|
+
this.owner.forgetContext(this);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
84
460
|
//# sourceMappingURL=browser.js.map
|
package/dist/browser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAsB,MAAM,aAAa,CAAC;AAE7D,oEAAoE;AACpE,KAAK,UAAU,SAAS,CAAC,MAAkB;IACzC,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,EAAU,EAAE,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9C,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YAC9B,IAAI,EAAE,IAAI,CAAC;gBAAE,SAAS;YACtB,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;YAClC,IAAI,GAAG,KAAK,OAAO;gBAAE,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;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AAC;QACnC,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI;YAAE,MAAM,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChE,CAAC;IAED,qEAAqE;IACrE,KAAK,CAAC,KAAK;QACT,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAAE,MAAM,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACrE,IAAI,CAAC,GAAG,EAAE,aAAa,EAAE,CAAC;QAC1B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACzB,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC9C,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;CACF"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `testsurfer test [paths...]`: run a test suite on node:test with
|
|
4
|
+
* Playwright imports pointed at testsurfer, so a Playwright suite runs
|
|
5
|
+
* without edits.
|
|
6
|
+
*
|
|
7
|
+
* --grep <pattern> only tests whose name matches
|
|
8
|
+
* --workers <n> test files at once (default: half the CPUs)
|
|
9
|
+
* --update-snapshots rewrite toHaveScreenshot baselines
|
|
10
|
+
* --reporter <name> node:test reporter (default: spec)
|
|
11
|
+
*
|
|
12
|
+
* With no paths it runs the `testDir` named in playwright.config.* or
|
|
13
|
+
* testsurfer.config.* when it can read one, else ./tests, else the
|
|
14
|
+
* current directory.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `testsurfer test [paths...]`: run a test suite on node:test with
|
|
4
|
+
* Playwright imports pointed at testsurfer, so a Playwright suite runs
|
|
5
|
+
* without edits.
|
|
6
|
+
*
|
|
7
|
+
* --grep <pattern> only tests whose name matches
|
|
8
|
+
* --workers <n> test files at once (default: half the CPUs)
|
|
9
|
+
* --update-snapshots rewrite toHaveScreenshot baselines
|
|
10
|
+
* --reporter <name> node:test reporter (default: spec)
|
|
11
|
+
*
|
|
12
|
+
* With no paths it runs the `testDir` named in playwright.config.* or
|
|
13
|
+
* testsurfer.config.* when it can read one, else ./tests, else the
|
|
14
|
+
* current directory.
|
|
15
|
+
*/
|
|
16
|
+
import { spawn } from 'node:child_process';
|
|
17
|
+
import * as fs from 'node:fs';
|
|
18
|
+
import * as os from 'node:os';
|
|
19
|
+
import * as path from 'node:path';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import { PLAYWRIGHT_CONFIGS } from "./pwconfig.js";
|
|
22
|
+
const TEST_FILE = /\.(spec|test)\.[cm]?[jt]sx?$/;
|
|
23
|
+
function usage(code) {
|
|
24
|
+
process.stdout.write('usage: testsurfer test [paths...] [--grep <pattern>] [--workers <n>] [--update-snapshots] [--reporter <name>]\n');
|
|
25
|
+
process.exit(code);
|
|
26
|
+
}
|
|
27
|
+
function collect(p, out) {
|
|
28
|
+
const st = fs.statSync(p, { throwIfNoEntry: false });
|
|
29
|
+
if (!st) {
|
|
30
|
+
process.stderr.write(`testsurfer: no such file or directory: ${p}\n`);
|
|
31
|
+
process.exit(2);
|
|
32
|
+
}
|
|
33
|
+
if (st.isFile()) {
|
|
34
|
+
out.push(p);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
for (const e of fs.readdirSync(p, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
38
|
+
if (e.name === 'node_modules' || e.name.startsWith('.'))
|
|
39
|
+
continue;
|
|
40
|
+
const full = path.join(p, e.name);
|
|
41
|
+
if (e.isDirectory())
|
|
42
|
+
collect(full, out);
|
|
43
|
+
else if (TEST_FILE.test(e.name))
|
|
44
|
+
out.push(full);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** testDir from a config file, read as text: configs import modules we do not want to run here. */
|
|
48
|
+
function configuredTestDir() {
|
|
49
|
+
for (const name of [...PLAYWRIGHT_CONFIGS, 'testsurfer.config.ts', 'testsurfer.config.js']) {
|
|
50
|
+
if (!fs.existsSync(name))
|
|
51
|
+
continue;
|
|
52
|
+
const m = /testDir\s*:\s*['"`]([^'"`]+)['"`]/.exec(fs.readFileSync(name, 'utf8'));
|
|
53
|
+
if (m)
|
|
54
|
+
return m[1];
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const argv = process.argv.slice(2);
|
|
59
|
+
if (argv[0] !== 'test')
|
|
60
|
+
usage(argv[0] === '--help' || argv[0] === '-h' ? 0 : 2);
|
|
61
|
+
const paths = [];
|
|
62
|
+
let grep = null;
|
|
63
|
+
let workers = Math.max(1, Math.floor(os.availableParallelism() / 2));
|
|
64
|
+
let reporter = 'spec';
|
|
65
|
+
const env = { ...process.env };
|
|
66
|
+
// Started from inside another node:test run, the child would refuse to run files.
|
|
67
|
+
delete env['NODE_TEST_CONTEXT'];
|
|
68
|
+
for (let i = 1; i < argv.length; i++) {
|
|
69
|
+
const a = argv[i];
|
|
70
|
+
if (a === '--grep' || a === '-g')
|
|
71
|
+
grep = argv[++i] ?? usage(2);
|
|
72
|
+
else if (a === '--workers' || a === '-j')
|
|
73
|
+
workers = Number(argv[++i] ?? usage(2));
|
|
74
|
+
else if (a === '--reporter')
|
|
75
|
+
reporter = argv[++i] ?? usage(2);
|
|
76
|
+
else if (a === '--update-snapshots' || a === '-u')
|
|
77
|
+
env['TESTSURFER_UPDATE_SNAPSHOTS'] = 'all';
|
|
78
|
+
else if (a.startsWith('-'))
|
|
79
|
+
usage(2);
|
|
80
|
+
else
|
|
81
|
+
paths.push(a);
|
|
82
|
+
}
|
|
83
|
+
if (paths.length === 0) {
|
|
84
|
+
const dir = configuredTestDir() ?? (fs.existsSync('tests') ? 'tests' : '.');
|
|
85
|
+
paths.push(dir);
|
|
86
|
+
}
|
|
87
|
+
const files = [];
|
|
88
|
+
for (const p of paths)
|
|
89
|
+
collect(p, files);
|
|
90
|
+
if (files.length === 0) {
|
|
91
|
+
process.stderr.write('testsurfer: no test files found (*.spec.* or *.test.*)\n');
|
|
92
|
+
process.exit(2);
|
|
93
|
+
}
|
|
94
|
+
const ext = import.meta.url.endsWith('.ts') ? '.ts' : '.js';
|
|
95
|
+
const register = new URL(`./register${ext}`, import.meta.url).href;
|
|
96
|
+
const args = [
|
|
97
|
+
'--import',
|
|
98
|
+
register,
|
|
99
|
+
'--test',
|
|
100
|
+
`--test-reporter=${reporter}`,
|
|
101
|
+
`--test-concurrency=${workers}`,
|
|
102
|
+
// A file is done when its tests are, as with Playwright's workers:
|
|
103
|
+
// a timer a test left running must not keep it alive.
|
|
104
|
+
'--test-force-exit',
|
|
105
|
+
...(grep ? [`--test-name-pattern=${grep}`] : []),
|
|
106
|
+
...files,
|
|
107
|
+
];
|
|
108
|
+
// A playwright.config's webServer, globalSetup and globalTeardown run
|
|
109
|
+
// around the whole run, in their own process (src/global.ts).
|
|
110
|
+
const pwConfig = PLAYWRIGHT_CONFIGS.find((n) => fs.existsSync(n));
|
|
111
|
+
let global = null;
|
|
112
|
+
if (pwConfig) {
|
|
113
|
+
const script = new URL(`./global${ext}`, import.meta.url);
|
|
114
|
+
global = spawn(process.execPath, ['--import', register, fileURLToPath(script), pwConfig], {
|
|
115
|
+
stdio: ['ignore', 'inherit', 'inherit', 'ipc'],
|
|
116
|
+
env,
|
|
117
|
+
});
|
|
118
|
+
const reply = await new Promise((resolve) => {
|
|
119
|
+
global.once('message', (m) => resolve(m));
|
|
120
|
+
global.once('exit', (code) => resolve({ failed: `global setup exited with code ${code}` }));
|
|
121
|
+
});
|
|
122
|
+
if (reply.failed) {
|
|
123
|
+
process.stderr.write(`testsurfer: ${reply.failed}\n`);
|
|
124
|
+
global.kill();
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
Object.assign(env, reply.env ?? {});
|
|
128
|
+
}
|
|
129
|
+
/** Run globalTeardown and stop web servers, then exit. */
|
|
130
|
+
function finish(code) {
|
|
131
|
+
if (!global || global.exitCode !== null)
|
|
132
|
+
process.exit(code);
|
|
133
|
+
global.once('exit', () => process.exit(code));
|
|
134
|
+
global.send('teardown');
|
|
135
|
+
setTimeout(() => process.exit(code), 30_000).unref();
|
|
136
|
+
}
|
|
137
|
+
const child = spawn(process.execPath, args, { stdio: 'inherit', env });
|
|
138
|
+
child.on('exit', (code, signal) => finish(code ?? (signal ? 1 : 0)));
|
|
139
|
+
process.on('SIGINT', () => child.kill('SIGINT'));
|
|
140
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,MAAM,SAAS,GAAG,8BAA8B,CAAC;AAEjD,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,iHAAiH,CAClH,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrB,CAA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,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC"}
|
package/dist/client.d.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { type Flags, type WireResponse } from './wire.ts';
|
|
15
15
|
/** The vibesurfer release testsurfer is built and tested against. */
|
|
16
|
-
export declare const PINNED_VIBESURFER = "0.2.
|
|
16
|
+
export declare const PINNED_VIBESURFER = "0.2.18";
|
|
17
17
|
export interface ClientOptions {
|
|
18
18
|
/** Socket path. Default: `~/.vibesurfer/daemon.sock`. */
|
|
19
19
|
socketPath?: string;
|
|
20
|
-
/** Command used to reach the vs binary, e.g. `['vs']` or `['npx', '-y', 'vibesurfer@0.2.
|
|
20
|
+
/** Command used to reach the vs binary, e.g. `['vs']` or `['npx', '-y', 'vibesurfer@0.2.18']`. */
|
|
21
21
|
vsCommand?: string[];
|
|
22
22
|
/** Per-request timeout in ms. Default 70000 (above the daemon's 60s wait cap). */
|
|
23
23
|
requestTimeout?: number;
|
|
@@ -41,7 +41,15 @@ export declare class WireClient {
|
|
|
41
41
|
private readonly opts;
|
|
42
42
|
private constructor();
|
|
43
43
|
static connect(opts?: ClientOptions): Promise<WireClient>;
|
|
44
|
+
/** Resolved daemon address; on Windows a named pipe only `vs socket` can name. */
|
|
45
|
+
private address;
|
|
44
46
|
private socketPath;
|
|
47
|
+
/**
|
|
48
|
+
* On Windows the daemon listens on a named pipe whose name is a hash
|
|
49
|
+
* of the socket path, so ask the vs binary for it (vibesurfer
|
|
50
|
+
* 0.2.15+). Unix uses the path directly.
|
|
51
|
+
*/
|
|
52
|
+
private resolveAddress;
|
|
45
53
|
private ensureConnected;
|
|
46
54
|
private spawnDaemon;
|
|
47
55
|
private socketUp;
|
|
@@ -55,5 +63,7 @@ export declare class WireClient {
|
|
|
55
63
|
* a `!` envelope, TimeoutError if the daemon does not answer in time.
|
|
56
64
|
*/
|
|
57
65
|
call(primitive: string, args?: string[], flags?: Flags, opts?: CallOptions): Promise<WireResponse>;
|
|
66
|
+
/** A second connection to the same daemon, with the same options. */
|
|
67
|
+
sibling(): Promise<WireClient>;
|
|
58
68
|
close(): void;
|
|
59
69
|
}
|