@one2x/playwright 1.57.0-alpha.1 → 1.57.0-alpha.2

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 (155) hide show
  1. package/package.json +2 -2
  2. package/lib/agents/generateAgents.js.map +0 -7
  3. package/lib/common/config.js.map +0 -7
  4. package/lib/common/configLoader.js.map +0 -7
  5. package/lib/common/esmLoaderHost.js.map +0 -7
  6. package/lib/common/expectBundle.js.map +0 -7
  7. package/lib/common/expectBundleImpl.js.map +0 -7
  8. package/lib/common/fixtures.js.map +0 -7
  9. package/lib/common/globals.js.map +0 -7
  10. package/lib/common/ipc.js.map +0 -7
  11. package/lib/common/poolBuilder.js.map +0 -7
  12. package/lib/common/process.js.map +0 -7
  13. package/lib/common/suiteUtils.js.map +0 -7
  14. package/lib/common/test.js.map +0 -7
  15. package/lib/common/testLoader.js.map +0 -7
  16. package/lib/common/testType.js.map +0 -7
  17. package/lib/common/validators.js.map +0 -7
  18. package/lib/fsWatcher.js.map +0 -7
  19. package/lib/index.js.map +0 -7
  20. package/lib/internalsForTest.js.map +0 -7
  21. package/lib/isomorphic/events.js.map +0 -7
  22. package/lib/isomorphic/folders.js.map +0 -7
  23. package/lib/isomorphic/stringInternPool.js.map +0 -7
  24. package/lib/isomorphic/teleReceiver.js.map +0 -7
  25. package/lib/isomorphic/teleSuiteUpdater.js.map +0 -7
  26. package/lib/isomorphic/testServerConnection.js.map +0 -7
  27. package/lib/isomorphic/testServerInterface.js.map +0 -7
  28. package/lib/isomorphic/testTree.js.map +0 -7
  29. package/lib/isomorphic/types.d.js.map +0 -7
  30. package/lib/loader/loaderMain.js.map +0 -7
  31. package/lib/matchers/expect.js.map +0 -7
  32. package/lib/matchers/matcherHint.js.map +0 -7
  33. package/lib/matchers/matchers.js.map +0 -7
  34. package/lib/matchers/toBeTruthy.js.map +0 -7
  35. package/lib/matchers/toEqual.js.map +0 -7
  36. package/lib/matchers/toHaveURL.js.map +0 -7
  37. package/lib/matchers/toMatchAriaSnapshot.js.map +0 -7
  38. package/lib/matchers/toMatchSnapshot.js.map +0 -7
  39. package/lib/matchers/toMatchText.js.map +0 -7
  40. package/lib/mcp/browser/actions.d.js.map +0 -7
  41. package/lib/mcp/browser/browserContextFactory.js.map +0 -7
  42. package/lib/mcp/browser/browserServerBackend.js.map +0 -7
  43. package/lib/mcp/browser/codegen.js.map +0 -7
  44. package/lib/mcp/browser/config.js.map +0 -7
  45. package/lib/mcp/browser/context.js.map +0 -7
  46. package/lib/mcp/browser/response.js.map +0 -7
  47. package/lib/mcp/browser/sessionLog.js.map +0 -7
  48. package/lib/mcp/browser/tab.js.map +0 -7
  49. package/lib/mcp/browser/tools/actionRetry.js.map +0 -7
  50. package/lib/mcp/browser/tools/common.js.map +0 -7
  51. package/lib/mcp/browser/tools/console.js.map +0 -7
  52. package/lib/mcp/browser/tools/dialogs.js.map +0 -7
  53. package/lib/mcp/browser/tools/evaluate.js.map +0 -7
  54. package/lib/mcp/browser/tools/files.js.map +0 -7
  55. package/lib/mcp/browser/tools/form.js.map +0 -7
  56. package/lib/mcp/browser/tools/install.js.map +0 -7
  57. package/lib/mcp/browser/tools/keyboard.js.map +0 -7
  58. package/lib/mcp/browser/tools/mouse.js.map +0 -7
  59. package/lib/mcp/browser/tools/navigate.js.map +0 -7
  60. package/lib/mcp/browser/tools/network.js.map +0 -7
  61. package/lib/mcp/browser/tools/pdf.js.map +0 -7
  62. package/lib/mcp/browser/tools/screenshot.js.map +0 -7
  63. package/lib/mcp/browser/tools/snapshot.js.map +0 -7
  64. package/lib/mcp/browser/tools/tabs.js.map +0 -7
  65. package/lib/mcp/browser/tools/tool.js.map +0 -7
  66. package/lib/mcp/browser/tools/tracing.js.map +0 -7
  67. package/lib/mcp/browser/tools/utils.js.map +0 -7
  68. package/lib/mcp/browser/tools/verify.js.map +0 -7
  69. package/lib/mcp/browser/tools/wait.js.map +0 -7
  70. package/lib/mcp/browser/tools.js.map +0 -7
  71. package/lib/mcp/browser/watchdog.js.map +0 -7
  72. package/lib/mcp/config.d.js.map +0 -7
  73. package/lib/mcp/extension/cdpRelay.js.map +0 -7
  74. package/lib/mcp/extension/extensionContextFactory.js.map +0 -7
  75. package/lib/mcp/extension/protocol.js.map +0 -7
  76. package/lib/mcp/index.js.map +0 -7
  77. package/lib/mcp/log.js.map +0 -7
  78. package/lib/mcp/program.js.map +0 -7
  79. package/lib/mcp/sdk/bundle.js.map +0 -7
  80. package/lib/mcp/sdk/exports.js.map +0 -7
  81. package/lib/mcp/sdk/http.js.map +0 -7
  82. package/lib/mcp/sdk/inProcessTransport.js.map +0 -7
  83. package/lib/mcp/sdk/mdb.js.map +0 -7
  84. package/lib/mcp/sdk/proxyBackend.js.map +0 -7
  85. package/lib/mcp/sdk/server.js.map +0 -7
  86. package/lib/mcp/sdk/tool.js.map +0 -7
  87. package/lib/mcp/test/browserBackend.js.map +0 -7
  88. package/lib/mcp/test/generatorTools.js.map +0 -7
  89. package/lib/mcp/test/plannerTools.js.map +0 -7
  90. package/lib/mcp/test/seed.js.map +0 -7
  91. package/lib/mcp/test/streams.js.map +0 -7
  92. package/lib/mcp/test/testBackend.js.map +0 -7
  93. package/lib/mcp/test/testContext.js.map +0 -7
  94. package/lib/mcp/test/testTool.js.map +0 -7
  95. package/lib/mcp/test/testTools.js.map +0 -7
  96. package/lib/mcpBundleImpl.js.map +0 -7
  97. package/lib/plugins/gitCommitInfoPlugin.js.map +0 -7
  98. package/lib/plugins/index.js.map +0 -7
  99. package/lib/plugins/webServerPlugin.js.map +0 -7
  100. package/lib/program.js.map +0 -7
  101. package/lib/reporters/base.js.map +0 -7
  102. package/lib/reporters/blob.js.map +0 -7
  103. package/lib/reporters/dot.js.map +0 -7
  104. package/lib/reporters/empty.js.map +0 -7
  105. package/lib/reporters/github.js.map +0 -7
  106. package/lib/reporters/html.js.map +0 -7
  107. package/lib/reporters/internalReporter.js.map +0 -7
  108. package/lib/reporters/json.js.map +0 -7
  109. package/lib/reporters/junit.js.map +0 -7
  110. package/lib/reporters/line.js.map +0 -7
  111. package/lib/reporters/list.js.map +0 -7
  112. package/lib/reporters/listModeReporter.js.map +0 -7
  113. package/lib/reporters/markdown.js.map +0 -7
  114. package/lib/reporters/merge.js.map +0 -7
  115. package/lib/reporters/multiplexer.js.map +0 -7
  116. package/lib/reporters/reporterV2.js.map +0 -7
  117. package/lib/reporters/teleEmitter.js.map +0 -7
  118. package/lib/reporters/versions/blobV1.js.map +0 -7
  119. package/lib/runner/dispatcher.js.map +0 -7
  120. package/lib/runner/failureTracker.js.map +0 -7
  121. package/lib/runner/lastRun.js.map +0 -7
  122. package/lib/runner/loadUtils.js.map +0 -7
  123. package/lib/runner/loaderHost.js.map +0 -7
  124. package/lib/runner/processHost.js.map +0 -7
  125. package/lib/runner/projectUtils.js.map +0 -7
  126. package/lib/runner/rebase.js.map +0 -7
  127. package/lib/runner/reporters.js.map +0 -7
  128. package/lib/runner/runner.js +0 -110
  129. package/lib/runner/sigIntWatcher.js.map +0 -7
  130. package/lib/runner/taskRunner.js.map +0 -7
  131. package/lib/runner/tasks.js.map +0 -7
  132. package/lib/runner/testGroups.js.map +0 -7
  133. package/lib/runner/testRunner.js.map +0 -7
  134. package/lib/runner/testServer.js.map +0 -7
  135. package/lib/runner/uiModeReporter.js.map +0 -7
  136. package/lib/runner/vcs.js.map +0 -7
  137. package/lib/runner/watchMode.js.map +0 -7
  138. package/lib/runner/workerHost.js.map +0 -7
  139. package/lib/third_party/pirates.js.map +0 -7
  140. package/lib/third_party/tsconfig-loader.js.map +0 -7
  141. package/lib/transform/babelBundle.js.map +0 -7
  142. package/lib/transform/babelBundleImpl.js.map +0 -7
  143. package/lib/transform/compilationCache.js.map +0 -7
  144. package/lib/transform/esmLoader.js.map +0 -7
  145. package/lib/transform/portTransport.js.map +0 -7
  146. package/lib/transform/transform.js.map +0 -7
  147. package/lib/util.js.map +0 -7
  148. package/lib/utilsBundle.js.map +0 -7
  149. package/lib/utilsBundleImpl.js.map +0 -7
  150. package/lib/worker/fixtureRunner.js.map +0 -7
  151. package/lib/worker/testInfo.js.map +0 -7
  152. package/lib/worker/testTracing.js.map +0 -7
  153. package/lib/worker/timeoutManager.js.map +0 -7
  154. package/lib/worker/util.js.map +0 -7
  155. package/lib/worker/workerMain.js.map +0 -7
@@ -1,7 +0,0 @@
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 } | undefined;\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 === 'self')\n this._stepInfo = undefined;\n else 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 const run = () => testInfo._runWithTimeout({ ...runnable, fixture: this._setupDescription }, () => this._setupInternal(testInfo));\n if (this._stepInfo)\n await testInfo._runAsStep(this._stepInfo, run);\n else\n await run();\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 if (!useFuncStarted.isDone())\n throw new Error(`use() was not called in fixture \"${this.registration.name}\"`);\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 const run = () => testInfo._runWithTimeout(fixtureRunnable, () => this._teardownInternal());\n if (this._stepInfo)\n await testInfo._runAsStep(this._stepInfo, run);\n else\n await run();\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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AI,IAAI,QAAQ;AAAA,IACzB;AACA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,gCAAgC,IAAc,UAAwB,cAAoD,UAA+B;AAC7J,UAAM,SAAS,MAAM,KAAK,6BAA6B,IAAI,UAAU,cAAc,QAAQ;AAC3F,QAAI,WAAW,MAAM;AAEnB,aAAO;AAAA,IACT;AACA,UAAM,SAAS,gBAAgB,UAAU,MAAM,GAAG,QAAQ,QAAQ,CAAC;AAAA,EACrE;AAAA,EAEA,MAAc,6BAA6B,cAAmC,UAAwB,UAAiD;AACrJ,QAAI,aAAa,UAAU;AACzB,WAAK,iBAAiB;AAExB,QAAI,UAAU,KAAK,cAAc,IAAI,aAAa,EAAE;AACpD,QAAI;AACF,aAAO;AAET,cAAU,IAAI,QAAQ,MAAM,YAAY;AACxC,UAAM,QAAQ,MAAM,UAAU,QAAQ;AACtC,WAAO;AAAA,EACT;AAAA,EAEA,4BAA4B,IAAc,UAA6B;AACrE,UAAM,QAAQ,wBAAwB,IAAI,QAAQ;AAClD,eAAW,QAAQ,OAAO;AACxB,YAAM,eAAe,KAAK,KAAM,QAAQ,IAAI;AAC5C,UAAI,aAAa,UAAU;AACzB,eAAO;AAAA,IACX;AACA,WAAO;AAAA,EACT;AACF;AAEA,SAAS,wBAAwB,IAAc,UAAqB;AAClE,aAAO,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
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/worker/testInfo.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 fs from 'fs';\nimport path from 'path';\n\nimport { captureRawStack, monotonicTime, sanitizeForFilePath, stringifyStackFrames, currentZone, createGuid, escapeWithQuotes } from 'playwright-core/lib/utils';\n\nimport { TimeoutManager, TimeoutManagerError, kMaxDeadline } from './timeoutManager';\nimport { addSuffixToFilePath, filteredStackTrace, getContainedPath, normalizeAndSaveAttachment, sanitizeFilePathBeforeExtension, trimLongString, windowsFilesystemFriendlyLength } from '../util';\nimport { TestTracing } from './testTracing';\nimport { testInfoError } from './util';\nimport { wrapFunctionWithLocation } from '../transform/transform';\n\nimport type { RunnableDescription } from './timeoutManager';\nimport type { FullProject, TestInfo, TestStatus, TestStepInfo, TestAnnotation } from '../../types/test';\nimport type { FullConfig, Location } from '../../types/testReporter';\nimport type { FullConfigInternal, FullProjectInternal } from '../common/config';\nimport type { AttachmentPayload, StepBeginPayload, StepEndPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';\nimport type { TestCase } from '../common/test';\nimport type { StackFrame } from '@protocol/channels';\n\nexport type TestStepCategory = 'expect' | 'fixture' | 'hook' | 'pw:api' | 'test.step' | 'test.attach';\n\ninterface TestStepData {\n title: string;\n category: TestStepCategory;\n location?: Location;\n apiName?: string;\n params?: Record<string, any>;\n infectParentStepsWithError?: boolean;\n box?: boolean;\n // steps with any defined group are hidden from the report\n // 'internal' steps are hidden from the trace\n group?: string;\n}\n\nexport interface TestStepInternal extends TestStepData {\n complete(result: { error?: Error | unknown, suggestedRebaseline?: string }): void;\n info: TestStepInfoImpl;\n attachmentIndices: number[];\n stepId: string;\n boxedStack?: StackFrame[];\n steps: TestStepInternal[];\n endWallTime?: number;\n error?: TestInfoErrorImpl;\n}\n\ntype SnapshotNames = {\n lastAnonymousSnapshotIndex: number;\n lastNamedSnapshotIndex: { [key: string]: number };\n};\n\nexport class TestInfoImpl implements TestInfo {\n private _onStepBegin: (payload: StepBeginPayload) => void;\n private _onStepEnd: (payload: StepEndPayload) => void;\n private _onAttach: (payload: AttachmentPayload) => void;\n private _snapshotNames: SnapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };\n private _ariaSnapshotNames: SnapshotNames = { lastAnonymousSnapshotIndex: 0, lastNamedSnapshotIndex: {} };\n readonly _timeoutManager: TimeoutManager;\n readonly _startTime: number;\n readonly _startWallTime: number;\n readonly _tracing: TestTracing;\n readonly _uniqueSymbol;\n\n _wasInterrupted = false;\n _lastStepId = 0;\n private readonly _requireFile: string;\n readonly _projectInternal: FullProjectInternal;\n readonly _configInternal: FullConfigInternal;\n private readonly _steps: TestStepInternal[] = [];\n private readonly _stepMap = new Map<string, TestStepInternal>();\n _onDidFinishTestFunctions: (() => Promise<void>)[] = [];\n _hasNonRetriableError = false;\n _hasUnhandledError = false;\n _allowSkips = false;\n\n // ------------ Main methods ------------\n skip: (arg?: any, description?: string) => void;\n fixme: (arg?: any, description?: string) => void;\n fail: (arg?: any, description?: string) => void;\n slow: (arg?: any, description?: string) => void;\n\n // ------------ TestInfo fields ------------\n readonly testId: string;\n readonly repeatEachIndex: number;\n readonly retry: number;\n readonly workerIndex: number;\n readonly parallelIndex: number;\n readonly project: FullProject;\n readonly config: FullConfig;\n readonly title: string;\n readonly titlePath: string[];\n readonly file: string;\n readonly line: number;\n readonly tags: string[];\n readonly column: number;\n readonly fn: Function;\n expectedStatus: TestStatus;\n duration: number = 0;\n readonly annotations: TestAnnotation[] = [];\n readonly attachments: TestInfo['attachments'] = [];\n status: TestStatus = 'passed';\n snapshotSuffix: string = '';\n readonly outputDir: string;\n readonly snapshotDir: string;\n errors: TestInfoErrorImpl[] = [];\n readonly _attachmentsPush: (...items: TestInfo['attachments']) => number;\n private _workerParams: WorkerInitParams;\n\n get error(): TestInfoErrorImpl | undefined {\n return this.errors[0];\n }\n\n set error(e: TestInfoErrorImpl | undefined) {\n if (e === undefined)\n throw new Error('Cannot assign testInfo.error undefined value!');\n this.errors[0] = e;\n }\n\n get timeout(): number {\n return this._timeoutManager.defaultSlot().timeout;\n }\n\n set timeout(timeout: number) {\n // Ignored.\n }\n\n _deadlineForMatcher(timeout: number): { deadline: number, timeoutMessage: string } {\n const startTime = monotonicTime();\n const matcherDeadline = timeout ? startTime + timeout : kMaxDeadline;\n const testDeadline = this._timeoutManager.currentSlotDeadline() - 250;\n const matcherMessage = `Timeout ${timeout}ms exceeded while waiting on the predicate`;\n const testMessage = `Test timeout of ${this.timeout}ms exceeded`;\n return { deadline: Math.min(testDeadline, matcherDeadline), timeoutMessage: testDeadline < matcherDeadline ? testMessage : matcherMessage };\n }\n\n static _defaultDeadlineForMatcher(timeout: number): { deadline: any; timeoutMessage: any; } {\n return { deadline: (timeout ? monotonicTime() + timeout : 0), timeoutMessage: `Timeout ${timeout}ms exceeded while waiting on the predicate` };\n }\n\n constructor(\n configInternal: FullConfigInternal,\n projectInternal: FullProjectInternal,\n workerParams: WorkerInitParams,\n test: TestCase | undefined,\n retry: number,\n onStepBegin: (payload: StepBeginPayload) => void,\n onStepEnd: (payload: StepEndPayload) => void,\n onAttach: (payload: AttachmentPayload) => void,\n ) {\n this.testId = test?.id ?? '';\n this._onStepBegin = onStepBegin;\n this._onStepEnd = onStepEnd;\n this._onAttach = onAttach;\n this._startTime = monotonicTime();\n this._startWallTime = Date.now();\n this._requireFile = test?._requireFile ?? '';\n this._uniqueSymbol = Symbol('testInfoUniqueSymbol');\n this._workerParams = workerParams;\n\n this.repeatEachIndex = workerParams.repeatEachIndex;\n this.retry = retry;\n this.workerIndex = workerParams.workerIndex;\n this.parallelIndex = workerParams.parallelIndex;\n this._projectInternal = projectInternal;\n this.project = projectInternal.project;\n this._configInternal = configInternal;\n this.config = configInternal.config;\n this.title = test?.title ?? '';\n this.titlePath = test?.titlePath() ?? [];\n this.file = test?.location.file ?? '';\n this.line = test?.location.line ?? 0;\n this.column = test?.location.column ?? 0;\n this.tags = test?.tags ?? [];\n this.fn = test?.fn ?? (() => {});\n this.expectedStatus = test?.expectedStatus ?? 'skipped';\n\n this._timeoutManager = new TimeoutManager(this.project.timeout);\n if (configInternal.configCLIOverrides.debug)\n this._setDebugMode();\n\n this.outputDir = (() => {\n const relativeTestFilePath = path.relative(this.project.testDir, this._requireFile.replace(/\\.(spec|test)\\.(js|ts|jsx|tsx|mjs|mts|cjs|cts)$/, ''));\n const sanitizedRelativePath = relativeTestFilePath.replace(process.platform === 'win32' ? new RegExp('\\\\\\\\', 'g') : new RegExp('/', 'g'), '-');\n const fullTitleWithoutSpec = this.titlePath.slice(1).join(' ');\n\n let testOutputDir = trimLongString(sanitizedRelativePath + '-' + sanitizeForFilePath(fullTitleWithoutSpec), windowsFilesystemFriendlyLength);\n if (projectInternal.id)\n testOutputDir += '-' + sanitizeForFilePath(projectInternal.id);\n if (this.retry)\n testOutputDir += '-retry' + this.retry;\n if (this.repeatEachIndex)\n testOutputDir += '-repeat' + this.repeatEachIndex;\n return path.join(this.project.outputDir, testOutputDir);\n })();\n\n this.snapshotDir = (() => {\n const relativeTestFilePath = path.relative(this.project.testDir, this._requireFile);\n return path.join(this.project.snapshotDir, relativeTestFilePath + '-snapshots');\n })();\n\n this._attachmentsPush = this.attachments.push.bind(this.attachments);\n const attachmentsPush = (...attachments: TestInfo['attachments']) => {\n for (const a of attachments)\n this._attach(a, this._parentStep()?.stepId);\n return this.attachments.length;\n };\n Object.defineProperty(this.attachments, 'push', {\n value: attachmentsPush,\n writable: true,\n enumerable: false,\n configurable: true\n });\n\n this._tracing = new TestTracing(this, workerParams.artifactsDir);\n\n this.skip = wrapFunctionWithLocation((location, ...args) => this._modifier('skip', location, args));\n this.fixme = wrapFunctionWithLocation((location, ...args) => this._modifier('fixme', location, args));\n this.fail = wrapFunctionWithLocation((location, ...args) => this._modifier('fail', location, args));\n this.slow = wrapFunctionWithLocation((location, ...args) => this._modifier('slow', location, args));\n }\n\n _modifier(type: 'skip' | 'fail' | 'fixme' | 'slow', location: Location, modifierArgs: [arg?: any, description?: string]) {\n if (typeof modifierArgs[1] === 'function') {\n throw new Error([\n 'It looks like you are calling test.skip() inside the test and pass a callback.',\n 'Pass a condition instead and optional description instead:',\n `test('my test', async ({ page, isMobile }) => {`,\n ` test.skip(isMobile, 'This test is not applicable on mobile');`,\n `});`,\n ].join('\\n'));\n }\n\n if (modifierArgs.length >= 1 && !modifierArgs[0])\n return;\n\n const description = modifierArgs[1];\n this.annotations.push({ type, description, location });\n if (type === 'slow') {\n this._timeoutManager.slow();\n } else if (type === 'skip' || type === 'fixme') {\n this.expectedStatus = 'skipped';\n throw new TestSkipError('Test is skipped: ' + (description || ''));\n } else if (type === 'fail') {\n if (this.expectedStatus !== 'skipped')\n this.expectedStatus = 'failed';\n }\n }\n\n private _findLastPredefinedStep(steps: TestStepInternal[]): TestStepInternal | undefined {\n // Find the deepest predefined step that has not finished yet.\n for (let i = steps.length - 1; i >= 0; i--) {\n const child = this._findLastPredefinedStep(steps[i].steps);\n if (child)\n return child;\n if ((steps[i].category === 'hook' || steps[i].category === 'fixture') && !steps[i].endWallTime)\n return steps[i];\n }\n }\n\n private _parentStep() {\n return currentZone().data<TestStepInternal>('stepZone') ?? this._findLastPredefinedStep(this._steps);\n }\n\n _addStep(data: Readonly<TestStepData>, parentStep?: TestStepInternal): TestStepInternal {\n const stepId = `${data.category}@${++this._lastStepId}`;\n\n if (data.category === 'hook' || data.category === 'fixture') {\n // Predefined steps form a fixed hierarchy - use the current one as parent.\n parentStep = this._findLastPredefinedStep(this._steps);\n } else {\n if (!parentStep)\n parentStep = this._parentStep();\n }\n\n const filteredStack = filteredStackTrace(captureRawStack());\n let boxedStack = parentStep?.boxedStack;\n let location = data.location;\n if (!boxedStack && data.box) {\n boxedStack = filteredStack.slice(1);\n location = location || boxedStack[0];\n }\n location = location || filteredStack[0];\n\n const step: TestStepInternal = {\n ...data,\n stepId,\n group: parentStep?.group ?? data.group,\n boxedStack,\n location,\n steps: [],\n attachmentIndices: [],\n info: new TestStepInfoImpl(this, stepId, data.title, parentStep?.info),\n complete: result => {\n if (step.endWallTime)\n return;\n\n step.endWallTime = Date.now();\n if (result.error) {\n if (typeof result.error === 'object' && !(result.error as any)?.[stepSymbol])\n (result.error as any)[stepSymbol] = step;\n const error = testInfoError(result.error);\n if (step.boxedStack)\n error.stack = `${error.message}\\n${stringifyStackFrames(step.boxedStack).join('\\n')}`;\n step.error = error;\n }\n\n if (!step.error) {\n // Soft errors inside try/catch will make the test fail.\n // In order to locate the failing step, we are marking all the parent\n // steps as failing unconditionally.\n for (const childStep of step.steps) {\n if (childStep.error && childStep.infectParentStepsWithError) {\n step.error = childStep.error;\n step.infectParentStepsWithError = true;\n break;\n }\n }\n }\n\n if (!step.group) {\n const payload: StepEndPayload = {\n testId: this.testId,\n stepId,\n wallTime: step.endWallTime,\n error: step.error,\n suggestedRebaseline: result.suggestedRebaseline,\n annotations: step.info.annotations,\n };\n this._onStepEnd(payload);\n }\n if (step.group !== 'internal') {\n const errorForTrace = step.error ? { name: '', message: step.error.message || '', stack: step.error.stack } : undefined;\n const attachments = step.attachmentIndices.map(i => this.attachments[i]);\n this._tracing.appendAfterActionForStep(stepId, errorForTrace, attachments, step.info.annotations);\n }\n }\n };\n const parentStepList = parentStep ? parentStep.steps : this._steps;\n parentStepList.push(step);\n this._stepMap.set(stepId, step);\n\n if (!step.group) {\n const payload: StepBeginPayload = {\n testId: this.testId,\n stepId,\n parentStepId: parentStep ? parentStep.stepId : undefined,\n title: step.title,\n category: step.category,\n wallTime: Date.now(),\n location: step.location,\n };\n this._onStepBegin(payload);\n }\n if (step.group !== 'internal') {\n this._tracing.appendBeforeActionForStep({\n stepId,\n parentId: parentStep?.stepId,\n title: step.title,\n category: step.category,\n params: step.params,\n stack: step.location ? [step.location] : [],\n group: step.group,\n });\n }\n\n return step;\n }\n\n _interrupt() {\n // Mark as interrupted so we can ignore TimeoutError thrown by interrupt() call.\n this._wasInterrupted = true;\n this._timeoutManager.interrupt();\n // Do not overwrite existing failure (for example, unhandled rejection) with \"interrupted\".\n if (this.status === 'passed')\n this.status = 'interrupted';\n }\n\n _failWithError(error: Error | unknown) {\n if (this.status === 'passed' || this.status === 'skipped')\n this.status = error instanceof TimeoutManagerError ? 'timedOut' : 'failed';\n const serialized = testInfoError(error);\n const step: TestStepInternal | undefined = typeof error === 'object' ? (error as any)?.[stepSymbol] : undefined;\n if (step && step.boxedStack)\n serialized.stack = `${(error as Error).name}: ${(error as Error).message}\\n${stringifyStackFrames(step.boxedStack).join('\\n')}`;\n this.errors.push(serialized);\n this._tracing.appendForError(serialized);\n }\n\n async _runAsStep(stepInfo: { title: string, category: 'hook' | 'fixture', location?: Location, group?: string }, cb: () => Promise<any>) {\n const step = this._addStep(stepInfo);\n try {\n await cb();\n step.complete({});\n } catch (error) {\n step.complete({ error });\n throw error;\n }\n }\n\n async _runWithTimeout(runnable: RunnableDescription, cb: () => Promise<any>) {\n try {\n await this._timeoutManager.withRunnable(runnable, async () => {\n try {\n await cb();\n } catch (e) {\n if (this._allowSkips && (e instanceof TestSkipError)) {\n if (this.status === 'passed')\n this.status = 'skipped';\n } else {\n // Unfortunately, we have to handle user errors and timeout errors differently.\n // Consider the following scenario:\n // - locator.click times out\n // - all steps containing the test function finish with TimeoutManagerError\n // - test finishes, the page is closed and this triggers locator.click error\n // - we would like to present the locator.click error to the user\n // - therefore, we need a try/catch inside the \"run with timeout\" block and capture the error\n this._failWithError(e);\n }\n throw e;\n }\n });\n } catch (error) {\n // When interrupting, we arrive here with a TimeoutManagerError, but we should not\n // consider it a timeout.\n if (!this._wasInterrupted && (error instanceof TimeoutManagerError))\n this._failWithError(error);\n throw error;\n }\n }\n\n _isFailure() {\n return this.status !== 'skipped' && this.status !== this.expectedStatus;\n }\n\n _currentHookType() {\n const type = this._timeoutManager.currentSlotType();\n return ['beforeAll', 'afterAll', 'beforeEach', 'afterEach'].includes(type) ? type : undefined;\n }\n\n _setDebugMode() {\n this._timeoutManager.setIgnoreTimeouts();\n }\n\n // ------------ TestInfo methods ------------\n\n async attach(name: string, options: { path?: string, body?: string | Buffer, contentType?: string } = {}) {\n const step = this._addStep({\n title: `Attach ${escapeWithQuotes(name, '\"')}`,\n category: 'test.attach',\n });\n this._attach(\n await normalizeAndSaveAttachment(this.outputPath(), name, options),\n step.stepId\n );\n step.complete({});\n }\n\n _attach(attachment: TestInfo['attachments'][0], stepId: string | undefined) {\n const index = this._attachmentsPush(attachment) - 1;\n\n let step = stepId ? this._stepMap.get(stepId) : undefined;\n if (!!step?.group)\n step = undefined;\n\n if (step) {\n step.attachmentIndices.push(index);\n } else {\n const stepId = `attach@${createGuid()}`;\n this._tracing.appendBeforeActionForStep({ stepId, title: `Attach ${escapeWithQuotes(attachment.name, '\"')}`, category: 'test.attach', stack: [] });\n this._tracing.appendAfterActionForStep(stepId, undefined, [attachment]);\n }\n\n this._onAttach({\n testId: this.testId,\n name: attachment.name,\n contentType: attachment.contentType,\n path: attachment.path,\n body: attachment.body?.toString('base64'),\n stepId: step?.stepId,\n });\n }\n\n outputPath(...pathSegments: string[]){\n const outputPath = this._getOutputPath(...pathSegments);\n fs.mkdirSync(this.outputDir, { recursive: true });\n return outputPath;\n }\n\n _getOutputPath(...pathSegments: string[]){\n const joinedPath = path.join(...pathSegments);\n const outputPath = getContainedPath(this.outputDir, joinedPath);\n if (outputPath)\n return outputPath;\n throw new Error(`The outputPath is not allowed outside of the parent directory. Please fix the defined path.\\n\\n\\toutputPath: ${joinedPath}`);\n }\n\n _fsSanitizedTestName() {\n const fullTitleWithoutSpec = this.titlePath.slice(1).join(' ');\n return sanitizeForFilePath(trimLongString(fullTitleWithoutSpec));\n }\n\n _resolveSnapshotPaths(kind: 'snapshot' | 'screenshot' | 'aria', name: string | string[] | undefined, updateSnapshotIndex: 'updateSnapshotIndex' | 'dontUpdateSnapshotIndex', anonymousExtension?: string) {\n // NOTE: snapshot path must not ever change for backwards compatibility!\n\n const snapshotNames = kind === 'aria' ? this._ariaSnapshotNames : this._snapshotNames;\n const defaultExtensions = { 'aria': '.aria.yml', 'screenshot': '.png', 'snapshot': '.txt' };\n const ariaAwareExtname = (filePath: string) => kind === 'aria' && filePath.endsWith('.aria.yml') ? '.aria.yml' : path.extname(filePath);\n\n let subPath: string;\n let ext: string;\n let relativeOutputPath: string;\n\n if (!name) {\n // Consider the use case below. We should save actual to different paths, so we use |nextAnonymousSnapshotIndex|.\n //\n // expect.toMatchSnapshot('a.png')\n // // noop\n // expect.toMatchSnapshot('a.png')\n const index = snapshotNames.lastAnonymousSnapshotIndex + 1;\n if (updateSnapshotIndex === 'updateSnapshotIndex')\n snapshotNames.lastAnonymousSnapshotIndex = index;\n const fullTitleWithoutSpec = [...this.titlePath.slice(1), index].join(' ');\n ext = anonymousExtension ?? defaultExtensions[kind];\n subPath = sanitizeFilePathBeforeExtension(trimLongString(fullTitleWithoutSpec) + ext, ext);\n // Trim the output file paths more aggressively to avoid hitting Windows filesystem limits.\n relativeOutputPath = sanitizeFilePathBeforeExtension(trimLongString(fullTitleWithoutSpec, windowsFilesystemFriendlyLength) + ext, ext);\n } else {\n if (Array.isArray(name)) {\n // We intentionally do not sanitize user-provided array of segments,\n // assuming it is a file system path.\n // See https://github.com/microsoft/playwright/pull/9156.\n subPath = path.join(...name);\n relativeOutputPath = path.join(...name);\n ext = ariaAwareExtname(subPath);\n } else {\n ext = ariaAwareExtname(name);\n subPath = sanitizeFilePathBeforeExtension(name, ext);\n // Trim the output file paths more aggressively to avoid hitting Windows filesystem limits.\n relativeOutputPath = sanitizeFilePathBeforeExtension(trimLongString(name, windowsFilesystemFriendlyLength), ext);\n }\n const index = (snapshotNames.lastNamedSnapshotIndex[relativeOutputPath] || 0) + 1;\n if (updateSnapshotIndex === 'updateSnapshotIndex')\n snapshotNames.lastNamedSnapshotIndex[relativeOutputPath] = index;\n if (index > 1)\n relativeOutputPath = addSuffixToFilePath(relativeOutputPath, `-${index - 1}`);\n }\n\n const absoluteSnapshotPath = this._applyPathTemplate(kind, subPath, ext);\n return { absoluteSnapshotPath, relativeOutputPath };\n }\n\n private _applyPathTemplate(kind: 'snapshot' | 'screenshot' | 'aria', relativePath: string, ext: string) {\n const legacyTemplate = '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}{-snapshotSuffix}{ext}';\n let template: string;\n if (kind === 'screenshot') {\n template = this._projectInternal.expect?.toHaveScreenshot?.pathTemplate || this._projectInternal.snapshotPathTemplate || legacyTemplate;\n } else if (kind === 'aria') {\n const ariaDefaultTemplate = '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}';\n template = this._projectInternal.expect?.toMatchAriaSnapshot?.pathTemplate || this._projectInternal.snapshotPathTemplate || ariaDefaultTemplate;\n } else {\n template = this._projectInternal.snapshotPathTemplate || legacyTemplate;\n }\n\n const dir = path.dirname(relativePath);\n const name = path.basename(relativePath, ext);\n const relativeTestFilePath = path.relative(this.project.testDir, this._requireFile);\n const parsedRelativeTestFilePath = path.parse(relativeTestFilePath);\n const projectNamePathSegment = sanitizeForFilePath(this.project.name);\n\n const snapshotPath = template\n .replace(/\\{(.)?testDir\\}/g, '$1' + this.project.testDir)\n .replace(/\\{(.)?snapshotDir\\}/g, '$1' + this.project.snapshotDir)\n .replace(/\\{(.)?snapshotSuffix\\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : '')\n .replace(/\\{(.)?testFileDir\\}/g, '$1' + parsedRelativeTestFilePath.dir)\n .replace(/\\{(.)?platform\\}/g, '$1' + process.platform)\n .replace(/\\{(.)?projectName\\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '')\n .replace(/\\{(.)?testName\\}/g, '$1' + this._fsSanitizedTestName())\n .replace(/\\{(.)?testFileName\\}/g, '$1' + parsedRelativeTestFilePath.base)\n .replace(/\\{(.)?testFilePath\\}/g, '$1' + relativeTestFilePath)\n .replace(/\\{(.)?arg\\}/g, '$1' + path.join(dir, name))\n .replace(/\\{(.)?ext\\}/g, ext ? '$1' + ext : '');\n\n return path.normalize(path.resolve(this._configInternal.configDir, snapshotPath));\n }\n\n snapshotPath(...name: string[]): string;\n snapshotPath(name: string, options: { kind: 'snapshot' | 'screenshot' | 'aria' }): string;\n snapshotPath(...args: any[]) {\n let name: string[] = args;\n let kind: 'snapshot' | 'screenshot' | 'aria' = 'snapshot';\n\n const options = args[args.length - 1];\n if (options && typeof options === 'object') {\n kind = options.kind ?? kind;\n name = args.slice(0, -1);\n }\n\n if (!['snapshot', 'screenshot', 'aria'].includes(kind))\n throw new Error(`testInfo.snapshotPath: unknown kind \"${kind}\", must be one of \"snapshot\", \"screenshot\" or \"aria\"`);\n\n // Assume a zero/single path segment corresponds to `toHaveScreenshot(name)`,\n // while multiple path segments correspond to `toHaveScreenshot([...name])`.\n return this._resolveSnapshotPaths(kind, name.length <= 1 ? name[0] : name, 'dontUpdateSnapshotIndex').absoluteSnapshotPath;\n }\n\n setTimeout(timeout: number) {\n this._timeoutManager.setTimeout(timeout);\n }\n\n _pauseOnError(): boolean {\n return this._workerParams.pauseOnError;\n }\n\n _pauseAtEnd(): boolean {\n return this._workerParams.pauseAtEnd;\n }\n}\n\nexport class TestStepInfoImpl implements TestStepInfo {\n annotations: TestAnnotation[] = [];\n\n private _testInfo: TestInfoImpl;\n private _stepId: string;\n private _title: string;\n private _parentStep?: TestStepInfoImpl;\n\n skip: (arg?: any, description?: string) => void;\n\n constructor(testInfo: TestInfoImpl, stepId: string, title: string, parentStep?: TestStepInfoImpl) {\n this._testInfo = testInfo;\n this._stepId = stepId;\n this._title = title;\n this._parentStep = parentStep;\n this.skip = wrapFunctionWithLocation((location: Location, ...args: unknown[]) => {\n // skip();\n // skip(condition: boolean, description: string);\n if (args.length > 0 && !args[0])\n return;\n const description = args[1] as (string|undefined);\n this.annotations.push({ type: 'skip', description, location });\n throw new StepSkipError(description);\n });\n }\n\n async _runStepBody<T>(skip: boolean, body: (step: TestStepInfo) => T | Promise<T>, location?: Location) {\n if (skip) {\n this.annotations.push({ type: 'skip', location });\n return undefined as T;\n }\n try {\n return await body(this);\n } catch (e) {\n if (e instanceof StepSkipError)\n return undefined as T;\n throw e;\n }\n }\n\n _attachToStep(attachment: TestInfo['attachments'][0]): void {\n this._testInfo._attach(attachment, this._stepId);\n }\n\n async attach(name: string, options?: { body?: string | Buffer; contentType?: string; path?: string; }): Promise<void> {\n this._attachToStep(await normalizeAndSaveAttachment(this._testInfo.outputPath(), name, options));\n }\n\n get titlePath(): string[] {\n const parent = this._parentStep ?? this._testInfo;\n return [...parent.titlePath, this._title];\n }\n}\n\nexport class TestSkipError extends Error {\n}\n\nexport class StepSkipError extends Error {\n}\n\nconst stepSymbol = Symbol('step');\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,gBAAe;AACf,kBAAiB;AAEjB,mBAAqI;AAErI,4BAAkE;AAClE,kBAAwL;AACxL,yBAA4B;AAC5B,IAAAA,eAA8B;AAC9B,uBAAyC;AAyClC,MAAM,aAAiC;AAAA,EAwF5C,YACE,gBACA,iBACA,cACA,MACA,OACA,aACA,WACA,UACA;AA7FF,SAAQ,iBAAgC,EAAE,4BAA4B,GAAG,wBAAwB,CAAC,EAAE;AACpG,SAAQ,qBAAoC,EAAE,4BAA4B,GAAG,wBAAwB,CAAC,EAAE;AAOxG,2BAAkB;AAClB,uBAAc;AAId,SAAiB,SAA6B,CAAC;AAC/C,SAAiB,WAAW,oBAAI,IAA8B;AAC9D,qCAAqD,CAAC;AACtD,iCAAwB;AACxB,8BAAqB;AACrB,uBAAc;AAwBd,oBAAmB;AACnB,SAAS,cAAgC,CAAC;AAC1C,SAAS,cAAuC,CAAC;AACjD,kBAAqB;AACrB,0BAAyB;AAGzB,kBAA8B,CAAC;AA6C7B,SAAK,SAAS,MAAM,MAAM;AAC1B,SAAK,eAAe;AACpB,S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F;AACpH,SAAK,cAAc,UAAM,wCAA2B,KAAK,UAAU,WAAW,GAAG,MAAM,OAAO,CAAC;AAAA,EACjG;AAAA,EAEA,IAAI,YAAsB;AACxB,UAAM,SAAS,KAAK,eAAe,KAAK;AACxC,WAAO,CAAC,GAAG,OAAO,WAAW,KAAK,MAAM;AAAA,EAC1C;AACF;AAEO,MAAM,sBAAsB,MAAM;AACzC;AAEO,MAAM,sBAAsB,MAAM;AACzC;AAEA,MAAM,aAAa,OAAO,MAAM;",
6
- "names": ["import_util", "path", "stepId", "fs"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/worker/testTracing.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 fs from 'fs';\nimport path from 'path';\n\nimport { ManualPromise, SerializedFS, calculateSha1, createGuid, monotonicTime } from 'playwright-core/lib/utils';\nimport { yauzl, yazl } from 'playwright-core/lib/zipBundle';\n\nimport { filteredStackTrace } from '../util';\n\nimport type { TestStepCategory, TestInfoImpl } from './testInfo';\nimport type { PlaywrightWorkerOptions, TestInfo, TraceMode } from '../../types/test';\nimport type { TestInfoErrorImpl } from '../common/ipc';\nimport type { SerializedError, StackFrame } from '@protocol/channels';\nimport type * as trace from '@trace/trace';\nimport type EventEmitter from 'events';\n\nexport type Attachment = TestInfo['attachments'][0];\nexport const testTraceEntryName = 'test.trace';\nconst version: trace.VERSION = 8;\nlet traceOrdinal = 0;\n\ntype TraceFixtureValue = PlaywrightWorkerOptions['trace'] | undefined;\ntype TraceOptions = { screenshots: boolean, snapshots: boolean, sources: boolean, attachments: boolean, _live: boolean, mode: TraceMode };\n\nexport class TestTracing {\n private _testInfo: TestInfoImpl;\n private _options: TraceOptions | undefined;\n private _liveTraceFile: { file: string, fs: SerializedFS } | undefined;\n private _traceEvents: trace.TraceEvent[] = [];\n private _temporaryTraceFiles: string[] = [];\n private _artifactsDir: string;\n private _tracesDir: string;\n private _contextCreatedEvent: trace.ContextCreatedTraceEvent;\n private _didFinishTestFunctionAndAfterEachHooks = false;\n\n constructor(testInfo: TestInfoImpl, artifactsDir: string) {\n this._testInfo = testInfo;\n this._artifactsDir = artifactsDir;\n this._tracesDir = path.join(this._artifactsDir, 'traces');\n this._contextCreatedEvent = {\n version,\n type: 'context-options',\n origin: 'testRunner',\n browserName: '',\n options: {},\n platform: process.platform,\n wallTime: Date.now(),\n monotonicTime: monotonicTime(),\n sdkLanguage: 'javascript',\n };\n this._appendTraceEvent(this._contextCreatedEvent);\n }\n\n private _shouldCaptureTrace() {\n if (this._options?.mode === 'on')\n return true;\n\n if (this._options?.mode === 'retain-on-failure')\n return true;\n\n if (this._options?.mode === 'on-first-retry' && this._testInfo.retry === 1)\n return true;\n\n if (this._options?.mode === 'on-all-retries' && this._testInfo.retry > 0)\n return true;\n\n if (this._options?.mode === 'retain-on-first-failure' && this._testInfo.retry === 0)\n return true;\n\n return false;\n }\n\n async startIfNeeded(value: TraceFixtureValue) {\n const defaultTraceOptions: TraceOptions = { screenshots: true, snapshots: true, sources: true, attachments: true, _live: false, mode: 'off' };\n\n if (!value) {\n this._options = defaultTraceOptions;\n } else if (typeof value === 'string') {\n this._options = { ...defaultTraceOptions, mode: value === 'retry-with-trace' ? 'on-first-retry' : value as TraceMode };\n } else {\n const mode = value.mode || 'off';\n this._options = { ...defaultTraceOptions, ...value, mode: (mode as string) === 'retry-with-trace' ? 'on-first-retry' : mode };\n }\n\n if (!this._shouldCaptureTrace()) {\n this._options = undefined;\n return;\n }\n\n if (!this._liveTraceFile && this._options._live) {\n // Note that trace name must start with testId for live tracing to work.\n this._liveTraceFile = { file: path.join(this._tracesDir, `${this._testInfo.testId}-test.trace`), fs: new SerializedFS() };\n this._liveTraceFile.fs.mkdir(path.dirname(this._liveTraceFile.file));\n const data = this._traceEvents.map(e => JSON.stringify(e)).join('\\n') + '\\n';\n this._liveTraceFile.fs.writeFile(this._liveTraceFile.file, data);\n }\n }\n\n didFinishTestFunctionAndAfterEachHooks() {\n this._didFinishTestFunctionAndAfterEachHooks = true;\n }\n\n artifactsDir() {\n return this._artifactsDir;\n }\n\n tracesDir() {\n return this._tracesDir;\n }\n\n traceTitle() {\n return [path.relative(this._testInfo.project.testDir, this._testInfo.file) + ':' + this._testInfo.line, ...this._testInfo.titlePath.slice(1)].join(' \u203A ');\n }\n\n generateNextTraceRecordingName() {\n const ordinalSuffix = traceOrdinal ? `-recording${traceOrdinal}` : '';\n ++traceOrdinal;\n const retrySuffix = this._testInfo.retry ? `-retry${this._testInfo.retry}` : '';\n // Note that trace name must start with testId for live tracing to work.\n return `${this._testInfo.testId}${retrySuffix}${ordinalSuffix}`;\n }\n\n private _generateNextTraceRecordingPath() {\n const file = path.join(this._artifactsDir, createGuid() + '.zip');\n this._temporaryTraceFiles.push(file);\n return file;\n }\n\n traceOptions() {\n return this._options;\n }\n\n maybeGenerateNextTraceRecordingPath() {\n // Forget about traces that should be saved on failure, when no failure happened\n // during the test and beforeEach/afterEach hooks.\n // This avoids downloading traces over the wire when not really needed.\n if (this._didFinishTestFunctionAndAfterEachHooks && this._shouldAbandonTrace())\n return;\n return this._generateNextTraceRecordingPath();\n }\n\n private _shouldAbandonTrace() {\n if (!this._options)\n return true;\n const testFailed = this._testInfo.status !== this._testInfo.expectedStatus;\n return !testFailed && (this._options.mode === 'retain-on-failure' || this._options.mode === 'retain-on-first-failure');\n }\n\n async stopIfNeeded() {\n if (!this._options)\n return;\n\n const error = await this._liveTraceFile?.fs.syncAndGetError();\n if (error)\n throw error;\n\n if (this._shouldAbandonTrace()) {\n for (const file of this._temporaryTraceFiles)\n await fs.promises.unlink(file).catch(() => {});\n return;\n }\n\n const zipFile = new yazl.ZipFile();\n\n if (!this._options?.attachments) {\n for (const event of this._traceEvents) {\n if (event.type === 'after')\n delete event.attachments;\n }\n }\n\n if (this._options?.sources) {\n const sourceFiles = new Set<string>();\n for (const event of this._traceEvents) {\n if (event.type === 'before') {\n for (const frame of event.stack || [])\n sourceFiles.add(frame.file);\n }\n }\n for (const sourceFile of sourceFiles) {\n await fs.promises.readFile(sourceFile, 'utf8').then(source => {\n zipFile.addBuffer(Buffer.from(source), 'resources/src@' + calculateSha1(sourceFile) + '.txt');\n }).catch(() => {});\n }\n }\n\n const sha1s = new Set<string>();\n for (const event of this._traceEvents.filter(e => e.type === 'after') as trace.AfterActionTraceEvent[]) {\n for (const attachment of (event.attachments || [])) {\n let contentPromise: Promise<Buffer | undefined> | undefined;\n if (attachment.path)\n contentPromise = fs.promises.readFile(attachment.path).catch(() => undefined);\n else if (attachment.base64)\n contentPromise = Promise.resolve(Buffer.from(attachment.base64, 'base64'));\n\n const content = await contentPromise;\n if (content === undefined)\n continue;\n\n const sha1 = calculateSha1(content);\n attachment.sha1 = sha1;\n delete attachment.path;\n delete attachment.base64;\n if (sha1s.has(sha1))\n continue;\n sha1s.add(sha1);\n zipFile.addBuffer(content, 'resources/' + sha1);\n }\n }\n\n const traceContent = Buffer.from(this._traceEvents.map(e => JSON.stringify(e)).join('\\n'));\n zipFile.addBuffer(traceContent, testTraceEntryName);\n\n await new Promise(f => {\n zipFile.end(undefined, () => {\n zipFile.outputStream.pipe(fs.createWriteStream(this._generateNextTraceRecordingPath())).on('close', f);\n });\n });\n\n const tracePath = this._testInfo.outputPath('trace.zip');\n await mergeTraceFiles(tracePath, this._temporaryTraceFiles);\n this._testInfo.attachments.push({ name: 'trace', path: tracePath, contentType: 'application/zip' });\n }\n\n appendForError(error: TestInfoErrorImpl) {\n const rawStack = error.stack?.split('\\n') || [];\n const stack = rawStack ? filteredStackTrace(rawStack) : [];\n this._appendTraceEvent({\n type: 'error',\n message: this._formatError(error),\n stack,\n });\n }\n\n _formatError(error: TestInfoErrorImpl) {\n const parts: string[] = [error.message || String(error.value)];\n if (error.cause)\n parts.push('[cause]: ' + this._formatError(error.cause));\n return parts.join('\\n');\n }\n\n appendStdioToTrace(type: 'stdout' | 'stderr', chunk: string | Buffer) {\n this._appendTraceEvent({\n type,\n timestamp: monotonicTime(),\n text: typeof chunk === 'string' ? chunk : undefined,\n base64: typeof chunk === 'string' ? undefined : chunk.toString('base64'),\n });\n }\n\n appendBeforeActionForStep(options: { stepId: string, parentId?: string, title: string, category: TestStepCategory, params?: Record<string, any>, stack: StackFrame[], group?: string }) {\n this._appendTraceEvent({\n type: 'before',\n callId: options.stepId,\n stepId: options.stepId,\n parentId: options.parentId,\n startTime: monotonicTime(),\n class: 'Test',\n method: options.category,\n title: options.title,\n params: Object.fromEntries(Object.entries(options.params || {}).map(([name, value]) => [name, generatePreview(value)])),\n stack: options.stack,\n group: options.group,\n });\n }\n\n appendAfterActionForStep(callId: string, error?: SerializedError['error'], attachments: Attachment[] = [], annotations?: trace.AfterActionTraceEventAnnotation[]) {\n this._appendTraceEvent({\n type: 'after',\n callId,\n endTime: monotonicTime(),\n attachments: serializeAttachments(attachments),\n annotations,\n error,\n });\n }\n\n private _appendTraceEvent(event: trace.TraceEvent) {\n this._traceEvents.push(event);\n if (this._liveTraceFile)\n this._liveTraceFile.fs.appendFile(this._liveTraceFile.file, JSON.stringify(event) + '\\n', true);\n }\n}\n\nfunction serializeAttachments(attachments: Attachment[]): trace.AfterActionTraceEvent['attachments'] {\n if (attachments.length === 0)\n return undefined;\n return attachments.filter(a => a.name !== 'trace').map(a => {\n return {\n name: a.name,\n contentType: a.contentType,\n path: a.path,\n base64: a.body?.toString('base64'),\n };\n });\n}\n\nfunction generatePreview(value: any, visited = new Set<any>()): string {\n if (visited.has(value))\n return '';\n visited.add(value);\n if (typeof value === 'string')\n return value;\n if (typeof value === 'number')\n return value.toString();\n if (typeof value === 'boolean')\n return value.toString();\n if (value === null)\n return 'null';\n if (value === undefined)\n return 'undefined';\n if (Array.isArray(value))\n return '[' + value.map(v => generatePreview(v, visited)).join(', ') + ']';\n if (typeof value === 'object')\n return 'Object';\n return String(value);\n}\n\nasync function mergeTraceFiles(fileName: string, temporaryTraceFiles: string[]) {\n temporaryTraceFiles = temporaryTraceFiles.filter(file => fs.existsSync(file));\n if (temporaryTraceFiles.length === 1) {\n await fs.promises.rename(temporaryTraceFiles[0], fileName);\n return;\n }\n\n const mergePromise = new ManualPromise();\n const zipFile = new yazl.ZipFile();\n const entryNames = new Set<string>();\n (zipFile as any as EventEmitter).on('error', error => mergePromise.reject(error));\n\n for (let i = temporaryTraceFiles.length - 1; i >= 0; --i) {\n const tempFile = temporaryTraceFiles[i];\n const promise = new ManualPromise<void>();\n yauzl.open(tempFile, (err, inZipFile) => {\n if (err) {\n promise.reject(err);\n return;\n }\n let pendingEntries = inZipFile.entryCount;\n inZipFile.on('entry', entry => {\n let entryName = entry.fileName;\n if (entry.fileName === testTraceEntryName) {\n // Keep the name for test traces so that the last test trace\n // that contains most of the information is kept in the trace.\n // Note the reverse order of the iteration (from new traces to old).\n } else if (entry.fileName.match(/trace\\.[a-z]*$/)) {\n entryName = i + '-' + entry.fileName;\n }\n if (entryNames.has(entryName)) {\n if (--pendingEntries === 0)\n promise.resolve();\n return;\n }\n entryNames.add(entryName);\n inZipFile.openReadStream(entry, (err, readStream) => {\n if (err) {\n promise.reject(err);\n return;\n }\n zipFile.addReadStream(readStream!, entryName);\n if (--pendingEntries === 0)\n promise.resolve();\n });\n });\n });\n await promise;\n }\n\n zipFile.end(undefined, () => {\n zipFile.outputStream.pipe(fs.createWriteStream(fileName)).on('close', () => {\n void Promise.all(temporaryTraceFiles.map(tempFile => fs.promises.unlink(tempFile))).then(() => {\n mergePromise.resolve();\n }).catch(error => mergePromise.reject(error));\n }).on('error', error => mergePromise.reject(error));\n });\n await mergePromise;\n}\n"],
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,aAAa,KAAK,UAAAD,QAAG,kBAAkB,QAAQ,CAAC,EAAE,GAAG,SAAS,MAAM;AAC1E,WAAK,QAAQ,IAAI,oBAAoB,IAAI,cAAY,UAAAA,QAAG,SAAS,OAAO,QAAQ,CAAC,CAAC,EAAE,KAAK,MAAM;AAC7F,qBAAa,QAAQ;AAAA,MACvB,CAAC,EAAE,MAAM,WAAS,aAAa,OAAO,KAAK,CAAC;AAAA,IAC9C,CAAC,EAAE,GAAG,SAAS,WAAS,aAAa,OAAO,KAAK,CAAC;AAAA,EACpD,CAAC;AACD,QAAM;AACR;",
6
- "names": ["path", "fs", "err"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/worker/timeoutManager.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 { ManualPromise, monotonicTime } from 'playwright-core/lib/utils';\nimport { colors } from 'playwright-core/lib/utils';\n\nimport { debugTest, formatLocation } from '../util';\n\nimport type { Location } from '../../types/testReporter';\n\nexport type TimeSlot = {\n timeout: number;\n elapsed: number;\n};\n\ntype RunnableType = 'test' | 'beforeAll' | 'afterAll' | 'beforeEach' | 'afterEach' | 'slow' | 'skip' | 'fail' | 'fixme' | 'teardown';\n\nexport type RunnableDescription = {\n type: RunnableType;\n location?: Location;\n slot?: TimeSlot; // Falls back to test slot.\n fixture?: FixtureDescription;\n};\n\nexport type FixtureDescription = {\n title: string;\n phase: 'setup' | 'teardown';\n location?: Location;\n slot?: TimeSlot; // Falls back to the runnable slot.\n};\n\ntype Running = {\n runnable: RunnableDescription;\n slot: TimeSlot;\n start: number;\n deadline: number;\n timer: NodeJS.Timeout | undefined;\n timeoutPromise: ManualPromise<any>;\n};\nexport const kMaxDeadline = 2147483647; // 2^31-1\n\nexport class TimeoutManager {\n private _defaultSlot: TimeSlot;\n private _running?: Running;\n private _ignoreTimeouts = false;\n\n constructor(timeout: number) {\n this._defaultSlot = { timeout, elapsed: 0 };\n }\n\n setIgnoreTimeouts() {\n this._ignoreTimeouts = true;\n if (this._running)\n this._updateTimeout(this._running);\n }\n\n interrupt() {\n if (this._running)\n this._running.timeoutPromise.reject(this._createTimeoutError(this._running));\n }\n\n isTimeExhaustedFor(runnable: RunnableDescription) {\n const slot = runnable.fixture?.slot || runnable.slot || this._defaultSlot;\n // Note: the \"-1\" here matches the +1 in _updateTimeout.\n return slot.timeout > 0 && (slot.elapsed >= slot.timeout - 1);\n }\n\n async withRunnable<T>(runnable: RunnableDescription, cb: () => Promise<T>): Promise<T> {\n if (this._running)\n throw new Error(`Internal error: duplicate runnable`);\n const running = this._running = {\n runnable,\n slot: runnable.fixture?.slot || runnable.slot || this._defaultSlot,\n start: monotonicTime(),\n deadline: kMaxDeadline,\n timer: undefined,\n timeoutPromise: new ManualPromise(),\n };\n let debugTitle = '';\n try {\n if (debugTest.enabled) {\n debugTitle = runnable.fixture ? `${runnable.fixture.phase} \"${runnable.fixture.title}\"` : runnable.type;\n const location = runnable.location ? ` at \"${formatLocation(runnable.location)}\"` : ``;\n debugTest(`started ${debugTitle}${location}`);\n }\n this._updateTimeout(running);\n return await Promise.race([\n cb(),\n running.timeoutPromise,\n ]);\n } finally {\n if (running.timer)\n clearTimeout(running.timer);\n running.timer = undefined;\n running.slot.elapsed += monotonicTime() - running.start;\n this._running = undefined;\n if (debugTest.enabled)\n debugTest(`finished ${debugTitle}`);\n }\n }\n\n private _updateTimeout(running: Running) {\n if (running.timer)\n clearTimeout(running.timer);\n running.timer = undefined;\n if (this._ignoreTimeouts || !running.slot.timeout) {\n running.deadline = kMaxDeadline;\n return;\n }\n running.deadline = running.start + (running.slot.timeout - running.slot.elapsed);\n // Compensate for Node.js troubles with timeouts that can fire too early.\n // We add an extra millisecond which seems to be enough.\n // See https://github.com/nodejs/node/issues/26578.\n const timeout = running.deadline - monotonicTime() + 1;\n if (timeout <= 0)\n running.timeoutPromise.reject(this._createTimeoutError(running));\n else\n running.timer = setTimeout(() => running.timeoutPromise.reject(this._createTimeoutError(running)), timeout);\n }\n\n defaultSlot() {\n return this._defaultSlot;\n }\n\n slow() {\n const slot = this._running ? this._running.slot : this._defaultSlot;\n slot.timeout = slot.timeout * 3;\n if (this._running)\n this._updateTimeout(this._running);\n }\n\n setTimeout(timeout: number) {\n const slot = this._running ? this._running.slot : this._defaultSlot;\n slot.timeout = timeout;\n if (this._running)\n this._updateTimeout(this._running);\n }\n\n currentSlotDeadline() {\n return this._running ? this._running.deadline : kMaxDeadline;\n }\n\n currentSlotType() {\n return this._running ? this._running.runnable.type : 'test';\n }\n\n private _createTimeoutError(running: Running): Error {\n let message = '';\n const timeout = running.slot.timeout;\n const runnable = running.runnable;\n switch (runnable.type) {\n case 'test': {\n if (runnable.fixture) {\n if (runnable.fixture.phase === 'setup')\n message = `Test timeout of ${timeout}ms exceeded while setting up \"${runnable.fixture.title}\".`;\n else\n message = `Tearing down \"${runnable.fixture.title}\" exceeded the test timeout of ${timeout}ms.`;\n } else {\n message = `Test timeout of ${timeout}ms exceeded.`;\n }\n break;\n }\n case 'afterEach':\n case 'beforeEach':\n message = `Test timeout of ${timeout}ms exceeded while running \"${runnable.type}\" hook.`;\n break;\n case 'beforeAll':\n case 'afterAll':\n message = `\"${runnable.type}\" hook timeout of ${timeout}ms exceeded.`;\n break;\n case 'teardown': {\n if (runnable.fixture)\n message = `Worker teardown timeout of ${timeout}ms exceeded while ${runnable.fixture.phase === 'setup' ? 'setting up' : 'tearing down'} \"${runnable.fixture.title}\".`;\n else\n message = `Worker teardown timeout of ${timeout}ms exceeded.`;\n break;\n }\n case 'skip':\n case 'slow':\n case 'fixme':\n case 'fail':\n message = `\"${runnable.type}\" modifier timeout of ${timeout}ms exceeded.`;\n break;\n }\n const fixtureWithSlot = runnable.fixture?.slot ? runnable.fixture : undefined;\n if (fixtureWithSlot)\n message = `Fixture \"${fixtureWithSlot.title}\" timeout of ${timeout}ms exceeded during ${fixtureWithSlot.phase}.`;\n message = colors.red(message);\n const location = (fixtureWithSlot || runnable).location;\n const error = new TimeoutManagerError(message);\n error.name = '';\n // Include location for hooks, modifiers and fixtures to distinguish between them.\n error.stack = message + (location ? `\\n at ${location.file}:${location.line}:${location.column}` : '');\n return error;\n }\n}\n\nexport class TimeoutManagerError extends Error {}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,mBAA6C;AAC7C,IAAAA,gBAAuB;AAEvB,kBAA0C;AAiCnC,MAAM,eAAe;AAErB,MAAM,eAAe;AAAA,EAK1B,YAAY,SAAiB;AAF7B,SAAQ,kBAAkB;AAGxB,SAAK,eAAe,EAAE,SAAS,SAAS,EAAE;AAAA,EAC5C;AAAA,EAEA,oBAAoB;AAClB,SAAK,kBAAkB;AACvB,QAAI,KAAK;AACP,WAAK,eAAe,KAAK,QAAQ;AAAA,EACrC;AAAA,EAEA,YAAY;AACV,QAAI,KAAK;AACP,WAAK,SAAS,eAAe,OAAO,KAAK,oBAAoB,KAAK,QAAQ,CAAC;AAAA,EAC/E;AAAA,EAEA,mBAAmB,UAA+B;AAChD,UAAM,OAAO,SAAS,SAAS,QAAQ,SAAS,QAAQ,KAAK;AAE7D,WAAO,KAAK,UAAU,KAAM,KAAK,WAAW,KAAK,UAAU;AAAA,EAC7D;AAAA,EAEA,MAAM,aAAgB,UAA+B,IAAkC;AACrF,QAAI,KAAK;AACP,YAAM,IAAI,MAAM,oCAAoC;AACtD,UAAM,UAAU,KAAK,WAAW;AAAA,MAC9B;AAAA,MACA,MAAM,SAAS,SAAS,QAAQ,SA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,MACF;AAAA,MACA,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,kBAAU,IAAI,SAAS,IAAI,yBAAyB,OAAO;AAC3D;AAAA,IACJ;AACA,UAAM,kBAAkB,SAAS,SAAS,OAAO,SAAS,UAAU;AACpE,QAAI;AACF,gBAAU,YAAY,gBAAgB,KAAK,gBAAgB,OAAO,sBAAsB,gBAAgB,KAAK;AAC/G,cAAU,qBAAO,IAAI,OAAO;AAC5B,UAAM,YAAY,mBAAmB,UAAU;AAC/C,UAAM,QAAQ,IAAI,oBAAoB,OAAO;AAC7C,UAAM,OAAO;AAEb,UAAM,QAAQ,WAAW,WAAW;AAAA,SAAY,SAAS,IAAI,IAAI,SAAS,IAAI,IAAI,SAAS,MAAM,KAAK;AACtG,WAAO;AAAA,EACT;AACF;AAEO,MAAM,4BAA4B,MAAM;AAAC;",
6
- "names": ["import_utils"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/worker/util.ts"],
4
- "sourcesContent": ["/**\n * Copyright (c) Microsoft Corporation.\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 { serializeError } from '../util';\n\nimport type { TestInfoErrorImpl } from '../common/ipc';\n\nexport function testInfoError(error: Error | any): TestInfoErrorImpl {\n return serializeError(error);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,kBAA+B;AAIxB,SAAS,cAAc,OAAuC;AACnE,aAAO,4BAAe,KAAK;AAC7B;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/worker/workerMain.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 { ManualPromise, gracefullyCloseAll, removeFolders } from 'playwright-core/lib/utils';\nimport { colors } from 'playwright-core/lib/utils';\n\nimport { deserializeConfig } from '../common/configLoader';\nimport { setCurrentTestInfo, setIsWorkerProcess } from '../common/globals';\nimport { stdioChunkToParams } from '../common/ipc';\nimport { debugTest, relativeFilePath } from '../util';\nimport { FixtureRunner } from './fixtureRunner';\nimport { TestSkipError, TestInfoImpl } from './testInfo';\nimport { testInfoError } from './util';\nimport { inheritFixtureNames } from '../common/fixtures';\nimport { PoolBuilder } from '../common/poolBuilder';\nimport { ProcessRunner } from '../common/process';\nimport { applyRepeatEachIndex, bindFileSuiteToProject, filterTestsRemoveEmptySuites } from '../common/suiteUtils';\nimport { loadTestFile } from '../common/testLoader';\n\nimport type { TimeSlot } from './timeoutManager';\nimport type { Location } from '../../types/testReporter';\nimport type { FullConfigInternal, FullProjectInternal } from '../common/config';\nimport type { DonePayload, RunPayload, TeardownErrorsPayload, TestBeginPayload, TestEndPayload, TestInfoErrorImpl, WorkerInitParams } from '../common/ipc';\nimport type { Suite, TestCase } from '../common/test';\nimport type { TestAnnotation } from '../../types/test';\n\nexport class WorkerMain extends ProcessRunner {\n private _params: WorkerInitParams;\n private _config!: FullConfigInternal;\n private _project!: FullProjectInternal;\n private _poolBuilder!: PoolBuilder;\n private _fixtureRunner: FixtureRunner;\n\n // Accumulated fatal errors that cannot be attributed to a test.\n private _fatalErrors: TestInfoErrorImpl[] = [];\n // Whether we should skip running remaining tests in this suite because\n // of a setup error, usually beforeAll hook.\n private _skipRemainingTestsInSuite: Suite | undefined;\n // The stage of the full cleanup. Once \"finished\", we can safely stop running anything.\n private _didRunFullCleanup = false;\n // Whether the worker was stopped due to an unhandled error in a test marked with test.fail().\n // This should force dispatcher to use a new worker instead.\n private _stoppedDueToUnhandledErrorInTestFail = false;\n // Whether the worker was requested to stop.\n private _isStopped = false;\n // This promise resolves once the single \"run test group\" call finishes.\n private _runFinished = new ManualPromise<void>();\n private _currentTest: TestInfoImpl | null = null;\n private _lastRunningTests: TestCase[] = [];\n private _totalRunningTests = 0;\n // Suites that had their beforeAll hooks, but not afterAll hooks executed.\n // These suites still need afterAll hooks to be executed for the proper cleanup.\n // Contains dynamic annotations originated by modifiers with a callback, e.g. `test.skip(() => true)`.\n private _activeSuites = new Map<Suite, TestAnnotation[]>();\n\n constructor(params: WorkerInitParams) {\n super();\n process.env.TEST_WORKER_INDEX = String(params.workerIndex);\n process.env.TEST_PARALLEL_INDEX = String(params.parallelIndex);\n setIsWorkerProcess();\n\n this._params = params;\n this._fixtureRunner = new FixtureRunner();\n\n // Resolve this promise, so worker does not stall waiting for the non-existent run to finish,\n // when it was sopped before running any test group.\n this._runFinished.resolve();\n\n process.on('unhandledRejection', reason => this.unhandledError(reason));\n process.on('uncaughtException', error => this.unhandledError(error));\n // eslint-disable-next-line no-restricted-properties\n process.stdout.write = (chunk: string | Buffer, cb?: any) => {\n this.dispatchEvent('stdOut', stdioChunkToParams(chunk));\n this._currentTest?._tracing.appendStdioToTrace('stdout', chunk);\n if (typeof cb === 'function')\n process.nextTick(cb);\n return true;\n };\n\n if (!process.env.PW_RUNNER_DEBUG) {\n // eslint-disable-next-line no-restricted-properties\n process.stderr.write = (chunk: string | Buffer, cb?: any) => {\n this.dispatchEvent('stdErr', stdioChunkToParams(chunk));\n this._currentTest?._tracing.appendStdioToTrace('stderr', chunk);\n if (typeof cb === 'function')\n process.nextTick(cb);\n return true;\n };\n }\n }\n\n private _stop(): Promise<void> {\n if (!this._isStopped) {\n this._isStopped = true;\n this._currentTest?._interrupt();\n }\n return this._runFinished;\n }\n\n override async gracefullyClose() {\n try {\n await this._stop();\n if (!this._config) {\n // We never set anything up and we can crash on attempting cleanup\n return;\n }\n // Ignore top-level errors, they are already inside TestInfo.errors.\n const fakeTestInfo = new TestInfoImpl(this._config, this._project, this._params, undefined, 0, () => {}, () => {}, () => {});\n const runnable = { type: 'teardown' } as const;\n // We have to load the project to get the right deadline below.\n await fakeTestInfo._runWithTimeout(runnable, () => this._loadIfNeeded()).catch(() => {});\n await this._fixtureRunner.teardownScope('test', fakeTestInfo, runnable).catch(() => {});\n await this._fixtureRunner.teardownScope('worker', fakeTestInfo, runnable).catch(() => {});\n // Close any other browsers launched in this process. This includes anything launched\n // manually in the test/hooks and internal browsers like Playwright Inspector.\n await fakeTestInfo._runWithTimeout(runnable, () => gracefullyCloseAll()).catch(() => {});\n this._fatalErrors.push(...fakeTestInfo.errors);\n } catch (e) {\n this._fatalErrors.push(testInfoError(e));\n }\n\n if (this._fatalErrors.length) {\n this._appendProcessTeardownDiagnostics(this._fatalErrors[this._fatalErrors.length - 1]);\n const payload: TeardownErrorsPayload = { fatalErrors: this._fatalErrors };\n this.dispatchEvent('teardownErrors', payload);\n }\n }\n\n private _appendProcessTeardownDiagnostics(error: TestInfoErrorImpl) {\n if (!this._lastRunningTests.length)\n return;\n const count = this._totalRunningTests === 1 ? '1 test' : `${this._totalRunningTests} tests`;\n let lastMessage = '';\n if (this._lastRunningTests.length < this._totalRunningTests)\n lastMessage = `, last ${this._lastRunningTests.length} tests were`;\n const message = [\n '',\n '',\n colors.red(`Failed worker ran ${count}${lastMessage}:`),\n ...this._lastRunningTests.map(test => formatTestTitle(test, this._project.project.name)),\n ].join('\\n');\n if (error.message) {\n if (error.stack) {\n let index = error.stack.indexOf(error.message);\n if (index !== -1) {\n index += error.message.length;\n error.stack = error.stack.substring(0, index) + message + error.stack.substring(index);\n }\n }\n error.message += message;\n } else if (error.value) {\n error.value += message;\n }\n }\n\n unhandledError(error: Error | any) {\n // No current test - fatal error.\n if (!this._currentTest) {\n if (!this._fatalErrors.length)\n this._fatalErrors.push(testInfoError(error));\n void this._stop();\n return;\n }\n\n // We do not differentiate between errors in the control flow\n // and unhandled errors - both lead to the test failing. This is good for regular tests,\n // so that you can, e.g. expect() from inside an event handler. The test fails,\n // and we restart the worker.\n if (!this._currentTest._hasUnhandledError) {\n this._currentTest._hasUnhandledError = true;\n this._currentTest._failWithError(error);\n }\n\n // For tests marked with test.fail(), this might be a problem when unhandled error\n // is not coming from the user test code (legit failure), but from fixtures or test runner.\n //\n // Ideally, we would mark this test as \"failed unexpectedly\" and show that in the report.\n // However, we do not have such a special test status, so the test will be considered ok (failed as expected).\n //\n // To avoid messing up future tests, we forcefully stop the worker, unless it is\n // an expect() error which we know does not mess things up.\n const isExpectError = (error instanceof Error) && !!(error as any).matcherResult;\n const shouldContinueInThisWorker = this._currentTest.expectedStatus === 'failed' && isExpectError;\n if (!shouldContinueInThisWorker) {\n this._stoppedDueToUnhandledErrorInTestFail = true;\n void this._stop();\n }\n }\n\n private async _loadIfNeeded() {\n if (this._config)\n return;\n\n const config = await deserializeConfig(this._params.config);\n const project = config.projects.find(p => p.id === this._params.projectId);\n if (!project)\n throw new Error(`Project \"${this._params.projectId}\" not found in the worker process. Make sure project name does not change.`);\n this._config = config;\n this._project = project;\n this._poolBuilder = PoolBuilder.createForWorker(this._project);\n }\n\n async runTestGroup(runPayload: RunPayload) {\n this._runFinished = new ManualPromise<void>();\n const entries = new Map(runPayload.entries.map(e => [e.testId, e]));\n let fatalUnknownTestIds: string[] | undefined;\n try {\n await this._loadIfNeeded();\n const fileSuite = await loadTestFile(runPayload.file, this._config);\n const suite = bindFileSuiteToProject(this._project, fileSuite);\n if (this._params.repeatEachIndex)\n applyRepeatEachIndex(this._project, suite, this._params.repeatEachIndex);\n const hasEntries = filterTestsRemoveEmptySuites(suite, test => entries.has(test.id));\n if (hasEntries) {\n this._poolBuilder.buildPools(suite);\n this._activeSuites = new Map();\n this._didRunFullCleanup = false;\n const tests = suite.allTests();\n for (let i = 0; i < tests.length; i++) {\n // Do not run tests after full cleanup, because we are entirely done.\n if (this._isStopped && this._didRunFullCleanup)\n break;\n const entry = entries.get(tests[i].id)!;\n entries.delete(tests[i].id);\n debugTest(`test started \"${tests[i].title}\"`);\n await this._runTest(tests[i], entry.retry, tests[i + 1]);\n debugTest(`test finished \"${tests[i].title}\"`);\n }\n } else {\n fatalUnknownTestIds = runPayload.entries.map(e => e.testId);\n void this._stop();\n }\n } catch (e) {\n // In theory, we should run above code without any errors.\n // However, in the case we screwed up, or loadTestFile failed in the worker\n // but not in the runner, let's do a fatal error.\n this._fatalErrors.push(testInfoError(e));\n void this._stop();\n } finally {\n const donePayload: DonePayload = {\n fatalErrors: this._fatalErrors,\n skipTestsDueToSetupFailure: [],\n fatalUnknownTestIds,\n stoppedDueToUnhandledErrorInTestFail: this._stoppedDueToUnhandledErrorInTestFail,\n };\n for (const test of this._skipRemainingTestsInSuite?.allTests() || []) {\n if (entries.has(test.id))\n donePayload.skipTestsDueToSetupFailure.push(test.id);\n }\n this.dispatchEvent('done', donePayload);\n this._fatalErrors = [];\n this._skipRemainingTestsInSuite = undefined;\n this._runFinished.resolve();\n }\n }\n\n private async _runTest(test: TestCase, retry: number, nextTest: TestCase | undefined) {\n const testInfo = new TestInfoImpl(this._config, this._project, this._params, test, retry,\n stepBeginPayload => this.dispatchEvent('stepBegin', stepBeginPayload),\n stepEndPayload => this.dispatchEvent('stepEnd', stepEndPayload),\n attachment => this.dispatchEvent('attach', attachment));\n\n const processAnnotation = (annotation: TestAnnotation) => {\n testInfo.annotations.push(annotation);\n switch (annotation.type) {\n case 'fixme':\n case 'skip':\n testInfo.expectedStatus = 'skipped';\n break;\n case 'fail':\n if (testInfo.expectedStatus !== 'skipped')\n testInfo.expectedStatus = 'failed';\n break;\n case 'slow':\n testInfo._timeoutManager.slow();\n break;\n }\n };\n\n if (!this._isStopped)\n this._fixtureRunner.setPool(test._pool!);\n\n const suites = getSuites(test);\n const reversedSuites = suites.slice().reverse();\n const nextSuites = new Set(getSuites(nextTest));\n\n testInfo._timeoutManager.setTimeout(test.timeout);\n for (const annotation of test.annotations)\n processAnnotation(annotation);\n\n // Process existing annotations dynamically set for parent suites.\n for (const suite of suites) {\n const extraAnnotations = this._activeSuites.get(suite) || [];\n for (const annotation of extraAnnotations)\n processAnnotation(annotation);\n }\n\n this._currentTest = testInfo;\n setCurrentTestInfo(testInfo);\n this.dispatchEvent('testBegin', buildTestBeginPayload(testInfo));\n\n const isSkipped = testInfo.expectedStatus === 'skipped';\n const hasAfterAllToRunBeforeNextTest = reversedSuites.some(suite => {\n return this._activeSuites.has(suite) && !nextSuites.has(suite) && suite._hooks.some(hook => hook.type === 'afterAll');\n });\n if (isSkipped && nextTest && !hasAfterAllToRunBeforeNextTest) {\n // Fast path - this test is skipped, and there are more tests that will handle cleanup.\n testInfo.status = 'skipped';\n this.dispatchEvent('testEnd', buildTestEndPayload(testInfo));\n return;\n }\n\n this._totalRunningTests++;\n this._lastRunningTests.push(test);\n if (this._lastRunningTests.length > 10)\n this._lastRunningTests.shift();\n let shouldRunAfterEachHooks = false;\n\n testInfo._allowSkips = true;\n\n await (async () => {\n await testInfo._runWithTimeout({ type: 'test' }, async () => {\n // Ideally, \"trace\" would be an config-level option belonging to the\n // test runner instead of a fixture belonging to Playwright.\n // However, for backwards compatibility, we have to read it from a fixture today.\n // We decided to not introduce the config-level option just yet.\n const traceFixtureRegistration = test._pool!.resolve('trace');\n if (!traceFixtureRegistration)\n return;\n if (typeof traceFixtureRegistration.fn === 'function')\n throw new Error(`\"trace\" option cannot be a function`);\n await testInfo._tracing.startIfNeeded(traceFixtureRegistration.fn);\n });\n\n if (this._isStopped || isSkipped) {\n // Two reasons to get here:\n // - Last test is skipped, so we should not run the test, but run the cleanup.\n // - Worker is requested to stop, but was not able to run full cleanup yet.\n // We should skip the test, but run the cleanup.\n testInfo.status = 'skipped';\n return;\n }\n\n await removeFolders([testInfo.outputDir]);\n\n let testFunctionParams: object | null = null;\n await testInfo._runAsStep({ title: 'Before Hooks', category: 'hook' }, async () => {\n // Run \"beforeAll\" hooks, unless already run during previous tests.\n for (const suite of suites)\n await this._runBeforeAllHooksForSuite(suite, testInfo);\n\n // Run \"beforeEach\" hooks. Once started with \"beforeEach\", we must run all \"afterEach\" hooks as well.\n shouldRunAfterEachHooks = true;\n await this._runEachHooksForSuites(suites, 'beforeEach', testInfo);\n\n // Setup fixtures required by the test.\n testFunctionParams = await this._fixtureRunner.resolveParametersForFunction(test.fn, testInfo, 'test', { type: 'test' });\n });\n\n if (testFunctionParams === null) {\n // Fixture setup failed or was skipped, we should not run the test now.\n return;\n }\n\n await testInfo._runWithTimeout({ type: 'test' }, async () => {\n // Now run the test itself.\n const fn = test.fn; // Extract a variable to get a better stack trace (\"myTest\" vs \"TestCase.myTest [as fn]\").\n await fn(testFunctionParams, testInfo);\n });\n })().catch(() => {}); // Ignore the top-level error, it is already inside TestInfo.errors.\n\n // Update duration, so it is available in fixture teardown and afterEach hooks.\n testInfo.duration = testInfo._timeoutManager.defaultSlot().elapsed | 0;\n\n // No skips in after hooks.\n testInfo._allowSkips = true;\n\n // After hooks get an additional timeout.\n const afterHooksTimeout = calculateMaxTimeout(this._project.project.timeout, testInfo.timeout);\n const afterHooksSlot = { timeout: afterHooksTimeout, elapsed: 0 };\n await testInfo._runAsStep({ title: 'After Hooks', category: 'hook' }, async () => {\n let firstAfterHooksError: Error | undefined;\n\n try {\n // Run \"immediately upon test function finish\" callback.\n await testInfo._runWithTimeout({ type: 'test', slot: afterHooksSlot }, async () => {\n for (const fn of testInfo._onDidFinishTestFunctions)\n await fn();\n });\n } catch (error) {\n firstAfterHooksError = firstAfterHooksError ?? error;\n }\n\n try {\n // Run \"afterEach\" hooks, unless we failed at beforeAll stage.\n if (shouldRunAfterEachHooks)\n await this._runEachHooksForSuites(reversedSuites, 'afterEach', testInfo, afterHooksSlot);\n } catch (error) {\n firstAfterHooksError = firstAfterHooksError ?? error;\n }\n\n testInfo._tracing.didFinishTestFunctionAndAfterEachHooks();\n\n try {\n // Teardown test-scoped fixtures. Attribute to 'test' so that users understand\n // they should probably increase the test timeout to fix this issue.\n await this._fixtureRunner.teardownScope('test', testInfo, { type: 'test', slot: afterHooksSlot });\n } catch (error) {\n firstAfterHooksError = firstAfterHooksError ?? error;\n }\n\n // Run \"afterAll\" hooks for suites that are not shared with the next test.\n // In case of failure the worker will be stopped and we have to make sure that afterAll\n // hooks run before worker fixtures teardown.\n for (const suite of reversedSuites) {\n if (!nextSuites.has(suite) || testInfo._isFailure()) {\n try {\n await this._runAfterAllHooksForSuite(suite, testInfo);\n } catch (error) {\n // Continue running \"afterAll\" hooks even after some of them timeout.\n firstAfterHooksError = firstAfterHooksError ?? error;\n }\n }\n }\n if (firstAfterHooksError)\n throw firstAfterHooksError;\n }).catch(() => {}); // Ignore the top-level error, it is already inside TestInfo.errors.\n\n if (testInfo._isFailure())\n this._isStopped = true;\n\n if (this._isStopped) {\n // Run all remaining \"afterAll\" hooks and teardown all fixtures when worker is shutting down.\n // Mark as \"cleaned up\" early to avoid running cleanup twice.\n this._didRunFullCleanup = true;\n\n await testInfo._runAsStep({ title: 'Worker Cleanup', category: 'hook' }, async () => {\n let firstWorkerCleanupError: Error | undefined;\n\n // Give it more time for the full cleanup.\n const teardownSlot = { timeout: this._project.project.timeout, elapsed: 0 };\n try {\n // Attribute to 'test' so that users understand they should probably increate the test timeout to fix this issue.\n await this._fixtureRunner.teardownScope('test', testInfo, { type: 'test', slot: teardownSlot });\n } catch (error) {\n firstWorkerCleanupError = firstWorkerCleanupError ?? error;\n }\n\n for (const suite of reversedSuites) {\n try {\n await this._runAfterAllHooksForSuite(suite, testInfo);\n } catch (error) {\n firstWorkerCleanupError = firstWorkerCleanupError ?? error;\n }\n }\n\n try {\n // Attribute to 'teardown' because worker fixtures are not perceived as a part of a test.\n await this._fixtureRunner.teardownScope('worker', testInfo, { type: 'teardown', slot: teardownSlot });\n } catch (error) {\n firstWorkerCleanupError = firstWorkerCleanupError ?? error;\n }\n\n if (firstWorkerCleanupError)\n throw firstWorkerCleanupError;\n }).catch(() => {}); // Ignore the top-level error, it is already inside TestInfo.errors.\n }\n\n const tracingSlot = { timeout: this._project.project.timeout, elapsed: 0 };\n await testInfo._runWithTimeout({ type: 'test', slot: tracingSlot }, async () => {\n await testInfo._tracing.stopIfNeeded();\n }).catch(() => {}); // Ignore the top-level error, it is already inside TestInfo.errors.\n\n testInfo.duration = (testInfo._timeoutManager.defaultSlot().elapsed + afterHooksSlot.elapsed) | 0;\n\n this._currentTest = null;\n setCurrentTestInfo(null);\n this.dispatchEvent('testEnd', buildTestEndPayload(testInfo));\n\n const preserveOutput = this._config.config.preserveOutput === 'always' ||\n (this._config.config.preserveOutput === 'failures-only' && testInfo._isFailure());\n if (!preserveOutput)\n await removeFolders([testInfo.outputDir]);\n }\n\n private _collectHooksAndModifiers(suite: Suite, type: 'beforeAll' | 'beforeEach' | 'afterAll' | 'afterEach', testInfo: TestInfoImpl) {\n type Runnable = { type: 'beforeEach' | 'afterEach' | 'beforeAll' | 'afterAll' | 'fixme' | 'skip' | 'slow' | 'fail', fn: Function, title: string, location: Location };\n const runnables: Runnable[] = [];\n for (const modifier of suite._modifiers) {\n const modifierType = this._fixtureRunner.dependsOnWorkerFixturesOnly(modifier.fn, modifier.location) ? 'beforeAll' : 'beforeEach';\n if (modifierType !== type)\n continue;\n const fn = async (fixtures: any) => {\n const result = await modifier.fn(fixtures);\n testInfo._modifier(modifier.type, modifier.location, [!!result, modifier.description]);\n };\n inheritFixtureNames(modifier.fn, fn);\n runnables.push({\n title: `${modifier.type} modifier`,\n location: modifier.location,\n type: modifier.type,\n fn,\n });\n }\n // Modifiers first, then hooks.\n runnables.push(...suite._hooks.filter(hook => hook.type === type));\n return runnables;\n }\n\n private async _runBeforeAllHooksForSuite(suite: Suite, testInfo: TestInfoImpl) {\n if (this._activeSuites.has(suite))\n return;\n const extraAnnotations: TestAnnotation[] = [];\n this._activeSuites.set(suite, extraAnnotations);\n await this._runAllHooksForSuite(suite, testInfo, 'beforeAll', extraAnnotations);\n }\n\n private async _runAllHooksForSuite(suite: Suite, testInfo: TestInfoImpl, type: 'beforeAll' | 'afterAll', extraAnnotations?: TestAnnotation[]) {\n // Always run all the hooks, and capture the first error.\n let firstError: Error | undefined;\n for (const hook of this._collectHooksAndModifiers(suite, type, testInfo)) {\n try {\n await testInfo._runAsStep({ title: hook.title, category: 'hook', location: hook.location }, async () => {\n // Separate time slot for each beforeAll/afterAll hook.\n const timeSlot = { timeout: this._project.project.timeout, elapsed: 0 };\n const runnable = { type: hook.type, slot: timeSlot, location: hook.location };\n const existingAnnotations = new Set(testInfo.annotations);\n try {\n await this._fixtureRunner.resolveParametersAndRunFunction(hook.fn, testInfo, 'all-hooks-only', runnable);\n } finally {\n if (extraAnnotations) {\n // Inherit all annotations defined in the beforeAll/modifer to all tests in the suite.\n const newAnnotations = testInfo.annotations.filter(a => !existingAnnotations.has(a));\n extraAnnotations.push(...newAnnotations);\n }\n // Each beforeAll/afterAll hook has its own scope for test fixtures. Attribute to the same runnable and timeSlot.\n // Note: we must teardown even after hook fails, because we'll run more hooks.\n await this._fixtureRunner.teardownScope('test', testInfo, runnable);\n }\n });\n } catch (error) {\n firstError = firstError ?? error;\n // Skip in beforeAll/modifier prevents others from running.\n if (type === 'beforeAll' && (error instanceof TestSkipError))\n break;\n if (type === 'beforeAll' && !this._skipRemainingTestsInSuite) {\n // This will inform dispatcher that we should not run more tests from this group\n // because we had a beforeAll error.\n // This behavior avoids getting the same common error for each test.\n this._skipRemainingTestsInSuite = suite;\n }\n }\n }\n if (firstError)\n throw firstError;\n }\n\n private async _runAfterAllHooksForSuite(suite: Suite, testInfo: TestInfoImpl) {\n if (!this._activeSuites.has(suite))\n return;\n this._activeSuites.delete(suite);\n await this._runAllHooksForSuite(suite, testInfo, 'afterAll');\n }\n\n private async _runEachHooksForSuites(suites: Suite[], type: 'beforeEach' | 'afterEach', testInfo: TestInfoImpl, slot?: TimeSlot) {\n // Always run all the hooks, unless one of the times out, and capture the first error.\n let firstError: Error | undefined;\n const hooks = suites.map(suite => this._collectHooksAndModifiers(suite, type, testInfo)).flat();\n for (const hook of hooks) {\n const runnable = { type: hook.type, location: hook.location, slot };\n if (testInfo._timeoutManager.isTimeExhaustedFor(runnable)) {\n // Do not run hooks that will timeout right away.\n continue;\n }\n try {\n await testInfo._runAsStep({ title: hook.title, category: 'hook', location: hook.location }, async () => {\n await this._fixtureRunner.resolveParametersAndRunFunction(hook.fn, testInfo, 'test', runnable);\n });\n } catch (error) {\n firstError = firstError ?? error;\n // Skip in modifier prevents others from running.\n if (error instanceof TestSkipError)\n break;\n }\n }\n if (firstError)\n throw firstError;\n }\n}\n\nfunction buildTestBeginPayload(testInfo: TestInfoImpl): TestBeginPayload {\n return {\n testId: testInfo.testId,\n startWallTime: testInfo._startWallTime,\n };\n}\n\nfunction buildTestEndPayload(testInfo: TestInfoImpl): TestEndPayload {\n return {\n testId: testInfo.testId,\n duration: testInfo.duration,\n status: testInfo.status!,\n errors: testInfo.errors,\n hasNonRetriableError: testInfo._hasNonRetriableError,\n expectedStatus: testInfo.expectedStatus,\n annotations: testInfo.annotations,\n timeout: testInfo.timeout,\n };\n}\n\nfunction getSuites(test: TestCase | undefined): Suite[] {\n const suites: Suite[] = [];\n for (let suite: Suite | undefined = test?.parent; suite; suite = suite.parent)\n suites.push(suite);\n suites.reverse(); // Put root suite first.\n return suites;\n}\n\nfunction formatTestTitle(test: TestCase, projectName: string) {\n // file, ...describes, test\n const [, ...titles] = test.titlePath();\n const location = `${relativeFilePath(test.location.file)}:${test.location.line}:${test.location.column}`;\n const projectTitle = projectName ? `[${projectName}] \u203A ` : '';\n return `${projectTitle}${location} \u203A ${titles.join(' \u203A ')}`;\n}\n\nfunction calculateMaxTimeout(t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