pokeedex 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (591) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +30 -0
  3. data/.gitignore +13 -0
  4. data/.standard.yml +9 -0
  5. data/CHANGELOG.md +5 -0
  6. data/CODE_OF_CONDUCT.md +132 -0
  7. data/Gemfile +14 -0
  8. data/Gemfile.lock +125 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +154 -0
  11. data/Rakefile +20 -0
  12. data/bin/pokeedex +85 -0
  13. data/lib/pokeedex/configuration.rb +47 -0
  14. data/lib/pokeedex/database.rb +42 -0
  15. data/lib/pokeedex/db/migrations/001_create_pokemons.rb +26 -0
  16. data/lib/pokeedex/exceptions.rb +15 -0
  17. data/lib/pokeedex/pokemon/base.rb +16 -0
  18. data/lib/pokeedex/pokemon/decorators/base.rb +112 -0
  19. data/lib/pokeedex/pokemon/model/base.rb +43 -0
  20. data/lib/pokeedex/pokemon/scrapper/base.rb +34 -0
  21. data/lib/pokeedex/pokemon/scrapper/fetchers/base.rb +123 -0
  22. data/lib/pokeedex/pokemon/scrapper/parsers/base.rb +205 -0
  23. data/lib/pokeedex/pokemon/scrapper/pokedex.rb +50 -0
  24. data/lib/pokeedex/pokemon/searcher/base.rb +59 -0
  25. data/lib/pokeedex/version.rb +5 -0
  26. data/lib/pokeedex.rb +55 -0
  27. data/node_modules/.bin/playwright +1 -0
  28. data/node_modules/.bin/playwright-core +1 -0
  29. data/node_modules/.yarn-integrity +22 -0
  30. data/node_modules/@playwright/test/LICENSE +202 -0
  31. data/node_modules/@playwright/test/NOTICE +5 -0
  32. data/node_modules/@playwright/test/README.md +169 -0
  33. data/node_modules/@playwright/test/cli.js +19 -0
  34. data/node_modules/@playwright/test/index.d.ts +18 -0
  35. data/node_modules/@playwright/test/index.js +17 -0
  36. data/node_modules/@playwright/test/index.mjs +18 -0
  37. data/node_modules/@playwright/test/node_modules/.bin/playwright +1 -0
  38. data/node_modules/@playwright/test/package.json +35 -0
  39. data/node_modules/@playwright/test/reporter.d.ts +17 -0
  40. data/node_modules/@playwright/test/reporter.js +17 -0
  41. data/node_modules/@playwright/test/reporter.mjs +17 -0
  42. data/node_modules/@types/node/LICENSE +21 -0
  43. data/node_modules/@types/node/README.md +15 -0
  44. data/node_modules/@types/node/assert/strict.d.ts +8 -0
  45. data/node_modules/@types/node/assert.d.ts +1040 -0
  46. data/node_modules/@types/node/async_hooks.d.ts +541 -0
  47. data/node_modules/@types/node/buffer.d.ts +2300 -0
  48. data/node_modules/@types/node/child_process.d.ts +1544 -0
  49. data/node_modules/@types/node/cluster.d.ts +578 -0
  50. data/node_modules/@types/node/console.d.ts +452 -0
  51. data/node_modules/@types/node/constants.d.ts +19 -0
  52. data/node_modules/@types/node/crypto.d.ts +4451 -0
  53. data/node_modules/@types/node/dgram.d.ts +596 -0
  54. data/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  55. data/node_modules/@types/node/dns/promises.d.ts +476 -0
  56. data/node_modules/@types/node/dns.d.ts +865 -0
  57. data/node_modules/@types/node/dom-events.d.ts +124 -0
  58. data/node_modules/@types/node/domain.d.ts +170 -0
  59. data/node_modules/@types/node/events.d.ts +931 -0
  60. data/node_modules/@types/node/fs/promises.d.ts +1264 -0
  61. data/node_modules/@types/node/fs.d.ts +4390 -0
  62. data/node_modules/@types/node/globals.d.ts +611 -0
  63. data/node_modules/@types/node/globals.global.d.ts +1 -0
  64. data/node_modules/@types/node/http.d.ts +1921 -0
  65. data/node_modules/@types/node/http2.d.ts +2555 -0
  66. data/node_modules/@types/node/https.d.ts +544 -0
  67. data/node_modules/@types/node/index.d.ts +90 -0
  68. data/node_modules/@types/node/inspector.d.ts +3966 -0
  69. data/node_modules/@types/node/module.d.ts +301 -0
  70. data/node_modules/@types/node/net.d.ts +995 -0
  71. data/node_modules/@types/node/os.d.ts +495 -0
  72. data/node_modules/@types/node/package.json +217 -0
  73. data/node_modules/@types/node/path.d.ts +200 -0
  74. data/node_modules/@types/node/perf_hooks.d.ts +941 -0
  75. data/node_modules/@types/node/process.d.ts +1912 -0
  76. data/node_modules/@types/node/punycode.d.ts +117 -0
  77. data/node_modules/@types/node/querystring.d.ts +153 -0
  78. data/node_modules/@types/node/readline/promises.d.ts +150 -0
  79. data/node_modules/@types/node/readline.d.ts +540 -0
  80. data/node_modules/@types/node/repl.d.ts +430 -0
  81. data/node_modules/@types/node/sea.d.ts +153 -0
  82. data/node_modules/@types/node/sqlite.d.ts +213 -0
  83. data/node_modules/@types/node/stream/consumers.d.ts +12 -0
  84. data/node_modules/@types/node/stream/promises.d.ts +83 -0
  85. data/node_modules/@types/node/stream/web.d.ts +606 -0
  86. data/node_modules/@types/node/stream.d.ts +1726 -0
  87. data/node_modules/@types/node/string_decoder.d.ts +67 -0
  88. data/node_modules/@types/node/test.d.ts +2098 -0
  89. data/node_modules/@types/node/timers/promises.d.ts +97 -0
  90. data/node_modules/@types/node/timers.d.ts +240 -0
  91. data/node_modules/@types/node/tls.d.ts +1220 -0
  92. data/node_modules/@types/node/trace_events.d.ts +197 -0
  93. data/node_modules/@types/node/tty.d.ts +208 -0
  94. data/node_modules/@types/node/url.d.ts +969 -0
  95. data/node_modules/@types/node/util.d.ts +2301 -0
  96. data/node_modules/@types/node/v8.d.ts +808 -0
  97. data/node_modules/@types/node/vm.d.ts +922 -0
  98. data/node_modules/@types/node/wasi.d.ts +181 -0
  99. data/node_modules/@types/node/worker_threads.d.ts +712 -0
  100. data/node_modules/@types/node/zlib.d.ts +539 -0
  101. data/node_modules/fsevents/LICENSE +22 -0
  102. data/node_modules/fsevents/README.md +83 -0
  103. data/node_modules/fsevents/fsevents.d.ts +46 -0
  104. data/node_modules/fsevents/fsevents.js +82 -0
  105. data/node_modules/fsevents/fsevents.node +0 -0
  106. data/node_modules/fsevents/package.json +62 -0
  107. data/node_modules/playwright/.eslintrc.js +6 -0
  108. data/node_modules/playwright/LICENSE +202 -0
  109. data/node_modules/playwright/NOTICE +5 -0
  110. data/node_modules/playwright/README.md +169 -0
  111. data/node_modules/playwright/ThirdPartyNotices.txt +4356 -0
  112. data/node_modules/playwright/cli.js +19 -0
  113. data/node_modules/playwright/index.d.ts +17 -0
  114. data/node_modules/playwright/index.js +17 -0
  115. data/node_modules/playwright/index.mjs +18 -0
  116. data/node_modules/playwright/jsx-runtime.js +41 -0
  117. data/node_modules/playwright/jsx-runtime.mjs +21 -0
  118. data/node_modules/playwright/lib/common/config.js +256 -0
  119. data/node_modules/playwright/lib/common/configLoader.js +321 -0
  120. data/node_modules/playwright/lib/common/esmLoaderHost.js +93 -0
  121. data/node_modules/playwright/lib/common/expectBundle.js +27 -0
  122. data/node_modules/playwright/lib/common/expectBundleImpl.js +389 -0
  123. data/node_modules/playwright/lib/common/fixtures.js +323 -0
  124. data/node_modules/playwright/lib/common/globals.js +48 -0
  125. data/node_modules/playwright/lib/common/ipc.js +48 -0
  126. data/node_modules/playwright/lib/common/poolBuilder.js +79 -0
  127. data/node_modules/playwright/lib/common/process.js +140 -0
  128. data/node_modules/playwright/lib/common/suiteUtils.js +133 -0
  129. data/node_modules/playwright/lib/common/test.js +311 -0
  130. data/node_modules/playwright/lib/common/testLoader.js +102 -0
  131. data/node_modules/playwright/lib/common/testType.js +284 -0
  132. data/node_modules/playwright/lib/fsWatcher.js +69 -0
  133. data/node_modules/playwright/lib/index.js +888 -0
  134. data/node_modules/playwright/lib/internalsForTest.js +28 -0
  135. data/node_modules/playwright/lib/isomorphic/events.js +72 -0
  136. data/node_modules/playwright/lib/isomorphic/folders.js +25 -0
  137. data/node_modules/playwright/lib/isomorphic/stringInternPool.js +58 -0
  138. data/node_modules/playwright/lib/isomorphic/teleReceiver.js +504 -0
  139. data/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +149 -0
  140. data/node_modules/playwright/lib/isomorphic/testServerConnection.js +210 -0
  141. data/node_modules/playwright/lib/isomorphic/testServerInterface.js +5 -0
  142. data/node_modules/playwright/lib/isomorphic/testTree.js +272 -0
  143. data/node_modules/playwright/lib/loader/loaderMain.js +58 -0
  144. data/node_modules/playwright/lib/matchers/expect.js +297 -0
  145. data/node_modules/playwright/lib/matchers/matcherHint.js +50 -0
  146. data/node_modules/playwright/lib/matchers/matchers.js +449 -0
  147. data/node_modules/playwright/lib/matchers/toBeTruthy.js +55 -0
  148. data/node_modules/playwright/lib/matchers/toEqual.js +57 -0
  149. data/node_modules/playwright/lib/matchers/toMatchSnapshot.js +383 -0
  150. data/node_modules/playwright/lib/matchers/toMatchText.js +76 -0
  151. data/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +78 -0
  152. data/node_modules/playwright/lib/plugins/index.js +19 -0
  153. data/node_modules/playwright/lib/plugins/webServerPlugin.js +187 -0
  154. data/node_modules/playwright/lib/program.js +346 -0
  155. data/node_modules/playwright/lib/reporters/base.js +553 -0
  156. data/node_modules/playwright/lib/reporters/blob.js +133 -0
  157. data/node_modules/playwright/lib/reporters/dot.js +82 -0
  158. data/node_modules/playwright/lib/reporters/empty.js +42 -0
  159. data/node_modules/playwright/lib/reporters/github.js +115 -0
  160. data/node_modules/playwright/lib/reporters/html.js +623 -0
  161. data/node_modules/playwright/lib/reporters/internalReporter.js +123 -0
  162. data/node_modules/playwright/lib/reporters/json.js +243 -0
  163. data/node_modules/playwright/lib/reporters/junit.js +233 -0
  164. data/node_modules/playwright/lib/reporters/line.js +108 -0
  165. data/node_modules/playwright/lib/reporters/list.js +222 -0
  166. data/node_modules/playwright/lib/reporters/markdown.js +76 -0
  167. data/node_modules/playwright/lib/reporters/merge.js +477 -0
  168. data/node_modules/playwright/lib/reporters/multiplexer.js +90 -0
  169. data/node_modules/playwright/lib/reporters/reporterV2.js +118 -0
  170. data/node_modules/playwright/lib/reporters/teleEmitter.js +268 -0
  171. data/node_modules/playwright/lib/reporters/versions/blobV1.js +5 -0
  172. data/node_modules/playwright/lib/runner/dispatcher.js +532 -0
  173. data/node_modules/playwright/lib/runner/failureTracker.js +60 -0
  174. data/node_modules/playwright/lib/runner/loadUtils.js +308 -0
  175. data/node_modules/playwright/lib/runner/loaderHost.js +85 -0
  176. data/node_modules/playwright/lib/runner/processHost.js +175 -0
  177. data/node_modules/playwright/lib/runner/projectUtils.js +203 -0
  178. data/node_modules/playwright/lib/runner/reporters.js +151 -0
  179. data/node_modules/playwright/lib/runner/runner.js +179 -0
  180. data/node_modules/playwright/lib/runner/sigIntWatcher.js +100 -0
  181. data/node_modules/playwright/lib/runner/taskRunner.js +147 -0
  182. data/node_modules/playwright/lib/runner/tasks.js +407 -0
  183. data/node_modules/playwright/lib/runner/testGroups.js +136 -0
  184. data/node_modules/playwright/lib/runner/testServer.js +605 -0
  185. data/node_modules/playwright/lib/runner/uiModeReporter.js +31 -0
  186. data/node_modules/playwright/lib/runner/vcs.js +55 -0
  187. data/node_modules/playwright/lib/runner/watchMode.js +398 -0
  188. data/node_modules/playwright/lib/runner/workerHost.js +85 -0
  189. data/node_modules/playwright/lib/third_party/tsconfig-loader.js +134 -0
  190. data/node_modules/playwright/lib/transform/babelBundle.js +28 -0
  191. data/node_modules/playwright/lib/transform/babelBundleImpl.js +2032 -0
  192. data/node_modules/playwright/lib/transform/compilationCache.js +254 -0
  193. data/node_modules/playwright/lib/transform/esmLoader.js +117 -0
  194. data/node_modules/playwright/lib/transform/esmUtils.js +32 -0
  195. data/node_modules/playwright/lib/transform/portTransport.js +81 -0
  196. data/node_modules/playwright/lib/transform/transform.js +267 -0
  197. data/node_modules/playwright/lib/util.js +356 -0
  198. data/node_modules/playwright/lib/utilsBundle.js +28 -0
  199. data/node_modules/playwright/lib/utilsBundleImpl.js +102 -0
  200. data/node_modules/playwright/lib/worker/fixtureRunner.js +279 -0
  201. data/node_modules/playwright/lib/worker/testInfo.js +397 -0
  202. data/node_modules/playwright/lib/worker/testTracing.js +314 -0
  203. data/node_modules/playwright/lib/worker/timeoutManager.js +153 -0
  204. data/node_modules/playwright/lib/worker/workerMain.js +637 -0
  205. data/node_modules/playwright/node_modules/.bin/playwright-core +1 -0
  206. data/node_modules/playwright/package.json +66 -0
  207. data/node_modules/playwright/test.d.ts +18 -0
  208. data/node_modules/playwright/test.js +24 -0
  209. data/node_modules/playwright/test.mjs +33 -0
  210. data/node_modules/playwright/types/test.d.ts +8444 -0
  211. data/node_modules/playwright/types/testReporter.d.ts +749 -0
  212. data/node_modules/playwright-core/LICENSE +202 -0
  213. data/node_modules/playwright-core/NOTICE +5 -0
  214. data/node_modules/playwright-core/README.md +3 -0
  215. data/node_modules/playwright-core/ThirdPartyNotices.txt +1548 -0
  216. data/node_modules/playwright-core/bin/PrintDeps.exe +0 -0
  217. data/node_modules/playwright-core/bin/README.md +2 -0
  218. data/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
  219. data/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +40 -0
  220. data/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  221. data/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  222. data/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +40 -0
  223. data/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  224. data/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  225. data/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +40 -0
  226. data/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  227. data/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  228. data/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +40 -0
  229. data/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  230. data/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  231. data/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +40 -0
  232. data/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  233. data/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  234. data/node_modules/playwright-core/browsers.json +53 -0
  235. data/node_modules/playwright-core/cli.js +18 -0
  236. data/node_modules/playwright-core/index.d.ts +17 -0
  237. data/node_modules/playwright-core/index.js +33 -0
  238. data/node_modules/playwright-core/index.mjs +28 -0
  239. data/node_modules/playwright-core/lib/androidServerImpl.js +69 -0
  240. data/node_modules/playwright-core/lib/browserServerImpl.js +92 -0
  241. data/node_modules/playwright-core/lib/cli/driver.js +95 -0
  242. data/node_modules/playwright-core/lib/cli/program.js +577 -0
  243. data/node_modules/playwright-core/lib/cli/programWithTestStub.js +67 -0
  244. data/node_modules/playwright-core/lib/client/accessibility.js +50 -0
  245. data/node_modules/playwright-core/lib/client/android.js +473 -0
  246. data/node_modules/playwright-core/lib/client/api.js +279 -0
  247. data/node_modules/playwright-core/lib/client/artifact.js +79 -0
  248. data/node_modules/playwright-core/lib/client/browser.js +145 -0
  249. data/node_modules/playwright-core/lib/client/browserContext.js +541 -0
  250. data/node_modules/playwright-core/lib/client/browserType.js +241 -0
  251. data/node_modules/playwright-core/lib/client/cdpSession.js +53 -0
  252. data/node_modules/playwright-core/lib/client/channelOwner.js +231 -0
  253. data/node_modules/playwright-core/lib/client/clientHelper.js +57 -0
  254. data/node_modules/playwright-core/lib/client/clientInstrumentation.js +50 -0
  255. data/node_modules/playwright-core/lib/client/clock.js +68 -0
  256. data/node_modules/playwright-core/lib/client/connection.js +330 -0
  257. data/node_modules/playwright-core/lib/client/consoleMessage.js +55 -0
  258. data/node_modules/playwright-core/lib/client/coverage.js +41 -0
  259. data/node_modules/playwright-core/lib/client/dialog.js +57 -0
  260. data/node_modules/playwright-core/lib/client/download.js +62 -0
  261. data/node_modules/playwright-core/lib/client/electron.js +135 -0
  262. data/node_modules/playwright-core/lib/client/elementHandle.js +321 -0
  263. data/node_modules/playwright-core/lib/client/errors.js +77 -0
  264. data/node_modules/playwright-core/lib/client/eventEmitter.js +314 -0
  265. data/node_modules/playwright-core/lib/client/events.js +94 -0
  266. data/node_modules/playwright-core/lib/client/fetch.js +396 -0
  267. data/node_modules/playwright-core/lib/client/fileChooser.js +45 -0
  268. data/node_modules/playwright-core/lib/client/frame.js +504 -0
  269. data/node_modules/playwright-core/lib/client/harRouter.js +99 -0
  270. data/node_modules/playwright-core/lib/client/input.js +111 -0
  271. data/node_modules/playwright-core/lib/client/jsHandle.js +129 -0
  272. data/node_modules/playwright-core/lib/client/jsonPipe.js +35 -0
  273. data/node_modules/playwright-core/lib/client/localUtils.js +35 -0
  274. data/node_modules/playwright-core/lib/client/locator.js +441 -0
  275. data/node_modules/playwright-core/lib/client/network.js +604 -0
  276. data/node_modules/playwright-core/lib/client/page.js +725 -0
  277. data/node_modules/playwright-core/lib/client/playwright.js +77 -0
  278. data/node_modules/playwright-core/lib/client/selectors.js +67 -0
  279. data/node_modules/playwright-core/lib/client/stream.js +54 -0
  280. data/node_modules/playwright-core/lib/client/tracing.js +138 -0
  281. data/node_modules/playwright-core/lib/client/types.js +24 -0
  282. data/node_modules/playwright-core/lib/client/video.js +51 -0
  283. data/node_modules/playwright-core/lib/client/waiter.js +158 -0
  284. data/node_modules/playwright-core/lib/client/webError.js +37 -0
  285. data/node_modules/playwright-core/lib/client/worker.js +71 -0
  286. data/node_modules/playwright-core/lib/client/writableStream.js +54 -0
  287. data/node_modules/playwright-core/lib/common/socksProxy.js +569 -0
  288. data/node_modules/playwright-core/lib/common/timeoutSettings.js +73 -0
  289. data/node_modules/playwright-core/lib/common/types.js +5 -0
  290. data/node_modules/playwright-core/lib/generated/clockSource.js +7 -0
  291. data/node_modules/playwright-core/lib/generated/consoleApiSource.js +7 -0
  292. data/node_modules/playwright-core/lib/generated/injectedScriptSource.js +7 -0
  293. data/node_modules/playwright-core/lib/generated/recorderSource.js +7 -0
  294. data/node_modules/playwright-core/lib/generated/utilityScriptSource.js +7 -0
  295. data/node_modules/playwright-core/lib/image_tools/colorUtils.js +98 -0
  296. data/node_modules/playwright-core/lib/image_tools/compare.js +108 -0
  297. data/node_modules/playwright-core/lib/image_tools/imageChannel.js +70 -0
  298. data/node_modules/playwright-core/lib/image_tools/stats.js +102 -0
  299. data/node_modules/playwright-core/lib/inProcessFactory.js +54 -0
  300. data/node_modules/playwright-core/lib/inprocess.js +20 -0
  301. data/node_modules/playwright-core/lib/outofprocess.js +67 -0
  302. data/node_modules/playwright-core/lib/protocol/debug.js +27 -0
  303. data/node_modules/playwright-core/lib/protocol/serializers.js +173 -0
  304. data/node_modules/playwright-core/lib/protocol/transport.js +82 -0
  305. data/node_modules/playwright-core/lib/protocol/validator.js +2694 -0
  306. data/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +139 -0
  307. data/node_modules/playwright-core/lib/remote/playwrightConnection.js +274 -0
  308. data/node_modules/playwright-core/lib/remote/playwrightServer.js +110 -0
  309. data/node_modules/playwright-core/lib/server/accessibility.js +62 -0
  310. data/node_modules/playwright-core/lib/server/android/android.js +441 -0
  311. data/node_modules/playwright-core/lib/server/android/backendAdb.js +172 -0
  312. data/node_modules/playwright-core/lib/server/artifact.js +104 -0
  313. data/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +296 -0
  314. data/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +206 -0
  315. data/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +162 -0
  316. data/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +110 -0
  317. data/node_modules/playwright-core/lib/server/bidi/bidiInput.js +174 -0
  318. data/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +304 -0
  319. data/node_modules/playwright-core/lib/server/bidi/bidiPage.js +456 -0
  320. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js +93 -0
  321. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +238 -0
  322. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +139 -0
  323. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +144 -0
  324. data/node_modules/playwright-core/lib/server/browser.js +137 -0
  325. data/node_modules/playwright-core/lib/server/browserContext.js +684 -0
  326. data/node_modules/playwright-core/lib/server/browserType.js +307 -0
  327. data/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
  328. data/node_modules/playwright-core/lib/server/chromium/chromium.js +362 -0
  329. data/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +44 -0
  330. data/node_modules/playwright-core/lib/server/chromium/crAccessibility.js +237 -0
  331. data/node_modules/playwright-core/lib/server/chromium/crBrowser.js +515 -0
  332. data/node_modules/playwright-core/lib/server/chromium/crConnection.js +228 -0
  333. data/node_modules/playwright-core/lib/server/chromium/crCoverage.js +246 -0
  334. data/node_modules/playwright-core/lib/server/chromium/crDevTools.js +104 -0
  335. data/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +143 -0
  336. data/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +156 -0
  337. data/node_modules/playwright-core/lib/server/chromium/crInput.js +171 -0
  338. data/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +767 -0
  339. data/node_modules/playwright-core/lib/server/chromium/crPage.js +1128 -0
  340. data/node_modules/playwright-core/lib/server/chromium/crPdf.js +153 -0
  341. data/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +133 -0
  342. data/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +112 -0
  343. data/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +145 -0
  344. data/node_modules/playwright-core/lib/server/chromium/videoRecorder.js +155 -0
  345. data/node_modules/playwright-core/lib/server/clock.js +125 -0
  346. data/node_modules/playwright-core/lib/server/codegen/csharp.js +299 -0
  347. data/node_modules/playwright-core/lib/server/codegen/java.js +235 -0
  348. data/node_modules/playwright-core/lib/server/codegen/javascript.js +223 -0
  349. data/node_modules/playwright-core/lib/server/codegen/jsonl.js +47 -0
  350. data/node_modules/playwright-core/lib/server/codegen/language.js +76 -0
  351. data/node_modules/playwright-core/lib/server/codegen/languages.js +30 -0
  352. data/node_modules/playwright-core/lib/server/codegen/python.js +265 -0
  353. data/node_modules/playwright-core/lib/server/codegen/types.js +5 -0
  354. data/node_modules/playwright-core/lib/server/console.js +57 -0
  355. data/node_modules/playwright-core/lib/server/cookieStore.js +112 -0
  356. data/node_modules/playwright-core/lib/server/debugController.js +234 -0
  357. data/node_modules/playwright-core/lib/server/debugger.js +132 -0
  358. data/node_modules/playwright-core/lib/server/deviceDescriptors.js +26 -0
  359. data/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +1669 -0
  360. data/node_modules/playwright-core/lib/server/dialog.js +70 -0
  361. data/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +193 -0
  362. data/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
  363. data/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +351 -0
  364. data/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +170 -0
  365. data/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
  366. data/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +48 -0
  367. data/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +103 -0
  368. data/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +44 -0
  369. data/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +395 -0
  370. data/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +93 -0
  371. data/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +228 -0
  372. data/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +286 -0
  373. data/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +102 -0
  374. data/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +59 -0
  375. data/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +413 -0
  376. data/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +221 -0
  377. data/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +358 -0
  378. data/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +106 -0
  379. data/node_modules/playwright-core/lib/server/dispatchers/selectorsDispatcher.js +36 -0
  380. data/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +62 -0
  381. data/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +54 -0
  382. data/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +58 -0
  383. data/node_modules/playwright-core/lib/server/dom.js +845 -0
  384. data/node_modules/playwright-core/lib/server/download.js +53 -0
  385. data/node_modules/playwright-core/lib/server/electron/electron.js +296 -0
  386. data/node_modules/playwright-core/lib/server/electron/loader.js +57 -0
  387. data/node_modules/playwright-core/lib/server/errors.js +68 -0
  388. data/node_modules/playwright-core/lib/server/fetch.js +660 -0
  389. data/node_modules/playwright-core/lib/server/fileChooser.js +42 -0
  390. data/node_modules/playwright-core/lib/server/fileUploadUtils.js +75 -0
  391. data/node_modules/playwright-core/lib/server/firefox/ffAccessibility.js +216 -0
  392. data/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +458 -0
  393. data/node_modules/playwright-core/lib/server/firefox/ffConnection.js +168 -0
  394. data/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +138 -0
  395. data/node_modules/playwright-core/lib/server/firefox/ffInput.js +150 -0
  396. data/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +233 -0
  397. data/node_modules/playwright-core/lib/server/firefox/ffPage.js +556 -0
  398. data/node_modules/playwright-core/lib/server/firefox/firefox.js +110 -0
  399. data/node_modules/playwright-core/lib/server/formData.js +75 -0
  400. data/node_modules/playwright-core/lib/server/frameSelectors.js +171 -0
  401. data/node_modules/playwright-core/lib/server/frames.js +1654 -0
  402. data/node_modules/playwright-core/lib/server/har/harRecorder.js +139 -0
  403. data/node_modules/playwright-core/lib/server/har/harTracer.js +531 -0
  404. data/node_modules/playwright-core/lib/server/helper.js +103 -0
  405. data/node_modules/playwright-core/lib/server/index.js +114 -0
  406. data/node_modules/playwright-core/lib/server/input.js +311 -0
  407. data/node_modules/playwright-core/lib/server/instrumentation.js +70 -0
  408. data/node_modules/playwright-core/lib/server/isomorphic/utilityScriptSerializers.js +226 -0
  409. data/node_modules/playwright-core/lib/server/javascript.js +306 -0
  410. data/node_modules/playwright-core/lib/server/launchApp.js +91 -0
  411. data/node_modules/playwright-core/lib/server/macEditingCommands.js +139 -0
  412. data/node_modules/playwright-core/lib/server/network.js +617 -0
  413. data/node_modules/playwright-core/lib/server/page.js +825 -0
  414. data/node_modules/playwright-core/lib/server/pipeTransport.js +85 -0
  415. data/node_modules/playwright-core/lib/server/playwright.js +85 -0
  416. data/node_modules/playwright-core/lib/server/progress.js +102 -0
  417. data/node_modules/playwright-core/lib/server/protocolError.js +49 -0
  418. data/node_modules/playwright-core/lib/server/recorder/contextRecorder.js +316 -0
  419. data/node_modules/playwright-core/lib/server/recorder/recorderActions.js +5 -0
  420. data/node_modules/playwright-core/lib/server/recorder/recorderApp.js +190 -0
  421. data/node_modules/playwright-core/lib/server/recorder/recorderCollection.js +127 -0
  422. data/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +177 -0
  423. data/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +71 -0
  424. data/node_modules/playwright-core/lib/server/recorder/throttledFile.js +46 -0
  425. data/node_modules/playwright-core/lib/server/recorder.js +324 -0
  426. data/node_modules/playwright-core/lib/server/registry/browserFetcher.js +168 -0
  427. data/node_modules/playwright-core/lib/server/registry/dependencies.js +322 -0
  428. data/node_modules/playwright-core/lib/server/registry/index.js +924 -0
  429. data/node_modules/playwright-core/lib/server/registry/nativeDeps.js +490 -0
  430. data/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +138 -0
  431. data/node_modules/playwright-core/lib/server/screenshotter.js +348 -0
  432. data/node_modules/playwright-core/lib/server/selectors.js +73 -0
  433. data/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +328 -0
  434. data/node_modules/playwright-core/lib/server/socksInterceptor.js +100 -0
  435. data/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +171 -0
  436. data/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +493 -0
  437. data/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +486 -0
  438. data/node_modules/playwright-core/lib/server/trace/test/inMemorySnapshotter.js +93 -0
  439. data/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +216 -0
  440. data/node_modules/playwright-core/lib/server/transport.js +191 -0
  441. data/node_modules/playwright-core/lib/server/types.js +24 -0
  442. data/node_modules/playwright-core/lib/server/usKeyboardLayout.js +555 -0
  443. data/node_modules/playwright-core/lib/server/webkit/webkit.js +87 -0
  444. data/node_modules/playwright-core/lib/server/webkit/wkAccessibility.js +194 -0
  445. data/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +328 -0
  446. data/node_modules/playwright-core/lib/server/webkit/wkConnection.js +173 -0
  447. data/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +146 -0
  448. data/node_modules/playwright-core/lib/server/webkit/wkInput.js +169 -0
  449. data/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +162 -0
  450. data/node_modules/playwright-core/lib/server/webkit/wkPage.js +1216 -0
  451. data/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +94 -0
  452. data/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +104 -0
  453. data/node_modules/playwright-core/lib/third_party/diff_match_patch.js +2222 -0
  454. data/node_modules/playwright-core/lib/third_party/pixelmatch.js +255 -0
  455. data/node_modules/playwright-core/lib/utils/ascii.js +31 -0
  456. data/node_modules/playwright-core/lib/utils/comparators.js +171 -0
  457. data/node_modules/playwright-core/lib/utils/crypto.js +174 -0
  458. data/node_modules/playwright-core/lib/utils/debug.js +46 -0
  459. data/node_modules/playwright-core/lib/utils/debugLogger.js +91 -0
  460. data/node_modules/playwright-core/lib/utils/env.js +49 -0
  461. data/node_modules/playwright-core/lib/utils/eventsHelper.js +38 -0
  462. data/node_modules/playwright-core/lib/utils/expectUtils.js +33 -0
  463. data/node_modules/playwright-core/lib/utils/fileUtils.js +205 -0
  464. data/node_modules/playwright-core/lib/utils/happy-eyeballs.js +181 -0
  465. data/node_modules/playwright-core/lib/utils/headers.js +52 -0
  466. data/node_modules/playwright-core/lib/utils/hostPlatform.js +133 -0
  467. data/node_modules/playwright-core/lib/utils/httpServer.js +236 -0
  468. data/node_modules/playwright-core/lib/utils/index.js +368 -0
  469. data/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +250 -0
  470. data/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +979 -0
  471. data/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +651 -0
  472. data/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +179 -0
  473. data/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +62 -0
  474. data/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +29 -0
  475. data/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +397 -0
  476. data/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +139 -0
  477. data/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +39 -0
  478. data/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +120 -0
  479. data/node_modules/playwright-core/lib/utils/linuxUtils.js +78 -0
  480. data/node_modules/playwright-core/lib/utils/manualPromise.js +109 -0
  481. data/node_modules/playwright-core/lib/utils/multimap.js +75 -0
  482. data/node_modules/playwright-core/lib/utils/network.js +160 -0
  483. data/node_modules/playwright-core/lib/utils/processLauncher.js +248 -0
  484. data/node_modules/playwright-core/lib/utils/profiler.js +53 -0
  485. data/node_modules/playwright-core/lib/utils/rtti.js +44 -0
  486. data/node_modules/playwright-core/lib/utils/semaphore.js +51 -0
  487. data/node_modules/playwright-core/lib/utils/spawnAsync.js +45 -0
  488. data/node_modules/playwright-core/lib/utils/stackTrace.js +121 -0
  489. data/node_modules/playwright-core/lib/utils/task.js +58 -0
  490. data/node_modules/playwright-core/lib/utils/time.js +37 -0
  491. data/node_modules/playwright-core/lib/utils/timeoutRunner.js +66 -0
  492. data/node_modules/playwright-core/lib/utils/traceUtils.js +44 -0
  493. data/node_modules/playwright-core/lib/utils/userAgent.js +105 -0
  494. data/node_modules/playwright-core/lib/utils/wsServer.js +127 -0
  495. data/node_modules/playwright-core/lib/utils/zipFile.js +75 -0
  496. data/node_modules/playwright-core/lib/utils/zones.js +62 -0
  497. data/node_modules/playwright-core/lib/utilsBundle.js +82 -0
  498. data/node_modules/playwright-core/lib/utilsBundleImpl/index.js +53 -0
  499. data/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
  500. data/node_modules/playwright-core/lib/vite/htmlReport/index.html +66 -0
  501. data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +24 -0
  502. data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +1 -0
  503. data/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  504. data/node_modules/playwright-core/lib/vite/recorder/assets/index-B-MT5gKo.css +1 -0
  505. data/node_modules/playwright-core/lib/vite/recorder/assets/index-DCpXOVIh.js +47 -0
  506. data/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
  507. data/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
  508. data/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +24 -0
  509. data/node_modules/playwright-core/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +1 -0
  510. data/node_modules/playwright-core/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +72 -0
  511. data/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +9 -0
  512. data/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +1 -0
  513. data/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  514. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.BkuvsLJp.js +2 -0
  515. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.html +16 -0
  516. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.w7WN2u1R.css +1 -0
  517. data/node_modules/playwright-core/lib/vite/traceViewer/index.C968kAiC.js +2 -0
  518. data/node_modules/playwright-core/lib/vite/traceViewer/index.CrbWWHbf.css +1 -0
  519. data/node_modules/playwright-core/lib/vite/traceViewer/index.html +27 -0
  520. data/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
  521. data/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +21 -0
  522. data/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -0
  523. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BkFnr4V0.js +10 -0
  524. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D3cNFP6u.css +1 -0
  525. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
  526. data/node_modules/playwright-core/lib/vite/traceViewer/workbench.DjbIuxix.css +1 -0
  527. data/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DSXBckUd.css +32 -0
  528. data/node_modules/playwright-core/lib/zipBundle.js +25 -0
  529. data/node_modules/playwright-core/lib/zipBundleImpl.js +5 -0
  530. data/node_modules/playwright-core/package.json +44 -0
  531. data/node_modules/playwright-core/types/protocol.d.ts +21500 -0
  532. data/node_modules/playwright-core/types/structs.d.ts +45 -0
  533. data/node_modules/playwright-core/types/types.d.ts +21431 -0
  534. data/node_modules/undici-types/LICENSE +21 -0
  535. data/node_modules/undici-types/README.md +6 -0
  536. data/node_modules/undici-types/agent.d.ts +31 -0
  537. data/node_modules/undici-types/api.d.ts +43 -0
  538. data/node_modules/undici-types/balanced-pool.d.ts +29 -0
  539. data/node_modules/undici-types/cache.d.ts +36 -0
  540. data/node_modules/undici-types/client.d.ts +108 -0
  541. data/node_modules/undici-types/connector.d.ts +34 -0
  542. data/node_modules/undici-types/content-type.d.ts +21 -0
  543. data/node_modules/undici-types/cookies.d.ts +28 -0
  544. data/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  545. data/node_modules/undici-types/dispatcher.d.ts +255 -0
  546. data/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  547. data/node_modules/undici-types/errors.d.ts +149 -0
  548. data/node_modules/undici-types/eventsource.d.ts +63 -0
  549. data/node_modules/undici-types/fetch.d.ts +209 -0
  550. data/node_modules/undici-types/file.d.ts +39 -0
  551. data/node_modules/undici-types/filereader.d.ts +54 -0
  552. data/node_modules/undici-types/formdata.d.ts +108 -0
  553. data/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  554. data/node_modules/undici-types/global-origin.d.ts +7 -0
  555. data/node_modules/undici-types/handlers.d.ts +15 -0
  556. data/node_modules/undici-types/header.d.ts +4 -0
  557. data/node_modules/undici-types/index.d.ts +71 -0
  558. data/node_modules/undici-types/interceptors.d.ts +15 -0
  559. data/node_modules/undici-types/mock-agent.d.ts +50 -0
  560. data/node_modules/undici-types/mock-client.d.ts +25 -0
  561. data/node_modules/undici-types/mock-errors.d.ts +12 -0
  562. data/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  563. data/node_modules/undici-types/mock-pool.d.ts +25 -0
  564. data/node_modules/undici-types/package.json +55 -0
  565. data/node_modules/undici-types/patch.d.ts +71 -0
  566. data/node_modules/undici-types/pool-stats.d.ts +19 -0
  567. data/node_modules/undici-types/pool.d.ts +39 -0
  568. data/node_modules/undici-types/proxy-agent.d.ts +28 -0
  569. data/node_modules/undici-types/readable.d.ts +60 -0
  570. data/node_modules/undici-types/retry-agent.d.ts +8 -0
  571. data/node_modules/undici-types/retry-handler.d.ts +116 -0
  572. data/node_modules/undici-types/util.d.ts +18 -0
  573. data/node_modules/undici-types/webidl.d.ts +222 -0
  574. data/node_modules/undici-types/websocket.d.ts +152 -0
  575. data/pokeedex.gemspec +32 -0
  576. data/spec/fixtures/pokemon_com/responses/GET-200-bulbasaur.html +2262 -0
  577. data/spec/fixtures/pokemon_com/responses/GET-404-not-found.html +808 -0
  578. data/spec/pokeedex/configuration_spec.rb +37 -0
  579. data/spec/pokeedex/database_spec.rb +21 -0
  580. data/spec/pokeedex/exceptions_spec.rb +11 -0
  581. data/spec/pokeedex/pokemon/base_spec.rb +15 -0
  582. data/spec/pokeedex/pokemon/decorators/base_spec.rb +63 -0
  583. data/spec/pokeedex/pokemon/model/base_spec.rb +36 -0
  584. data/spec/pokeedex/pokemon/scrapper/fetchers/base_spec.rb +36 -0
  585. data/spec/pokeedex/pokemon/scrapper/parsers/base_spec.rb +49 -0
  586. data/spec/pokeedex/pokemon/scrapper/pokedex_spec.rb +71 -0
  587. data/spec/pokeedex/pokemon/searcher/base.rb +81 -0
  588. data/spec/pokeedex_spec.rb +7 -0
  589. data/spec/spec_helper.rb +42 -0
  590. data/yarn.lock +41 -0
  591. metadata +731 -0
@@ -0,0 +1,888 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports._baseTest = void 0;
7
+ Object.defineProperty(exports, "defineConfig", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _configLoader.defineConfig;
11
+ }
12
+ });
13
+ Object.defineProperty(exports, "expect", {
14
+ enumerable: true,
15
+ get: function () {
16
+ return _expect.expect;
17
+ }
18
+ });
19
+ Object.defineProperty(exports, "mergeExpects", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _expect.mergeExpects;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "mergeTests", {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _testType.mergeTests;
29
+ }
30
+ });
31
+ exports.test = void 0;
32
+ var fs = _interopRequireWildcard(require("fs"));
33
+ var path = _interopRequireWildcard(require("path"));
34
+ var playwrightLibrary = _interopRequireWildcard(require("playwright-core"));
35
+ var _utils = require("playwright-core/lib/utils");
36
+ var _testType = require("./common/testType");
37
+ var _globals = require("./common/globals");
38
+ var _expect = require("./matchers/expect");
39
+ var _configLoader = require("./common/configLoader");
40
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
41
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
42
+ /**
43
+ * Copyright (c) Microsoft Corporation.
44
+ *
45
+ * Licensed under the Apache License, Version 2.0 (the 'License");
46
+ * you may not use this file except in compliance with the License.
47
+ * You may obtain a copy of the License at
48
+ *
49
+ * http://www.apache.org/licenses/LICENSE-2.0
50
+ *
51
+ * Unless required by applicable law or agreed to in writing, software
52
+ * distributed under the License is distributed on an "AS IS" BASIS,
53
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54
+ * See the License for the specific language governing permissions and
55
+ * limitations under the License.
56
+ */
57
+
58
+ const _baseTest = exports._baseTest = _testType.rootTestType.test;
59
+ (0, _utils.addInternalStackPrefix)(path.dirname(require.resolve('../package.json')));
60
+ if (process['__pw_initiator__']) {
61
+ const originalStackTraceLimit = Error.stackTraceLimit;
62
+ Error.stackTraceLimit = 200;
63
+ try {
64
+ throw new Error('Requiring @playwright/test second time, \nFirst:\n' + process['__pw_initiator__'] + '\n\nSecond: ');
65
+ } finally {
66
+ Error.stackTraceLimit = originalStackTraceLimit;
67
+ }
68
+ } else {
69
+ process['__pw_initiator__'] = new Error().stack;
70
+ }
71
+ const playwrightFixtures = {
72
+ defaultBrowserType: ['chromium', {
73
+ scope: 'worker',
74
+ option: true
75
+ }],
76
+ browserName: [({
77
+ defaultBrowserType
78
+ }, use) => use(defaultBrowserType), {
79
+ scope: 'worker',
80
+ option: true
81
+ }],
82
+ playwright: [async ({}, use) => {
83
+ await use(require('playwright-core'));
84
+ }, {
85
+ scope: 'worker',
86
+ box: true
87
+ }],
88
+ headless: [({
89
+ launchOptions
90
+ }, use) => {
91
+ var _launchOptions$headle;
92
+ return use((_launchOptions$headle = launchOptions.headless) !== null && _launchOptions$headle !== void 0 ? _launchOptions$headle : true);
93
+ }, {
94
+ scope: 'worker',
95
+ option: true
96
+ }],
97
+ channel: [({
98
+ launchOptions
99
+ }, use) => use(launchOptions.channel), {
100
+ scope: 'worker',
101
+ option: true
102
+ }],
103
+ launchOptions: [{}, {
104
+ scope: 'worker',
105
+ option: true
106
+ }],
107
+ connectOptions: [async ({
108
+ _optionConnectOptions
109
+ }, use) => {
110
+ await use(connectOptionsFromEnv() || _optionConnectOptions);
111
+ }, {
112
+ scope: 'worker',
113
+ option: true
114
+ }],
115
+ screenshot: ['off', {
116
+ scope: 'worker',
117
+ option: true
118
+ }],
119
+ video: ['off', {
120
+ scope: 'worker',
121
+ option: true
122
+ }],
123
+ trace: ['off', {
124
+ scope: 'worker',
125
+ option: true
126
+ }],
127
+ _browserOptions: [async ({
128
+ playwright,
129
+ headless,
130
+ channel,
131
+ launchOptions
132
+ }, use) => {
133
+ const options = {
134
+ handleSIGINT: false,
135
+ ...launchOptions
136
+ };
137
+ if (headless !== undefined) options.headless = headless;
138
+ if (channel !== undefined) options.channel = channel;
139
+ options.tracesDir = tracing().tracesDir();
140
+ for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit, playwright._experimentalBidi]) browserType._defaultLaunchOptions = options;
141
+ await use(options);
142
+ for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit, playwright._experimentalBidi]) browserType._defaultLaunchOptions = undefined;
143
+ }, {
144
+ scope: 'worker',
145
+ auto: true,
146
+ box: true
147
+ }],
148
+ browser: [async ({
149
+ playwright,
150
+ browserName,
151
+ _browserOptions,
152
+ connectOptions,
153
+ _reuseContext
154
+ }, use, testInfo) => {
155
+ if (!['chromium', 'firefox', 'webkit', '_experimentalBidi'].includes(browserName)) throw new Error(`Unexpected browserName "${browserName}", must be one of "chromium", "firefox" or "webkit"`);
156
+ if (connectOptions) {
157
+ var _connectOptions$expos;
158
+ const browser = await playwright[browserName].connect({
159
+ ...connectOptions,
160
+ exposeNetwork: (_connectOptions$expos = connectOptions.exposeNetwork) !== null && _connectOptions$expos !== void 0 ? _connectOptions$expos : connectOptions._exposeNetwork,
161
+ headers: {
162
+ ...(_reuseContext ? {
163
+ 'x-playwright-reuse-context': '1'
164
+ } : {}),
165
+ // HTTP headers are ASCII only (not UTF-8).
166
+ 'x-playwright-launch-options': (0, _utils.jsonStringifyForceASCII)(_browserOptions),
167
+ ...connectOptions.headers
168
+ }
169
+ });
170
+ await use(browser);
171
+ await browser._wrapApiCall(async () => {
172
+ await browser.close({
173
+ reason: 'Test ended.'
174
+ });
175
+ }, true);
176
+ return;
177
+ }
178
+ const browser = await playwright[browserName].launch();
179
+ await use(browser);
180
+ await browser._wrapApiCall(async () => {
181
+ await browser.close({
182
+ reason: 'Test ended.'
183
+ });
184
+ }, true);
185
+ }, {
186
+ scope: 'worker',
187
+ timeout: 0
188
+ }],
189
+ acceptDownloads: [({
190
+ contextOptions
191
+ }, use) => {
192
+ var _contextOptions$accep;
193
+ return use((_contextOptions$accep = contextOptions.acceptDownloads) !== null && _contextOptions$accep !== void 0 ? _contextOptions$accep : true);
194
+ }, {
195
+ option: true
196
+ }],
197
+ bypassCSP: [({
198
+ contextOptions
199
+ }, use) => {
200
+ var _contextOptions$bypas;
201
+ return use((_contextOptions$bypas = contextOptions.bypassCSP) !== null && _contextOptions$bypas !== void 0 ? _contextOptions$bypas : false);
202
+ }, {
203
+ option: true
204
+ }],
205
+ colorScheme: [({
206
+ contextOptions
207
+ }, use) => use(contextOptions.colorScheme === undefined ? 'light' : contextOptions.colorScheme), {
208
+ option: true
209
+ }],
210
+ deviceScaleFactor: [({
211
+ contextOptions
212
+ }, use) => use(contextOptions.deviceScaleFactor), {
213
+ option: true
214
+ }],
215
+ extraHTTPHeaders: [({
216
+ contextOptions
217
+ }, use) => use(contextOptions.extraHTTPHeaders), {
218
+ option: true
219
+ }],
220
+ geolocation: [({
221
+ contextOptions
222
+ }, use) => use(contextOptions.geolocation), {
223
+ option: true
224
+ }],
225
+ hasTouch: [({
226
+ contextOptions
227
+ }, use) => {
228
+ var _contextOptions$hasTo;
229
+ return use((_contextOptions$hasTo = contextOptions.hasTouch) !== null && _contextOptions$hasTo !== void 0 ? _contextOptions$hasTo : false);
230
+ }, {
231
+ option: true
232
+ }],
233
+ httpCredentials: [({
234
+ contextOptions
235
+ }, use) => use(contextOptions.httpCredentials), {
236
+ option: true
237
+ }],
238
+ ignoreHTTPSErrors: [({
239
+ contextOptions
240
+ }, use) => {
241
+ var _contextOptions$ignor;
242
+ return use((_contextOptions$ignor = contextOptions.ignoreHTTPSErrors) !== null && _contextOptions$ignor !== void 0 ? _contextOptions$ignor : false);
243
+ }, {
244
+ option: true
245
+ }],
246
+ isMobile: [({
247
+ contextOptions
248
+ }, use) => {
249
+ var _contextOptions$isMob;
250
+ return use((_contextOptions$isMob = contextOptions.isMobile) !== null && _contextOptions$isMob !== void 0 ? _contextOptions$isMob : false);
251
+ }, {
252
+ option: true
253
+ }],
254
+ javaScriptEnabled: [({
255
+ contextOptions
256
+ }, use) => {
257
+ var _contextOptions$javaS;
258
+ return use((_contextOptions$javaS = contextOptions.javaScriptEnabled) !== null && _contextOptions$javaS !== void 0 ? _contextOptions$javaS : true);
259
+ }, {
260
+ option: true
261
+ }],
262
+ locale: [({
263
+ contextOptions
264
+ }, use) => {
265
+ var _contextOptions$local;
266
+ return use((_contextOptions$local = contextOptions.locale) !== null && _contextOptions$local !== void 0 ? _contextOptions$local : 'en-US');
267
+ }, {
268
+ option: true
269
+ }],
270
+ offline: [({
271
+ contextOptions
272
+ }, use) => {
273
+ var _contextOptions$offli;
274
+ return use((_contextOptions$offli = contextOptions.offline) !== null && _contextOptions$offli !== void 0 ? _contextOptions$offli : false);
275
+ }, {
276
+ option: true
277
+ }],
278
+ permissions: [({
279
+ contextOptions
280
+ }, use) => use(contextOptions.permissions), {
281
+ option: true
282
+ }],
283
+ proxy: [({
284
+ contextOptions
285
+ }, use) => use(contextOptions.proxy), {
286
+ option: true
287
+ }],
288
+ storageState: [({
289
+ contextOptions
290
+ }, use) => use(contextOptions.storageState), {
291
+ option: true
292
+ }],
293
+ clientCertificates: [({
294
+ contextOptions
295
+ }, use) => use(contextOptions.clientCertificates), {
296
+ option: true
297
+ }],
298
+ timezoneId: [({
299
+ contextOptions
300
+ }, use) => use(contextOptions.timezoneId), {
301
+ option: true
302
+ }],
303
+ userAgent: [({
304
+ contextOptions
305
+ }, use) => use(contextOptions.userAgent), {
306
+ option: true
307
+ }],
308
+ viewport: [({
309
+ contextOptions
310
+ }, use) => use(contextOptions.viewport === undefined ? {
311
+ width: 1280,
312
+ height: 720
313
+ } : contextOptions.viewport), {
314
+ option: true
315
+ }],
316
+ actionTimeout: [0, {
317
+ option: true
318
+ }],
319
+ testIdAttribute: ['data-testid', {
320
+ option: true
321
+ }],
322
+ navigationTimeout: [0, {
323
+ option: true
324
+ }],
325
+ baseURL: [async ({}, use) => {
326
+ await use(process.env.PLAYWRIGHT_TEST_BASE_URL);
327
+ }, {
328
+ option: true
329
+ }],
330
+ serviceWorkers: [({
331
+ contextOptions
332
+ }, use) => {
333
+ var _contextOptions$servi;
334
+ return use((_contextOptions$servi = contextOptions.serviceWorkers) !== null && _contextOptions$servi !== void 0 ? _contextOptions$servi : 'allow');
335
+ }, {
336
+ option: true
337
+ }],
338
+ contextOptions: [{}, {
339
+ option: true
340
+ }],
341
+ _combinedContextOptions: [async ({
342
+ acceptDownloads,
343
+ bypassCSP,
344
+ clientCertificates,
345
+ colorScheme,
346
+ deviceScaleFactor,
347
+ extraHTTPHeaders,
348
+ hasTouch,
349
+ geolocation,
350
+ httpCredentials,
351
+ ignoreHTTPSErrors,
352
+ isMobile,
353
+ javaScriptEnabled,
354
+ locale,
355
+ offline,
356
+ permissions,
357
+ proxy,
358
+ storageState,
359
+ viewport,
360
+ timezoneId,
361
+ userAgent,
362
+ baseURL,
363
+ contextOptions,
364
+ serviceWorkers
365
+ }, use) => {
366
+ const options = {};
367
+ if (acceptDownloads !== undefined) options.acceptDownloads = acceptDownloads;
368
+ if (bypassCSP !== undefined) options.bypassCSP = bypassCSP;
369
+ if (colorScheme !== undefined) options.colorScheme = colorScheme;
370
+ if (deviceScaleFactor !== undefined) options.deviceScaleFactor = deviceScaleFactor;
371
+ if (extraHTTPHeaders !== undefined) options.extraHTTPHeaders = extraHTTPHeaders;
372
+ if (geolocation !== undefined) options.geolocation = geolocation;
373
+ if (hasTouch !== undefined) options.hasTouch = hasTouch;
374
+ if (httpCredentials !== undefined) options.httpCredentials = httpCredentials;
375
+ if (ignoreHTTPSErrors !== undefined) options.ignoreHTTPSErrors = ignoreHTTPSErrors;
376
+ if (isMobile !== undefined) options.isMobile = isMobile;
377
+ if (javaScriptEnabled !== undefined) options.javaScriptEnabled = javaScriptEnabled;
378
+ if (locale !== undefined) options.locale = locale;
379
+ if (offline !== undefined) options.offline = offline;
380
+ if (permissions !== undefined) options.permissions = permissions;
381
+ if (proxy !== undefined) options.proxy = proxy;
382
+ if (storageState !== undefined) options.storageState = storageState;
383
+ if (clientCertificates !== null && clientCertificates !== void 0 && clientCertificates.length) options.clientCertificates = resolveClientCerticates(clientCertificates);
384
+ if (timezoneId !== undefined) options.timezoneId = timezoneId;
385
+ if (userAgent !== undefined) options.userAgent = userAgent;
386
+ if (viewport !== undefined) options.viewport = viewport;
387
+ if (baseURL !== undefined) options.baseURL = baseURL;
388
+ if (serviceWorkers !== undefined) options.serviceWorkers = serviceWorkers;
389
+ await use({
390
+ ...contextOptions,
391
+ ...options
392
+ });
393
+ }, {
394
+ box: true
395
+ }],
396
+ _setupContextOptions: [async ({
397
+ playwright,
398
+ _combinedContextOptions,
399
+ actionTimeout,
400
+ navigationTimeout,
401
+ testIdAttribute
402
+ }, use, testInfo) => {
403
+ if (testIdAttribute) playwrightLibrary.selectors.setTestIdAttribute(testIdAttribute);
404
+ testInfo.snapshotSuffix = process.platform;
405
+ if ((0, _utils.debugMode)()) testInfo._setDebugMode();
406
+ for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
407
+ browserType._defaultContextOptions = _combinedContextOptions;
408
+ browserType._defaultContextTimeout = actionTimeout || 0;
409
+ browserType._defaultContextNavigationTimeout = navigationTimeout || 0;
410
+ }
411
+ playwright.request._defaultContextOptions = {
412
+ ..._combinedContextOptions
413
+ };
414
+ playwright.request._defaultContextOptions.tracesDir = tracing().tracesDir();
415
+ playwright.request._defaultContextOptions.timeout = actionTimeout || 0;
416
+ await use();
417
+ playwright.request._defaultContextOptions = undefined;
418
+ for (const browserType of [playwright.chromium, playwright.firefox, playwright.webkit]) {
419
+ browserType._defaultContextOptions = undefined;
420
+ browserType._defaultContextTimeout = undefined;
421
+ browserType._defaultContextNavigationTimeout = undefined;
422
+ }
423
+ }, {
424
+ auto: 'all-hooks-included',
425
+ title: 'context configuration',
426
+ box: true
427
+ }],
428
+ _setupArtifacts: [async ({
429
+ playwright,
430
+ screenshot
431
+ }, use, testInfo) => {
432
+ // This fixture has a separate zero-timeout slot to ensure that artifact collection
433
+ // happens even after some fixtures or hooks time out.
434
+ // Now that default test timeout is known, we can replace zero with an actual value.
435
+ testInfo.setTimeout(testInfo.project.timeout);
436
+ const artifactsRecorder = new ArtifactsRecorder(playwright, tracing().artifactsDir(), screenshot);
437
+ await artifactsRecorder.willStartTest(testInfo);
438
+ const csiListener = {
439
+ onApiCallBegin: (apiName, params, frames, userData, out) => {
440
+ const testInfo = (0, _globals.currentTestInfo)();
441
+ if (!testInfo || apiName.includes('setTestIdAttribute')) return {
442
+ userObject: null
443
+ };
444
+ const step = testInfo._addStep({
445
+ location: frames[0],
446
+ category: 'pw:api',
447
+ title: renderApiCall(apiName, params),
448
+ apiName,
449
+ params
450
+ });
451
+ userData.userObject = step;
452
+ out.stepId = step.stepId;
453
+ },
454
+ onApiCallEnd: (userData, error) => {
455
+ const step = userData.userObject;
456
+ step === null || step === void 0 || step.complete({
457
+ error
458
+ });
459
+ },
460
+ onWillPause: () => {
461
+ var _currentTestInfo;
462
+ (_currentTestInfo = (0, _globals.currentTestInfo)()) === null || _currentTestInfo === void 0 || _currentTestInfo._setDebugMode();
463
+ },
464
+ runAfterCreateBrowserContext: async context => {
465
+ await (artifactsRecorder === null || artifactsRecorder === void 0 ? void 0 : artifactsRecorder.didCreateBrowserContext(context));
466
+ const testInfo = (0, _globals.currentTestInfo)();
467
+ if (testInfo) attachConnectedHeaderIfNeeded(testInfo, context.browser());
468
+ },
469
+ runAfterCreateRequestContext: async context => {
470
+ await (artifactsRecorder === null || artifactsRecorder === void 0 ? void 0 : artifactsRecorder.didCreateRequestContext(context));
471
+ },
472
+ runBeforeCloseBrowserContext: async context => {
473
+ await (artifactsRecorder === null || artifactsRecorder === void 0 ? void 0 : artifactsRecorder.willCloseBrowserContext(context));
474
+ },
475
+ runBeforeCloseRequestContext: async context => {
476
+ await (artifactsRecorder === null || artifactsRecorder === void 0 ? void 0 : artifactsRecorder.willCloseRequestContext(context));
477
+ }
478
+ };
479
+ const clientInstrumentation = playwright._instrumentation;
480
+ clientInstrumentation.addListener(csiListener);
481
+ await use();
482
+ clientInstrumentation.removeListener(csiListener);
483
+ await artifactsRecorder.didFinishTest();
484
+ }, {
485
+ auto: 'all-hooks-included',
486
+ title: 'trace recording',
487
+ box: true,
488
+ timeout: 0
489
+ }],
490
+ _contextFactory: [async ({
491
+ browser,
492
+ video,
493
+ _reuseContext,
494
+ _combinedContextOptions /** mitigate dep-via-auto lack of traceability */
495
+ }, use, testInfo) => {
496
+ const testInfoImpl = testInfo;
497
+ const videoMode = normalizeVideoMode(video);
498
+ const captureVideo = shouldCaptureVideo(videoMode, testInfo) && !_reuseContext;
499
+ const contexts = new Map();
500
+ await use(async options => {
501
+ const hook = testInfoImpl._currentHookType();
502
+ if (hook === 'beforeAll' || hook === 'afterAll') {
503
+ throw new Error([`"context" and "page" fixtures are not supported in "${hook}" since they are created on a per-test basis.`, `If you would like to reuse a single page between tests, create context manually with browser.newContext(). See https://aka.ms/playwright/reuse-page for details.`, `If you would like to configure your page before each test, do that in beforeEach hook instead.`].join('\n'));
504
+ }
505
+ const videoOptions = captureVideo ? {
506
+ recordVideo: {
507
+ dir: tracing().artifactsDir(),
508
+ size: typeof video === 'string' ? undefined : video.size
509
+ }
510
+ } : {};
511
+ const context = await browser.newContext({
512
+ ...videoOptions,
513
+ ...options
514
+ });
515
+ const contextData = {
516
+ pagesWithVideo: []
517
+ };
518
+ contexts.set(context, contextData);
519
+ if (captureVideo) context.on('page', page => contextData.pagesWithVideo.push(page));
520
+ if (process.env.PW_CLOCK === 'frozen') {
521
+ await context._wrapApiCall(async () => {
522
+ await context.clock.install({
523
+ time: 0
524
+ });
525
+ await context.clock.pauseAt(1000);
526
+ }, true);
527
+ } else if (process.env.PW_CLOCK === 'realtime') {
528
+ await context._wrapApiCall(async () => {
529
+ await context.clock.install({
530
+ time: 0
531
+ });
532
+ }, true);
533
+ }
534
+ return context;
535
+ });
536
+ let counter = 0;
537
+ const closeReason = testInfo.status === 'timedOut' ? 'Test timeout of ' + testInfo.timeout + 'ms exceeded.' : 'Test ended.';
538
+ await Promise.all([...contexts.keys()].map(async context => {
539
+ await context._wrapApiCall(async () => {
540
+ await context.close({
541
+ reason: closeReason
542
+ });
543
+ }, true);
544
+ const testFailed = testInfo.status !== testInfo.expectedStatus;
545
+ const preserveVideo = captureVideo && (videoMode === 'on' || testFailed && videoMode === 'retain-on-failure' || videoMode === 'on-first-retry' && testInfo.retry === 1);
546
+ if (preserveVideo) {
547
+ const {
548
+ pagesWithVideo: pagesForVideo
549
+ } = contexts.get(context);
550
+ const videos = pagesForVideo.map(p => p.video()).filter(Boolean);
551
+ await Promise.all(videos.map(async v => {
552
+ try {
553
+ const savedPath = testInfo.outputPath(`video${counter ? '-' + counter : ''}.webm`);
554
+ ++counter;
555
+ await v.saveAs(savedPath);
556
+ testInfo.attachments.push({
557
+ name: 'video',
558
+ path: savedPath,
559
+ contentType: 'video/webm'
560
+ });
561
+ } catch (e) {
562
+ // Silent catch empty videos.
563
+ }
564
+ }));
565
+ }
566
+ }));
567
+ }, {
568
+ scope: 'test',
569
+ title: 'context',
570
+ box: true
571
+ }],
572
+ _optionContextReuseMode: ['none', {
573
+ scope: 'worker',
574
+ option: true
575
+ }],
576
+ _optionConnectOptions: [undefined, {
577
+ scope: 'worker',
578
+ option: true
579
+ }],
580
+ _reuseContext: [async ({
581
+ video,
582
+ _optionContextReuseMode
583
+ }, use) => {
584
+ let mode = _optionContextReuseMode;
585
+ if (process.env.PW_TEST_REUSE_CONTEXT) mode = 'when-possible';
586
+ const reuse = mode === 'when-possible' && normalizeVideoMode(video) === 'off';
587
+ await use(reuse);
588
+ }, {
589
+ scope: 'worker',
590
+ title: 'context',
591
+ box: true
592
+ }],
593
+ context: async ({
594
+ playwright,
595
+ browser,
596
+ _reuseContext,
597
+ _contextFactory
598
+ }, use, testInfo) => {
599
+ attachConnectedHeaderIfNeeded(testInfo, browser);
600
+ if (!_reuseContext) {
601
+ await use(await _contextFactory());
602
+ return;
603
+ }
604
+ const defaultContextOptions = playwright.chromium._defaultContextOptions;
605
+ const context = await browser._newContextForReuse(defaultContextOptions);
606
+ context[kIsReusedContext] = true;
607
+ await use(context);
608
+ const closeReason = testInfo.status === 'timedOut' ? 'Test timeout of ' + testInfo.timeout + 'ms exceeded.' : 'Test ended.';
609
+ await browser._stopPendingOperations(closeReason);
610
+ },
611
+ page: async ({
612
+ context,
613
+ _reuseContext
614
+ }, use) => {
615
+ if (!_reuseContext) {
616
+ await use(await context.newPage());
617
+ return;
618
+ }
619
+
620
+ // First time we are reusing the context, we should create the page.
621
+ let [page] = context.pages();
622
+ if (!page) page = await context.newPage();
623
+ await use(page);
624
+ },
625
+ request: async ({
626
+ playwright
627
+ }, use) => {
628
+ const request = await playwright.request.newContext();
629
+ await use(request);
630
+ const hook = test.info()._currentHookType();
631
+ if (hook === 'beforeAll') {
632
+ await request.dispose({
633
+ reason: [`Fixture { request } from beforeAll cannot be reused in a test.`, ` - Recommended fix: use a separate { request } in the test.`, ` - Alternatively, manually create APIRequestContext in beforeAll and dispose it in afterAll.`, `See https://playwright.dev/docs/api-testing#sending-api-requests-from-ui-tests for more details.`].join('\n')
634
+ });
635
+ } else {
636
+ await request.dispose();
637
+ }
638
+ }
639
+ };
640
+ function normalizeVideoMode(video) {
641
+ if (!video) return 'off';
642
+ let videoMode = typeof video === 'string' ? video : video.mode;
643
+ if (videoMode === 'retry-with-video') videoMode = 'on-first-retry';
644
+ return videoMode;
645
+ }
646
+ function shouldCaptureVideo(videoMode, testInfo) {
647
+ return videoMode === 'on' || videoMode === 'retain-on-failure' || videoMode === 'on-first-retry' && testInfo.retry === 1;
648
+ }
649
+ function normalizeScreenshotMode(screenshot) {
650
+ if (!screenshot) return 'off';
651
+ return typeof screenshot === 'string' ? screenshot : screenshot.mode;
652
+ }
653
+ function attachConnectedHeaderIfNeeded(testInfo, browser) {
654
+ const connectHeaders = browser === null || browser === void 0 ? void 0 : browser._connectHeaders;
655
+ if (!connectHeaders) return;
656
+ for (const header of connectHeaders) {
657
+ if (header.name !== 'x-playwright-attachment') continue;
658
+ const [name, value] = header.value.split('=');
659
+ if (!name || !value) continue;
660
+ if (testInfo.attachments.some(attachment => attachment.name === name)) continue;
661
+ testInfo.attachments.push({
662
+ name,
663
+ contentType: 'text/plain',
664
+ body: Buffer.from(value)
665
+ });
666
+ }
667
+ }
668
+ function resolveFileToConfig(file) {
669
+ const config = test.info().config.configFile;
670
+ if (!config || !file) return file;
671
+ if (path.isAbsolute(file)) return file;
672
+ return path.resolve(path.dirname(config), file);
673
+ }
674
+ function resolveClientCerticates(clientCertificates) {
675
+ for (const cert of clientCertificates) {
676
+ cert.certPath = resolveFileToConfig(cert.certPath);
677
+ cert.keyPath = resolveFileToConfig(cert.keyPath);
678
+ cert.pfxPath = resolveFileToConfig(cert.pfxPath);
679
+ }
680
+ return clientCertificates;
681
+ }
682
+ const kTracingStarted = Symbol('kTracingStarted');
683
+ const kIsReusedContext = Symbol('kReusedContext');
684
+ function connectOptionsFromEnv() {
685
+ const wsEndpoint = process.env.PW_TEST_CONNECT_WS_ENDPOINT;
686
+ if (!wsEndpoint) return undefined;
687
+ const headers = process.env.PW_TEST_CONNECT_HEADERS ? JSON.parse(process.env.PW_TEST_CONNECT_HEADERS) : undefined;
688
+ return {
689
+ wsEndpoint,
690
+ headers,
691
+ exposeNetwork: process.env.PW_TEST_CONNECT_EXPOSE_NETWORK
692
+ };
693
+ }
694
+ class ArtifactsRecorder {
695
+ constructor(playwright, artifactsDir, screenshot) {
696
+ this._testInfo = void 0;
697
+ this._playwright = void 0;
698
+ this._artifactsDir = void 0;
699
+ this._screenshotMode = void 0;
700
+ this._screenshotOptions = void 0;
701
+ this._temporaryScreenshots = [];
702
+ this._temporaryArtifacts = [];
703
+ this._reusedContexts = new Set();
704
+ this._screenshotOrdinal = 0;
705
+ this._screenshottedSymbol = void 0;
706
+ this._startedCollectingArtifacts = void 0;
707
+ this._playwright = playwright;
708
+ this._artifactsDir = artifactsDir;
709
+ this._screenshotMode = normalizeScreenshotMode(screenshot);
710
+ this._screenshotOptions = typeof screenshot === 'string' ? undefined : screenshot;
711
+ this._screenshottedSymbol = Symbol('screenshotted');
712
+ this._startedCollectingArtifacts = Symbol('startedCollectingArtifacts');
713
+ }
714
+ _createTemporaryArtifact(...name) {
715
+ const file = path.join(this._artifactsDir, ...name);
716
+ this._temporaryArtifacts.push(file);
717
+ return file;
718
+ }
719
+ async willStartTest(testInfo) {
720
+ this._testInfo = testInfo;
721
+ testInfo._onDidFinishTestFunction = () => this.didFinishTestFunction();
722
+
723
+ // Since beforeAll(s), test and afterAll(s) reuse the same TestInfo, make sure we do not
724
+ // overwrite previous screenshots.
725
+ this._screenshotOrdinal = testInfo.attachments.filter(a => a.name === 'screenshot').length;
726
+
727
+ // Process existing contexts.
728
+ for (const browserType of [this._playwright.chromium, this._playwright.firefox, this._playwright.webkit]) {
729
+ const promises = [];
730
+ const existingContexts = Array.from(browserType._contexts);
731
+ for (const context of existingContexts) {
732
+ if (context[kIsReusedContext]) this._reusedContexts.add(context);else promises.push(this.didCreateBrowserContext(context));
733
+ }
734
+ await Promise.all(promises);
735
+ }
736
+ {
737
+ const existingApiRequests = Array.from(this._playwright.request._contexts);
738
+ await Promise.all(existingApiRequests.map(c => this.didCreateRequestContext(c)));
739
+ }
740
+ }
741
+ async didCreateBrowserContext(context) {
742
+ await this._startTraceChunkOnContextCreation(context.tracing);
743
+ }
744
+ async willCloseBrowserContext(context) {
745
+ // When reusing context, we get all previous contexts closed at the start of next test.
746
+ // Do not record empty traces and useless screenshots for them.
747
+ if (this._reusedContexts.has(context)) return;
748
+ await this._stopTracing(context.tracing);
749
+ if (this._screenshotMode === 'on' || this._screenshotMode === 'only-on-failure') {
750
+ // Capture screenshot for now. We'll know whether we have to preserve them
751
+ // after the test finishes.
752
+ await Promise.all(context.pages().map(page => this._screenshotPage(page, true)));
753
+ }
754
+ }
755
+ async didCreateRequestContext(context) {
756
+ const tracing = context._tracing;
757
+ await this._startTraceChunkOnContextCreation(tracing);
758
+ }
759
+ async willCloseRequestContext(context) {
760
+ const tracing = context._tracing;
761
+ await this._stopTracing(tracing);
762
+ }
763
+ async didFinishTestFunction() {
764
+ const captureScreenshots = this._screenshotMode === 'on' || this._screenshotMode === 'only-on-failure' && this._testInfo._isFailure();
765
+ if (captureScreenshots) await this._screenshotOnTestFailure();
766
+ }
767
+ async didFinishTest() {
768
+ const captureScreenshots = this._screenshotMode === 'on' || this._screenshotMode === 'only-on-failure' && this._testInfo._isFailure();
769
+ if (captureScreenshots) await this._screenshotOnTestFailure();
770
+ const leftoverContexts = [];
771
+ for (const browserType of [this._playwright.chromium, this._playwright.firefox, this._playwright.webkit]) leftoverContexts.push(...browserType._contexts);
772
+ const leftoverApiRequests = Array.from(this._playwright.request._contexts);
773
+
774
+ // Collect traces/screenshots for remaining contexts.
775
+ await Promise.all(leftoverContexts.map(async context => {
776
+ await this._stopTracing(context.tracing);
777
+ }).concat(leftoverApiRequests.map(async context => {
778
+ const tracing = context._tracing;
779
+ await this._stopTracing(tracing);
780
+ })));
781
+
782
+ // Attach temporary screenshots for contexts closed before collecting the test trace.
783
+ if (captureScreenshots) {
784
+ for (const file of this._temporaryScreenshots) {
785
+ try {
786
+ const screenshotPath = this._createScreenshotAttachmentPath();
787
+ await fs.promises.rename(file, screenshotPath);
788
+ this._attachScreenshot(screenshotPath);
789
+ } catch {}
790
+ }
791
+ }
792
+ }
793
+ _createScreenshotAttachmentPath() {
794
+ const testFailed = this._testInfo._isFailure();
795
+ const index = this._screenshotOrdinal + 1;
796
+ ++this._screenshotOrdinal;
797
+ const screenshotPath = this._testInfo.outputPath(`test-${testFailed ? 'failed' : 'finished'}-${index}.png`);
798
+ return screenshotPath;
799
+ }
800
+ async _screenshotPage(page, temporary) {
801
+ if (page[this._screenshottedSymbol]) return;
802
+ page[this._screenshottedSymbol] = true;
803
+ try {
804
+ const screenshotPath = temporary ? this._createTemporaryArtifact((0, _utils.createGuid)() + '.png') : this._createScreenshotAttachmentPath();
805
+ // Pass caret=initial to avoid any evaluations that might slow down the screenshot
806
+ // and let the page modify itself from the problematic state it had at the moment of failure.
807
+ await page.screenshot({
808
+ ...this._screenshotOptions,
809
+ timeout: 5000,
810
+ path: screenshotPath,
811
+ caret: 'initial'
812
+ });
813
+ if (temporary) this._temporaryScreenshots.push(screenshotPath);else this._attachScreenshot(screenshotPath);
814
+ } catch {
815
+ // Screenshot may fail, just ignore.
816
+ }
817
+ }
818
+ _attachScreenshot(screenshotPath) {
819
+ this._testInfo.attachments.push({
820
+ name: 'screenshot',
821
+ path: screenshotPath,
822
+ contentType: 'image/png'
823
+ });
824
+ }
825
+ async _screenshotOnTestFailure() {
826
+ const contexts = [];
827
+ for (const browserType of [this._playwright.chromium, this._playwright.firefox, this._playwright.webkit]) contexts.push(...browserType._contexts);
828
+ const pages = contexts.map(ctx => ctx.pages()).flat();
829
+ await Promise.all(pages.map(page => this._screenshotPage(page, false)));
830
+ }
831
+ async _startTraceChunkOnContextCreation(tracing) {
832
+ const options = this._testInfo._tracing.traceOptions();
833
+ if (options) {
834
+ const title = this._testInfo._tracing.traceTitle();
835
+ const name = this._testInfo._tracing.generateNextTraceRecordingName();
836
+ if (!tracing[kTracingStarted]) {
837
+ await tracing.start({
838
+ ...options,
839
+ title,
840
+ name
841
+ });
842
+ tracing[kTracingStarted] = true;
843
+ } else {
844
+ await tracing.startChunk({
845
+ title,
846
+ name
847
+ });
848
+ }
849
+ } else {
850
+ if (tracing[kTracingStarted]) {
851
+ tracing[kTracingStarted] = false;
852
+ await tracing.stop();
853
+ }
854
+ }
855
+ }
856
+ async _stopTracing(tracing) {
857
+ if (tracing[this._startedCollectingArtifacts]) return;
858
+ tracing[this._startedCollectingArtifacts] = true;
859
+ if (this._testInfo._tracing.traceOptions() && tracing[kTracingStarted]) await tracing.stopChunk({
860
+ path: this._testInfo._tracing.generateNextTraceRecordingPath()
861
+ });
862
+ }
863
+ }
864
+ const paramsToRender = ['url', 'selector', 'text', 'key'];
865
+ function renderApiCall(apiName, params) {
866
+ const paramsArray = [];
867
+ if (params) {
868
+ for (const name of paramsToRender) {
869
+ if (!(name in params)) continue;
870
+ let value;
871
+ if (name === 'selector' && (0, _utils.isString)(params[name]) && params[name].startsWith('internal:')) {
872
+ const getter = (0, _utils.asLocator)('javascript', params[name]);
873
+ apiName = apiName.replace(/^locator\./, 'locator.' + getter + '.');
874
+ apiName = apiName.replace(/^page\./, 'page.' + getter + '.');
875
+ apiName = apiName.replace(/^frame\./, 'frame.' + getter + '.');
876
+ } else {
877
+ value = params[name];
878
+ paramsArray.push(value);
879
+ }
880
+ }
881
+ }
882
+ const paramsText = paramsArray.length ? '(' + paramsArray.join(', ') + ')' : '';
883
+ return apiName + paramsText;
884
+ }
885
+ function tracing() {
886
+ return test.info()._tracing;
887
+ }
888
+ const test = exports.test = _baseTest.extend(playwrightFixtures);