screw-bugs 0.1.10 → 0.1.12

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.
@@ -68,6 +68,51 @@ export const checkVideo = (lookup, installCommand) => lookup.found
68
68
  why: 'screw-bugs records every browser session as a video with it; runs need that video.',
69
69
  },
70
70
  };
71
+ /** Where to report a recording that fails on a machine that has everything it needs. */
72
+ const ISSUES_URL = 'https://github.com/uxstudioteam/screw-bugs/issues';
73
+ /**
74
+ * The test recording (`Browser.checkRecording`): a failure, said by what went wrong, since a run
75
+ * that cannot be recorded does not start. `ffmpegCommand` downloads Playwright's ffmpeg again.
76
+ */
77
+ export const checkRecorded = (result, ffmpegCommand) => {
78
+ if (result.ok)
79
+ return { id: 'recording', ok: true, detail: result.detail };
80
+ const failed = (detail, fix) => ({
81
+ id: 'recording',
82
+ ok: false,
83
+ detail: `${detail}: ${result.problem.charAt(0).toLowerCase()}${result.problem.slice(1).replace(/\.$/, '')}.`,
84
+ ...(fix ? { fix } : {}),
85
+ });
86
+ const why = 'Every run is recorded as a video; a session that cannot be recorded does not run.';
87
+ switch (result.reason) {
88
+ case 'frames_rejected':
89
+ return failed('A test recording got no frame of the right size', {
90
+ action: `Report this, with your OS and browser version, at ${ISSUES_URL}.`,
91
+ why: `${why} The browser's window showed less (or more) than the page it was given.`,
92
+ });
93
+ case 'no_frames':
94
+ return failed('A test recording got no frame from the browser', {
95
+ action: `Update the browser; if it still fails, report this at ${ISSUES_URL}.`,
96
+ why,
97
+ });
98
+ case 'encoder':
99
+ return failed("Playwright's ffmpeg could not encode a test recording", {
100
+ action: "Download Playwright's ffmpeg again with the command.",
101
+ command: ffmpegCommand,
102
+ why,
103
+ });
104
+ case 'output':
105
+ return failed('A test recording could not be saved or read back', {
106
+ action: 'Check that the temporary folder is writable and the disk has room.',
107
+ why,
108
+ });
109
+ case 'browser':
110
+ return failed('A test recording could not open a browser session', {
111
+ action: `Check that the browser starts on this machine; if it does, report this at ${ISSUES_URL}.`,
112
+ why,
113
+ });
114
+ }
115
+ };
71
116
  export const checkDisk = (path, freeBytes) => {
72
117
  if (freeBytes === undefined) {
73
118
  return {
@@ -170,13 +215,16 @@ export const runDoctor = (projectRoot, lookupFfmpeg = findFfmpeg, update) => Eff
170
215
  tailnetCheck,
171
216
  ], { concurrency: 'unbounded' });
172
217
  const installCommand = found ? '' : yield* installBrowserCommand;
173
- const ffmpegCommand = ffmpeg.found ? '' : yield* installFfmpegCommand;
218
+ const ffmpegCommand = yield* installFfmpegCommand;
219
+ // Only with a browser and ffmpeg: without them, their own checks say what is missing.
220
+ const recorded = found !== undefined && ffmpeg.found ? yield* browser.checkRecording : undefined;
174
221
  const checks = [
175
222
  checkRunning(name, Option.match(running, { onNone: () => version, onSome: (found) => found.version }), Option.getOrUndefined(running)?.build),
176
223
  // Boundary: the version of the Node running us; there is no Effect service for it.
177
224
  checkNode(process.versions.node, engines.node),
178
225
  checkBrowser(found, installCommand),
179
- checkVideo(ffmpeg, ffmpegCommand),
226
+ checkVideo(ffmpeg, ffmpeg.found ? '' : ffmpegCommand),
227
+ ...(recorded ? [checkRecorded(recorded, ffmpegCommand)] : []),
180
228
  checkDisk(projectRoot, free),
181
229
  ...(tailnet ? [tailnet] : []),
182
230
  ...(updateCheck ? [updateCheck] : []),
package/dist/cli/mcp.js CHANGED
@@ -264,6 +264,9 @@ const StartRunInput = Schema.Struct({
264
264
  'Omit for one "page loads" case ' +
265
265
  '(loads the URL, passes without an HTTP error, takes a screenshot). Step examples: ' +
266
266
  '{"action":"goto","url":"/login"}, ' +
267
+ '{"action":"goto","url":"/no-such-page","status":404} (for a page that must answer with ' +
268
+ 'an error status, such as a not-found page: that exact status passes, any other fails, ' +
269
+ '200 included; without status an HTTP error fails the case), ' +
267
270
  '{"action":"fill","target":{"label":"Email"},"value":"a@b.co"}, ' +
268
271
  '{"action":"click","target":{"role":"button","name":"Sign in"}}, ' +
269
272
  '{"action":"hover","target":{"text":"Hi there"}} (moves the pointer over it, for controls ' +
@@ -272,7 +275,7 @@ const StartRunInput = Schema.Struct({
272
275
  '{"action":"expectNoText","text":"Acme"} (passes when it does not show as text, image ' +
273
276
  'alt text or ARIA label, in the page and its frames, or with frame or target only there), ' +
274
277
  '{"action":"expectUrl","includes":"/dashboard"}, {"action":"screenshot","name":"home"}, ' +
275
- '{"action":"reload"}, ' +
278
+ '{"action":"reload"} (also takes status), ' +
276
279
  '{"action":"upload","target":{"role":"button","name":"Upload"},"files":[{"path":"fixtures/resume.pdf","about":"A 2-page PDF résumé of a fictional designer"}]}, ' +
277
280
  '{"action":"waitFor","target":{"css":".restyling"},"state":"detached"} (state visible, ' +
278
281
  'hidden, attached or detached; default visible), ' +
@@ -338,8 +341,11 @@ const SubmitFindingsInput = Schema.Struct({
338
341
  description: 'Your write-up, from run_status: a one-sentence headline, fixes (most important first, by ' +
339
342
  'case ID), per case what you did, what worked and what did not, highlights (an element on ' +
340
343
  'one of its screenshot IDs, named like a step target, red for a problem, green for as ' +
341
- 'expected) and key moments (its timecodes), what you did not test and why (notTested: ' +
342
- 'what and why; a passing run covers only what its cases did), and next tests. Short ' +
344
+ 'expected; region marks only a part of it, such as text in a picture) and key moments (its ' +
345
+ 'timecodes), per fix its evidence (marks on screenshots of any case, shown side by side ' +
346
+ 'under the fix: give every mismatch both sides), what you did not test and why (notTested: ' +
347
+ 'what and why, and the caseId of a case that did not finish and left it untested; a ' +
348
+ 'passing run covers only what its cases did), and next tests. Short ' +
343
349
  'texts and capped lists; see the field limits. Use only IDs and timecodes ' +
344
350
  "from run_status. The run's checks decide statuses; you can only mark a case failed (its " +
345
351
  'failed: what is wrong), whenever your own evidence (a database, logs, the screenshots) ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "screw-bugs",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Local browser QA for coding agents (MCP), people and CI.",
5
5
  "keywords": [
6
6
  "browser",
@@ -46,7 +46,7 @@
46
46
  "dependencies": {
47
47
  "@effect/platform-node": "^4.1.0",
48
48
  "@modelcontextprotocol/server": "2.4.0",
49
- "@screw-bugs/core": "0.1.10",
49
+ "@screw-bugs/core": "0.1.12",
50
50
  "effect": "^4.1.0",
51
51
  "playwright-core": "1.64.1"
52
52
  },