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.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +30 -0
- data/.gitignore +13 -0
- data/.standard.yml +9 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +125 -0
- data/LICENSE.txt +21 -0
- data/README.md +154 -0
- data/Rakefile +20 -0
- data/bin/pokeedex +85 -0
- data/lib/pokeedex/configuration.rb +47 -0
- data/lib/pokeedex/database.rb +42 -0
- data/lib/pokeedex/db/migrations/001_create_pokemons.rb +26 -0
- data/lib/pokeedex/exceptions.rb +15 -0
- data/lib/pokeedex/pokemon/base.rb +16 -0
- data/lib/pokeedex/pokemon/decorators/base.rb +112 -0
- data/lib/pokeedex/pokemon/model/base.rb +43 -0
- data/lib/pokeedex/pokemon/scrapper/base.rb +34 -0
- data/lib/pokeedex/pokemon/scrapper/fetchers/base.rb +123 -0
- data/lib/pokeedex/pokemon/scrapper/parsers/base.rb +205 -0
- data/lib/pokeedex/pokemon/scrapper/pokedex.rb +50 -0
- data/lib/pokeedex/pokemon/searcher/base.rb +59 -0
- data/lib/pokeedex/version.rb +5 -0
- data/lib/pokeedex.rb +55 -0
- data/node_modules/.bin/playwright +1 -0
- data/node_modules/.bin/playwright-core +1 -0
- data/node_modules/.yarn-integrity +22 -0
- data/node_modules/@playwright/test/LICENSE +202 -0
- data/node_modules/@playwright/test/NOTICE +5 -0
- data/node_modules/@playwright/test/README.md +169 -0
- data/node_modules/@playwright/test/cli.js +19 -0
- data/node_modules/@playwright/test/index.d.ts +18 -0
- data/node_modules/@playwright/test/index.js +17 -0
- data/node_modules/@playwright/test/index.mjs +18 -0
- data/node_modules/@playwright/test/node_modules/.bin/playwright +1 -0
- data/node_modules/@playwright/test/package.json +35 -0
- data/node_modules/@playwright/test/reporter.d.ts +17 -0
- data/node_modules/@playwright/test/reporter.js +17 -0
- data/node_modules/@playwright/test/reporter.mjs +17 -0
- data/node_modules/@types/node/LICENSE +21 -0
- data/node_modules/@types/node/README.md +15 -0
- data/node_modules/@types/node/assert/strict.d.ts +8 -0
- data/node_modules/@types/node/assert.d.ts +1040 -0
- data/node_modules/@types/node/async_hooks.d.ts +541 -0
- data/node_modules/@types/node/buffer.d.ts +2300 -0
- data/node_modules/@types/node/child_process.d.ts +1544 -0
- data/node_modules/@types/node/cluster.d.ts +578 -0
- data/node_modules/@types/node/console.d.ts +452 -0
- data/node_modules/@types/node/constants.d.ts +19 -0
- data/node_modules/@types/node/crypto.d.ts +4451 -0
- data/node_modules/@types/node/dgram.d.ts +596 -0
- data/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- data/node_modules/@types/node/dns/promises.d.ts +476 -0
- data/node_modules/@types/node/dns.d.ts +865 -0
- data/node_modules/@types/node/dom-events.d.ts +124 -0
- data/node_modules/@types/node/domain.d.ts +170 -0
- data/node_modules/@types/node/events.d.ts +931 -0
- data/node_modules/@types/node/fs/promises.d.ts +1264 -0
- data/node_modules/@types/node/fs.d.ts +4390 -0
- data/node_modules/@types/node/globals.d.ts +611 -0
- data/node_modules/@types/node/globals.global.d.ts +1 -0
- data/node_modules/@types/node/http.d.ts +1921 -0
- data/node_modules/@types/node/http2.d.ts +2555 -0
- data/node_modules/@types/node/https.d.ts +544 -0
- data/node_modules/@types/node/index.d.ts +90 -0
- data/node_modules/@types/node/inspector.d.ts +3966 -0
- data/node_modules/@types/node/module.d.ts +301 -0
- data/node_modules/@types/node/net.d.ts +995 -0
- data/node_modules/@types/node/os.d.ts +495 -0
- data/node_modules/@types/node/package.json +217 -0
- data/node_modules/@types/node/path.d.ts +200 -0
- data/node_modules/@types/node/perf_hooks.d.ts +941 -0
- data/node_modules/@types/node/process.d.ts +1912 -0
- data/node_modules/@types/node/punycode.d.ts +117 -0
- data/node_modules/@types/node/querystring.d.ts +153 -0
- data/node_modules/@types/node/readline/promises.d.ts +150 -0
- data/node_modules/@types/node/readline.d.ts +540 -0
- data/node_modules/@types/node/repl.d.ts +430 -0
- data/node_modules/@types/node/sea.d.ts +153 -0
- data/node_modules/@types/node/sqlite.d.ts +213 -0
- data/node_modules/@types/node/stream/consumers.d.ts +12 -0
- data/node_modules/@types/node/stream/promises.d.ts +83 -0
- data/node_modules/@types/node/stream/web.d.ts +606 -0
- data/node_modules/@types/node/stream.d.ts +1726 -0
- data/node_modules/@types/node/string_decoder.d.ts +67 -0
- data/node_modules/@types/node/test.d.ts +2098 -0
- data/node_modules/@types/node/timers/promises.d.ts +97 -0
- data/node_modules/@types/node/timers.d.ts +240 -0
- data/node_modules/@types/node/tls.d.ts +1220 -0
- data/node_modules/@types/node/trace_events.d.ts +197 -0
- data/node_modules/@types/node/tty.d.ts +208 -0
- data/node_modules/@types/node/url.d.ts +969 -0
- data/node_modules/@types/node/util.d.ts +2301 -0
- data/node_modules/@types/node/v8.d.ts +808 -0
- data/node_modules/@types/node/vm.d.ts +922 -0
- data/node_modules/@types/node/wasi.d.ts +181 -0
- data/node_modules/@types/node/worker_threads.d.ts +712 -0
- data/node_modules/@types/node/zlib.d.ts +539 -0
- data/node_modules/fsevents/LICENSE +22 -0
- data/node_modules/fsevents/README.md +83 -0
- data/node_modules/fsevents/fsevents.d.ts +46 -0
- data/node_modules/fsevents/fsevents.js +82 -0
- data/node_modules/fsevents/fsevents.node +0 -0
- data/node_modules/fsevents/package.json +62 -0
- data/node_modules/playwright/.eslintrc.js +6 -0
- data/node_modules/playwright/LICENSE +202 -0
- data/node_modules/playwright/NOTICE +5 -0
- data/node_modules/playwright/README.md +169 -0
- data/node_modules/playwright/ThirdPartyNotices.txt +4356 -0
- data/node_modules/playwright/cli.js +19 -0
- data/node_modules/playwright/index.d.ts +17 -0
- data/node_modules/playwright/index.js +17 -0
- data/node_modules/playwright/index.mjs +18 -0
- data/node_modules/playwright/jsx-runtime.js +41 -0
- data/node_modules/playwright/jsx-runtime.mjs +21 -0
- data/node_modules/playwright/lib/common/config.js +256 -0
- data/node_modules/playwright/lib/common/configLoader.js +321 -0
- data/node_modules/playwright/lib/common/esmLoaderHost.js +93 -0
- data/node_modules/playwright/lib/common/expectBundle.js +27 -0
- data/node_modules/playwright/lib/common/expectBundleImpl.js +389 -0
- data/node_modules/playwright/lib/common/fixtures.js +323 -0
- data/node_modules/playwright/lib/common/globals.js +48 -0
- data/node_modules/playwright/lib/common/ipc.js +48 -0
- data/node_modules/playwright/lib/common/poolBuilder.js +79 -0
- data/node_modules/playwright/lib/common/process.js +140 -0
- data/node_modules/playwright/lib/common/suiteUtils.js +133 -0
- data/node_modules/playwright/lib/common/test.js +311 -0
- data/node_modules/playwright/lib/common/testLoader.js +102 -0
- data/node_modules/playwright/lib/common/testType.js +284 -0
- data/node_modules/playwright/lib/fsWatcher.js +69 -0
- data/node_modules/playwright/lib/index.js +888 -0
- data/node_modules/playwright/lib/internalsForTest.js +28 -0
- data/node_modules/playwright/lib/isomorphic/events.js +72 -0
- data/node_modules/playwright/lib/isomorphic/folders.js +25 -0
- data/node_modules/playwright/lib/isomorphic/stringInternPool.js +58 -0
- data/node_modules/playwright/lib/isomorphic/teleReceiver.js +504 -0
- data/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +149 -0
- data/node_modules/playwright/lib/isomorphic/testServerConnection.js +210 -0
- data/node_modules/playwright/lib/isomorphic/testServerInterface.js +5 -0
- data/node_modules/playwright/lib/isomorphic/testTree.js +272 -0
- data/node_modules/playwright/lib/loader/loaderMain.js +58 -0
- data/node_modules/playwright/lib/matchers/expect.js +297 -0
- data/node_modules/playwright/lib/matchers/matcherHint.js +50 -0
- data/node_modules/playwright/lib/matchers/matchers.js +449 -0
- data/node_modules/playwright/lib/matchers/toBeTruthy.js +55 -0
- data/node_modules/playwright/lib/matchers/toEqual.js +57 -0
- data/node_modules/playwright/lib/matchers/toMatchSnapshot.js +383 -0
- data/node_modules/playwright/lib/matchers/toMatchText.js +76 -0
- data/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +78 -0
- data/node_modules/playwright/lib/plugins/index.js +19 -0
- data/node_modules/playwright/lib/plugins/webServerPlugin.js +187 -0
- data/node_modules/playwright/lib/program.js +346 -0
- data/node_modules/playwright/lib/reporters/base.js +553 -0
- data/node_modules/playwright/lib/reporters/blob.js +133 -0
- data/node_modules/playwright/lib/reporters/dot.js +82 -0
- data/node_modules/playwright/lib/reporters/empty.js +42 -0
- data/node_modules/playwright/lib/reporters/github.js +115 -0
- data/node_modules/playwright/lib/reporters/html.js +623 -0
- data/node_modules/playwright/lib/reporters/internalReporter.js +123 -0
- data/node_modules/playwright/lib/reporters/json.js +243 -0
- data/node_modules/playwright/lib/reporters/junit.js +233 -0
- data/node_modules/playwright/lib/reporters/line.js +108 -0
- data/node_modules/playwright/lib/reporters/list.js +222 -0
- data/node_modules/playwright/lib/reporters/markdown.js +76 -0
- data/node_modules/playwright/lib/reporters/merge.js +477 -0
- data/node_modules/playwright/lib/reporters/multiplexer.js +90 -0
- data/node_modules/playwright/lib/reporters/reporterV2.js +118 -0
- data/node_modules/playwright/lib/reporters/teleEmitter.js +268 -0
- data/node_modules/playwright/lib/reporters/versions/blobV1.js +5 -0
- data/node_modules/playwright/lib/runner/dispatcher.js +532 -0
- data/node_modules/playwright/lib/runner/failureTracker.js +60 -0
- data/node_modules/playwright/lib/runner/loadUtils.js +308 -0
- data/node_modules/playwright/lib/runner/loaderHost.js +85 -0
- data/node_modules/playwright/lib/runner/processHost.js +175 -0
- data/node_modules/playwright/lib/runner/projectUtils.js +203 -0
- data/node_modules/playwright/lib/runner/reporters.js +151 -0
- data/node_modules/playwright/lib/runner/runner.js +179 -0
- data/node_modules/playwright/lib/runner/sigIntWatcher.js +100 -0
- data/node_modules/playwright/lib/runner/taskRunner.js +147 -0
- data/node_modules/playwright/lib/runner/tasks.js +407 -0
- data/node_modules/playwright/lib/runner/testGroups.js +136 -0
- data/node_modules/playwright/lib/runner/testServer.js +605 -0
- data/node_modules/playwright/lib/runner/uiModeReporter.js +31 -0
- data/node_modules/playwright/lib/runner/vcs.js +55 -0
- data/node_modules/playwright/lib/runner/watchMode.js +398 -0
- data/node_modules/playwright/lib/runner/workerHost.js +85 -0
- data/node_modules/playwright/lib/third_party/tsconfig-loader.js +134 -0
- data/node_modules/playwright/lib/transform/babelBundle.js +28 -0
- data/node_modules/playwright/lib/transform/babelBundleImpl.js +2032 -0
- data/node_modules/playwright/lib/transform/compilationCache.js +254 -0
- data/node_modules/playwright/lib/transform/esmLoader.js +117 -0
- data/node_modules/playwright/lib/transform/esmUtils.js +32 -0
- data/node_modules/playwright/lib/transform/portTransport.js +81 -0
- data/node_modules/playwright/lib/transform/transform.js +267 -0
- data/node_modules/playwright/lib/util.js +356 -0
- data/node_modules/playwright/lib/utilsBundle.js +28 -0
- data/node_modules/playwright/lib/utilsBundleImpl.js +102 -0
- data/node_modules/playwright/lib/worker/fixtureRunner.js +279 -0
- data/node_modules/playwright/lib/worker/testInfo.js +397 -0
- data/node_modules/playwright/lib/worker/testTracing.js +314 -0
- data/node_modules/playwright/lib/worker/timeoutManager.js +153 -0
- data/node_modules/playwright/lib/worker/workerMain.js +637 -0
- data/node_modules/playwright/node_modules/.bin/playwright-core +1 -0
- data/node_modules/playwright/package.json +66 -0
- data/node_modules/playwright/test.d.ts +18 -0
- data/node_modules/playwright/test.js +24 -0
- data/node_modules/playwright/test.mjs +33 -0
- data/node_modules/playwright/types/test.d.ts +8444 -0
- data/node_modules/playwright/types/testReporter.d.ts +749 -0
- data/node_modules/playwright-core/LICENSE +202 -0
- data/node_modules/playwright-core/NOTICE +5 -0
- data/node_modules/playwright-core/README.md +3 -0
- data/node_modules/playwright-core/ThirdPartyNotices.txt +1548 -0
- data/node_modules/playwright-core/bin/PrintDeps.exe +0 -0
- data/node_modules/playwright-core/bin/README.md +2 -0
- data/node_modules/playwright-core/bin/install_media_pack.ps1 +5 -0
- data/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +40 -0
- data/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
- data/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
- data/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +40 -0
- data/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
- data/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +40 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +40 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +40 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
- data/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
- data/node_modules/playwright-core/browsers.json +53 -0
- data/node_modules/playwright-core/cli.js +18 -0
- data/node_modules/playwright-core/index.d.ts +17 -0
- data/node_modules/playwright-core/index.js +33 -0
- data/node_modules/playwright-core/index.mjs +28 -0
- data/node_modules/playwright-core/lib/androidServerImpl.js +69 -0
- data/node_modules/playwright-core/lib/browserServerImpl.js +92 -0
- data/node_modules/playwright-core/lib/cli/driver.js +95 -0
- data/node_modules/playwright-core/lib/cli/program.js +577 -0
- data/node_modules/playwright-core/lib/cli/programWithTestStub.js +67 -0
- data/node_modules/playwright-core/lib/client/accessibility.js +50 -0
- data/node_modules/playwright-core/lib/client/android.js +473 -0
- data/node_modules/playwright-core/lib/client/api.js +279 -0
- data/node_modules/playwright-core/lib/client/artifact.js +79 -0
- data/node_modules/playwright-core/lib/client/browser.js +145 -0
- data/node_modules/playwright-core/lib/client/browserContext.js +541 -0
- data/node_modules/playwright-core/lib/client/browserType.js +241 -0
- data/node_modules/playwright-core/lib/client/cdpSession.js +53 -0
- data/node_modules/playwright-core/lib/client/channelOwner.js +231 -0
- data/node_modules/playwright-core/lib/client/clientHelper.js +57 -0
- data/node_modules/playwright-core/lib/client/clientInstrumentation.js +50 -0
- data/node_modules/playwright-core/lib/client/clock.js +68 -0
- data/node_modules/playwright-core/lib/client/connection.js +330 -0
- data/node_modules/playwright-core/lib/client/consoleMessage.js +55 -0
- data/node_modules/playwright-core/lib/client/coverage.js +41 -0
- data/node_modules/playwright-core/lib/client/dialog.js +57 -0
- data/node_modules/playwright-core/lib/client/download.js +62 -0
- data/node_modules/playwright-core/lib/client/electron.js +135 -0
- data/node_modules/playwright-core/lib/client/elementHandle.js +321 -0
- data/node_modules/playwright-core/lib/client/errors.js +77 -0
- data/node_modules/playwright-core/lib/client/eventEmitter.js +314 -0
- data/node_modules/playwright-core/lib/client/events.js +94 -0
- data/node_modules/playwright-core/lib/client/fetch.js +396 -0
- data/node_modules/playwright-core/lib/client/fileChooser.js +45 -0
- data/node_modules/playwright-core/lib/client/frame.js +504 -0
- data/node_modules/playwright-core/lib/client/harRouter.js +99 -0
- data/node_modules/playwright-core/lib/client/input.js +111 -0
- data/node_modules/playwright-core/lib/client/jsHandle.js +129 -0
- data/node_modules/playwright-core/lib/client/jsonPipe.js +35 -0
- data/node_modules/playwright-core/lib/client/localUtils.js +35 -0
- data/node_modules/playwright-core/lib/client/locator.js +441 -0
- data/node_modules/playwright-core/lib/client/network.js +604 -0
- data/node_modules/playwright-core/lib/client/page.js +725 -0
- data/node_modules/playwright-core/lib/client/playwright.js +77 -0
- data/node_modules/playwright-core/lib/client/selectors.js +67 -0
- data/node_modules/playwright-core/lib/client/stream.js +54 -0
- data/node_modules/playwright-core/lib/client/tracing.js +138 -0
- data/node_modules/playwright-core/lib/client/types.js +24 -0
- data/node_modules/playwright-core/lib/client/video.js +51 -0
- data/node_modules/playwright-core/lib/client/waiter.js +158 -0
- data/node_modules/playwright-core/lib/client/webError.js +37 -0
- data/node_modules/playwright-core/lib/client/worker.js +71 -0
- data/node_modules/playwright-core/lib/client/writableStream.js +54 -0
- data/node_modules/playwright-core/lib/common/socksProxy.js +569 -0
- data/node_modules/playwright-core/lib/common/timeoutSettings.js +73 -0
- data/node_modules/playwright-core/lib/common/types.js +5 -0
- data/node_modules/playwright-core/lib/generated/clockSource.js +7 -0
- data/node_modules/playwright-core/lib/generated/consoleApiSource.js +7 -0
- data/node_modules/playwright-core/lib/generated/injectedScriptSource.js +7 -0
- data/node_modules/playwright-core/lib/generated/recorderSource.js +7 -0
- data/node_modules/playwright-core/lib/generated/utilityScriptSource.js +7 -0
- data/node_modules/playwright-core/lib/image_tools/colorUtils.js +98 -0
- data/node_modules/playwright-core/lib/image_tools/compare.js +108 -0
- data/node_modules/playwright-core/lib/image_tools/imageChannel.js +70 -0
- data/node_modules/playwright-core/lib/image_tools/stats.js +102 -0
- data/node_modules/playwright-core/lib/inProcessFactory.js +54 -0
- data/node_modules/playwright-core/lib/inprocess.js +20 -0
- data/node_modules/playwright-core/lib/outofprocess.js +67 -0
- data/node_modules/playwright-core/lib/protocol/debug.js +27 -0
- data/node_modules/playwright-core/lib/protocol/serializers.js +173 -0
- data/node_modules/playwright-core/lib/protocol/transport.js +82 -0
- data/node_modules/playwright-core/lib/protocol/validator.js +2694 -0
- data/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +139 -0
- data/node_modules/playwright-core/lib/remote/playwrightConnection.js +274 -0
- data/node_modules/playwright-core/lib/remote/playwrightServer.js +110 -0
- data/node_modules/playwright-core/lib/server/accessibility.js +62 -0
- data/node_modules/playwright-core/lib/server/android/android.js +441 -0
- data/node_modules/playwright-core/lib/server/android/backendAdb.js +172 -0
- data/node_modules/playwright-core/lib/server/artifact.js +104 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +296 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +206 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +162 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +110 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiInput.js +174 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +304 -0
- data/node_modules/playwright-core/lib/server/bidi/bidiPage.js +456 -0
- data/node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js +93 -0
- data/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +238 -0
- data/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +139 -0
- data/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +144 -0
- data/node_modules/playwright-core/lib/server/browser.js +137 -0
- data/node_modules/playwright-core/lib/server/browserContext.js +684 -0
- data/node_modules/playwright-core/lib/server/browserType.js +307 -0
- data/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
- data/node_modules/playwright-core/lib/server/chromium/chromium.js +362 -0
- data/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +44 -0
- data/node_modules/playwright-core/lib/server/chromium/crAccessibility.js +237 -0
- data/node_modules/playwright-core/lib/server/chromium/crBrowser.js +515 -0
- data/node_modules/playwright-core/lib/server/chromium/crConnection.js +228 -0
- data/node_modules/playwright-core/lib/server/chromium/crCoverage.js +246 -0
- data/node_modules/playwright-core/lib/server/chromium/crDevTools.js +104 -0
- data/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +143 -0
- data/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +156 -0
- data/node_modules/playwright-core/lib/server/chromium/crInput.js +171 -0
- data/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +767 -0
- data/node_modules/playwright-core/lib/server/chromium/crPage.js +1128 -0
- data/node_modules/playwright-core/lib/server/chromium/crPdf.js +153 -0
- data/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +133 -0
- data/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +112 -0
- data/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +145 -0
- data/node_modules/playwright-core/lib/server/chromium/videoRecorder.js +155 -0
- data/node_modules/playwright-core/lib/server/clock.js +125 -0
- data/node_modules/playwright-core/lib/server/codegen/csharp.js +299 -0
- data/node_modules/playwright-core/lib/server/codegen/java.js +235 -0
- data/node_modules/playwright-core/lib/server/codegen/javascript.js +223 -0
- data/node_modules/playwright-core/lib/server/codegen/jsonl.js +47 -0
- data/node_modules/playwright-core/lib/server/codegen/language.js +76 -0
- data/node_modules/playwright-core/lib/server/codegen/languages.js +30 -0
- data/node_modules/playwright-core/lib/server/codegen/python.js +265 -0
- data/node_modules/playwright-core/lib/server/codegen/types.js +5 -0
- data/node_modules/playwright-core/lib/server/console.js +57 -0
- data/node_modules/playwright-core/lib/server/cookieStore.js +112 -0
- data/node_modules/playwright-core/lib/server/debugController.js +234 -0
- data/node_modules/playwright-core/lib/server/debugger.js +132 -0
- data/node_modules/playwright-core/lib/server/deviceDescriptors.js +26 -0
- data/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +1669 -0
- data/node_modules/playwright-core/lib/server/dialog.js +70 -0
- data/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +193 -0
- data/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
- data/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +351 -0
- data/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +170 -0
- data/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +55 -0
- data/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +48 -0
- data/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +103 -0
- data/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +44 -0
- data/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +395 -0
- data/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +93 -0
- data/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +228 -0
- data/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +286 -0
- data/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +102 -0
- data/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +59 -0
- data/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +413 -0
- data/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +221 -0
- data/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +358 -0
- data/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +106 -0
- data/node_modules/playwright-core/lib/server/dispatchers/selectorsDispatcher.js +36 -0
- data/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +62 -0
- data/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +54 -0
- data/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +58 -0
- data/node_modules/playwright-core/lib/server/dom.js +845 -0
- data/node_modules/playwright-core/lib/server/download.js +53 -0
- data/node_modules/playwright-core/lib/server/electron/electron.js +296 -0
- data/node_modules/playwright-core/lib/server/electron/loader.js +57 -0
- data/node_modules/playwright-core/lib/server/errors.js +68 -0
- data/node_modules/playwright-core/lib/server/fetch.js +660 -0
- data/node_modules/playwright-core/lib/server/fileChooser.js +42 -0
- data/node_modules/playwright-core/lib/server/fileUploadUtils.js +75 -0
- data/node_modules/playwright-core/lib/server/firefox/ffAccessibility.js +216 -0
- data/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +458 -0
- data/node_modules/playwright-core/lib/server/firefox/ffConnection.js +168 -0
- data/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +138 -0
- data/node_modules/playwright-core/lib/server/firefox/ffInput.js +150 -0
- data/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +233 -0
- data/node_modules/playwright-core/lib/server/firefox/ffPage.js +556 -0
- data/node_modules/playwright-core/lib/server/firefox/firefox.js +110 -0
- data/node_modules/playwright-core/lib/server/formData.js +75 -0
- data/node_modules/playwright-core/lib/server/frameSelectors.js +171 -0
- data/node_modules/playwright-core/lib/server/frames.js +1654 -0
- data/node_modules/playwright-core/lib/server/har/harRecorder.js +139 -0
- data/node_modules/playwright-core/lib/server/har/harTracer.js +531 -0
- data/node_modules/playwright-core/lib/server/helper.js +103 -0
- data/node_modules/playwright-core/lib/server/index.js +114 -0
- data/node_modules/playwright-core/lib/server/input.js +311 -0
- data/node_modules/playwright-core/lib/server/instrumentation.js +70 -0
- data/node_modules/playwright-core/lib/server/isomorphic/utilityScriptSerializers.js +226 -0
- data/node_modules/playwright-core/lib/server/javascript.js +306 -0
- data/node_modules/playwright-core/lib/server/launchApp.js +91 -0
- data/node_modules/playwright-core/lib/server/macEditingCommands.js +139 -0
- data/node_modules/playwright-core/lib/server/network.js +617 -0
- data/node_modules/playwright-core/lib/server/page.js +825 -0
- data/node_modules/playwright-core/lib/server/pipeTransport.js +85 -0
- data/node_modules/playwright-core/lib/server/playwright.js +85 -0
- data/node_modules/playwright-core/lib/server/progress.js +102 -0
- data/node_modules/playwright-core/lib/server/protocolError.js +49 -0
- data/node_modules/playwright-core/lib/server/recorder/contextRecorder.js +316 -0
- data/node_modules/playwright-core/lib/server/recorder/recorderActions.js +5 -0
- data/node_modules/playwright-core/lib/server/recorder/recorderApp.js +190 -0
- data/node_modules/playwright-core/lib/server/recorder/recorderCollection.js +127 -0
- data/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +177 -0
- data/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +71 -0
- data/node_modules/playwright-core/lib/server/recorder/throttledFile.js +46 -0
- data/node_modules/playwright-core/lib/server/recorder.js +324 -0
- data/node_modules/playwright-core/lib/server/registry/browserFetcher.js +168 -0
- data/node_modules/playwright-core/lib/server/registry/dependencies.js +322 -0
- data/node_modules/playwright-core/lib/server/registry/index.js +924 -0
- data/node_modules/playwright-core/lib/server/registry/nativeDeps.js +490 -0
- data/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +138 -0
- data/node_modules/playwright-core/lib/server/screenshotter.js +348 -0
- data/node_modules/playwright-core/lib/server/selectors.js +73 -0
- data/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +328 -0
- data/node_modules/playwright-core/lib/server/socksInterceptor.js +100 -0
- data/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +171 -0
- data/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +493 -0
- data/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +486 -0
- data/node_modules/playwright-core/lib/server/trace/test/inMemorySnapshotter.js +93 -0
- data/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +216 -0
- data/node_modules/playwright-core/lib/server/transport.js +191 -0
- data/node_modules/playwright-core/lib/server/types.js +24 -0
- data/node_modules/playwright-core/lib/server/usKeyboardLayout.js +555 -0
- data/node_modules/playwright-core/lib/server/webkit/webkit.js +87 -0
- data/node_modules/playwright-core/lib/server/webkit/wkAccessibility.js +194 -0
- data/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +328 -0
- data/node_modules/playwright-core/lib/server/webkit/wkConnection.js +173 -0
- data/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +146 -0
- data/node_modules/playwright-core/lib/server/webkit/wkInput.js +169 -0
- data/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +162 -0
- data/node_modules/playwright-core/lib/server/webkit/wkPage.js +1216 -0
- data/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +94 -0
- data/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +104 -0
- data/node_modules/playwright-core/lib/third_party/diff_match_patch.js +2222 -0
- data/node_modules/playwright-core/lib/third_party/pixelmatch.js +255 -0
- data/node_modules/playwright-core/lib/utils/ascii.js +31 -0
- data/node_modules/playwright-core/lib/utils/comparators.js +171 -0
- data/node_modules/playwright-core/lib/utils/crypto.js +174 -0
- data/node_modules/playwright-core/lib/utils/debug.js +46 -0
- data/node_modules/playwright-core/lib/utils/debugLogger.js +91 -0
- data/node_modules/playwright-core/lib/utils/env.js +49 -0
- data/node_modules/playwright-core/lib/utils/eventsHelper.js +38 -0
- data/node_modules/playwright-core/lib/utils/expectUtils.js +33 -0
- data/node_modules/playwright-core/lib/utils/fileUtils.js +205 -0
- data/node_modules/playwright-core/lib/utils/happy-eyeballs.js +181 -0
- data/node_modules/playwright-core/lib/utils/headers.js +52 -0
- data/node_modules/playwright-core/lib/utils/hostPlatform.js +133 -0
- data/node_modules/playwright-core/lib/utils/httpServer.js +236 -0
- data/node_modules/playwright-core/lib/utils/index.js +368 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +250 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +979 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +651 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +179 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +62 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +29 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +397 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +139 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +39 -0
- data/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +120 -0
- data/node_modules/playwright-core/lib/utils/linuxUtils.js +78 -0
- data/node_modules/playwright-core/lib/utils/manualPromise.js +109 -0
- data/node_modules/playwright-core/lib/utils/multimap.js +75 -0
- data/node_modules/playwright-core/lib/utils/network.js +160 -0
- data/node_modules/playwright-core/lib/utils/processLauncher.js +248 -0
- data/node_modules/playwright-core/lib/utils/profiler.js +53 -0
- data/node_modules/playwright-core/lib/utils/rtti.js +44 -0
- data/node_modules/playwright-core/lib/utils/semaphore.js +51 -0
- data/node_modules/playwright-core/lib/utils/spawnAsync.js +45 -0
- data/node_modules/playwright-core/lib/utils/stackTrace.js +121 -0
- data/node_modules/playwright-core/lib/utils/task.js +58 -0
- data/node_modules/playwright-core/lib/utils/time.js +37 -0
- data/node_modules/playwright-core/lib/utils/timeoutRunner.js +66 -0
- data/node_modules/playwright-core/lib/utils/traceUtils.js +44 -0
- data/node_modules/playwright-core/lib/utils/userAgent.js +105 -0
- data/node_modules/playwright-core/lib/utils/wsServer.js +127 -0
- data/node_modules/playwright-core/lib/utils/zipFile.js +75 -0
- data/node_modules/playwright-core/lib/utils/zones.js +62 -0
- data/node_modules/playwright-core/lib/utilsBundle.js +82 -0
- data/node_modules/playwright-core/lib/utilsBundleImpl/index.js +53 -0
- data/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
- data/node_modules/playwright-core/lib/vite/htmlReport/index.html +66 -0
- data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +24 -0
- data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +1 -0
- data/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- data/node_modules/playwright-core/lib/vite/recorder/assets/index-B-MT5gKo.css +1 -0
- data/node_modules/playwright-core/lib/vite/recorder/assets/index-DCpXOVIh.js +47 -0
- data/node_modules/playwright-core/lib/vite/recorder/index.html +29 -0
- data/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +9 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +24 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +1 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +72 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +9 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +1 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/embedded.BkuvsLJp.js +2 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/embedded.html +16 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/embedded.w7WN2u1R.css +1 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/index.C968kAiC.js +2 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/index.CrbWWHbf.css +1 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/index.html +27 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +9 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +21 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BkFnr4V0.js +10 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D3cNFP6u.css +1 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +18 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/workbench.DjbIuxix.css +1 -0
- data/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DSXBckUd.css +32 -0
- data/node_modules/playwright-core/lib/zipBundle.js +25 -0
- data/node_modules/playwright-core/lib/zipBundleImpl.js +5 -0
- data/node_modules/playwright-core/package.json +44 -0
- data/node_modules/playwright-core/types/protocol.d.ts +21500 -0
- data/node_modules/playwright-core/types/structs.d.ts +45 -0
- data/node_modules/playwright-core/types/types.d.ts +21431 -0
- data/node_modules/undici-types/LICENSE +21 -0
- data/node_modules/undici-types/README.md +6 -0
- data/node_modules/undici-types/agent.d.ts +31 -0
- data/node_modules/undici-types/api.d.ts +43 -0
- data/node_modules/undici-types/balanced-pool.d.ts +29 -0
- data/node_modules/undici-types/cache.d.ts +36 -0
- data/node_modules/undici-types/client.d.ts +108 -0
- data/node_modules/undici-types/connector.d.ts +34 -0
- data/node_modules/undici-types/content-type.d.ts +21 -0
- data/node_modules/undici-types/cookies.d.ts +28 -0
- data/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- data/node_modules/undici-types/dispatcher.d.ts +255 -0
- data/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- data/node_modules/undici-types/errors.d.ts +149 -0
- data/node_modules/undici-types/eventsource.d.ts +63 -0
- data/node_modules/undici-types/fetch.d.ts +209 -0
- data/node_modules/undici-types/file.d.ts +39 -0
- data/node_modules/undici-types/filereader.d.ts +54 -0
- data/node_modules/undici-types/formdata.d.ts +108 -0
- data/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- data/node_modules/undici-types/global-origin.d.ts +7 -0
- data/node_modules/undici-types/handlers.d.ts +15 -0
- data/node_modules/undici-types/header.d.ts +4 -0
- data/node_modules/undici-types/index.d.ts +71 -0
- data/node_modules/undici-types/interceptors.d.ts +15 -0
- data/node_modules/undici-types/mock-agent.d.ts +50 -0
- data/node_modules/undici-types/mock-client.d.ts +25 -0
- data/node_modules/undici-types/mock-errors.d.ts +12 -0
- data/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- data/node_modules/undici-types/mock-pool.d.ts +25 -0
- data/node_modules/undici-types/package.json +55 -0
- data/node_modules/undici-types/patch.d.ts +71 -0
- data/node_modules/undici-types/pool-stats.d.ts +19 -0
- data/node_modules/undici-types/pool.d.ts +39 -0
- data/node_modules/undici-types/proxy-agent.d.ts +28 -0
- data/node_modules/undici-types/readable.d.ts +60 -0
- data/node_modules/undici-types/retry-agent.d.ts +8 -0
- data/node_modules/undici-types/retry-handler.d.ts +116 -0
- data/node_modules/undici-types/util.d.ts +18 -0
- data/node_modules/undici-types/webidl.d.ts +222 -0
- data/node_modules/undici-types/websocket.d.ts +152 -0
- data/pokeedex.gemspec +32 -0
- data/spec/fixtures/pokemon_com/responses/GET-200-bulbasaur.html +2262 -0
- data/spec/fixtures/pokemon_com/responses/GET-404-not-found.html +808 -0
- data/spec/pokeedex/configuration_spec.rb +37 -0
- data/spec/pokeedex/database_spec.rb +21 -0
- data/spec/pokeedex/exceptions_spec.rb +11 -0
- data/spec/pokeedex/pokemon/base_spec.rb +15 -0
- data/spec/pokeedex/pokemon/decorators/base_spec.rb +63 -0
- data/spec/pokeedex/pokemon/model/base_spec.rb +36 -0
- data/spec/pokeedex/pokemon/scrapper/fetchers/base_spec.rb +36 -0
- data/spec/pokeedex/pokemon/scrapper/parsers/base_spec.rb +49 -0
- data/spec/pokeedex/pokemon/scrapper/pokedex_spec.rb +71 -0
- data/spec/pokeedex/pokemon/searcher/base.rb +81 -0
- data/spec/pokeedex_spec.rb +7 -0
- data/spec/spec_helper.rb +42 -0
- data/yarn.lock +41 -0
- metadata +731 -0
@@ -0,0 +1,279 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.FixtureRunner = void 0;
|
7
|
+
var _util = require("../util");
|
8
|
+
var _utils = require("playwright-core/lib/utils");
|
9
|
+
var _fixtures = require("../common/fixtures");
|
10
|
+
/**
|
11
|
+
* Copyright Microsoft Corporation. All rights reserved.
|
12
|
+
*
|
13
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
+
* you may not use this file except in compliance with the License.
|
15
|
+
* You may obtain a copy of the License at
|
16
|
+
*
|
17
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
+
*
|
19
|
+
* Unless required by applicable law or agreed to in writing, software
|
20
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
+
* See the License for the specific language governing permissions and
|
23
|
+
* limitations under the License.
|
24
|
+
*/
|
25
|
+
|
26
|
+
class Fixture {
|
27
|
+
constructor(runner, registration) {
|
28
|
+
this.runner = void 0;
|
29
|
+
this.registration = void 0;
|
30
|
+
this.value = void 0;
|
31
|
+
this.failed = false;
|
32
|
+
this._useFuncFinished = void 0;
|
33
|
+
this._selfTeardownComplete = void 0;
|
34
|
+
this._setupDescription = void 0;
|
35
|
+
this._teardownDescription = void 0;
|
36
|
+
this._stepInfo = void 0;
|
37
|
+
this._deps = new Set();
|
38
|
+
this._usages = new Set();
|
39
|
+
this.runner = runner;
|
40
|
+
this.registration = registration;
|
41
|
+
this.value = null;
|
42
|
+
const shouldGenerateStep = !this.registration.box && !this.registration.option;
|
43
|
+
const isUserFixture = this.registration.location && (0, _util.filterStackFile)(this.registration.location.file);
|
44
|
+
const title = this.registration.customTitle || this.registration.name;
|
45
|
+
const location = isUserFixture ? this.registration.location : undefined;
|
46
|
+
this._stepInfo = shouldGenerateStep ? {
|
47
|
+
category: 'fixture',
|
48
|
+
location
|
49
|
+
} : undefined;
|
50
|
+
this._setupDescription = {
|
51
|
+
title,
|
52
|
+
phase: 'setup',
|
53
|
+
location,
|
54
|
+
slot: this.registration.timeout === undefined ? undefined : {
|
55
|
+
timeout: this.registration.timeout,
|
56
|
+
elapsed: 0
|
57
|
+
}
|
58
|
+
};
|
59
|
+
this._teardownDescription = {
|
60
|
+
...this._setupDescription,
|
61
|
+
phase: 'teardown'
|
62
|
+
};
|
63
|
+
}
|
64
|
+
async setup(testInfo, runnable) {
|
65
|
+
this.runner.instanceForId.set(this.registration.id, this);
|
66
|
+
if (typeof this.registration.fn !== 'function') {
|
67
|
+
this.value = this.registration.fn;
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
await testInfo._runAsStage({
|
71
|
+
title: `fixture: ${this.registration.name}`,
|
72
|
+
runnable: {
|
73
|
+
...runnable,
|
74
|
+
fixture: this._setupDescription
|
75
|
+
},
|
76
|
+
stepInfo: this._stepInfo
|
77
|
+
}, async () => {
|
78
|
+
await this._setupInternal(testInfo);
|
79
|
+
});
|
80
|
+
}
|
81
|
+
async _setupInternal(testInfo) {
|
82
|
+
const params = {};
|
83
|
+
for (const name of this.registration.deps) {
|
84
|
+
const registration = this.runner.pool.resolve(name, this.registration);
|
85
|
+
const dep = this.runner.instanceForId.get(registration.id);
|
86
|
+
if (!dep) {
|
87
|
+
this.failed = true;
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
// Fixture teardown is root => leaves, when we need to teardown a fixture,
|
91
|
+
// it recursively tears down its usages first.
|
92
|
+
dep._usages.add(this);
|
93
|
+
// Don't forget to decrement all usages when fixture goes.
|
94
|
+
// Otherwise worker-scope fixtures will retain test-scope fixtures forever.
|
95
|
+
this._deps.add(dep);
|
96
|
+
params[name] = dep.value;
|
97
|
+
if (dep.failed) {
|
98
|
+
this.failed = true;
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
let called = false;
|
103
|
+
const useFuncStarted = new _utils.ManualPromise();
|
104
|
+
const useFunc = async value => {
|
105
|
+
if (called) throw new Error(`Cannot provide fixture value for the second time`);
|
106
|
+
called = true;
|
107
|
+
this.value = value;
|
108
|
+
this._useFuncFinished = new _utils.ManualPromise();
|
109
|
+
useFuncStarted.resolve();
|
110
|
+
await this._useFuncFinished;
|
111
|
+
};
|
112
|
+
const workerInfo = {
|
113
|
+
config: testInfo.config,
|
114
|
+
parallelIndex: testInfo.parallelIndex,
|
115
|
+
workerIndex: testInfo.workerIndex,
|
116
|
+
project: testInfo.project
|
117
|
+
};
|
118
|
+
const info = this.registration.scope === 'worker' ? workerInfo : testInfo;
|
119
|
+
this._selfTeardownComplete = (async () => {
|
120
|
+
try {
|
121
|
+
await this.registration.fn(params, useFunc, info);
|
122
|
+
} catch (error) {
|
123
|
+
this.failed = true;
|
124
|
+
if (!useFuncStarted.isDone()) useFuncStarted.reject(error);else throw error;
|
125
|
+
}
|
126
|
+
})();
|
127
|
+
await useFuncStarted;
|
128
|
+
}
|
129
|
+
async teardown(testInfo, runnable) {
|
130
|
+
try {
|
131
|
+
const fixtureRunnable = {
|
132
|
+
...runnable,
|
133
|
+
fixture: this._teardownDescription
|
134
|
+
};
|
135
|
+
// Do not even start the teardown for a fixture that does not have any
|
136
|
+
// time remaining in the time slot. This avoids cascading timeouts.
|
137
|
+
if (!testInfo._timeoutManager.isTimeExhaustedFor(fixtureRunnable)) {
|
138
|
+
await testInfo._runAsStage({
|
139
|
+
title: `fixture: ${this.registration.name}`,
|
140
|
+
runnable: fixtureRunnable,
|
141
|
+
stepInfo: this._stepInfo
|
142
|
+
}, async () => {
|
143
|
+
await this._teardownInternal();
|
144
|
+
});
|
145
|
+
}
|
146
|
+
} finally {
|
147
|
+
// To preserve fixtures integrity, forcefully cleanup fixtures
|
148
|
+
// that cannnot teardown due to a timeout or an error.
|
149
|
+
for (const dep of this._deps) dep._usages.delete(this);
|
150
|
+
this.runner.instanceForId.delete(this.registration.id);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
async _teardownInternal() {
|
154
|
+
if (typeof this.registration.fn !== 'function') return;
|
155
|
+
if (this._usages.size !== 0) {
|
156
|
+
// TODO: replace with assert.
|
157
|
+
console.error('Internal error: fixture integrity at', this._teardownDescription.title); // eslint-disable-line no-console
|
158
|
+
this._usages.clear();
|
159
|
+
}
|
160
|
+
if (this._useFuncFinished) {
|
161
|
+
this._useFuncFinished.resolve();
|
162
|
+
this._useFuncFinished = undefined;
|
163
|
+
await this._selfTeardownComplete;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
_collectFixturesInTeardownOrder(scope, collector) {
|
167
|
+
if (this.registration.scope !== scope) return;
|
168
|
+
for (const fixture of this._usages) fixture._collectFixturesInTeardownOrder(scope, collector);
|
169
|
+
collector.add(this);
|
170
|
+
}
|
171
|
+
}
|
172
|
+
class FixtureRunner {
|
173
|
+
constructor() {
|
174
|
+
this.testScopeClean = true;
|
175
|
+
this.pool = void 0;
|
176
|
+
this.instanceForId = new Map();
|
177
|
+
}
|
178
|
+
setPool(pool) {
|
179
|
+
if (!this.testScopeClean) throw new Error('Did not teardown test scope');
|
180
|
+
if (this.pool && pool.digest !== this.pool.digest) {
|
181
|
+
throw new Error([`Playwright detected inconsistent test.use() options.`, `Most common mistakes that lead to this issue:`, ` - Calling test.use() outside of the test file, for example in a common helper.`, ` - One test file imports from another test file.`].join('\n'));
|
182
|
+
}
|
183
|
+
this.pool = pool;
|
184
|
+
}
|
185
|
+
_collectFixturesInSetupOrder(registration, collector) {
|
186
|
+
if (collector.has(registration)) return;
|
187
|
+
for (const name of registration.deps) {
|
188
|
+
const dep = this.pool.resolve(name, registration);
|
189
|
+
this._collectFixturesInSetupOrder(dep, collector);
|
190
|
+
}
|
191
|
+
collector.add(registration);
|
192
|
+
}
|
193
|
+
async teardownScope(scope, testInfo, runnable) {
|
194
|
+
// Teardown fixtures in the reverse order.
|
195
|
+
const fixtures = Array.from(this.instanceForId.values()).reverse();
|
196
|
+
const collector = new Set();
|
197
|
+
for (const fixture of fixtures) fixture._collectFixturesInTeardownOrder(scope, collector);
|
198
|
+
let firstError;
|
199
|
+
for (const fixture of collector) {
|
200
|
+
try {
|
201
|
+
await fixture.teardown(testInfo, runnable);
|
202
|
+
} catch (error) {
|
203
|
+
var _firstError;
|
204
|
+
firstError = (_firstError = firstError) !== null && _firstError !== void 0 ? _firstError : error;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
if (scope === 'test') this.testScopeClean = true;
|
208
|
+
if (firstError) throw firstError;
|
209
|
+
}
|
210
|
+
async resolveParametersForFunction(fn, testInfo, autoFixtures, runnable) {
|
211
|
+
const collector = new Set();
|
212
|
+
|
213
|
+
// Collect automatic fixtures.
|
214
|
+
const auto = [];
|
215
|
+
for (const registration of this.pool.autoFixtures()) {
|
216
|
+
let shouldRun = true;
|
217
|
+
if (autoFixtures === 'all-hooks-only') shouldRun = registration.scope === 'worker' || registration.auto === 'all-hooks-included';else if (autoFixtures === 'worker') shouldRun = registration.scope === 'worker';
|
218
|
+
if (shouldRun) auto.push(registration);
|
219
|
+
}
|
220
|
+
auto.sort((r1, r2) => (r1.scope === 'worker' ? 0 : 1) - (r2.scope === 'worker' ? 0 : 1));
|
221
|
+
for (const registration of auto) this._collectFixturesInSetupOrder(registration, collector);
|
222
|
+
|
223
|
+
// Collect used fixtures.
|
224
|
+
const names = getRequiredFixtureNames(fn);
|
225
|
+
for (const name of names) this._collectFixturesInSetupOrder(this.pool.resolve(name), collector);
|
226
|
+
|
227
|
+
// Setup fixtures.
|
228
|
+
for (const registration of collector) await this._setupFixtureForRegistration(registration, testInfo, runnable);
|
229
|
+
|
230
|
+
// Create params object.
|
231
|
+
const params = {};
|
232
|
+
for (const name of names) {
|
233
|
+
const registration = this.pool.resolve(name);
|
234
|
+
const fixture = this.instanceForId.get(registration.id);
|
235
|
+
if (!fixture || fixture.failed) return null;
|
236
|
+
params[name] = fixture.value;
|
237
|
+
}
|
238
|
+
return params;
|
239
|
+
}
|
240
|
+
async resolveParametersAndRunFunction(fn, testInfo, autoFixtures, runnable) {
|
241
|
+
const params = await this.resolveParametersForFunction(fn, testInfo, autoFixtures, runnable);
|
242
|
+
if (params === null) {
|
243
|
+
// Do not run the function when fixture setup has already failed.
|
244
|
+
return null;
|
245
|
+
}
|
246
|
+
await testInfo._runAsStage({
|
247
|
+
title: 'run function',
|
248
|
+
runnable
|
249
|
+
}, async () => {
|
250
|
+
await fn(params, testInfo);
|
251
|
+
});
|
252
|
+
}
|
253
|
+
async _setupFixtureForRegistration(registration, testInfo, runnable) {
|
254
|
+
if (registration.scope === 'test') this.testScopeClean = false;
|
255
|
+
let fixture = this.instanceForId.get(registration.id);
|
256
|
+
if (fixture) return fixture;
|
257
|
+
fixture = new Fixture(this, registration);
|
258
|
+
await fixture.setup(testInfo, runnable);
|
259
|
+
return fixture;
|
260
|
+
}
|
261
|
+
dependsOnWorkerFixturesOnly(fn, location) {
|
262
|
+
const names = getRequiredFixtureNames(fn, location);
|
263
|
+
for (const name of names) {
|
264
|
+
const registration = this.pool.resolve(name);
|
265
|
+
if (registration.scope !== 'worker') return false;
|
266
|
+
}
|
267
|
+
return true;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
exports.FixtureRunner = FixtureRunner;
|
271
|
+
function getRequiredFixtureNames(fn, location) {
|
272
|
+
return (0, _fixtures.fixtureParameterNames)(fn, location !== null && location !== void 0 ? location : {
|
273
|
+
file: '<unknown>',
|
274
|
+
line: 1,
|
275
|
+
column: 1
|
276
|
+
}, e => {
|
277
|
+
throw new Error(`${(0, _util.formatLocation)(e.location)}: ${e.message}`);
|
278
|
+
});
|
279
|
+
}
|
@@ -0,0 +1,397 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.TestInfoImpl = exports.SkipError = void 0;
|
7
|
+
var _fs = _interopRequireDefault(require("fs"));
|
8
|
+
var _path = _interopRequireDefault(require("path"));
|
9
|
+
var _utils = require("playwright-core/lib/utils");
|
10
|
+
var _timeoutManager = require("./timeoutManager");
|
11
|
+
var _util = require("../util");
|
12
|
+
var _testTracing = require("./testTracing");
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
|
+
/**
|
15
|
+
* Copyright Microsoft Corporation. All rights reserved.
|
16
|
+
*
|
17
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
18
|
+
* you may not use this file except in compliance with the License.
|
19
|
+
* You may obtain a copy of the License at
|
20
|
+
*
|
21
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
22
|
+
*
|
23
|
+
* Unless required by applicable law or agreed to in writing, software
|
24
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
25
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
26
|
+
* See the License for the specific language governing permissions and
|
27
|
+
* limitations under the License.
|
28
|
+
*/
|
29
|
+
|
30
|
+
class TestInfoImpl {
|
31
|
+
get error() {
|
32
|
+
return this.errors[0];
|
33
|
+
}
|
34
|
+
set error(e) {
|
35
|
+
if (e === undefined) throw new Error('Cannot assign testInfo.error undefined value!');
|
36
|
+
this.errors[0] = e;
|
37
|
+
}
|
38
|
+
get timeout() {
|
39
|
+
return this._timeoutManager.defaultSlot().timeout;
|
40
|
+
}
|
41
|
+
set timeout(timeout) {
|
42
|
+
// Ignored.
|
43
|
+
}
|
44
|
+
_deadlineForMatcher(timeout) {
|
45
|
+
const startTime = (0, _utils.monotonicTime)();
|
46
|
+
const matcherDeadline = timeout ? startTime + timeout : _timeoutManager.kMaxDeadline;
|
47
|
+
const testDeadline = this._timeoutManager.currentSlotDeadline() - 250;
|
48
|
+
const matcherMessage = `Timeout ${timeout}ms exceeded while waiting on the predicate`;
|
49
|
+
const testMessage = `Test timeout of ${this.timeout}ms exceeded`;
|
50
|
+
return {
|
51
|
+
deadline: Math.min(testDeadline, matcherDeadline),
|
52
|
+
timeoutMessage: testDeadline < matcherDeadline ? testMessage : matcherMessage
|
53
|
+
};
|
54
|
+
}
|
55
|
+
static _defaultDeadlineForMatcher(timeout) {
|
56
|
+
return {
|
57
|
+
deadline: timeout ? (0, _utils.monotonicTime)() + timeout : 0,
|
58
|
+
timeoutMessage: `Timeout ${timeout}ms exceeded while waiting on the predicate`
|
59
|
+
};
|
60
|
+
}
|
61
|
+
constructor(configInternal, projectInternal, workerParams, test, retry, onStepBegin, onStepEnd, onAttach) {
|
62
|
+
var _test$id, _test$_requireFile, _test$title, _test$titlePath, _test$location$file, _test$location$line, _test$location$column, _test$tags, _test$fn, _test$expectedStatus;
|
63
|
+
this._onStepBegin = void 0;
|
64
|
+
this._onStepEnd = void 0;
|
65
|
+
this._onAttach = void 0;
|
66
|
+
this._timeoutManager = void 0;
|
67
|
+
this._startTime = void 0;
|
68
|
+
this._startWallTime = void 0;
|
69
|
+
this._tracing = void 0;
|
70
|
+
this._wasInterrupted = false;
|
71
|
+
this._lastStepId = 0;
|
72
|
+
this._requireFile = void 0;
|
73
|
+
this._projectInternal = void 0;
|
74
|
+
this._configInternal = void 0;
|
75
|
+
this._steps = [];
|
76
|
+
this._onDidFinishTestFunction = void 0;
|
77
|
+
this._hasNonRetriableError = false;
|
78
|
+
this._hasUnhandledError = false;
|
79
|
+
this._allowSkips = false;
|
80
|
+
// ------------ TestInfo fields ------------
|
81
|
+
this.testId = void 0;
|
82
|
+
this.repeatEachIndex = void 0;
|
83
|
+
this.retry = void 0;
|
84
|
+
this.workerIndex = void 0;
|
85
|
+
this.parallelIndex = void 0;
|
86
|
+
this.project = void 0;
|
87
|
+
this.config = void 0;
|
88
|
+
this.title = void 0;
|
89
|
+
this.titlePath = void 0;
|
90
|
+
this.file = void 0;
|
91
|
+
this.line = void 0;
|
92
|
+
this.tags = void 0;
|
93
|
+
this.column = void 0;
|
94
|
+
this.fn = void 0;
|
95
|
+
this.expectedStatus = void 0;
|
96
|
+
this.duration = 0;
|
97
|
+
this.annotations = [];
|
98
|
+
this.attachments = [];
|
99
|
+
this.status = 'passed';
|
100
|
+
this.snapshotSuffix = '';
|
101
|
+
this.outputDir = void 0;
|
102
|
+
this.snapshotDir = void 0;
|
103
|
+
this.errors = [];
|
104
|
+
this._attachmentsPush = void 0;
|
105
|
+
this.testId = (_test$id = test === null || test === void 0 ? void 0 : test.id) !== null && _test$id !== void 0 ? _test$id : '';
|
106
|
+
this._onStepBegin = onStepBegin;
|
107
|
+
this._onStepEnd = onStepEnd;
|
108
|
+
this._onAttach = onAttach;
|
109
|
+
this._startTime = (0, _utils.monotonicTime)();
|
110
|
+
this._startWallTime = Date.now();
|
111
|
+
this._requireFile = (_test$_requireFile = test === null || test === void 0 ? void 0 : test._requireFile) !== null && _test$_requireFile !== void 0 ? _test$_requireFile : '';
|
112
|
+
this.repeatEachIndex = workerParams.repeatEachIndex;
|
113
|
+
this.retry = retry;
|
114
|
+
this.workerIndex = workerParams.workerIndex;
|
115
|
+
this.parallelIndex = workerParams.parallelIndex;
|
116
|
+
this._projectInternal = projectInternal;
|
117
|
+
this.project = projectInternal.project;
|
118
|
+
this._configInternal = configInternal;
|
119
|
+
this.config = configInternal.config;
|
120
|
+
this.title = (_test$title = test === null || test === void 0 ? void 0 : test.title) !== null && _test$title !== void 0 ? _test$title : '';
|
121
|
+
this.titlePath = (_test$titlePath = test === null || test === void 0 ? void 0 : test.titlePath()) !== null && _test$titlePath !== void 0 ? _test$titlePath : [];
|
122
|
+
this.file = (_test$location$file = test === null || test === void 0 ? void 0 : test.location.file) !== null && _test$location$file !== void 0 ? _test$location$file : '';
|
123
|
+
this.line = (_test$location$line = test === null || test === void 0 ? void 0 : test.location.line) !== null && _test$location$line !== void 0 ? _test$location$line : 0;
|
124
|
+
this.column = (_test$location$column = test === null || test === void 0 ? void 0 : test.location.column) !== null && _test$location$column !== void 0 ? _test$location$column : 0;
|
125
|
+
this.tags = (_test$tags = test === null || test === void 0 ? void 0 : test.tags) !== null && _test$tags !== void 0 ? _test$tags : [];
|
126
|
+
this.fn = (_test$fn = test === null || test === void 0 ? void 0 : test.fn) !== null && _test$fn !== void 0 ? _test$fn : () => {};
|
127
|
+
this.expectedStatus = (_test$expectedStatus = test === null || test === void 0 ? void 0 : test.expectedStatus) !== null && _test$expectedStatus !== void 0 ? _test$expectedStatus : 'skipped';
|
128
|
+
this._timeoutManager = new _timeoutManager.TimeoutManager(this.project.timeout);
|
129
|
+
if (configInternal.configCLIOverrides.debug) this._setDebugMode();
|
130
|
+
this.outputDir = (() => {
|
131
|
+
const relativeTestFilePath = _path.default.relative(this.project.testDir, this._requireFile.replace(/\.(spec|test)\.(js|ts|jsx|tsx|mjs|mts|cjs|cts)$/, ''));
|
132
|
+
const sanitizedRelativePath = relativeTestFilePath.replace(process.platform === 'win32' ? new RegExp('\\\\', 'g') : new RegExp('/', 'g'), '-');
|
133
|
+
const fullTitleWithoutSpec = this.titlePath.slice(1).join(' ');
|
134
|
+
let testOutputDir = (0, _util.trimLongString)(sanitizedRelativePath + '-' + (0, _utils.sanitizeForFilePath)(fullTitleWithoutSpec), _util.windowsFilesystemFriendlyLength);
|
135
|
+
if (projectInternal.id) testOutputDir += '-' + (0, _utils.sanitizeForFilePath)(projectInternal.id);
|
136
|
+
if (this.retry) testOutputDir += '-retry' + this.retry;
|
137
|
+
if (this.repeatEachIndex) testOutputDir += '-repeat' + this.repeatEachIndex;
|
138
|
+
return _path.default.join(this.project.outputDir, testOutputDir);
|
139
|
+
})();
|
140
|
+
this.snapshotDir = (() => {
|
141
|
+
const relativeTestFilePath = _path.default.relative(this.project.testDir, this._requireFile);
|
142
|
+
return _path.default.join(this.project.snapshotDir, relativeTestFilePath + '-snapshots');
|
143
|
+
})();
|
144
|
+
this._attachmentsPush = this.attachments.push.bind(this.attachments);
|
145
|
+
this.attachments.push = (...attachments) => {
|
146
|
+
for (const a of attachments) this._attach(a.name, a);
|
147
|
+
return this.attachments.length;
|
148
|
+
};
|
149
|
+
this._tracing = new _testTracing.TestTracing(this, workerParams.artifactsDir);
|
150
|
+
}
|
151
|
+
_modifier(type, modifierArgs) {
|
152
|
+
if (typeof modifierArgs[1] === 'function') {
|
153
|
+
throw new Error(['It looks like you are calling test.skip() inside the test and pass a callback.', 'Pass a condition instead and optional description instead:', `test('my test', async ({ page, isMobile }) => {`, ` test.skip(isMobile, 'This test is not applicable on mobile');`, `});`].join('\n'));
|
154
|
+
}
|
155
|
+
if (modifierArgs.length >= 1 && !modifierArgs[0]) return;
|
156
|
+
const description = modifierArgs[1];
|
157
|
+
this.annotations.push({
|
158
|
+
type,
|
159
|
+
description
|
160
|
+
});
|
161
|
+
if (type === 'slow') {
|
162
|
+
this._timeoutManager.slow();
|
163
|
+
} else if (type === 'skip' || type === 'fixme') {
|
164
|
+
this.expectedStatus = 'skipped';
|
165
|
+
throw new SkipError('Test is skipped: ' + (description || ''));
|
166
|
+
} else if (type === 'fail') {
|
167
|
+
if (this.expectedStatus !== 'skipped') this.expectedStatus = 'failed';
|
168
|
+
}
|
169
|
+
}
|
170
|
+
_findLastStageStep(steps) {
|
171
|
+
// Find the deepest step that is marked as isStage and has not finished yet.
|
172
|
+
for (let i = steps.length - 1; i >= 0; i--) {
|
173
|
+
const child = this._findLastStageStep(steps[i].steps);
|
174
|
+
if (child) return child;
|
175
|
+
if (steps[i].isStage && !steps[i].endWallTime) return steps[i];
|
176
|
+
}
|
177
|
+
}
|
178
|
+
_addStep(data) {
|
179
|
+
var _parentStep, _parentStep2;
|
180
|
+
const stepId = `${data.category}@${++this._lastStepId}`;
|
181
|
+
let parentStep;
|
182
|
+
if (data.isStage) {
|
183
|
+
// Predefined stages form a fixed hierarchy - use the current one as parent.
|
184
|
+
parentStep = this._findLastStageStep(this._steps);
|
185
|
+
} else {
|
186
|
+
parentStep = _utils.zones.zoneData('stepZone');
|
187
|
+
if (!parentStep) {
|
188
|
+
// If no parent step on stack, assume the current stage as parent.
|
189
|
+
parentStep = this._findLastStageStep(this._steps);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
const filteredStack = (0, _util.filteredStackTrace)((0, _utils.captureRawStack)());
|
193
|
+
data.boxedStack = (_parentStep = parentStep) === null || _parentStep === void 0 ? void 0 : _parentStep.boxedStack;
|
194
|
+
if (!data.boxedStack && data.box) {
|
195
|
+
data.boxedStack = filteredStack.slice(1);
|
196
|
+
data.location = data.location || data.boxedStack[0];
|
197
|
+
}
|
198
|
+
data.location = data.location || filteredStack[0];
|
199
|
+
const step = {
|
200
|
+
stepId,
|
201
|
+
...data,
|
202
|
+
steps: [],
|
203
|
+
complete: result => {
|
204
|
+
if (step.endWallTime) return;
|
205
|
+
step.endWallTime = Date.now();
|
206
|
+
if (result.error) {
|
207
|
+
var _result$error;
|
208
|
+
if (typeof result.error === 'object' && !((_result$error = result.error) !== null && _result$error !== void 0 && _result$error[stepSymbol])) result.error[stepSymbol] = step;
|
209
|
+
const error = (0, _util.serializeError)(result.error);
|
210
|
+
if (data.boxedStack) error.stack = `${error.message}\n${(0, _utils.stringifyStackFrames)(data.boxedStack).join('\n')}`;
|
211
|
+
step.error = error;
|
212
|
+
}
|
213
|
+
if (!step.error) {
|
214
|
+
// Soft errors inside try/catch will make the test fail.
|
215
|
+
// In order to locate the failing step, we are marking all the parent
|
216
|
+
// steps as failing unconditionally.
|
217
|
+
for (const childStep of step.steps) {
|
218
|
+
if (childStep.error && childStep.infectParentStepsWithError) {
|
219
|
+
step.error = childStep.error;
|
220
|
+
step.infectParentStepsWithError = true;
|
221
|
+
break;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
}
|
225
|
+
const payload = {
|
226
|
+
testId: this.testId,
|
227
|
+
stepId,
|
228
|
+
wallTime: step.endWallTime,
|
229
|
+
error: step.error
|
230
|
+
};
|
231
|
+
this._onStepEnd(payload);
|
232
|
+
const errorForTrace = step.error ? {
|
233
|
+
name: '',
|
234
|
+
message: step.error.message || '',
|
235
|
+
stack: step.error.stack
|
236
|
+
} : undefined;
|
237
|
+
this._tracing.appendAfterActionForStep(stepId, errorForTrace, result.attachments);
|
238
|
+
}
|
239
|
+
};
|
240
|
+
const parentStepList = parentStep ? parentStep.steps : this._steps;
|
241
|
+
parentStepList.push(step);
|
242
|
+
const payload = {
|
243
|
+
testId: this.testId,
|
244
|
+
stepId,
|
245
|
+
parentStepId: parentStep ? parentStep.stepId : undefined,
|
246
|
+
title: data.title,
|
247
|
+
category: data.category,
|
248
|
+
wallTime: Date.now(),
|
249
|
+
location: data.location
|
250
|
+
};
|
251
|
+
this._onStepBegin(payload);
|
252
|
+
this._tracing.appendBeforeActionForStep(stepId, (_parentStep2 = parentStep) === null || _parentStep2 === void 0 ? void 0 : _parentStep2.stepId, data.apiName || data.title, data.params, data.location ? [data.location] : []);
|
253
|
+
return step;
|
254
|
+
}
|
255
|
+
_interrupt() {
|
256
|
+
// Mark as interrupted so we can ignore TimeoutError thrown by interrupt() call.
|
257
|
+
this._wasInterrupted = true;
|
258
|
+
this._timeoutManager.interrupt();
|
259
|
+
// Do not overwrite existing failure (for example, unhandled rejection) with "interrupted".
|
260
|
+
if (this.status === 'passed') this.status = 'interrupted';
|
261
|
+
}
|
262
|
+
_failWithError(error) {
|
263
|
+
if (this.status === 'passed' || this.status === 'skipped') this.status = error instanceof _timeoutManager.TimeoutManagerError ? 'timedOut' : 'failed';
|
264
|
+
const serialized = (0, _util.serializeError)(error);
|
265
|
+
const step = typeof error === 'object' ? error === null || error === void 0 ? void 0 : error[stepSymbol] : undefined;
|
266
|
+
if (step && step.boxedStack) serialized.stack = `${error.name}: ${error.message}\n${(0, _utils.stringifyStackFrames)(step.boxedStack).join('\n')}`;
|
267
|
+
this.errors.push(serialized);
|
268
|
+
this._tracing.appendForError(serialized);
|
269
|
+
}
|
270
|
+
async _runAsStage(stage, cb) {
|
271
|
+
if (_util.debugTest.enabled) {
|
272
|
+
var _stage$runnable;
|
273
|
+
const location = (_stage$runnable = stage.runnable) !== null && _stage$runnable !== void 0 && _stage$runnable.location ? ` at "${(0, _util.formatLocation)(stage.runnable.location)}"` : ``;
|
274
|
+
(0, _util.debugTest)(`started stage "${stage.title}"${location}`);
|
275
|
+
}
|
276
|
+
stage.step = stage.stepInfo ? this._addStep({
|
277
|
+
...stage.stepInfo,
|
278
|
+
title: stage.title,
|
279
|
+
isStage: true
|
280
|
+
}) : undefined;
|
281
|
+
try {
|
282
|
+
var _stage$step;
|
283
|
+
await this._timeoutManager.withRunnable(stage.runnable, async () => {
|
284
|
+
try {
|
285
|
+
await cb();
|
286
|
+
} catch (e) {
|
287
|
+
// Only handle errors directly thrown by the user code.
|
288
|
+
if (!stage.runnable) throw e;
|
289
|
+
if (this._allowSkips && e instanceof SkipError) {
|
290
|
+
if (this.status === 'passed') this.status = 'skipped';
|
291
|
+
} else {
|
292
|
+
// Unfortunately, we have to handle user errors and timeout errors differently.
|
293
|
+
// Consider the following scenario:
|
294
|
+
// - locator.click times out
|
295
|
+
// - all stages containing the test function finish with TimeoutManagerError
|
296
|
+
// - test finishes, the page is closed and this triggers locator.click error
|
297
|
+
// - we would like to present the locator.click error to the user
|
298
|
+
// - therefore, we need a try/catch inside the "run with timeout" block and capture the error
|
299
|
+
this._failWithError(e);
|
300
|
+
}
|
301
|
+
throw e;
|
302
|
+
}
|
303
|
+
});
|
304
|
+
(_stage$step = stage.step) === null || _stage$step === void 0 || _stage$step.complete({});
|
305
|
+
} catch (error) {
|
306
|
+
var _stage$step2;
|
307
|
+
// When interrupting, we arrive here with a TimeoutManagerError, but we should not
|
308
|
+
// consider it a timeout.
|
309
|
+
if (!this._wasInterrupted && error instanceof _timeoutManager.TimeoutManagerError && stage.runnable) this._failWithError(error);
|
310
|
+
(_stage$step2 = stage.step) === null || _stage$step2 === void 0 || _stage$step2.complete({
|
311
|
+
error
|
312
|
+
});
|
313
|
+
throw error;
|
314
|
+
} finally {
|
315
|
+
(0, _util.debugTest)(`finished stage "${stage.title}"`);
|
316
|
+
}
|
317
|
+
}
|
318
|
+
_isFailure() {
|
319
|
+
return this.status !== 'skipped' && this.status !== this.expectedStatus;
|
320
|
+
}
|
321
|
+
_currentHookType() {
|
322
|
+
const type = this._timeoutManager.currentSlotType();
|
323
|
+
return ['beforeAll', 'afterAll', 'beforeEach', 'afterEach'].includes(type) ? type : undefined;
|
324
|
+
}
|
325
|
+
_setDebugMode() {
|
326
|
+
this._timeoutManager.setIgnoreTimeouts();
|
327
|
+
}
|
328
|
+
|
329
|
+
// ------------ TestInfo methods ------------
|
330
|
+
|
331
|
+
async attach(name, options = {}) {
|
332
|
+
this._attach(name, await (0, _util.normalizeAndSaveAttachment)(this.outputPath(), name, options));
|
333
|
+
}
|
334
|
+
_attach(name, attachment) {
|
335
|
+
var _attachment$body;
|
336
|
+
const step = this._addStep({
|
337
|
+
title: `attach "${name}"`,
|
338
|
+
category: 'attach'
|
339
|
+
});
|
340
|
+
this._attachmentsPush(attachment);
|
341
|
+
this._onAttach({
|
342
|
+
testId: this.testId,
|
343
|
+
name: attachment.name,
|
344
|
+
contentType: attachment.contentType,
|
345
|
+
path: attachment.path,
|
346
|
+
body: (_attachment$body = attachment.body) === null || _attachment$body === void 0 ? void 0 : _attachment$body.toString('base64')
|
347
|
+
});
|
348
|
+
step.complete({
|
349
|
+
attachments: [attachment]
|
350
|
+
});
|
351
|
+
}
|
352
|
+
outputPath(...pathSegments) {
|
353
|
+
const outputPath = this._getOutputPath(...pathSegments);
|
354
|
+
_fs.default.mkdirSync(this.outputDir, {
|
355
|
+
recursive: true
|
356
|
+
});
|
357
|
+
return outputPath;
|
358
|
+
}
|
359
|
+
_getOutputPath(...pathSegments) {
|
360
|
+
const joinedPath = _path.default.join(...pathSegments);
|
361
|
+
const outputPath = (0, _util.getContainedPath)(this.outputDir, joinedPath);
|
362
|
+
if (outputPath) return outputPath;
|
363
|
+
throw new Error(`The outputPath is not allowed outside of the parent directory. Please fix the defined path.\n\n\toutputPath: ${joinedPath}`);
|
364
|
+
}
|
365
|
+
_fsSanitizedTestName() {
|
366
|
+
const fullTitleWithoutSpec = this.titlePath.slice(1).join(' ');
|
367
|
+
return (0, _utils.sanitizeForFilePath)((0, _util.trimLongString)(fullTitleWithoutSpec));
|
368
|
+
}
|
369
|
+
snapshotPath(...pathSegments) {
|
370
|
+
const subPath = _path.default.join(...pathSegments);
|
371
|
+
const parsedSubPath = _path.default.parse(subPath);
|
372
|
+
const relativeTestFilePath = _path.default.relative(this.project.testDir, this._requireFile);
|
373
|
+
const parsedRelativeTestFilePath = _path.default.parse(relativeTestFilePath);
|
374
|
+
const projectNamePathSegment = (0, _utils.sanitizeForFilePath)(this.project.name);
|
375
|
+
const snapshotPath = (this._projectInternal.snapshotPathTemplate || '').replace(/\{(.)?testDir\}/g, '$1' + this.project.testDir).replace(/\{(.)?snapshotDir\}/g, '$1' + this.project.snapshotDir).replace(/\{(.)?snapshotSuffix\}/g, this.snapshotSuffix ? '$1' + this.snapshotSuffix : '').replace(/\{(.)?testFileDir\}/g, '$1' + parsedRelativeTestFilePath.dir).replace(/\{(.)?platform\}/g, '$1' + process.platform).replace(/\{(.)?projectName\}/g, projectNamePathSegment ? '$1' + projectNamePathSegment : '').replace(/\{(.)?testName\}/g, '$1' + this._fsSanitizedTestName()).replace(/\{(.)?testFileName\}/g, '$1' + parsedRelativeTestFilePath.base).replace(/\{(.)?testFilePath\}/g, '$1' + relativeTestFilePath).replace(/\{(.)?arg\}/g, '$1' + _path.default.join(parsedSubPath.dir, parsedSubPath.name)).replace(/\{(.)?ext\}/g, parsedSubPath.ext ? '$1' + parsedSubPath.ext : '');
|
376
|
+
return _path.default.normalize(_path.default.resolve(this._configInternal.configDir, snapshotPath));
|
377
|
+
}
|
378
|
+
skip(...args) {
|
379
|
+
this._modifier('skip', args);
|
380
|
+
}
|
381
|
+
fixme(...args) {
|
382
|
+
this._modifier('fixme', args);
|
383
|
+
}
|
384
|
+
fail(...args) {
|
385
|
+
this._modifier('fail', args);
|
386
|
+
}
|
387
|
+
slow(...args) {
|
388
|
+
this._modifier('slow', args);
|
389
|
+
}
|
390
|
+
setTimeout(timeout) {
|
391
|
+
this._timeoutManager.setTimeout(timeout);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
exports.TestInfoImpl = TestInfoImpl;
|
395
|
+
class SkipError extends Error {}
|
396
|
+
exports.SkipError = SkipError;
|
397
|
+
const stepSymbol = Symbol('step');
|