@stablyai/internal-playwright 0.1.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 (297) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +168 -0
  4. package/ThirdPartyNotices.txt +6277 -0
  5. package/cli.js +19 -0
  6. package/index.d.ts +17 -0
  7. package/index.js +17 -0
  8. package/index.mjs +18 -0
  9. package/jsx-runtime.js +42 -0
  10. package/jsx-runtime.mjs +21 -0
  11. package/lib/agents/generateAgents.js +265 -0
  12. package/lib/agents/generator.md +102 -0
  13. package/lib/agents/healer.md +78 -0
  14. package/lib/agents/planner.md +135 -0
  15. package/lib/cli.js +274 -0
  16. package/lib/common/config.js +274 -0
  17. package/lib/common/config.js.map +7 -0
  18. package/lib/common/configLoader.js +377 -0
  19. package/lib/common/configLoader.js.map +7 -0
  20. package/lib/common/esmLoaderHost.js +102 -0
  21. package/lib/common/esmLoaderHost.js.map +7 -0
  22. package/lib/common/expectBundle.js +52 -0
  23. package/lib/common/expectBundle.js.map +7 -0
  24. package/lib/common/expectBundleImpl.js +389 -0
  25. package/lib/common/expectBundleImpl.js.map +7 -0
  26. package/lib/common/fixtures.js +302 -0
  27. package/lib/common/fixtures.js.map +7 -0
  28. package/lib/common/globals.js +58 -0
  29. package/lib/common/globals.js.map +7 -0
  30. package/lib/common/ipc.js +60 -0
  31. package/lib/common/ipc.js.map +7 -0
  32. package/lib/common/poolBuilder.js +85 -0
  33. package/lib/common/poolBuilder.js.map +7 -0
  34. package/lib/common/process.js +104 -0
  35. package/lib/common/process.js.map +7 -0
  36. package/lib/common/suiteUtils.js +140 -0
  37. package/lib/common/suiteUtils.js.map +7 -0
  38. package/lib/common/test.js +321 -0
  39. package/lib/common/test.js.map +7 -0
  40. package/lib/common/testLoader.js +100 -0
  41. package/lib/common/testLoader.js.map +7 -0
  42. package/lib/common/testType.js +310 -0
  43. package/lib/common/testType.js.map +7 -0
  44. package/lib/fsWatcher.js +67 -0
  45. package/lib/fsWatcher.js.map +7 -0
  46. package/lib/index.js +696 -0
  47. package/lib/index.js.map +7 -0
  48. package/lib/internalsForTest.js +42 -0
  49. package/lib/internalsForTest.js.map +7 -0
  50. package/lib/isomorphic/events.js +77 -0
  51. package/lib/isomorphic/events.js.map +7 -0
  52. package/lib/isomorphic/folders.js +30 -0
  53. package/lib/isomorphic/folders.js.map +7 -0
  54. package/lib/isomorphic/stringInternPool.js +69 -0
  55. package/lib/isomorphic/stringInternPool.js.map +7 -0
  56. package/lib/isomorphic/teleReceiver.js +507 -0
  57. package/lib/isomorphic/teleReceiver.js.map +7 -0
  58. package/lib/isomorphic/teleSuiteUpdater.js +137 -0
  59. package/lib/isomorphic/teleSuiteUpdater.js.map +7 -0
  60. package/lib/isomorphic/testServerConnection.js +211 -0
  61. package/lib/isomorphic/testServerConnection.js.map +7 -0
  62. package/lib/isomorphic/testServerInterface.js +16 -0
  63. package/lib/isomorphic/testServerInterface.js.map +7 -0
  64. package/lib/isomorphic/testTree.js +334 -0
  65. package/lib/isomorphic/testTree.js.map +7 -0
  66. package/lib/isomorphic/types.d.js +16 -0
  67. package/lib/isomorphic/types.d.js.map +7 -0
  68. package/lib/loader/loaderMain.js +59 -0
  69. package/lib/loader/loaderMain.js.map +7 -0
  70. package/lib/matchers/expect.js +325 -0
  71. package/lib/matchers/expect.js.map +7 -0
  72. package/lib/matchers/matcherHint.js +87 -0
  73. package/lib/matchers/matcherHint.js.map +7 -0
  74. package/lib/matchers/matchers.js +366 -0
  75. package/lib/matchers/matchers.js.map +7 -0
  76. package/lib/matchers/toBeTruthy.js +73 -0
  77. package/lib/matchers/toBeTruthy.js.map +7 -0
  78. package/lib/matchers/toEqual.js +99 -0
  79. package/lib/matchers/toEqual.js.map +7 -0
  80. package/lib/matchers/toHaveURL.js +102 -0
  81. package/lib/matchers/toHaveURL.js.map +7 -0
  82. package/lib/matchers/toMatchAriaSnapshot.js +159 -0
  83. package/lib/matchers/toMatchAriaSnapshot.js.map +7 -0
  84. package/lib/matchers/toMatchSnapshot.js +359 -0
  85. package/lib/matchers/toMatchSnapshot.js.map +7 -0
  86. package/lib/matchers/toMatchText.js +99 -0
  87. package/lib/matchers/toMatchText.js.map +7 -0
  88. package/lib/mcp/browser/actions.d.js +16 -0
  89. package/lib/mcp/browser/backend.js +93 -0
  90. package/lib/mcp/browser/backend.js.map +7 -0
  91. package/lib/mcp/browser/browserContextFactory.js +296 -0
  92. package/lib/mcp/browser/browserServerBackend.js +76 -0
  93. package/lib/mcp/browser/codegen.js +66 -0
  94. package/lib/mcp/browser/config.js +385 -0
  95. package/lib/mcp/browser/context.js +287 -0
  96. package/lib/mcp/browser/response.js +228 -0
  97. package/lib/mcp/browser/sessionLog.js +160 -0
  98. package/lib/mcp/browser/tab.js +277 -0
  99. package/lib/mcp/browser/tool.js +30 -0
  100. package/lib/mcp/browser/tool.js.map +7 -0
  101. package/lib/mcp/browser/tools/common.js +63 -0
  102. package/lib/mcp/browser/tools/console.js +44 -0
  103. package/lib/mcp/browser/tools/dialogs.js +60 -0
  104. package/lib/mcp/browser/tools/evaluate.js +70 -0
  105. package/lib/mcp/browser/tools/files.js +58 -0
  106. package/lib/mcp/browser/tools/form.js +74 -0
  107. package/lib/mcp/browser/tools/install.js +69 -0
  108. package/lib/mcp/browser/tools/keyboard.js +85 -0
  109. package/lib/mcp/browser/tools/mouse.js +107 -0
  110. package/lib/mcp/browser/tools/navigate.js +62 -0
  111. package/lib/mcp/browser/tools/network.js +54 -0
  112. package/lib/mcp/browser/tools/pdf.js +59 -0
  113. package/lib/mcp/browser/tools/screenshot.js +88 -0
  114. package/lib/mcp/browser/tools/snapshot.js +182 -0
  115. package/lib/mcp/browser/tools/tabs.js +67 -0
  116. package/lib/mcp/browser/tools/tool.js +49 -0
  117. package/lib/mcp/browser/tools/tracing.js +74 -0
  118. package/lib/mcp/browser/tools/utils.js +100 -0
  119. package/lib/mcp/browser/tools/verify.js +154 -0
  120. package/lib/mcp/browser/tools/wait.js +63 -0
  121. package/lib/mcp/browser/tools.js +80 -0
  122. package/lib/mcp/browser/tools.js.map +7 -0
  123. package/lib/mcp/browser/watchdog.js +44 -0
  124. package/lib/mcp/config.d.js +16 -0
  125. package/lib/mcp/extension/cdpRelay.js +351 -0
  126. package/lib/mcp/extension/extensionContextFactory.js +75 -0
  127. package/lib/mcp/extension/protocol.js +28 -0
  128. package/lib/mcp/index.js +61 -0
  129. package/lib/mcp/log.js +35 -0
  130. package/lib/mcp/program.js +96 -0
  131. package/lib/mcp/sdk/bundle.js +81 -0
  132. package/lib/mcp/sdk/bundle.js.map +7 -0
  133. package/lib/mcp/sdk/call.js +49 -0
  134. package/lib/mcp/sdk/call.js.map +7 -0
  135. package/lib/mcp/sdk/exports.js +32 -0
  136. package/lib/mcp/sdk/exports.js.map +7 -0
  137. package/lib/mcp/sdk/http.js +187 -0
  138. package/lib/mcp/sdk/http.js.map +7 -0
  139. package/lib/mcp/sdk/inProcessTransport.js +71 -0
  140. package/lib/mcp/sdk/inProcessTransport.js.map +7 -0
  141. package/lib/mcp/sdk/mdb.js +206 -0
  142. package/lib/mcp/sdk/mdb.js.map +7 -0
  143. package/lib/mcp/sdk/proxyBackend.js +128 -0
  144. package/lib/mcp/sdk/proxyBackend.js.map +7 -0
  145. package/lib/mcp/sdk/server.js +189 -0
  146. package/lib/mcp/sdk/server.js.map +7 -0
  147. package/lib/mcp/sdk/tool.js +51 -0
  148. package/lib/mcp/sdk/tool.js.map +7 -0
  149. package/lib/mcp/test/backend.js +67 -0
  150. package/lib/mcp/test/backend.js.map +7 -0
  151. package/lib/mcp/test/browserBackend.js +98 -0
  152. package/lib/mcp/test/context.js +48 -0
  153. package/lib/mcp/test/context.js.map +7 -0
  154. package/lib/mcp/test/generatorTools.js +122 -0
  155. package/lib/mcp/test/plannerTools.js +46 -0
  156. package/lib/mcp/test/seed.js +72 -0
  157. package/lib/mcp/test/streams.js +39 -0
  158. package/lib/mcp/test/streams.js.map +7 -0
  159. package/lib/mcp/test/testBackend.js +97 -0
  160. package/lib/mcp/test/testContext.js +176 -0
  161. package/lib/mcp/test/testTool.js +30 -0
  162. package/lib/mcp/test/testTools.js +115 -0
  163. package/lib/mcp/test/tool.js +30 -0
  164. package/lib/mcp/test/tool.js.map +7 -0
  165. package/lib/mcp/test/tools.js +150 -0
  166. package/lib/mcp/test/tools.js.map +7 -0
  167. package/lib/mcp/vscode/host.js +187 -0
  168. package/lib/mcp/vscode/main.js +77 -0
  169. package/lib/mcpBundleImpl.js +41 -0
  170. package/lib/mcpBundleImpl.js.map +7 -0
  171. package/lib/plugins/gitCommitInfoPlugin.js +198 -0
  172. package/lib/plugins/gitCommitInfoPlugin.js.map +7 -0
  173. package/lib/plugins/index.js +28 -0
  174. package/lib/plugins/index.js.map +7 -0
  175. package/lib/plugins/webServerPlugin.js +209 -0
  176. package/lib/plugins/webServerPlugin.js.map +7 -0
  177. package/lib/program.js +412 -0
  178. package/lib/program.js.map +7 -0
  179. package/lib/reporters/base.js +609 -0
  180. package/lib/reporters/base.js.map +7 -0
  181. package/lib/reporters/blob.js +135 -0
  182. package/lib/reporters/blob.js.map +7 -0
  183. package/lib/reporters/dot.js +82 -0
  184. package/lib/reporters/dot.js.map +7 -0
  185. package/lib/reporters/empty.js +32 -0
  186. package/lib/reporters/empty.js.map +7 -0
  187. package/lib/reporters/github.js +128 -0
  188. package/lib/reporters/github.js.map +7 -0
  189. package/lib/reporters/html.js +644 -0
  190. package/lib/reporters/html.js.map +7 -0
  191. package/lib/reporters/internalReporter.js +130 -0
  192. package/lib/reporters/internalReporter.js.map +7 -0
  193. package/lib/reporters/json.js +254 -0
  194. package/lib/reporters/json.js.map +7 -0
  195. package/lib/reporters/junit.js +230 -0
  196. package/lib/reporters/junit.js.map +7 -0
  197. package/lib/reporters/line.js +113 -0
  198. package/lib/reporters/line.js.map +7 -0
  199. package/lib/reporters/list.js +235 -0
  200. package/lib/reporters/list.js.map +7 -0
  201. package/lib/reporters/listModeReporter.js +69 -0
  202. package/lib/reporters/listModeReporter.js.map +7 -0
  203. package/lib/reporters/markdown.js +144 -0
  204. package/lib/reporters/markdown.js.map +7 -0
  205. package/lib/reporters/merge.js +535 -0
  206. package/lib/reporters/merge.js.map +7 -0
  207. package/lib/reporters/multiplexer.js +104 -0
  208. package/lib/reporters/multiplexer.js.map +7 -0
  209. package/lib/reporters/reporterV2.js +102 -0
  210. package/lib/reporters/reporterV2.js.map +7 -0
  211. package/lib/reporters/teleEmitter.js +297 -0
  212. package/lib/reporters/teleEmitter.js.map +7 -0
  213. package/lib/reporters/versions/blobV1.js +16 -0
  214. package/lib/reporters/versions/blobV1.js.map +7 -0
  215. package/lib/runner/dispatcher.js +491 -0
  216. package/lib/runner/dispatcher.js.map +7 -0
  217. package/lib/runner/failureTracker.js +72 -0
  218. package/lib/runner/failureTracker.js.map +7 -0
  219. package/lib/runner/lastRun.js +77 -0
  220. package/lib/runner/lastRun.js.map +7 -0
  221. package/lib/runner/loadUtils.js +333 -0
  222. package/lib/runner/loadUtils.js.map +7 -0
  223. package/lib/runner/loaderHost.js +89 -0
  224. package/lib/runner/loaderHost.js.map +7 -0
  225. package/lib/runner/processHost.js +161 -0
  226. package/lib/runner/processHost.js.map +7 -0
  227. package/lib/runner/projectUtils.js +241 -0
  228. package/lib/runner/projectUtils.js.map +7 -0
  229. package/lib/runner/rebase.js +189 -0
  230. package/lib/runner/rebase.js.map +7 -0
  231. package/lib/runner/reporters.js +137 -0
  232. package/lib/runner/reporters.js.map +7 -0
  233. package/lib/runner/runner.js +173 -0
  234. package/lib/runner/sigIntWatcher.js +96 -0
  235. package/lib/runner/sigIntWatcher.js.map +7 -0
  236. package/lib/runner/taskRunner.js +127 -0
  237. package/lib/runner/taskRunner.js.map +7 -0
  238. package/lib/runner/tasks.js +410 -0
  239. package/lib/runner/tasks.js.map +7 -0
  240. package/lib/runner/testGroups.js +117 -0
  241. package/lib/runner/testGroups.js.map +7 -0
  242. package/lib/runner/testRunner.js +390 -0
  243. package/lib/runner/testRunner.js.map +7 -0
  244. package/lib/runner/testServer.js +264 -0
  245. package/lib/runner/testServer.js.map +7 -0
  246. package/lib/runner/uiMode.js +271 -0
  247. package/lib/runner/uiModeReporter.js +30 -0
  248. package/lib/runner/uiModeReporter.js.map +7 -0
  249. package/lib/runner/vcs.js +72 -0
  250. package/lib/runner/vcs.js.map +7 -0
  251. package/lib/runner/watchMode.js +395 -0
  252. package/lib/runner/watchMode.js.map +7 -0
  253. package/lib/runner/workerHost.js +95 -0
  254. package/lib/runner/workerHost.js.map +7 -0
  255. package/lib/store.js +98 -0
  256. package/lib/third_party/pirates.js +62 -0
  257. package/lib/third_party/pirates.js.map +7 -0
  258. package/lib/third_party/tsconfig-loader.js +103 -0
  259. package/lib/third_party/tsconfig-loader.js.map +7 -0
  260. package/lib/transform/babelBundle.js +43 -0
  261. package/lib/transform/babelBundle.js.map +7 -0
  262. package/lib/transform/babelBundleImpl.js +461 -0
  263. package/lib/transform/babelBundleImpl.js.map +7 -0
  264. package/lib/transform/compilationCache.js +272 -0
  265. package/lib/transform/compilationCache.js.map +7 -0
  266. package/lib/transform/esmLoader.js +104 -0
  267. package/lib/transform/esmLoader.js.map +7 -0
  268. package/lib/transform/esmUtils.js +32 -0
  269. package/lib/transform/portTransport.js +67 -0
  270. package/lib/transform/portTransport.js.map +7 -0
  271. package/lib/transform/transform.js +293 -0
  272. package/lib/transform/transform.js.map +7 -0
  273. package/lib/util.js +403 -0
  274. package/lib/util.js.map +7 -0
  275. package/lib/utilsBundle.js +43 -0
  276. package/lib/utilsBundle.js.map +7 -0
  277. package/lib/utilsBundleImpl.js +100 -0
  278. package/lib/utilsBundleImpl.js.map +7 -0
  279. package/lib/worker/fixtureRunner.js +258 -0
  280. package/lib/worker/fixtureRunner.js.map +7 -0
  281. package/lib/worker/stepContext.js +34 -0
  282. package/lib/worker/testInfo.js +508 -0
  283. package/lib/worker/testInfo.js.map +7 -0
  284. package/lib/worker/testTracing.js +344 -0
  285. package/lib/worker/testTracing.js.map +7 -0
  286. package/lib/worker/timeoutManager.js +174 -0
  287. package/lib/worker/timeoutManager.js.map +7 -0
  288. package/lib/worker/util.js +31 -0
  289. package/lib/worker/util.js.map +7 -0
  290. package/lib/worker/workerMain.js +520 -0
  291. package/lib/worker/workerMain.js.map +7 -0
  292. package/package.json +74 -0
  293. package/test.d.ts +18 -0
  294. package/test.js +24 -0
  295. package/test.mjs +33 -0
  296. package/types/test.d.ts +10217 -0
  297. package/types/testReporter.d.ts +816 -0
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var fixtureRunner_exports = {};
20
+ __export(fixtureRunner_exports, {
21
+ FixtureRunner: () => FixtureRunner
22
+ });
23
+ module.exports = __toCommonJS(fixtureRunner_exports);
24
+ var import_utils = require("playwright-core/lib/utils");
25
+ var import_fixtures = require("../common/fixtures");
26
+ var import_util = require("../util");
27
+ class Fixture {
28
+ constructor(runner, registration) {
29
+ this.failed = false;
30
+ this._deps = /* @__PURE__ */ new Set();
31
+ this._usages = /* @__PURE__ */ new Set();
32
+ this.runner = runner;
33
+ this.registration = registration;
34
+ this.value = null;
35
+ const isUserFixture = this.registration.location && (0, import_util.filterStackFile)(this.registration.location.file);
36
+ const title = this.registration.customTitle || this.registration.name;
37
+ const location = isUserFixture ? this.registration.location : void 0;
38
+ this._stepInfo = { title: `Fixture ${(0, import_utils.escapeWithQuotes)(title, '"')}`, category: "fixture", location };
39
+ if (this.registration.box === "self")
40
+ this._stepInfo = void 0;
41
+ else if (this.registration.box)
42
+ this._stepInfo.group = isUserFixture ? "configuration" : "internal";
43
+ this._setupDescription = {
44
+ title,
45
+ phase: "setup",
46
+ location,
47
+ slot: this.registration.timeout === void 0 ? void 0 : {
48
+ timeout: this.registration.timeout,
49
+ elapsed: 0
50
+ }
51
+ };
52
+ this._teardownDescription = { ...this._setupDescription, phase: "teardown" };
53
+ }
54
+ async setup(testInfo, runnable) {
55
+ this.runner.instanceForId.set(this.registration.id, this);
56
+ if (typeof this.registration.fn !== "function") {
57
+ this.value = this.registration.fn;
58
+ return;
59
+ }
60
+ const run = () => testInfo._runWithTimeout({ ...runnable, fixture: this._setupDescription }, () => this._setupInternal(testInfo));
61
+ if (this._stepInfo)
62
+ await testInfo._runAsStep(this._stepInfo, run);
63
+ else
64
+ await run();
65
+ }
66
+ async _setupInternal(testInfo) {
67
+ const params = {};
68
+ for (const name of this.registration.deps) {
69
+ const registration = this.runner.pool.resolve(name, this.registration);
70
+ const dep = this.runner.instanceForId.get(registration.id);
71
+ if (!dep) {
72
+ this.failed = true;
73
+ return;
74
+ }
75
+ dep._usages.add(this);
76
+ this._deps.add(dep);
77
+ params[name] = dep.value;
78
+ if (dep.failed) {
79
+ this.failed = true;
80
+ return;
81
+ }
82
+ }
83
+ let called = false;
84
+ const useFuncStarted = new import_utils.ManualPromise();
85
+ const useFunc = async (value) => {
86
+ if (called)
87
+ throw new Error(`Cannot provide fixture value for the second time`);
88
+ called = true;
89
+ this.value = value;
90
+ this._useFuncFinished = new import_utils.ManualPromise();
91
+ useFuncStarted.resolve();
92
+ await this._useFuncFinished;
93
+ };
94
+ const workerInfo = { config: testInfo.config, parallelIndex: testInfo.parallelIndex, workerIndex: testInfo.workerIndex, project: testInfo.project };
95
+ const info = this.registration.scope === "worker" ? workerInfo : testInfo;
96
+ this._selfTeardownComplete = (async () => {
97
+ try {
98
+ await this.registration.fn(params, useFunc, info);
99
+ if (!useFuncStarted.isDone())
100
+ throw new Error(`use() was not called in fixture "${this.registration.name}"`);
101
+ } catch (error) {
102
+ this.failed = true;
103
+ if (!useFuncStarted.isDone())
104
+ useFuncStarted.reject(error);
105
+ else
106
+ throw error;
107
+ }
108
+ })();
109
+ await useFuncStarted;
110
+ }
111
+ async teardown(testInfo, runnable) {
112
+ try {
113
+ const fixtureRunnable = { ...runnable, fixture: this._teardownDescription };
114
+ if (!testInfo._timeoutManager.isTimeExhaustedFor(fixtureRunnable)) {
115
+ const run = () => testInfo._runWithTimeout(fixtureRunnable, () => this._teardownInternal());
116
+ if (this._stepInfo)
117
+ await testInfo._runAsStep(this._stepInfo, run);
118
+ else
119
+ await run();
120
+ }
121
+ } finally {
122
+ for (const dep of this._deps)
123
+ dep._usages.delete(this);
124
+ this.runner.instanceForId.delete(this.registration.id);
125
+ }
126
+ }
127
+ async _teardownInternal() {
128
+ if (typeof this.registration.fn !== "function")
129
+ return;
130
+ if (this._usages.size !== 0) {
131
+ console.error("Internal error: fixture integrity at", this._teardownDescription.title);
132
+ this._usages.clear();
133
+ }
134
+ if (this._useFuncFinished) {
135
+ this._useFuncFinished.resolve();
136
+ this._useFuncFinished = void 0;
137
+ await this._selfTeardownComplete;
138
+ }
139
+ }
140
+ _collectFixturesInTeardownOrder(scope, collector) {
141
+ if (this.registration.scope !== scope)
142
+ return;
143
+ for (const fixture of this._usages)
144
+ fixture._collectFixturesInTeardownOrder(scope, collector);
145
+ collector.add(this);
146
+ }
147
+ }
148
+ class FixtureRunner {
149
+ constructor() {
150
+ this.testScopeClean = true;
151
+ this.instanceForId = /* @__PURE__ */ new Map();
152
+ }
153
+ setPool(pool) {
154
+ if (!this.testScopeClean)
155
+ throw new Error("Did not teardown test scope");
156
+ if (this.pool && pool.digest !== this.pool.digest) {
157
+ throw new Error([
158
+ `Playwright detected inconsistent test.use() options.`,
159
+ `Most common mistakes that lead to this issue:`,
160
+ ` - Calling test.use() outside of the test file, for example in a common helper.`,
161
+ ` - One test file imports from another test file.`
162
+ ].join("\n"));
163
+ }
164
+ this.pool = pool;
165
+ }
166
+ _collectFixturesInSetupOrder(registration, collector) {
167
+ if (collector.has(registration))
168
+ return;
169
+ for (const name of registration.deps) {
170
+ const dep = this.pool.resolve(name, registration);
171
+ this._collectFixturesInSetupOrder(dep, collector);
172
+ }
173
+ collector.add(registration);
174
+ }
175
+ async teardownScope(scope, testInfo, runnable) {
176
+ const fixtures = Array.from(this.instanceForId.values()).reverse();
177
+ const collector = /* @__PURE__ */ new Set();
178
+ for (const fixture of fixtures)
179
+ fixture._collectFixturesInTeardownOrder(scope, collector);
180
+ let firstError;
181
+ for (const fixture of collector) {
182
+ try {
183
+ await fixture.teardown(testInfo, runnable);
184
+ } catch (error) {
185
+ firstError = firstError ?? error;
186
+ }
187
+ }
188
+ if (scope === "test")
189
+ this.testScopeClean = true;
190
+ if (firstError)
191
+ throw firstError;
192
+ }
193
+ async resolveParametersForFunction(fn, testInfo, autoFixtures, runnable) {
194
+ const collector = /* @__PURE__ */ new Set();
195
+ const auto = [];
196
+ for (const registration of this.pool.autoFixtures()) {
197
+ let shouldRun = true;
198
+ if (autoFixtures === "all-hooks-only")
199
+ shouldRun = registration.scope === "worker" || registration.auto === "all-hooks-included";
200
+ else if (autoFixtures === "worker")
201
+ shouldRun = registration.scope === "worker";
202
+ if (shouldRun)
203
+ auto.push(registration);
204
+ }
205
+ auto.sort((r1, r2) => (r1.scope === "worker" ? 0 : 1) - (r2.scope === "worker" ? 0 : 1));
206
+ for (const registration of auto)
207
+ this._collectFixturesInSetupOrder(registration, collector);
208
+ const names = getRequiredFixtureNames(fn);
209
+ for (const name of names)
210
+ this._collectFixturesInSetupOrder(this.pool.resolve(name), collector);
211
+ for (const registration of collector)
212
+ await this._setupFixtureForRegistration(registration, testInfo, runnable);
213
+ const params = {};
214
+ for (const name of names) {
215
+ const registration = this.pool.resolve(name);
216
+ const fixture = this.instanceForId.get(registration.id);
217
+ if (!fixture || fixture.failed)
218
+ return null;
219
+ params[name] = fixture.value;
220
+ }
221
+ return params;
222
+ }
223
+ async resolveParametersAndRunFunction(fn, testInfo, autoFixtures, runnable) {
224
+ const params = await this.resolveParametersForFunction(fn, testInfo, autoFixtures, runnable);
225
+ if (params === null) {
226
+ return null;
227
+ }
228
+ await testInfo._runWithTimeout(runnable, () => fn(params, testInfo));
229
+ }
230
+ async _setupFixtureForRegistration(registration, testInfo, runnable) {
231
+ if (registration.scope === "test")
232
+ this.testScopeClean = false;
233
+ let fixture = this.instanceForId.get(registration.id);
234
+ if (fixture)
235
+ return fixture;
236
+ fixture = new Fixture(this, registration);
237
+ await fixture.setup(testInfo, runnable);
238
+ return fixture;
239
+ }
240
+ dependsOnWorkerFixturesOnly(fn, location) {
241
+ const names = getRequiredFixtureNames(fn, location);
242
+ for (const name of names) {
243
+ const registration = this.pool.resolve(name);
244
+ if (registration.scope !== "worker")
245
+ return false;
246
+ }
247
+ return true;
248
+ }
249
+ }
250
+ function getRequiredFixtureNames(fn, location) {
251
+ return (0, import_fixtures.fixtureParameterNames)(fn, location ?? { file: "<unknown>", line: 1, column: 1 }, (e) => {
252
+ throw new Error(`${(0, import_util.formatLocation)(e.location)}: ${e.message}`);
253
+ });
254
+ }
255
+ // Annotate the CommonJS export names for ESM import in node:
256
+ 0 && (module.exports = {
257
+ FixtureRunner
258
+ });
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/worker/fixtureRunner.ts"],
4
+ "sourcesContent": ["/**\n * Copyright Microsoft Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { escapeWithQuotes, ManualPromise } from 'playwright-core/lib/utils';\n\nimport { fixtureParameterNames } from '../common/fixtures';\nimport { filterStackFile, formatLocation } from '../util';\n\nimport type { TestInfoImpl } from './testInfo';\nimport type { FixtureDescription, RunnableDescription } from './timeoutManager';\nimport type { WorkerInfo } from '../../types/test';\nimport type { Location } from '../../types/testReporter';\nimport type { FixturePool, FixtureRegistration, FixtureScope } from '../common/fixtures';\n\nclass Fixture {\n runner: FixtureRunner;\n registration: FixtureRegistration;\n value: any;\n failed = false;\n\n private _useFuncFinished: ManualPromise<void> | undefined;\n private _selfTeardownComplete: Promise<void> | undefined;\n private _setupDescription: FixtureDescription;\n private _teardownDescription: FixtureDescription;\n private _stepInfo: { title: string, category: 'fixture', location?: Location, group?: string };\n _deps = new Set<Fixture>();\n _usages = new Set<Fixture>();\n\n constructor(runner: FixtureRunner, registration: FixtureRegistration) {\n this.runner = runner;\n this.registration = registration;\n this.value = null;\n const isUserFixture = this.registration.location && filterStackFile(this.registration.location.file);\n const title = this.registration.customTitle || this.registration.name;\n const location = isUserFixture ? this.registration.location : undefined;\n this._stepInfo = { title: `Fixture ${escapeWithQuotes(title, '\"')}`, category: 'fixture', location };\n if (this.registration.box)\n this._stepInfo.group = isUserFixture ? 'configuration' : 'internal';\n this._setupDescription = {\n title,\n phase: 'setup',\n location,\n slot: this.registration.timeout === undefined ? undefined : {\n timeout: this.registration.timeout,\n elapsed: 0,\n }\n };\n this._teardownDescription = { ...this._setupDescription, phase: 'teardown' };\n }\n\n async setup(testInfo: TestInfoImpl, runnable: RunnableDescription) {\n this.runner.instanceForId.set(this.registration.id, this);\n\n if (typeof this.registration.fn !== 'function') {\n this.value = this.registration.fn;\n return;\n }\n\n await testInfo._runAsStep(this._stepInfo, async () => {\n await testInfo._runWithTimeout({ ...runnable, fixture: this._setupDescription }, () => this._setupInternal(testInfo));\n });\n }\n\n private async _setupInternal(testInfo: TestInfoImpl) {\n const params: { [key: string]: any } = {};\n for (const name of this.registration.deps) {\n const registration = this.runner.pool!.resolve(name, this.registration)!;\n const dep = this.runner.instanceForId.get(registration.id);\n if (!dep) {\n this.failed = true;\n return;\n }\n // Fixture teardown is root => leaves, when we need to teardown a fixture,\n // it recursively tears down its usages first.\n dep._usages.add(this);\n // Don't forget to decrement all usages when fixture goes.\n // Otherwise worker-scope fixtures will retain test-scope fixtures forever.\n this._deps.add(dep);\n params[name] = dep.value;\n if (dep.failed) {\n this.failed = true;\n return;\n }\n }\n\n let called = false;\n const useFuncStarted = new ManualPromise<void>();\n const useFunc = async (value: any) => {\n if (called)\n throw new Error(`Cannot provide fixture value for the second time`);\n called = true;\n this.value = value;\n this._useFuncFinished = new ManualPromise<void>();\n useFuncStarted.resolve();\n await this._useFuncFinished;\n };\n\n const workerInfo: WorkerInfo = { config: testInfo.config, parallelIndex: testInfo.parallelIndex, workerIndex: testInfo.workerIndex, project: testInfo.project };\n const info = this.registration.scope === 'worker' ? workerInfo : testInfo;\n this._selfTeardownComplete = (async () => {\n try {\n await this.registration.fn(params, useFunc, info);\n } catch (error) {\n this.failed = true;\n if (!useFuncStarted.isDone())\n useFuncStarted.reject(error);\n else\n throw error;\n }\n })();\n await useFuncStarted;\n }\n\n async teardown(testInfo: TestInfoImpl, runnable: RunnableDescription) {\n try {\n const fixtureRunnable = { ...runnable, fixture: this._teardownDescription };\n // Do not even start the teardown for a fixture that does not have any\n // time remaining in the time slot. This avoids cascading timeouts.\n if (!testInfo._timeoutManager.isTimeExhaustedFor(fixtureRunnable)) {\n await testInfo._runAsStep(this._stepInfo, async () => {\n await testInfo._runWithTimeout(fixtureRunnable, () => this._teardownInternal());\n });\n }\n } finally {\n // To preserve fixtures integrity, forcefully cleanup fixtures\n // that cannnot teardown due to a timeout or an error.\n for (const dep of this._deps)\n dep._usages.delete(this);\n this.runner.instanceForId.delete(this.registration.id);\n }\n }\n\n private async _teardownInternal() {\n if (typeof this.registration.fn !== 'function')\n return;\n if (this._usages.size !== 0) {\n // TODO: replace with assert.\n console.error('Internal error: fixture integrity at', this._teardownDescription.title); // eslint-disable-line no-console\n this._usages.clear();\n }\n if (this._useFuncFinished) {\n this._useFuncFinished.resolve();\n this._useFuncFinished = undefined;\n await this._selfTeardownComplete;\n }\n }\n\n _collectFixturesInTeardownOrder(scope: FixtureScope, collector: Set<Fixture>) {\n if (this.registration.scope !== scope)\n return;\n for (const fixture of this._usages)\n fixture._collectFixturesInTeardownOrder(scope, collector);\n collector.add(this);\n }\n}\n\nexport class FixtureRunner {\n private testScopeClean = true;\n pool: FixturePool | undefined;\n instanceForId = new Map<string, Fixture>();\n\n setPool(pool: FixturePool) {\n if (!this.testScopeClean)\n throw new Error('Did not teardown test scope');\n if (this.pool && pool.digest !== this.pool.digest) {\n throw new Error([\n `Playwright detected inconsistent test.use() options.`,\n `Most common mistakes that lead to this issue:`,\n ` - Calling test.use() outside of the test file, for example in a common helper.`,\n ` - One test file imports from another test file.`,\n ].join('\\n'));\n }\n this.pool = pool;\n }\n\n private _collectFixturesInSetupOrder(registration: FixtureRegistration, collector: Set<FixtureRegistration>) {\n if (collector.has(registration))\n return;\n for (const name of registration.deps) {\n const dep = this.pool!.resolve(name, registration)!;\n this._collectFixturesInSetupOrder(dep, collector);\n }\n collector.add(registration);\n }\n\n async teardownScope(scope: FixtureScope, testInfo: TestInfoImpl, runnable: RunnableDescription) {\n // Teardown fixtures in the reverse order.\n const fixtures = Array.from(this.instanceForId.values()).reverse();\n const collector = new Set<Fixture>();\n for (const fixture of fixtures)\n fixture._collectFixturesInTeardownOrder(scope, collector);\n let firstError: Error | undefined;\n for (const fixture of collector) {\n try {\n await fixture.teardown(testInfo, runnable);\n } catch (error) {\n firstError = firstError ?? error;\n }\n }\n if (scope === 'test')\n this.testScopeClean = true;\n if (firstError)\n throw firstError;\n }\n\n async resolveParametersForFunction(fn: Function, testInfo: TestInfoImpl, autoFixtures: 'worker' | 'test' | 'all-hooks-only', runnable: RunnableDescription): Promise<object | null> {\n const collector = new Set<FixtureRegistration>();\n\n // Collect automatic fixtures.\n const auto: FixtureRegistration[] = [];\n for (const registration of this.pool!.autoFixtures()) {\n let shouldRun = true;\n if (autoFixtures === 'all-hooks-only')\n shouldRun = registration.scope === 'worker' || registration.auto === 'all-hooks-included';\n else if (autoFixtures === 'worker')\n shouldRun = registration.scope === 'worker';\n if (shouldRun)\n auto.push(registration);\n }\n auto.sort((r1, r2) => (r1.scope === 'worker' ? 0 : 1) - (r2.scope === 'worker' ? 0 : 1));\n for (const registration of auto)\n this._collectFixturesInSetupOrder(registration, collector);\n\n // Collect used fixtures.\n const names = getRequiredFixtureNames(fn);\n for (const name of names)\n this._collectFixturesInSetupOrder(this.pool!.resolve(name)!, collector);\n\n // Setup fixtures.\n for (const registration of collector)\n await this._setupFixtureForRegistration(registration, testInfo, runnable);\n\n // Create params object.\n const params: { [key: string]: any } = {};\n for (const name of names) {\n const registration = this.pool!.resolve(name)!;\n const fixture = this.instanceForId.get(registration.id);\n if (!fixture || fixture.failed)\n return null;\n params[name] = fixture.value;\n }\n return params;\n }\n\n async resolveParametersAndRunFunction(fn: Function, testInfo: TestInfoImpl, autoFixtures: 'worker' | 'test' | 'all-hooks-only', runnable: RunnableDescription) {\n const params = await this.resolveParametersForFunction(fn, testInfo, autoFixtures, runnable);\n if (params === null) {\n // Do not run the function when fixture setup has already failed.\n return null;\n }\n await testInfo._runWithTimeout(runnable, () => fn(params, testInfo));\n }\n\n private async _setupFixtureForRegistration(registration: FixtureRegistration, testInfo: TestInfoImpl, runnable: RunnableDescription): Promise<Fixture> {\n if (registration.scope === 'test')\n this.testScopeClean = false;\n\n let fixture = this.instanceForId.get(registration.id);\n if (fixture)\n return fixture;\n\n fixture = new Fixture(this, registration);\n await fixture.setup(testInfo, runnable);\n return fixture;\n }\n\n dependsOnWorkerFixturesOnly(fn: Function, location: Location): boolean {\n const names = getRequiredFixtureNames(fn, location);\n for (const name of names) {\n const registration = this.pool!.resolve(name)!;\n if (registration.scope !== 'worker')\n return false;\n }\n return true;\n }\n}\n\nfunction getRequiredFixtureNames(fn: Function, location?: Location) {\n return fixtureParameterNames(fn, location ?? { file: '<unknown>', line: 1, column: 1 }, e => {\n throw new Error(`${formatLocation(e.location!)}: ${e.message}`);\n });\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAAgD;AAEhD,sBAAsC;AACtC,kBAAgD;AAQhD,MAAM,QAAQ;AAAA,EAcZ,YAAY,QAAuB,cAAmC;AAVtE,kBAAS;AAOT,iBAAQ,oBAAI,IAAa;AACzB,mBAAU,oBAAI,IAAa;AAGzB,SAAK,SAAS;AACd,SAAK,eAAe;AACpB,SAAK,QAAQ;AACb,UAAM,gBAAgB,KAAK,aAAa,gBAAY,6BAAgB,KAAK,aAAa,SAAS,IAAI;AACnG,UAAM,QAAQ,KAAK,aAAa,eAAe,KAAK,aAAa;AACjE,UAAM,WAAW,gBAAgB,KAAK,aAAa,WAAW;AAC9D,SAAK,YAAY,EAAE,OAAO,eAAW,+BAAiB,OAAO,GAAG,CAAC,IAAI,UAAU,WAAW,SAAS;AACnG,QAAI,KAAK,aAAa;AACpB,WAAK,UAAU,QAAQ,gBAAgB,kBAAkB;AAC3D,SAAK,oBAAoB;AAAA,MACvB;AAAA,MACA,OAAO;AAAA,MACP;AAAA,MACA,MAAM,KAAK,aAAa,YAAY,SAAY,SAAY;AAAA,QAC1D,SAAS,KAAK,aAAa;AAAA,QAC3B,SAAS;AAAA,MACX;AAAA,IACF;AACA,SAAK,uBAAuB,EAAE,GAAG,KAAK,mBAAmB,OAAO,WAAW;AAAA,EAC7E;AAAA,EAEA,MAAM,MAAM,UAAwB,UAA+B;AACjE,SAAK,OAAO,cAAc,IAAI,KAAK,aAAa,IAAI,IAAI;AAExD,QAAI,OAAO,KAAK,aAAa,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AAO,uCAAsB,IAAI,YAAY,EAAE,MAAM,aAAa,MAAM,GAAG,QAAQ,EAAE,GAAG,OAAK;AAC3F,UAAM,IAAI,MAAM,OAAG,4BAAe,EAAE,QAAS,CAAC,KAAK,EAAE,OAAO,EAAE;AAAA,EAChE,CAAC;AACH;",
6
+ "names": []
7
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var stepContext_exports = {};
20
+ __export(stepContext_exports, {
21
+ getCurrentStepInfo: () => getCurrentStepInfo,
22
+ stepContextStorage: () => stepContextStorage
23
+ });
24
+ module.exports = __toCommonJS(stepContext_exports);
25
+ var import_async_hooks = require("async_hooks");
26
+ const stepContextStorage = new import_async_hooks.AsyncLocalStorage();
27
+ function getCurrentStepInfo() {
28
+ return stepContextStorage.getStore();
29
+ }
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ getCurrentStepInfo,
33
+ stepContextStorage
34
+ });