vouchington-tooling 0.53.0 → 0.55.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.
Files changed (197) hide show
  1. package/README.md +99 -12
  2. package/dist/agent-blackboard/index.d.mts +0 -1
  3. package/dist/agent-blackboard/index.mjs +0 -23
  4. package/dist/cli/commands/agent-blackboard-flags.d.mts +0 -1
  5. package/dist/cli/commands/agent-blackboard-flags.mjs +0 -9
  6. package/dist/cli/commands/agent-blackboard.d.mts +0 -2
  7. package/dist/cli/commands/agent-blackboard.mjs +7 -121
  8. package/dist/cli/commands/story-coverage.d.mts +2 -0
  9. package/dist/cli/commands/story-coverage.mjs +56 -0
  10. package/dist/cli/index.mjs +6 -0
  11. package/dist/cli/optional-peer.d.mts +5 -0
  12. package/dist/cli/optional-peer.mjs +17 -0
  13. package/dist/cli/parse-forwarded-commands.d.mts +3 -0
  14. package/dist/cli/parse-forwarded-commands.mjs +2 -0
  15. package/dist/cli/parse-story-coverage-fields.d.mts +19 -0
  16. package/dist/cli/parse-story-coverage-fields.mjs +69 -0
  17. package/dist/cli/parse-story-coverage.d.mts +8 -0
  18. package/dist/cli/parse-story-coverage.mjs +34 -0
  19. package/dist/cli/parse.d.mts +5 -1
  20. package/dist/cli/parse.mjs +3 -0
  21. package/dist/cli/story-coverage-lazy.d.mts +3 -0
  22. package/dist/cli/story-coverage-lazy.mjs +6 -0
  23. package/dist/cli/usage.d.mts +1 -1
  24. package/dist/cli/usage.mjs +8 -7
  25. package/dist/host-storage/check.d.mts +38 -0
  26. package/dist/host-storage/check.mjs +109 -0
  27. package/dist/host-storage/cli.d.mts +7 -0
  28. package/dist/host-storage/cli.mjs +102 -0
  29. package/dist/host-storage/host-storage.test-helpers.d.mts +26 -0
  30. package/dist/host-storage/host-storage.test-helpers.mjs +58 -0
  31. package/dist/host-storage/index.d.mts +3 -0
  32. package/dist/host-storage/index.mjs +3 -0
  33. package/dist/host-storage/preflight.d.mts +22 -0
  34. package/dist/host-storage/preflight.mjs +105 -0
  35. package/dist/index.d.mts +2 -0
  36. package/dist/index.mjs +1 -0
  37. package/dist/playwright/assertions.d.mts +1 -0
  38. package/dist/playwright/assertions.mjs +5 -0
  39. package/dist/playwright/blocked-external-network.d.mts +15 -0
  40. package/dist/playwright/blocked-external-network.mjs +73 -0
  41. package/dist/playwright/browser-dialog-issues.d.mts +12 -0
  42. package/dist/playwright/browser-dialog-issues.mjs +29 -0
  43. package/dist/playwright/browser-errors.d.mts +23 -0
  44. package/dist/playwright/browser-errors.mjs +130 -0
  45. package/dist/playwright/browser-issue-monitor.test-helpers.d.mts +31 -0
  46. package/dist/playwright/browser-issue-monitor.test-helpers.mjs +51 -0
  47. package/dist/playwright/browser-issue-records.d.mts +42 -0
  48. package/dist/playwright/browser-issue-records.mjs +148 -0
  49. package/dist/playwright/browser-test.d.mts +22 -0
  50. package/dist/playwright/browser-test.mjs +68 -0
  51. package/dist/playwright/expect-no-broken-images.d.mts +17 -0
  52. package/dist/playwright/expect-no-broken-images.mjs +39 -0
  53. package/dist/playwright/index.d.mts +32 -0
  54. package/dist/playwright/index.mjs +22 -0
  55. package/dist/playwright/mobile-assertions.d.mts +14 -0
  56. package/dist/playwright/mobile-assertions.mjs +43 -0
  57. package/dist/playwright/monitored-test-info.d.mts +14 -0
  58. package/dist/playwright/monitored-test-info.mjs +1 -0
  59. package/dist/playwright/navigate-to.d.mts +27 -0
  60. package/dist/playwright/navigate-to.mjs +39 -0
  61. package/dist/playwright/radix-select.d.mts +18 -0
  62. package/dist/playwright/radix-select.mjs +19 -0
  63. package/dist/playwright/random-id.d.mts +34 -0
  64. package/dist/playwright/random-id.mjs +37 -0
  65. package/dist/playwright/retry-on-connection-lost.d.mts +7 -0
  66. package/dist/playwright/retry-on-connection-lost.mjs +107 -0
  67. package/dist/playwright/scroll-to-load-more.d.mts +37 -0
  68. package/dist/playwright/scroll-to-load-more.mjs +158 -0
  69. package/dist/playwright/storybook.d.mts +2 -0
  70. package/dist/playwright/storybook.mjs +13 -0
  71. package/dist/playwright/test-fixtures.d.mts +1 -0
  72. package/dist/playwright/test-fixtures.mjs +2 -0
  73. package/dist/playwright/test-lifecycle-reporter.d.mts +27 -0
  74. package/dist/playwright/test-lifecycle-reporter.mjs +57 -0
  75. package/dist/playwright/totp.d.mts +6 -0
  76. package/dist/playwright/totp.mjs +37 -0
  77. package/dist/playwright/turnstile-stub.d.mts +8 -0
  78. package/dist/playwright/turnstile-stub.mjs +61 -0
  79. package/dist/playwright/viewport-constants.d.mts +30 -0
  80. package/dist/playwright/viewport-constants.mjs +9 -0
  81. package/dist/playwright/virtual-authenticator.d.mts +5 -0
  82. package/dist/playwright/virtual-authenticator.mjs +15 -0
  83. package/dist/playwright/wait-for-hydration.d.mts +29 -0
  84. package/dist/playwright/wait-for-hydration.mjs +81 -0
  85. package/dist/shell-parse/ansi-c-string.d.mts +12 -0
  86. package/dist/shell-parse/ansi-c-string.mjs +80 -0
  87. package/dist/shell-parse/index.d.mts +20 -0
  88. package/dist/shell-parse/index.mjs +15 -0
  89. package/dist/shell-parse/shell-command-substitution-reads.d.mts +8 -0
  90. package/dist/shell-parse/shell-command-substitution-reads.mjs +53 -0
  91. package/dist/shell-parse/shell-command-substitutions.d.mts +8 -0
  92. package/dist/shell-parse/shell-command-substitutions.mjs +52 -0
  93. package/dist/shell-parse/shell-command-wrappers.d.mts +26 -0
  94. package/dist/shell-parse/shell-command-wrappers.mjs +143 -0
  95. package/dist/shell-parse/shell-commands.d.mts +24 -0
  96. package/dist/shell-parse/shell-commands.mjs +155 -0
  97. package/dist/shell-parse/shell-heredoc-delimiter.d.mts +5 -0
  98. package/dist/shell-parse/shell-heredoc-delimiter.mjs +52 -0
  99. package/dist/shell-parse/shell-heredoc-parser.d.mts +7 -0
  100. package/dist/shell-parse/shell-heredoc-parser.mjs +49 -0
  101. package/dist/shell-parse/shell-heredoc-quote-state.d.mts +19 -0
  102. package/dist/shell-parse/shell-heredoc-quote-state.mjs +40 -0
  103. package/dist/shell-parse/shell-heredoc.d.mts +10 -0
  104. package/dist/shell-parse/shell-heredoc.mjs +90 -0
  105. package/dist/shell-parse/shell-redirections.d.mts +5 -0
  106. package/dist/shell-parse/shell-redirections.mjs +34 -0
  107. package/dist/shell-parse/shell-script-operand.d.mts +13 -0
  108. package/dist/shell-parse/shell-script-operand.mjs +103 -0
  109. package/dist/shell-parse/shell-stdin-script.d.mts +6 -0
  110. package/dist/shell-parse/shell-stdin-script.mjs +61 -0
  111. package/dist/shell-parse/shell-token-utils.d.mts +9 -0
  112. package/dist/shell-parse/shell-token-utils.mjs +33 -0
  113. package/dist/shell-parse/shell-tokenizer-comments.d.mts +1 -0
  114. package/dist/shell-parse/shell-tokenizer-comments.mjs +57 -0
  115. package/dist/shell-parse/shell-tokenizer-operators.d.mts +14 -0
  116. package/dist/shell-parse/shell-tokenizer-operators.mjs +47 -0
  117. package/dist/shell-parse/shell-tokenizer.d.mts +12 -0
  118. package/dist/shell-parse/shell-tokenizer.mjs +104 -0
  119. package/dist/story-coverage/analyze.d.mts +8 -0
  120. package/dist/story-coverage/analyze.mjs +24 -0
  121. package/dist/story-coverage/check.d.mts +11 -0
  122. package/dist/story-coverage/check.mjs +42 -0
  123. package/dist/story-coverage/components.d.mts +10 -0
  124. package/dist/story-coverage/components.mjs +40 -0
  125. package/dist/story-coverage/coverage.d.mts +10 -0
  126. package/dist/story-coverage/coverage.mjs +43 -0
  127. package/dist/story-coverage/index.d.mts +13 -0
  128. package/dist/story-coverage/index.mjs +7 -0
  129. package/dist/story-coverage/messages.d.mts +10 -0
  130. package/dist/story-coverage/messages.mjs +42 -0
  131. package/dist/story-coverage/options.d.mts +27 -0
  132. package/dist/story-coverage/options.mjs +51 -0
  133. package/dist/story-coverage/workspace.d.mts +2 -0
  134. package/dist/story-coverage/workspace.mjs +27 -0
  135. package/dist/test-helpers/cancel-runs.test-helpers.d.mts +39 -0
  136. package/dist/test-helpers/cancel-runs.test-helpers.mjs +124 -0
  137. package/dist/test-helpers/run-bounded-exit-observer.test-helpers.d.mts +12 -0
  138. package/dist/test-helpers/run-bounded-exit-observer.test-helpers.mjs +68 -0
  139. package/dist/test-helpers/run-bounded-output-fixture.test-helpers.d.mts +18 -0
  140. package/dist/test-helpers/run-bounded-output-fixture.test-helpers.mjs +162 -0
  141. package/dist/vitest-diagnostics/browser.d.mts +2 -0
  142. package/dist/vitest-diagnostics/browser.mjs +6 -0
  143. package/dist/vitest-diagnostics/index.d.mts +14 -23
  144. package/dist/vitest-diagnostics/index.mjs +8 -124
  145. package/dist/vitest-diagnostics/report-summary.d.mts +22 -0
  146. package/dist/vitest-diagnostics/report-summary.mjs +123 -0
  147. package/dist/vitest-diagnostics/vitest-fake-timer-guard.d.mts +6 -0
  148. package/dist/vitest-diagnostics/vitest-fake-timer-guard.mjs +34 -0
  149. package/dist/vitest-diagnostics/vitest-fork-leak-detection.d.mts +1 -0
  150. package/dist/vitest-diagnostics/vitest-fork-leak-detection.mjs +8 -0
  151. package/dist/vitest-diagnostics/vitest-fork-leak-diagnostics.d.mts +17 -1
  152. package/dist/vitest-diagnostics/vitest-fork-leak-diagnostics.mjs +44 -2
  153. package/dist/vitest-diagnostics/vitest-fork-leak-handshake-samples.d.mts +55 -0
  154. package/dist/vitest-diagnostics/vitest-fork-leak-handshake-samples.mjs +74 -0
  155. package/dist/vitest-diagnostics/vitest-fork-leak-handshake.d.mts +19 -0
  156. package/dist/vitest-diagnostics/vitest-fork-leak-handshake.mjs +136 -0
  157. package/dist/vitest-diagnostics/vitest-network-allowlist-dns.d.mts +7 -0
  158. package/dist/vitest-diagnostics/vitest-network-allowlist-dns.mjs +54 -0
  159. package/dist/vitest-diagnostics/vitest-network-allowlist-host.d.mts +8 -0
  160. package/dist/vitest-diagnostics/vitest-network-allowlist-host.mjs +48 -0
  161. package/dist/vitest-diagnostics/vitest-network-allowlist-socket.d.mts +14 -0
  162. package/dist/vitest-diagnostics/vitest-network-allowlist-socket.mjs +39 -0
  163. package/dist/vitest-diagnostics/vitest-network-allowlist.d.mts +7 -0
  164. package/dist/vitest-diagnostics/vitest-network-allowlist.mjs +72 -0
  165. package/dist/vitest-diagnostics/vitest-process-resources.d.mts +10 -0
  166. package/dist/vitest-diagnostics/vitest-process-resources.mjs +54 -0
  167. package/dist/vitest-effective-timeout/cap.d.mts +9 -0
  168. package/dist/vitest-effective-timeout/cap.mjs +28 -0
  169. package/dist/vitest-effective-timeout/check-profiles.d.mts +15 -0
  170. package/dist/vitest-effective-timeout/check-profiles.mjs +52 -0
  171. package/dist/vitest-effective-timeout/config-file.d.mts +6 -0
  172. package/dist/vitest-effective-timeout/config-file.mjs +23 -0
  173. package/dist/vitest-effective-timeout/fixtures.d.mts +2 -0
  174. package/dist/vitest-effective-timeout/fixtures.mjs +18 -0
  175. package/dist/vitest-effective-timeout/index.d.mts +7 -0
  176. package/dist/vitest-effective-timeout/index.mjs +4 -0
  177. package/dist/vitest-effective-timeout/profiles.d.mts +10 -0
  178. package/dist/vitest-effective-timeout/profiles.mjs +33 -0
  179. package/dist/vitest-effective-timeout/run-profile.d.mts +31 -0
  180. package/dist/vitest-effective-timeout/run-profile.mjs +95 -0
  181. package/docs/mcp-server.md +2 -13
  182. package/package.json +37 -2
  183. package/scripts/__pycache__/run_bounded_process.cpython-312.pyc +0 -0
  184. package/scripts/chromium-launch-probe.d.mts +7 -0
  185. package/scripts/chromium-launch-probe.mjs +101 -0
  186. package/scripts/run-bounded-fixtures/run-bounded-backpressure.py +186 -0
  187. package/scripts/run-bounded-fixtures/run-bounded-merged-output.py +75 -0
  188. package/scripts/run-bounded-fixtures/run-bounded-reset-socket.py +25 -0
  189. package/scripts/run-bounded.py +199 -0
  190. package/scripts/run_bounded_process.py +129 -0
  191. package/scripts/worktree/git-index-lock.sh +16 -0
  192. package/scripts/worktree/git-worktrees.sh +23 -20
  193. package/scripts/worktree/reset-worktree-run.sh +199 -0
  194. package/scripts/worktree/reset-worktree.sh +122 -0
  195. package/skills/blackboard/SKILL.md +4 -64
  196. package/skills/stacked-prs/SKILL.md +1 -1
  197. package/skills/stacked-prs/references/drain.md +2 -2
@@ -0,0 +1,148 @@
1
+ import { formatBrowserDialogIssue, getBrowserDialogIssueSearchableValues, getPageUrl, } from "./browser-dialog-issues.mjs";
2
+ export { createDialogIssue } from "./browser-dialog-issues.mjs";
3
+ export function validateAllowlist(entries) {
4
+ for (const entry of entries) {
5
+ if (!entry.reason.trim()) {
6
+ throw new Error(`Browser issue allowlist entry for ${entry.pattern} must include a reason`);
7
+ }
8
+ const probeValues = [
9
+ '',
10
+ 'unrelated browser issue probe',
11
+ 'https://example.invalid/unrelated-probe',
12
+ ];
13
+ // The empty probe is skipped so patterns such as /./ and /.+/ are still rejected.
14
+ const matchesEveryProbe = probeValues.filter(Boolean).every((value) => {
15
+ entry.pattern.lastIndex = 0;
16
+ return entry.pattern.test(value);
17
+ });
18
+ if (matchesEveryProbe) {
19
+ throw new Error(`Browser issue allowlist entry for ${entry.pattern} is too broad`);
20
+ }
21
+ }
22
+ }
23
+ function getRequestFrameUrl(request) {
24
+ try {
25
+ return request.frame().url();
26
+ }
27
+ catch {
28
+ return '(frame URL unavailable)';
29
+ }
30
+ }
31
+ export function createWebErrorIssue(webError) {
32
+ return {
33
+ error: webError.error(),
34
+ pageUrl: getPageUrl(webError.page()),
35
+ type: 'weberror',
36
+ };
37
+ }
38
+ export function createRequestFailedIssue(request) {
39
+ return {
40
+ failureText: request.failure()?.errorText ?? '(no failure text)',
41
+ frameUrl: getRequestFrameUrl(request),
42
+ method: request.method(),
43
+ resourceType: request.resourceType(),
44
+ type: 'requestfailed',
45
+ url: request.url(),
46
+ };
47
+ }
48
+ export function createConsoleErrorIssue(message) {
49
+ const location = message.location();
50
+ const coordinates = `${location.lineNumber}:${location.columnNumber}`;
51
+ return {
52
+ location: location.url ? `${location.url}:${coordinates}` : coordinates,
53
+ pageUrl: getPageUrl(message.page()),
54
+ text: message.text(),
55
+ type: 'consoleerror',
56
+ };
57
+ }
58
+ export function createPageCrashIssue(page) {
59
+ return { pageUrl: getPageUrl(page), type: 'pagecrash' };
60
+ }
61
+ export function formatBrowserIssue(issue) {
62
+ if (issue.type === 'consoleerror') {
63
+ return [
64
+ '[consoleerror]',
65
+ `Page: ${issue.pageUrl}`,
66
+ `Location: ${issue.location}`,
67
+ issue.text,
68
+ ].join('\n');
69
+ }
70
+ if (issue.type === 'weberror') {
71
+ return [
72
+ '[weberror]',
73
+ `Page: ${issue.pageUrl}`,
74
+ `Message: ${issue.error.message}`,
75
+ issue.error.stack ?? issue.error.message,
76
+ ].join('\n');
77
+ }
78
+ if (issue.type === 'dialog') {
79
+ return formatBrowserDialogIssue(issue);
80
+ }
81
+ if (issue.type === 'pagecrash') {
82
+ return ['[pagecrash]', `Page: ${issue.pageUrl}`, 'The browser page crashed.'].join('\n');
83
+ }
84
+ return [
85
+ '[requestfailed]',
86
+ `${issue.method} ${issue.url}`,
87
+ `Resource: ${issue.resourceType}`,
88
+ `Frame: ${issue.frameUrl}`,
89
+ `Failure: ${issue.failureText}`,
90
+ ].join('\n');
91
+ }
92
+ export function matchesAllowlist(issue, allowlist) {
93
+ const searchableValues = issue.type === 'requestfailed'
94
+ ? [issue.url, issue.failureText, issue.frameUrl, issue.resourceType]
95
+ : issue.type === 'consoleerror'
96
+ ? [issue.text, issue.pageUrl, issue.location]
97
+ : issue.type === 'dialog'
98
+ ? getBrowserDialogIssueSearchableValues(issue)
99
+ : issue.type === 'weberror'
100
+ ? [issue.error?.message ?? '', issue.pageUrl]
101
+ : [issue.pageUrl];
102
+ return allowlist.some((entry) => {
103
+ if (entry.type !== issue.type)
104
+ return false;
105
+ return searchableValues.some((value) => {
106
+ entry.pattern.lastIndex = 0;
107
+ return entry.pattern.test(value);
108
+ });
109
+ });
110
+ }
111
+ export function isExpectedBrowserCancellation(issue) {
112
+ return issue.type === 'requestfailed' && issue.failureText === 'net::ERR_ABORTED';
113
+ }
114
+ export function isBrowserSynthesizedResourceLoadError(message) {
115
+ if (!message.text().startsWith('Failed to load resource: '))
116
+ return false;
117
+ const location = message.location();
118
+ if (location.lineNumber !== 0 || location.columnNumber !== 0)
119
+ return false;
120
+ // JS/CSS/WASM assets that 404 don't emit requestfailed, so let those through
121
+ // so that broken chunk loads are still detectable.
122
+ if (/\.(?:js|mjs|css|wasm)(?:[?#]|$)/i.test(location.url))
123
+ return false;
124
+ return true;
125
+ }
126
+ function isLocalUrl(value) {
127
+ try {
128
+ const { hostname } = new URL(value);
129
+ const normalizedHostname = hostname.replace(/^\[(.*)]$/, '$1');
130
+ return ['', 'localhost', '127.0.0.1', '::1'].includes(normalizedHostname);
131
+ }
132
+ catch {
133
+ return false;
134
+ }
135
+ }
136
+ export function isRetryableLocalConnectionLoss(issue) {
137
+ if (issue.type !== 'requestfailed')
138
+ return false;
139
+ const isLocalRequest = isLocalUrl(issue.url) &&
140
+ (issue.frameUrl === '(frame URL unavailable)' || isLocalUrl(issue.frameUrl));
141
+ if (!isLocalRequest)
142
+ return false;
143
+ if (issue.failureText === 'net::ERR_NETWORK_CHANGED')
144
+ return true;
145
+ return (issue.resourceType === 'document' &&
146
+ (issue.failureText === 'net::ERR_CONNECTION_RESET' ||
147
+ issue.failureText === 'net::ERR_CONNECTION_REFUSED'));
148
+ }
@@ -0,0 +1,22 @@
1
+ import { expect, type Browser, type BrowserContext, type Page } from '@playwright/test';
2
+ import { BrowserIssueMonitor } from './browser-errors.mts';
3
+ import type { MonitoredTestInfo } from './monitored-test-info.mts';
4
+ import type { BrowserIssueAllowlistEntry } from './browser-issue-records.mts';
5
+ import { type BlockedExternalNetworkRule } from './blocked-external-network.mts';
6
+ export interface BrowserTestOptions {
7
+ allowlist?: readonly BrowserIssueAllowlistEntry[];
8
+ assertTimeout?: (timeout: number, label: string) => void;
9
+ /** Replaces the default GTM/GA/DoubleClick rules; spread BLOCKED_EXTERNAL_NETWORK_RULES to extend them. */
10
+ rules?: readonly BlockedExternalNetworkRule[];
11
+ warningPattern?: RegExp;
12
+ }
13
+ interface BrowserErrorFixtures {
14
+ browserErrors: BrowserIssueMonitor;
15
+ }
16
+ export declare function createBrowserErrorsFixture(options?: BrowserTestOptions): ({ context }: {
17
+ context: BrowserContext;
18
+ }, run: (monitor: BrowserIssueMonitor) => Promise<void>, testInfo: MonitoredTestInfo) => Promise<void>;
19
+ export declare function createBrowserTest(options?: BrowserTestOptions): import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & BrowserErrorFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
20
+ export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & BrowserErrorFixtures, import("@playwright/test").PlaywrightWorkerArgs & import("@playwright/test").PlaywrightWorkerOptions>;
21
+ export { expect };
22
+ export declare function withMonitoredPage<T>(browserOrContext: Browser | BrowserContext, testInfo: MonitoredTestInfo, callback: (page: Page) => Promise<T>, options?: BrowserTestOptions): Promise<T>;
@@ -0,0 +1,68 @@
1
+ import { expect, test as base, } from '@playwright/test';
2
+ import { BrowserIssueMonitor } from "./browser-errors.mjs";
3
+ import { BLOCKED_EXTERNAL_NETWORK_RULES, blockedExternalRequestFailureAllowlist, installBlockedExternalNetwork, } from "./blocked-external-network.mjs";
4
+ function monitorOptions(options) {
5
+ const allowlist = [
6
+ ...(options.allowlist ?? blockedExternalRequestFailureAllowlist([], options.rules)),
7
+ ];
8
+ if (options.warningPattern === undefined)
9
+ return { allowlist };
10
+ return { allowlist, warningPattern: options.warningPattern };
11
+ }
12
+ export function createBrowserErrorsFixture(options = {}) {
13
+ const rules = options.rules ?? BLOCKED_EXTERNAL_NETWORK_RULES;
14
+ return async function browserErrorsFixture({ context }, run, testInfo) {
15
+ options.assertTimeout?.(testInfo.timeout, 'Playwright effective test timeout');
16
+ const monitor = new BrowserIssueMonitor(testInfo, monitorOptions(options));
17
+ await installBlockedExternalNetwork(context, rules);
18
+ monitor.monitorContext(context);
19
+ try {
20
+ try {
21
+ await run(monitor);
22
+ }
23
+ catch (error) {
24
+ await monitor.attachIssuesIfAny();
25
+ throw error;
26
+ }
27
+ if (testInfo.status === testInfo.expectedStatus)
28
+ await monitor.assertNoIssues();
29
+ else
30
+ await monitor.attachIssuesIfAny();
31
+ }
32
+ finally {
33
+ monitor.dispose();
34
+ }
35
+ };
36
+ }
37
+ export function createBrowserTest(options = {}) {
38
+ return base.extend({
39
+ browserErrors: [createBrowserErrorsFixture(options), { auto: true }],
40
+ });
41
+ }
42
+ export const test = createBrowserTest();
43
+ export { expect };
44
+ export async function withMonitoredPage(browserOrContext, testInfo, callback, options = {}) {
45
+ options.assertTimeout?.(testInfo.timeout, 'Playwright effective test timeout');
46
+ const monitor = new BrowserIssueMonitor(testInfo, monitorOptions(options));
47
+ const page = await browserOrContext.newPage();
48
+ let removeRoutes;
49
+ try {
50
+ removeRoutes = await installBlockedExternalNetwork(page.context(), options.rules ?? BLOCKED_EXTERNAL_NETWORK_RULES);
51
+ monitor.monitorContext(page.context());
52
+ let result;
53
+ try {
54
+ result = await callback(page);
55
+ }
56
+ catch (error) {
57
+ await monitor.attachIssuesIfAny();
58
+ throw error;
59
+ }
60
+ await monitor.assertNoIssues();
61
+ return result;
62
+ }
63
+ finally {
64
+ monitor.dispose();
65
+ await removeRoutes?.();
66
+ await page.close().catch(() => undefined);
67
+ }
68
+ }
@@ -0,0 +1,17 @@
1
+ import type { Page } from '@playwright/test';
2
+ interface ImageResponseGuard {
3
+ assertNoImageFailures(): void;
4
+ }
5
+ /**
6
+ * Registers response and requestfailed listeners on `page` to record any image
7
+ * requests that fail at the network level or return a non-2xx HTTP status.
8
+ *
9
+ * Call once at the top of a test, then call `assertNoImageFailures()` after the
10
+ * interaction under test completes. This is the network-level gate — it catches
11
+ * off-screen and lazy-loaded images that a visible-element poll cannot see.
12
+ *
13
+ * Any image failure during the test surfaces here. Ignore a known-flaky host in
14
+ * the caller's network policy instead of suppressing the error here.
15
+ */
16
+ export declare function installImageResponseGuard(page: Page): ImageResponseGuard;
17
+ export {};
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Registers response and requestfailed listeners on `page` to record any image
3
+ * requests that fail at the network level or return a non-2xx HTTP status.
4
+ *
5
+ * Call once at the top of a test, then call `assertNoImageFailures()` after the
6
+ * interaction under test completes. This is the network-level gate — it catches
7
+ * off-screen and lazy-loaded images that a visible-element poll cannot see.
8
+ *
9
+ * Any image failure during the test surfaces here. Ignore a known-flaky host in
10
+ * the caller's network policy instead of suppressing the error here.
11
+ */
12
+ export function installImageResponseGuard(page) {
13
+ const failures = [];
14
+ // Treat 2xx (success) and 3xx (304 Not Modified, redirect hops) as healthy — Playwright
15
+ // emits a response event for each hop, and the terminal response is what matters.
16
+ page.on('response', (response) => {
17
+ const status = response.status();
18
+ if (status >= 200 && status < 400)
19
+ return;
20
+ if (response.request().resourceType() === 'image') {
21
+ failures.push({ url: response.url(), status });
22
+ }
23
+ });
24
+ page.on('requestfailed', (request) => {
25
+ if (request.resourceType() === 'image') {
26
+ failures.push({ url: request.url(), status: null });
27
+ }
28
+ });
29
+ return {
30
+ assertNoImageFailures() {
31
+ if (failures.length === 0)
32
+ return;
33
+ const details = failures
34
+ .map((failure) => ` ${failure.status ?? 'failed'} ${failure.url}`)
35
+ .join('\n');
36
+ throw new Error(`${failures.length} image(s) failed to load:\n${details}`);
37
+ },
38
+ };
39
+ }
@@ -0,0 +1,32 @@
1
+ import TestLifecycleReporter from './test-lifecycle-reporter.mts';
2
+ export { BrowserIssueMonitor } from './browser-errors.mts';
3
+ export type { BrowserIssueAllowlistEntry } from './browser-issue-records.mts';
4
+ export { createDialogIssue, formatBrowserDialogIssue, getBrowserDialogIssueSearchableValues, getPageUrl, } from './browser-dialog-issues.mts';
5
+ export type { BrowserDialogIssue } from './browser-dialog-issues.mts';
6
+ export { createConsoleErrorIssue, createPageCrashIssue, createRequestFailedIssue, createWebErrorIssue, formatBrowserIssue, isBrowserSynthesizedResourceLoadError, isExpectedBrowserCancellation, isRetryableLocalConnectionLoss, matchesAllowlist, validateAllowlist, } from './browser-issue-records.mts';
7
+ export type { BrowserIssue } from './browser-issue-records.mts';
8
+ export { BLOCKED_EXTERNAL_NETWORK_RULES, blockedExternalRequestFailureAllowlist, installBlockedExternalNetwork, isBlockedExternalNetworkUrl, } from './blocked-external-network.mts';
9
+ export type { BlockedExternalNetworkRule } from './blocked-external-network.mts';
10
+ export { createBrowserErrorsFixture, createBrowserTest, expect, test, withMonitoredPage, } from './browser-test.mts';
11
+ export type { BrowserTestOptions } from './browser-test.mts';
12
+ export type { MonitoredTestInfo } from './monitored-test-info.mts';
13
+ export type { Browser, BrowserContext, Locator, Page, Request, TestInfo } from '@playwright/test';
14
+ export { navigateTo } from './navigate-to.mts';
15
+ export { retryOnConnectionLost } from './retry-on-connection-lost.mts';
16
+ export { forceMainScrollableBeforeHydration, scrollToLoadMore } from './scroll-to-load-more.mts';
17
+ export { DEFAULT_TURNSTILE_STUB_ATTRIBUTE, DEFAULT_TURNSTILE_STUB_TOKEN, installTurnstileStub, } from './turnstile-stub.mts';
18
+ export type { TurnstileStubOptions } from './turnstile-stub.mts';
19
+ export { waitForBelowFoldHydration } from './wait-for-hydration.mts';
20
+ export { requireTestValue } from './assertions.mts';
21
+ export { installImageResponseGuard } from './expect-no-broken-images.mts';
22
+ export { assertNoHorizontalScroll, getHorizontalOverflowState } from './mobile-assertions.mts';
23
+ export type { HorizontalOverflowState } from './mobile-assertions.mts';
24
+ export { openRadixDropdown } from './radix-select.mts';
25
+ export { randomSuffix } from './random-id.mts';
26
+ export { storybookBundleHasStory } from './storybook.mts';
27
+ export { TEST_PNG } from './test-fixtures.mts';
28
+ export { TestLifecycleReporter };
29
+ export type { TestLifecycleReporterOptions } from './test-lifecycle-reporter.mts';
30
+ export { generateTotpCode } from './totp.mts';
31
+ export { DESKTOP_VIEWPORT, MOBILE_VIEWPORTS } from './viewport-constants.mts';
32
+ export { setupVirtualAuthenticator } from './virtual-authenticator.mts';
@@ -0,0 +1,22 @@
1
+ import TestLifecycleReporter from "./test-lifecycle-reporter.mjs";
2
+ export { BrowserIssueMonitor } from "./browser-errors.mjs";
3
+ export { createDialogIssue, formatBrowserDialogIssue, getBrowserDialogIssueSearchableValues, getPageUrl, } from "./browser-dialog-issues.mjs";
4
+ export { createConsoleErrorIssue, createPageCrashIssue, createRequestFailedIssue, createWebErrorIssue, formatBrowserIssue, isBrowserSynthesizedResourceLoadError, isExpectedBrowserCancellation, isRetryableLocalConnectionLoss, matchesAllowlist, validateAllowlist, } from "./browser-issue-records.mjs";
5
+ export { BLOCKED_EXTERNAL_NETWORK_RULES, blockedExternalRequestFailureAllowlist, installBlockedExternalNetwork, isBlockedExternalNetworkUrl, } from "./blocked-external-network.mjs";
6
+ export { createBrowserErrorsFixture, createBrowserTest, expect, test, withMonitoredPage, } from "./browser-test.mjs";
7
+ export { navigateTo } from "./navigate-to.mjs";
8
+ export { retryOnConnectionLost } from "./retry-on-connection-lost.mjs";
9
+ export { forceMainScrollableBeforeHydration, scrollToLoadMore } from "./scroll-to-load-more.mjs";
10
+ export { DEFAULT_TURNSTILE_STUB_ATTRIBUTE, DEFAULT_TURNSTILE_STUB_TOKEN, installTurnstileStub, } from "./turnstile-stub.mjs";
11
+ export { waitForBelowFoldHydration } from "./wait-for-hydration.mjs";
12
+ export { requireTestValue } from "./assertions.mjs";
13
+ export { installImageResponseGuard } from "./expect-no-broken-images.mjs";
14
+ export { assertNoHorizontalScroll, getHorizontalOverflowState } from "./mobile-assertions.mjs";
15
+ export { openRadixDropdown } from "./radix-select.mjs";
16
+ export { randomSuffix } from "./random-id.mjs";
17
+ export { storybookBundleHasStory } from "./storybook.mjs";
18
+ export { TEST_PNG } from "./test-fixtures.mjs";
19
+ export { TestLifecycleReporter };
20
+ export { generateTotpCode } from "./totp.mjs";
21
+ export { DESKTOP_VIEWPORT, MOBILE_VIEWPORTS } from "./viewport-constants.mjs";
22
+ export { setupVirtualAuthenticator } from "./virtual-authenticator.mjs";
@@ -0,0 +1,14 @@
1
+ import { type Page } from '@playwright/test';
2
+ export interface HorizontalOverflowState {
3
+ overflow: boolean;
4
+ scrollWidth: number;
5
+ clientWidth: number;
6
+ offenders: Array<{
7
+ tag: string;
8
+ id: string;
9
+ cls: string;
10
+ right: number;
11
+ }>;
12
+ }
13
+ export declare function getHorizontalOverflowState(): HorizontalOverflowState;
14
+ export declare function assertNoHorizontalScroll(page: Page): Promise<void>;
@@ -0,0 +1,43 @@
1
+ import { expect } from '@playwright/test';
2
+ export function getHorizontalOverflowState() {
3
+ const root = globalThis.document;
4
+ const scrollWidth = root.documentElement.scrollWidth;
5
+ const clientWidth = root.documentElement.clientWidth;
6
+ if (scrollWidth <= clientWidth) {
7
+ return { overflow: false, scrollWidth, clientWidth, offenders: [] };
8
+ }
9
+ const offenders = [];
10
+ for (const element of root.querySelectorAll('*')) {
11
+ const rect = element.getBoundingClientRect();
12
+ if (rect.right > clientWidth + 1) {
13
+ offenders.push({
14
+ tag: element.tagName,
15
+ id: element.id,
16
+ cls: (element.getAttribute('class') ?? '').slice(0, 60),
17
+ right: Math.round(rect.right),
18
+ });
19
+ }
20
+ }
21
+ return { overflow: true, scrollWidth, clientWidth, offenders: offenders.slice(0, 10) };
22
+ }
23
+ export async function assertNoHorizontalScroll(page) {
24
+ // Poll until layout settles — CSS transitions like
25
+ // sidebar collapse may briefly cause scrollWidth > clientWidth.
26
+ const state = { lastResult: null };
27
+ try {
28
+ await expect
29
+ .poll(async () => {
30
+ state.lastResult = await page.evaluate(getHorizontalOverflowState);
31
+ return state.lastResult.overflow;
32
+ }, { timeout: 5000, intervals: [50, 100] })
33
+ .toBe(false);
34
+ }
35
+ catch (err) {
36
+ // Log only once after all retries are exhausted
37
+ const { lastResult } = state;
38
+ if (lastResult?.overflow) {
39
+ console.error(`Horizontal overflow detected: scrollWidth=${lastResult.scrollWidth} clientWidth=${lastResult.clientWidth}\nOffending elements:`, JSON.stringify(lastResult.offenders, null, 2));
40
+ }
41
+ throw err;
42
+ }
43
+ }
@@ -0,0 +1,14 @@
1
+ import type { TestInfo } from '@playwright/test';
2
+ /**
3
+ * The members of Playwright's `TestInfo` that the browser-issue helpers read or call.
4
+ * A real `TestInfo` is assignable to it, and so is a small object literal.
5
+ */
6
+ export interface MonitoredTestInfo {
7
+ attach(name: string, options: {
8
+ body: Buffer;
9
+ contentType: string;
10
+ }): Promise<void>;
11
+ readonly expectedStatus: TestInfo['expectedStatus'];
12
+ readonly status?: TestInfo['status'];
13
+ readonly timeout: number;
14
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { Page } from '@playwright/test';
2
+ import { retryOnConnectionLost } from './retry-on-connection-lost.mts';
3
+ import { installTurnstileStub } from './turnstile-stub.mts';
4
+ /**
5
+ * Navigate to a URL and wait for network idle (or a custom wait state).
6
+ * Always use this instead of raw page.goto() to avoid flaky tests
7
+ * caused by interacting with pages before they've fully loaded.
8
+ *
9
+ * Installs the Turnstile stub once per page (see turnstile-stub.mts) so the
10
+ * widget script does not keep third-party traffic alive past the navigation
11
+ * timeout. Pass `dependencies.installTurnstileStub` to replace that install.
12
+ *
13
+ * Retries transient connection errors (ERR_CONNECTION_REFUSED / RESET) using
14
+ * bounded retries and 5s backoff to absorb cold starts.
15
+ *
16
+ * Pass `waitUntil: 'load'` for pages with a connection that stays open and
17
+ * never reaches networkidle.
18
+ *
19
+ * Safe for URLs that redirect on the client — the readiness wait restarts against
20
+ * whichever document the redirect lands on (see wait-for-hydration.mts).
21
+ */
22
+ export declare function navigateTo(page: Page, url: string, { waitUntil }?: {
23
+ waitUntil?: "load" | "networkidle" | undefined;
24
+ }, dependencies?: Partial<{
25
+ installTurnstileStub: typeof installTurnstileStub;
26
+ retryOnConnectionLost: typeof retryOnConnectionLost;
27
+ }>): Promise<void>;
@@ -0,0 +1,39 @@
1
+ import { retryOnConnectionLost } from "./retry-on-connection-lost.mjs";
2
+ import { installTurnstileStub } from "./turnstile-stub.mjs";
3
+ import { waitForBelowFoldHydration } from "./wait-for-hydration.mjs";
4
+ /**
5
+ * Navigate to a URL and wait for network idle (or a custom wait state).
6
+ * Always use this instead of raw page.goto() to avoid flaky tests
7
+ * caused by interacting with pages before they've fully loaded.
8
+ *
9
+ * Installs the Turnstile stub once per page (see turnstile-stub.mts) so the
10
+ * widget script does not keep third-party traffic alive past the navigation
11
+ * timeout. Pass `dependencies.installTurnstileStub` to replace that install.
12
+ *
13
+ * Retries transient connection errors (ERR_CONNECTION_REFUSED / RESET) using
14
+ * bounded retries and 5s backoff to absorb cold starts.
15
+ *
16
+ * Pass `waitUntil: 'load'` for pages with a connection that stays open and
17
+ * never reaches networkidle.
18
+ *
19
+ * Safe for URLs that redirect on the client — the readiness wait restarts against
20
+ * whichever document the redirect lands on (see wait-for-hydration.mts).
21
+ */
22
+ export async function navigateTo(page, url, { waitUntil = 'networkidle' } = {}, dependencies) {
23
+ const installStub = dependencies?.installTurnstileStub ?? installTurnstileStub;
24
+ const retry = dependencies?.retryOnConnectionLost ?? retryOnConnectionLost;
25
+ await installStub(page);
26
+ await retry(async () => {
27
+ await page.goto(url, { waitUntil: 'domcontentloaded' });
28
+ await page.waitForLoadState(waitUntil);
29
+ // React 19 + React Compiler can attach above-fold handlers after networkidle on
30
+ // slower machines. This bounded idle probe reduces that race but cannot prove
31
+ // every handler is wired; a control that rejects early interaction owns a
32
+ // disabled-until-hydrated boundary, and tests assert that boundary is enabled.
33
+ //
34
+ // A route that redirects on the client can reach `waitUntil` before the
35
+ // redirect fires, so pass it through: if the redirect lands mid-wait, the
36
+ // replacement document is settled to the same state this call asked for.
37
+ await waitForBelowFoldHydration(page, { waitUntil });
38
+ });
39
+ }
@@ -0,0 +1,18 @@
1
+ import type { Locator } from '@playwright/test';
2
+ /**
3
+ * Opens a Radix UI Select or DropdownMenu by pressing Space on the trigger.
4
+ *
5
+ * Radix portals the dropdown content outside the trigger's DOM subtree, so the
6
+ * trigger must be focused first; Space is the reliable keyboard activation path
7
+ * (ArrowDown also works for DropdownMenu but Space is universal for both).
8
+ *
9
+ * After calling this, wait for the option you want with `toBeAttached()` before
10
+ * clicking — not `toBeVisible()`. Radix items are attached to the DOM immediately
11
+ * but may not pass the visibility check until the CSS animation settles.
12
+ *
13
+ * @example
14
+ * await openRadixDropdown(page.getByTestId('sort-trigger'))
15
+ * await expect(page.getByTestId('sort-option-new')).toBeAttached()
16
+ * await page.getByTestId('sort-option-new').click()
17
+ */
18
+ export declare function openRadixDropdown(trigger: Locator): Promise<void>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Opens a Radix UI Select or DropdownMenu by pressing Space on the trigger.
3
+ *
4
+ * Radix portals the dropdown content outside the trigger's DOM subtree, so the
5
+ * trigger must be focused first; Space is the reliable keyboard activation path
6
+ * (ArrowDown also works for DropdownMenu but Space is universal for both).
7
+ *
8
+ * After calling this, wait for the option you want with `toBeAttached()` before
9
+ * clicking — not `toBeVisible()`. Radix items are attached to the DOM immediately
10
+ * but may not pass the visibility check until the CSS animation settles.
11
+ *
12
+ * @example
13
+ * await openRadixDropdown(page.getByTestId('sort-trigger'))
14
+ * await expect(page.getByTestId('sort-option-new')).toBeAttached()
15
+ * await page.getByTestId('sort-option-new').click()
16
+ */
17
+ export async function openRadixDropdown(trigger) {
18
+ await trigger.press(' ');
19
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Generate a short random suffix for unique-ID-style usage in Playwright tests.
3
+ * Use this instead of `Date.now()`, which can collide between parallel workers
4
+ * and which returns different values when called twice in the same test.
5
+ *
6
+ * The suffix is 12 lowercase hex characters (about 48 bits of entropy), which
7
+ * is plenty for slug/title/hostname uniqueness while remaining short and
8
+ * readable in CI logs and screenshots.
9
+ *
10
+ * Compute the suffix once per test and reuse it everywhere a related ID is
11
+ * needed (slug, name, hostname, etc.) so all values stay consistent:
12
+ *
13
+ * ```ts
14
+ * const suffix = randomSuffix()
15
+ * await insertRecord(`Example ${suffix}`, `example-${suffix}`)
16
+ * ```
17
+ *
18
+ * If a `beforeAll` hook seeds data shared by a `describe` block (or a whole
19
+ * file), call `randomSuffix()` *inside* that hook, not at module/describe
20
+ * scope. Playwright's `fullyParallel` scheduler can hand a worker a second
21
+ * test from the same file, re-running `beforeAll` with module scope intact —
22
+ * a suffix hoisted outside the hook stays the same across that re-entry and
23
+ * produces the same slug/name twice, which throws on any unique column.
24
+ * Assign it as the first statement of the hook so every entry mints a fresh value:
25
+ *
26
+ * ```ts
27
+ * let suffix = ''
28
+ * test.beforeAll(async () => {
29
+ * suffix = randomSuffix()
30
+ * await insertRecord(`Example ${suffix}`, `example-${suffix}`)
31
+ * })
32
+ * ```
33
+ */
34
+ export declare function randomSuffix(): string;
@@ -0,0 +1,37 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ /**
3
+ * Generate a short random suffix for unique-ID-style usage in Playwright tests.
4
+ * Use this instead of `Date.now()`, which can collide between parallel workers
5
+ * and which returns different values when called twice in the same test.
6
+ *
7
+ * The suffix is 12 lowercase hex characters (about 48 bits of entropy), which
8
+ * is plenty for slug/title/hostname uniqueness while remaining short and
9
+ * readable in CI logs and screenshots.
10
+ *
11
+ * Compute the suffix once per test and reuse it everywhere a related ID is
12
+ * needed (slug, name, hostname, etc.) so all values stay consistent:
13
+ *
14
+ * ```ts
15
+ * const suffix = randomSuffix()
16
+ * await insertRecord(`Example ${suffix}`, `example-${suffix}`)
17
+ * ```
18
+ *
19
+ * If a `beforeAll` hook seeds data shared by a `describe` block (or a whole
20
+ * file), call `randomSuffix()` *inside* that hook, not at module/describe
21
+ * scope. Playwright's `fullyParallel` scheduler can hand a worker a second
22
+ * test from the same file, re-running `beforeAll` with module scope intact —
23
+ * a suffix hoisted outside the hook stays the same across that re-entry and
24
+ * produces the same slug/name twice, which throws on any unique column.
25
+ * Assign it as the first statement of the hook so every entry mints a fresh value:
26
+ *
27
+ * ```ts
28
+ * let suffix = ''
29
+ * test.beforeAll(async () => {
30
+ * suffix = randomSuffix()
31
+ * await insertRecord(`Example ${suffix}`, `example-${suffix}`)
32
+ * })
33
+ * ```
34
+ */
35
+ export function randomSuffix() {
36
+ return randomUUID().replaceAll('-', '').slice(0, 12);
37
+ }
@@ -0,0 +1,7 @@
1
+ interface RetryOnConnectionLostOptions {
2
+ backoffMs?: number;
3
+ maxRetries?: number;
4
+ maxDurationMs?: number;
5
+ }
6
+ export declare function retryOnConnectionLost<T>(fn: () => Promise<T>, options?: RetryOnConnectionLostOptions): Promise<T>;
7
+ export {};