easytouch-linux 1.0.7 → 1.0.18
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.
- package/LICENSE.txt +201 -0
- package/README.md +33 -314
- package/SKILL.md +366 -0
- package/bin/arm64/et +0 -0
- package/bin/et.js +60 -0
- package/bin/x64/et +0 -0
- package/package.json +19 -37
- package/.playwright/node/LICENSE +0 -2607
- package/.playwright/node/linux-x64/node +0 -0
- package/.playwright/package/README.md +0 -3
- package/.playwright/package/ThirdPartyNotices.txt +0 -1602
- package/.playwright/package/api.json +0 -1
- package/.playwright/package/bin/install_media_pack.ps1 +0 -5
- package/.playwright/package/bin/reinstall_chrome_beta_linux.sh +0 -42
- package/.playwright/package/bin/reinstall_chrome_beta_mac.sh +0 -13
- package/.playwright/package/bin/reinstall_chrome_beta_win.ps1 +0 -24
- package/.playwright/package/bin/reinstall_chrome_stable_linux.sh +0 -42
- package/.playwright/package/bin/reinstall_chrome_stable_mac.sh +0 -12
- package/.playwright/package/bin/reinstall_chrome_stable_win.ps1 +0 -24
- package/.playwright/package/bin/reinstall_msedge_beta_linux.sh +0 -48
- package/.playwright/package/bin/reinstall_msedge_beta_mac.sh +0 -11
- package/.playwright/package/bin/reinstall_msedge_beta_win.ps1 +0 -23
- package/.playwright/package/bin/reinstall_msedge_dev_linux.sh +0 -48
- package/.playwright/package/bin/reinstall_msedge_dev_mac.sh +0 -11
- package/.playwright/package/bin/reinstall_msedge_dev_win.ps1 +0 -23
- package/.playwright/package/bin/reinstall_msedge_stable_linux.sh +0 -48
- package/.playwright/package/bin/reinstall_msedge_stable_mac.sh +0 -11
- package/.playwright/package/bin/reinstall_msedge_stable_win.ps1 +0 -24
- package/.playwright/package/browsers.json +0 -66
- package/.playwright/package/cli.js +0 -18
- package/.playwright/package/index.d.ts +0 -17
- package/.playwright/package/index.js +0 -33
- package/.playwright/package/index.mjs +0 -28
- package/.playwright/package/lib/androidServerImpl.js +0 -69
- package/.playwright/package/lib/browserServerImpl.js +0 -92
- package/.playwright/package/lib/cli/driver.js +0 -95
- package/.playwright/package/lib/cli/program.js +0 -583
- package/.playwright/package/lib/cli/programWithTestStub.js +0 -67
- package/.playwright/package/lib/client/accessibility.js +0 -50
- package/.playwright/package/lib/client/android.js +0 -473
- package/.playwright/package/lib/client/api.js +0 -285
- package/.playwright/package/lib/client/artifact.js +0 -79
- package/.playwright/package/lib/client/browser.js +0 -145
- package/.playwright/package/lib/client/browserContext.js +0 -559
- package/.playwright/package/lib/client/browserType.js +0 -241
- package/.playwright/package/lib/client/cdpSession.js +0 -53
- package/.playwright/package/lib/client/channelOwner.js +0 -215
- package/.playwright/package/lib/client/clientHelper.js +0 -57
- package/.playwright/package/lib/client/clientInstrumentation.js +0 -52
- package/.playwright/package/lib/client/clock.js +0 -68
- package/.playwright/package/lib/client/connection.js +0 -333
- package/.playwright/package/lib/client/consoleMessage.js +0 -55
- package/.playwright/package/lib/client/coverage.js +0 -41
- package/.playwright/package/lib/client/dialog.js +0 -57
- package/.playwright/package/lib/client/download.js +0 -62
- package/.playwright/package/lib/client/electron.js +0 -135
- package/.playwright/package/lib/client/elementHandle.js +0 -321
- package/.playwright/package/lib/client/errors.js +0 -77
- package/.playwright/package/lib/client/eventEmitter.js +0 -314
- package/.playwright/package/lib/client/events.js +0 -94
- package/.playwright/package/lib/client/fetch.js +0 -391
- package/.playwright/package/lib/client/fileChooser.js +0 -45
- package/.playwright/package/lib/client/frame.js +0 -504
- package/.playwright/package/lib/client/harRouter.js +0 -99
- package/.playwright/package/lib/client/input.js +0 -111
- package/.playwright/package/lib/client/jsHandle.js +0 -121
- package/.playwright/package/lib/client/jsonPipe.js +0 -35
- package/.playwright/package/lib/client/localUtils.js +0 -36
- package/.playwright/package/lib/client/locator.js +0 -448
- package/.playwright/package/lib/client/network.js +0 -769
- package/.playwright/package/lib/client/page.js +0 -748
- package/.playwright/package/lib/client/playwright.js +0 -80
- package/.playwright/package/lib/client/selectors.js +0 -67
- package/.playwright/package/lib/client/stream.js +0 -54
- package/.playwright/package/lib/client/tracing.js +0 -147
- package/.playwright/package/lib/client/types.js +0 -24
- package/.playwright/package/lib/client/video.js +0 -51
- package/.playwright/package/lib/client/waiter.js +0 -162
- package/.playwright/package/lib/client/webError.js +0 -37
- package/.playwright/package/lib/client/worker.js +0 -71
- package/.playwright/package/lib/client/writableStream.js +0 -54
- package/.playwright/package/lib/common/socksProxy.js +0 -569
- package/.playwright/package/lib/common/timeoutSettings.js +0 -73
- package/.playwright/package/lib/common/types.js +0 -5
- package/.playwright/package/lib/generated/clockSource.js +0 -7
- package/.playwright/package/lib/generated/consoleApiSource.js +0 -7
- package/.playwright/package/lib/generated/injectedScriptSource.js +0 -7
- package/.playwright/package/lib/generated/pollingRecorderSource.js +0 -7
- package/.playwright/package/lib/generated/utilityScriptSource.js +0 -7
- package/.playwright/package/lib/generated/webSocketMockSource.js +0 -7
- package/.playwright/package/lib/image_tools/colorUtils.js +0 -98
- package/.playwright/package/lib/image_tools/compare.js +0 -108
- package/.playwright/package/lib/image_tools/imageChannel.js +0 -70
- package/.playwright/package/lib/image_tools/stats.js +0 -102
- package/.playwright/package/lib/inProcessFactory.js +0 -56
- package/.playwright/package/lib/inprocess.js +0 -20
- package/.playwright/package/lib/outofprocess.js +0 -67
- package/.playwright/package/lib/protocol/debug.js +0 -27
- package/.playwright/package/lib/protocol/serializers.js +0 -173
- package/.playwright/package/lib/protocol/transport.js +0 -82
- package/.playwright/package/lib/protocol/validator.js +0 -2780
- package/.playwright/package/lib/protocol/validatorPrimitives.js +0 -139
- package/.playwright/package/lib/remote/playwrightConnection.js +0 -275
- package/.playwright/package/lib/remote/playwrightServer.js +0 -111
- package/.playwright/package/lib/server/accessibility.js +0 -62
- package/.playwright/package/lib/server/android/android.js +0 -441
- package/.playwright/package/lib/server/android/backendAdb.js +0 -172
- package/.playwright/package/lib/server/artifact.js +0 -104
- package/.playwright/package/lib/server/bidi/bidiBrowser.js +0 -314
- package/.playwright/package/lib/server/bidi/bidiChromium.js +0 -124
- package/.playwright/package/lib/server/bidi/bidiConnection.js +0 -204
- package/.playwright/package/lib/server/bidi/bidiExecutionContext.js +0 -175
- package/.playwright/package/lib/server/bidi/bidiFirefox.js +0 -104
- package/.playwright/package/lib/server/bidi/bidiInput.js +0 -160
- package/.playwright/package/lib/server/bidi/bidiNetworkManager.js +0 -337
- package/.playwright/package/lib/server/bidi/bidiOverCdp.js +0 -103
- package/.playwright/package/lib/server/bidi/bidiPage.js +0 -518
- package/.playwright/package/lib/server/bidi/bidiPdf.js +0 -140
- package/.playwright/package/lib/server/bidi/third_party/bidiDeserializer.js +0 -93
- package/.playwright/package/lib/server/bidi/third_party/bidiKeyboard.js +0 -240
- package/.playwright/package/lib/server/bidi/third_party/bidiProtocol.js +0 -139
- package/.playwright/package/lib/server/bidi/third_party/bidiSerializer.js +0 -144
- package/.playwright/package/lib/server/bidi/third_party/firefoxPrefs.js +0 -221
- package/.playwright/package/lib/server/browser.js +0 -148
- package/.playwright/package/lib/server/browserContext.js +0 -675
- package/.playwright/package/lib/server/browserType.js +0 -338
- package/.playwright/package/lib/server/chromium/appIcon.png +0 -0
- package/.playwright/package/lib/server/chromium/chromium.js +0 -354
- package/.playwright/package/lib/server/chromium/chromiumSwitches.js +0 -46
- package/.playwright/package/lib/server/chromium/crAccessibility.js +0 -237
- package/.playwright/package/lib/server/chromium/crBrowser.js +0 -516
- package/.playwright/package/lib/server/chromium/crConnection.js +0 -228
- package/.playwright/package/lib/server/chromium/crCoverage.js +0 -246
- package/.playwright/package/lib/server/chromium/crDevTools.js +0 -104
- package/.playwright/package/lib/server/chromium/crDragDrop.js +0 -143
- package/.playwright/package/lib/server/chromium/crExecutionContext.js +0 -132
- package/.playwright/package/lib/server/chromium/crInput.js +0 -182
- package/.playwright/package/lib/server/chromium/crNetworkManager.js +0 -767
- package/.playwright/package/lib/server/chromium/crPage.js +0 -1122
- package/.playwright/package/lib/server/chromium/crPdf.js +0 -153
- package/.playwright/package/lib/server/chromium/crProtocolHelper.js +0 -133
- package/.playwright/package/lib/server/chromium/crServiceWorker.js +0 -112
- package/.playwright/package/lib/server/chromium/defaultFontFamilies.js +0 -145
- package/.playwright/package/lib/server/chromium/videoRecorder.js +0 -155
- package/.playwright/package/lib/server/clock.js +0 -125
- package/.playwright/package/lib/server/codegen/csharp.js +0 -304
- package/.playwright/package/lib/server/codegen/java.js +0 -243
- package/.playwright/package/lib/server/codegen/javascript.js +0 -253
- package/.playwright/package/lib/server/codegen/jsonl.js +0 -47
- package/.playwright/package/lib/server/codegen/language.js +0 -88
- package/.playwright/package/lib/server/codegen/languages.js +0 -30
- package/.playwright/package/lib/server/codegen/python.js +0 -262
- package/.playwright/package/lib/server/codegen/types.js +0 -5
- package/.playwright/package/lib/server/console.js +0 -57
- package/.playwright/package/lib/server/cookieStore.js +0 -185
- package/.playwright/package/lib/server/debugController.js +0 -212
- package/.playwright/package/lib/server/debugger.js +0 -132
- package/.playwright/package/lib/server/deviceDescriptors.js +0 -26
- package/.playwright/package/lib/server/deviceDescriptorsSource.json +0 -1669
- package/.playwright/package/lib/server/dialog.js +0 -71
- package/.playwright/package/lib/server/dispatchers/androidDispatcher.js +0 -204
- package/.playwright/package/lib/server/dispatchers/artifactDispatcher.js +0 -118
- package/.playwright/package/lib/server/dispatchers/browserContextDispatcher.js +0 -357
- package/.playwright/package/lib/server/dispatchers/browserDispatcher.js +0 -170
- package/.playwright/package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
- package/.playwright/package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -48
- package/.playwright/package/lib/server/dispatchers/debugControllerDispatcher.js +0 -105
- package/.playwright/package/lib/server/dispatchers/dialogDispatcher.js +0 -44
- package/.playwright/package/lib/server/dispatchers/dispatcher.js +0 -395
- package/.playwright/package/lib/server/dispatchers/electronDispatcher.js +0 -93
- package/.playwright/package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -228
- package/.playwright/package/lib/server/dispatchers/frameDispatcher.js +0 -294
- package/.playwright/package/lib/server/dispatchers/jsHandleDispatcher.js +0 -97
- package/.playwright/package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -59
- package/.playwright/package/lib/server/dispatchers/localUtilsDispatcher.js +0 -413
- package/.playwright/package/lib/server/dispatchers/networkDispatchers.js +0 -221
- package/.playwright/package/lib/server/dispatchers/pageDispatcher.js +0 -367
- package/.playwright/package/lib/server/dispatchers/playwrightDispatcher.js +0 -107
- package/.playwright/package/lib/server/dispatchers/selectorsDispatcher.js +0 -36
- package/.playwright/package/lib/server/dispatchers/streamDispatcher.js +0 -62
- package/.playwright/package/lib/server/dispatchers/tracingDispatcher.js +0 -64
- package/.playwright/package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -188
- package/.playwright/package/lib/server/dispatchers/writableStreamDispatcher.js +0 -58
- package/.playwright/package/lib/server/dom.js +0 -893
- package/.playwright/package/lib/server/download.js +0 -60
- package/.playwright/package/lib/server/electron/electron.js +0 -296
- package/.playwright/package/lib/server/electron/loader.js +0 -57
- package/.playwright/package/lib/server/errors.js +0 -68
- package/.playwright/package/lib/server/fetch.js +0 -663
- package/.playwright/package/lib/server/fileChooser.js +0 -42
- package/.playwright/package/lib/server/fileUploadUtils.js +0 -75
- package/.playwright/package/lib/server/firefox/ffAccessibility.js +0 -216
- package/.playwright/package/lib/server/firefox/ffBrowser.js +0 -462
- package/.playwright/package/lib/server/firefox/ffConnection.js +0 -168
- package/.playwright/package/lib/server/firefox/ffExecutionContext.js +0 -123
- package/.playwright/package/lib/server/firefox/ffInput.js +0 -161
- package/.playwright/package/lib/server/firefox/ffNetworkManager.js +0 -233
- package/.playwright/package/lib/server/firefox/ffPage.js +0 -544
- package/.playwright/package/lib/server/firefox/firefox.js +0 -99
- package/.playwright/package/lib/server/formData.js +0 -75
- package/.playwright/package/lib/server/frameSelectors.js +0 -171
- package/.playwright/package/lib/server/frames.js +0 -1663
- package/.playwright/package/lib/server/har/harRecorder.js +0 -139
- package/.playwright/package/lib/server/har/harTracer.js +0 -542
- package/.playwright/package/lib/server/helper.js +0 -103
- package/.playwright/package/lib/server/index.js +0 -108
- package/.playwright/package/lib/server/input.js +0 -309
- package/.playwright/package/lib/server/instrumentation.js +0 -70
- package/.playwright/package/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
- package/.playwright/package/lib/server/javascript.js +0 -293
- package/.playwright/package/lib/server/launchApp.js +0 -91
- package/.playwright/package/lib/server/macEditingCommands.js +0 -139
- package/.playwright/package/lib/server/network.js +0 -617
- package/.playwright/package/lib/server/page.js +0 -863
- package/.playwright/package/lib/server/pipeTransport.js +0 -85
- package/.playwright/package/lib/server/playwright.js +0 -88
- package/.playwright/package/lib/server/progress.js +0 -99
- package/.playwright/package/lib/server/protocolError.js +0 -49
- package/.playwright/package/lib/server/recorder/chat.js +0 -177
- package/.playwright/package/lib/server/recorder/contextRecorder.js +0 -290
- package/.playwright/package/lib/server/recorder/recorderApp.js +0 -187
- package/.playwright/package/lib/server/recorder/recorderCollection.js +0 -104
- package/.playwright/package/lib/server/recorder/recorderFrontend.js +0 -5
- package/.playwright/package/lib/server/recorder/recorderRunner.js +0 -159
- package/.playwright/package/lib/server/recorder/recorderUtils.js +0 -89
- package/.playwright/package/lib/server/recorder/throttledFile.js +0 -46
- package/.playwright/package/lib/server/recorder.js +0 -367
- package/.playwright/package/lib/server/registry/browserFetcher.js +0 -168
- package/.playwright/package/lib/server/registry/dependencies.js +0 -322
- package/.playwright/package/lib/server/registry/index.js +0 -1165
- package/.playwright/package/lib/server/registry/nativeDeps.js +0 -496
- package/.playwright/package/lib/server/registry/oopDownloadBrowserMain.js +0 -138
- package/.playwright/package/lib/server/screenshotter.js +0 -348
- package/.playwright/package/lib/server/selectors.js +0 -73
- package/.playwright/package/lib/server/socksClientCertificatesInterceptor.js +0 -340
- package/.playwright/package/lib/server/socksInterceptor.js +0 -100
- package/.playwright/package/lib/server/trace/recorder/snapshotter.js +0 -161
- package/.playwright/package/lib/server/trace/recorder/snapshotterInjected.js +0 -518
- package/.playwright/package/lib/server/trace/recorder/tracing.js +0 -596
- package/.playwright/package/lib/server/trace/test/inMemorySnapshotter.js +0 -93
- package/.playwright/package/lib/server/trace/viewer/traceViewer.js +0 -219
- package/.playwright/package/lib/server/transport.js +0 -192
- package/.playwright/package/lib/server/types.js +0 -24
- package/.playwright/package/lib/server/usKeyboardLayout.js +0 -555
- package/.playwright/package/lib/server/webkit/webkit.js +0 -87
- package/.playwright/package/lib/server/webkit/wkAccessibility.js +0 -194
- package/.playwright/package/lib/server/webkit/wkBrowser.js +0 -329
- package/.playwright/package/lib/server/webkit/wkConnection.js +0 -173
- package/.playwright/package/lib/server/webkit/wkExecutionContext.js +0 -131
- package/.playwright/package/lib/server/webkit/wkInput.js +0 -179
- package/.playwright/package/lib/server/webkit/wkInterceptableRequest.js +0 -162
- package/.playwright/package/lib/server/webkit/wkPage.js +0 -1207
- package/.playwright/package/lib/server/webkit/wkProvisionalPage.js +0 -94
- package/.playwright/package/lib/server/webkit/wkWorkers.js +0 -104
- package/.playwright/package/lib/third_party/pixelmatch.js +0 -255
- package/.playwright/package/lib/utils/ascii.js +0 -31
- package/.playwright/package/lib/utils/comparators.js +0 -159
- package/.playwright/package/lib/utils/crypto.js +0 -171
- package/.playwright/package/lib/utils/debug.js +0 -46
- package/.playwright/package/lib/utils/debugLogger.js +0 -93
- package/.playwright/package/lib/utils/env.js +0 -49
- package/.playwright/package/lib/utils/eventsHelper.js +0 -38
- package/.playwright/package/lib/utils/expectUtils.js +0 -33
- package/.playwright/package/lib/utils/fileUtils.js +0 -205
- package/.playwright/package/lib/utils/happy-eyeballs.js +0 -194
- package/.playwright/package/lib/utils/headers.js +0 -52
- package/.playwright/package/lib/utils/hostPlatform.js +0 -145
- package/.playwright/package/lib/utils/httpServer.js +0 -233
- package/.playwright/package/lib/utils/index.js +0 -368
- package/.playwright/package/lib/utils/isomorphic/ariaSnapshot.js +0 -391
- package/.playwright/package/lib/utils/isomorphic/cssParser.js +0 -250
- package/.playwright/package/lib/utils/isomorphic/cssTokenizer.js +0 -979
- package/.playwright/package/lib/utils/isomorphic/locatorGenerators.js +0 -660
- package/.playwright/package/lib/utils/isomorphic/locatorParser.js +0 -185
- package/.playwright/package/lib/utils/isomorphic/locatorUtils.js +0 -62
- package/.playwright/package/lib/utils/isomorphic/mimeType.js +0 -29
- package/.playwright/package/lib/utils/isomorphic/selectorParser.js +0 -397
- package/.playwright/package/lib/utils/isomorphic/stringUtils.js +0 -169
- package/.playwright/package/lib/utils/isomorphic/traceUtils.js +0 -39
- package/.playwright/package/lib/utils/isomorphic/urlMatch.js +0 -122
- package/.playwright/package/lib/utils/linuxUtils.js +0 -78
- package/.playwright/package/lib/utils/manualPromise.js +0 -109
- package/.playwright/package/lib/utils/multimap.js +0 -75
- package/.playwright/package/lib/utils/network.js +0 -160
- package/.playwright/package/lib/utils/processLauncher.js +0 -248
- package/.playwright/package/lib/utils/profiler.js +0 -53
- package/.playwright/package/lib/utils/rtti.js +0 -44
- package/.playwright/package/lib/utils/semaphore.js +0 -51
- package/.playwright/package/lib/utils/sequence.js +0 -64
- package/.playwright/package/lib/utils/spawnAsync.js +0 -45
- package/.playwright/package/lib/utils/stackTrace.js +0 -134
- package/.playwright/package/lib/utils/task.js +0 -58
- package/.playwright/package/lib/utils/time.js +0 -37
- package/.playwright/package/lib/utils/timeoutRunner.js +0 -66
- package/.playwright/package/lib/utils/traceUtils.js +0 -44
- package/.playwright/package/lib/utils/userAgent.js +0 -105
- package/.playwright/package/lib/utils/wsServer.js +0 -128
- package/.playwright/package/lib/utils/zipFile.js +0 -75
- package/.playwright/package/lib/utils/zones.js +0 -69
- package/.playwright/package/lib/utilsBundle.js +0 -81
- package/.playwright/package/lib/utilsBundleImpl/index.js +0 -210
- package/.playwright/package/lib/utilsBundleImpl/xdg-open +0 -1066
- package/.playwright/package/lib/vite/htmlReport/index.html +0 -69
- package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
- package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-k-61wZCK.js +0 -24
- package/.playwright/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/.playwright/package/lib/vite/recorder/assets/index-B70BEW3b.js +0 -184
- package/.playwright/package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
- package/.playwright/package/lib/vite/recorder/index.html +0 -29
- package/.playwright/package/lib/vite/recorder/playwright-logo.svg +0 -9
- package/.playwright/package/lib/vite/traceViewer/assets/codeMirrorModule-CyuxU5C-.js +0 -24
- package/.playwright/package/lib/vite/traceViewer/assets/defaultSettingsView-5nVJRt0A.js +0 -243
- package/.playwright/package/lib/vite/traceViewer/assets/xtermModule-c-SNdYZy.js +0 -9
- package/.playwright/package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/.playwright/package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/index.html +0 -43
- package/.playwright/package/lib/vite/traceViewer/index.qVn2ZnpC.js +0 -2
- package/.playwright/package/lib/vite/traceViewer/playwright-logo.svg +0 -9
- package/.playwright/package/lib/vite/traceViewer/snapshot.html +0 -21
- package/.playwright/package/lib/vite/traceViewer/sw.bundle.js +0 -3
- package/.playwright/package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
- package/.playwright/package/lib/vite/traceViewer/uiMode.html +0 -17
- package/.playwright/package/lib/vite/traceViewer/uiMode.m4IPRPOd.js +0 -5
- package/.playwright/package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
- package/.playwright/package/lib/zipBundle.js +0 -25
- package/.playwright/package/lib/zipBundleImpl.js +0 -5
- package/.playwright/package/package.json +0 -44
- package/.playwright/package/protocol.yml +0 -3758
- package/.playwright/package/types/protocol.d.ts +0 -21868
- package/.playwright/package/types/structs.d.ts +0 -45
- package/.playwright/package/types/types.d.ts +0 -22663
- package/et +0 -0
- package/install.js +0 -19
- package/playwright.ps1 +0 -7
- package/scripts/playwright-bridge.js +0 -560
|
@@ -1,660 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PythonLocatorFactory = exports.JsonlLocatorFactory = exports.JavaScriptLocatorFactory = exports.JavaLocatorFactory = exports.CSharpLocatorFactory = void 0;
|
|
7
|
-
exports.asLocator = asLocator;
|
|
8
|
-
exports.asLocators = asLocators;
|
|
9
|
-
var _stringUtils = require("./stringUtils");
|
|
10
|
-
var _selectorParser = require("./selectorParser");
|
|
11
|
-
/**
|
|
12
|
-
* Copyright (c) Microsoft Corporation.
|
|
13
|
-
*
|
|
14
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* you may not use this file except in compliance with the License.
|
|
16
|
-
* You may obtain a copy of the License at
|
|
17
|
-
*
|
|
18
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
* See the License for the specific language governing permissions and
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
function asLocator(lang, selector, isFrameLocator = false) {
|
|
28
|
-
return asLocators(lang, selector, isFrameLocator, 1)[0];
|
|
29
|
-
}
|
|
30
|
-
function asLocators(lang, selector, isFrameLocator = false, maxOutputSize = 20, preferredQuote) {
|
|
31
|
-
try {
|
|
32
|
-
return innerAsLocators(new generators[lang](preferredQuote), (0, _selectorParser.parseSelector)(selector), isFrameLocator, maxOutputSize);
|
|
33
|
-
} catch (e) {
|
|
34
|
-
// Tolerate invalid input.
|
|
35
|
-
return [selector];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function innerAsLocators(factory, parsed, isFrameLocator = false, maxOutputSize = 20) {
|
|
39
|
-
const parts = [...parsed.parts];
|
|
40
|
-
const tokens = [];
|
|
41
|
-
let nextBase = isFrameLocator ? 'frame-locator' : 'page';
|
|
42
|
-
for (let index = 0; index < parts.length; index++) {
|
|
43
|
-
const part = parts[index];
|
|
44
|
-
const base = nextBase;
|
|
45
|
-
nextBase = 'locator';
|
|
46
|
-
if (part.name === 'nth') {
|
|
47
|
-
if (part.body === '0') tokens.push([factory.generateLocator(base, 'first', ''), factory.generateLocator(base, 'nth', '0')]);else if (part.body === '-1') tokens.push([factory.generateLocator(base, 'last', ''), factory.generateLocator(base, 'nth', '-1')]);else tokens.push([factory.generateLocator(base, 'nth', part.body)]);
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (part.name === 'internal:text') {
|
|
51
|
-
const {
|
|
52
|
-
exact,
|
|
53
|
-
text
|
|
54
|
-
} = detectExact(part.body);
|
|
55
|
-
tokens.push([factory.generateLocator(base, 'text', text, {
|
|
56
|
-
exact
|
|
57
|
-
})]);
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (part.name === 'internal:has-text') {
|
|
61
|
-
const {
|
|
62
|
-
exact,
|
|
63
|
-
text
|
|
64
|
-
} = detectExact(part.body);
|
|
65
|
-
// There is no locator equivalent for strict has-text, leave it as is.
|
|
66
|
-
if (!exact) {
|
|
67
|
-
tokens.push([factory.generateLocator(base, 'has-text', text, {
|
|
68
|
-
exact
|
|
69
|
-
})]);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (part.name === 'internal:has-not-text') {
|
|
74
|
-
const {
|
|
75
|
-
exact,
|
|
76
|
-
text
|
|
77
|
-
} = detectExact(part.body);
|
|
78
|
-
// There is no locator equivalent for strict has-not-text, leave it as is.
|
|
79
|
-
if (!exact) {
|
|
80
|
-
tokens.push([factory.generateLocator(base, 'has-not-text', text, {
|
|
81
|
-
exact
|
|
82
|
-
})]);
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
if (part.name === 'internal:has') {
|
|
87
|
-
const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
|
|
88
|
-
tokens.push(inners.map(inner => factory.generateLocator(base, 'has', inner)));
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
if (part.name === 'internal:has-not') {
|
|
92
|
-
const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
|
|
93
|
-
tokens.push(inners.map(inner => factory.generateLocator(base, 'hasNot', inner)));
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (part.name === 'internal:and') {
|
|
97
|
-
const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
|
|
98
|
-
tokens.push(inners.map(inner => factory.generateLocator(base, 'and', inner)));
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (part.name === 'internal:or') {
|
|
102
|
-
const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
|
|
103
|
-
tokens.push(inners.map(inner => factory.generateLocator(base, 'or', inner)));
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
if (part.name === 'internal:chain') {
|
|
107
|
-
const inners = innerAsLocators(factory, part.body.parsed, false, maxOutputSize);
|
|
108
|
-
tokens.push(inners.map(inner => factory.generateLocator(base, 'chain', inner)));
|
|
109
|
-
continue;
|
|
110
|
-
}
|
|
111
|
-
if (part.name === 'internal:label') {
|
|
112
|
-
const {
|
|
113
|
-
exact,
|
|
114
|
-
text
|
|
115
|
-
} = detectExact(part.body);
|
|
116
|
-
tokens.push([factory.generateLocator(base, 'label', text, {
|
|
117
|
-
exact
|
|
118
|
-
})]);
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
if (part.name === 'internal:role') {
|
|
122
|
-
const attrSelector = (0, _selectorParser.parseAttributeSelector)(part.body, true);
|
|
123
|
-
const options = {
|
|
124
|
-
attrs: []
|
|
125
|
-
};
|
|
126
|
-
for (const attr of attrSelector.attributes) {
|
|
127
|
-
if (attr.name === 'name') {
|
|
128
|
-
options.exact = attr.caseSensitive;
|
|
129
|
-
options.name = attr.value;
|
|
130
|
-
} else {
|
|
131
|
-
if (attr.name === 'level' && typeof attr.value === 'string') attr.value = +attr.value;
|
|
132
|
-
options.attrs.push({
|
|
133
|
-
name: attr.name === 'include-hidden' ? 'includeHidden' : attr.name,
|
|
134
|
-
value: attr.value
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
tokens.push([factory.generateLocator(base, 'role', attrSelector.name, options)]);
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (part.name === 'internal:testid') {
|
|
142
|
-
const attrSelector = (0, _selectorParser.parseAttributeSelector)(part.body, true);
|
|
143
|
-
const {
|
|
144
|
-
value
|
|
145
|
-
} = attrSelector.attributes[0];
|
|
146
|
-
tokens.push([factory.generateLocator(base, 'test-id', value)]);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (part.name === 'internal:attr') {
|
|
150
|
-
const attrSelector = (0, _selectorParser.parseAttributeSelector)(part.body, true);
|
|
151
|
-
const {
|
|
152
|
-
name,
|
|
153
|
-
value,
|
|
154
|
-
caseSensitive
|
|
155
|
-
} = attrSelector.attributes[0];
|
|
156
|
-
const text = value;
|
|
157
|
-
const exact = !!caseSensitive;
|
|
158
|
-
if (name === 'placeholder') {
|
|
159
|
-
tokens.push([factory.generateLocator(base, 'placeholder', text, {
|
|
160
|
-
exact
|
|
161
|
-
})]);
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
if (name === 'alt') {
|
|
165
|
-
tokens.push([factory.generateLocator(base, 'alt', text, {
|
|
166
|
-
exact
|
|
167
|
-
})]);
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
if (name === 'title') {
|
|
171
|
-
tokens.push([factory.generateLocator(base, 'title', text, {
|
|
172
|
-
exact
|
|
173
|
-
})]);
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
if (part.name === 'internal:control' && part.body === 'enter-frame') {
|
|
178
|
-
// transform last tokens from `${selector}` into `${selector}.contentFrame()` and `frameLocator(${selector})`
|
|
179
|
-
const lastTokens = tokens[tokens.length - 1];
|
|
180
|
-
const lastPart = parts[index - 1];
|
|
181
|
-
const transformed = lastTokens.map(token => factory.chainLocators([token, factory.generateLocator(base, 'frame', '')]));
|
|
182
|
-
if (['xpath', 'css'].includes(lastPart.name)) {
|
|
183
|
-
transformed.push(factory.generateLocator(base, 'frame-locator', (0, _selectorParser.stringifySelector)({
|
|
184
|
-
parts: [lastPart]
|
|
185
|
-
})), factory.generateLocator(base, 'frame-locator', (0, _selectorParser.stringifySelector)({
|
|
186
|
-
parts: [lastPart]
|
|
187
|
-
}, true)));
|
|
188
|
-
}
|
|
189
|
-
lastTokens.splice(0, lastTokens.length, ...transformed);
|
|
190
|
-
nextBase = 'frame-locator';
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
const nextPart = parts[index + 1];
|
|
194
|
-
const selectorPart = (0, _selectorParser.stringifySelector)({
|
|
195
|
-
parts: [part]
|
|
196
|
-
});
|
|
197
|
-
const locatorPart = factory.generateLocator(base, 'default', selectorPart);
|
|
198
|
-
if (nextPart && ['internal:has-text', 'internal:has-not-text'].includes(nextPart.name)) {
|
|
199
|
-
const {
|
|
200
|
-
exact,
|
|
201
|
-
text
|
|
202
|
-
} = detectExact(nextPart.body);
|
|
203
|
-
// There is no locator equivalent for strict has-text and has-not-text, leave it as is.
|
|
204
|
-
if (!exact) {
|
|
205
|
-
const nextLocatorPart = factory.generateLocator('locator', nextPart.name === 'internal:has-text' ? 'has-text' : 'has-not-text', text, {
|
|
206
|
-
exact
|
|
207
|
-
});
|
|
208
|
-
const options = {};
|
|
209
|
-
if (nextPart.name === 'internal:has-text') options.hasText = text;else options.hasNotText = text;
|
|
210
|
-
const combinedPart = factory.generateLocator(base, 'default', selectorPart, options);
|
|
211
|
-
// Two options:
|
|
212
|
-
// - locator('div').filter({ hasText: 'foo' })
|
|
213
|
-
// - locator('div', { hasText: 'foo' })
|
|
214
|
-
tokens.push([factory.chainLocators([locatorPart, nextLocatorPart]), combinedPart]);
|
|
215
|
-
index++;
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// Selectors can be prefixed with engine name, e.g. xpath=//foo
|
|
221
|
-
let locatorPartWithEngine;
|
|
222
|
-
if (['xpath', 'css'].includes(part.name)) {
|
|
223
|
-
const selectorPart = (0, _selectorParser.stringifySelector)({
|
|
224
|
-
parts: [part]
|
|
225
|
-
}, /* forceEngineName */true);
|
|
226
|
-
locatorPartWithEngine = factory.generateLocator(base, 'default', selectorPart);
|
|
227
|
-
}
|
|
228
|
-
tokens.push([locatorPart, locatorPartWithEngine].filter(Boolean));
|
|
229
|
-
}
|
|
230
|
-
return combineTokens(factory, tokens, maxOutputSize);
|
|
231
|
-
}
|
|
232
|
-
function combineTokens(factory, tokens, maxOutputSize) {
|
|
233
|
-
const currentTokens = tokens.map(() => '');
|
|
234
|
-
const result = [];
|
|
235
|
-
const visit = index => {
|
|
236
|
-
if (index === tokens.length) {
|
|
237
|
-
result.push(factory.chainLocators(currentTokens));
|
|
238
|
-
return result.length < maxOutputSize;
|
|
239
|
-
}
|
|
240
|
-
for (const taken of tokens[index]) {
|
|
241
|
-
currentTokens[index] = taken;
|
|
242
|
-
if (!visit(index + 1)) return false;
|
|
243
|
-
}
|
|
244
|
-
return true;
|
|
245
|
-
};
|
|
246
|
-
visit(0);
|
|
247
|
-
return result;
|
|
248
|
-
}
|
|
249
|
-
function detectExact(text) {
|
|
250
|
-
let exact = false;
|
|
251
|
-
const match = text.match(/^\/(.*)\/([igm]*)$/);
|
|
252
|
-
if (match) return {
|
|
253
|
-
text: new RegExp(match[1], match[2])
|
|
254
|
-
};
|
|
255
|
-
if (text.endsWith('"')) {
|
|
256
|
-
text = JSON.parse(text);
|
|
257
|
-
exact = true;
|
|
258
|
-
} else if (text.endsWith('"s')) {
|
|
259
|
-
text = JSON.parse(text.substring(0, text.length - 1));
|
|
260
|
-
exact = true;
|
|
261
|
-
} else if (text.endsWith('"i')) {
|
|
262
|
-
text = JSON.parse(text.substring(0, text.length - 1));
|
|
263
|
-
exact = false;
|
|
264
|
-
}
|
|
265
|
-
return {
|
|
266
|
-
exact,
|
|
267
|
-
text
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
class JavaScriptLocatorFactory {
|
|
271
|
-
constructor(preferredQuote) {
|
|
272
|
-
this.preferredQuote = preferredQuote;
|
|
273
|
-
}
|
|
274
|
-
generateLocator(base, kind, body, options = {}) {
|
|
275
|
-
switch (kind) {
|
|
276
|
-
case 'default':
|
|
277
|
-
if (options.hasText !== undefined) return `locator(${this.quote(body)}, { hasText: ${this.toHasText(options.hasText)} })`;
|
|
278
|
-
if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, { hasNotText: ${this.toHasText(options.hasNotText)} })`;
|
|
279
|
-
return `locator(${this.quote(body)})`;
|
|
280
|
-
case 'frame-locator':
|
|
281
|
-
return `frameLocator(${this.quote(body)})`;
|
|
282
|
-
case 'frame':
|
|
283
|
-
return `contentFrame()`;
|
|
284
|
-
case 'nth':
|
|
285
|
-
return `nth(${body})`;
|
|
286
|
-
case 'first':
|
|
287
|
-
return `first()`;
|
|
288
|
-
case 'last':
|
|
289
|
-
return `last()`;
|
|
290
|
-
case 'role':
|
|
291
|
-
const attrs = [];
|
|
292
|
-
if (isRegExp(options.name)) {
|
|
293
|
-
attrs.push(`name: ${this.regexToSourceString(options.name)}`);
|
|
294
|
-
} else if (typeof options.name === 'string') {
|
|
295
|
-
attrs.push(`name: ${this.quote(options.name)}`);
|
|
296
|
-
if (options.exact) attrs.push(`exact: true`);
|
|
297
|
-
}
|
|
298
|
-
for (const {
|
|
299
|
-
name,
|
|
300
|
-
value
|
|
301
|
-
} of options.attrs) attrs.push(`${name}: ${typeof value === 'string' ? this.quote(value) : value}`);
|
|
302
|
-
const attrString = attrs.length ? `, { ${attrs.join(', ')} }` : '';
|
|
303
|
-
return `getByRole(${this.quote(body)}${attrString})`;
|
|
304
|
-
case 'has-text':
|
|
305
|
-
return `filter({ hasText: ${this.toHasText(body)} })`;
|
|
306
|
-
case 'has-not-text':
|
|
307
|
-
return `filter({ hasNotText: ${this.toHasText(body)} })`;
|
|
308
|
-
case 'has':
|
|
309
|
-
return `filter({ has: ${body} })`;
|
|
310
|
-
case 'hasNot':
|
|
311
|
-
return `filter({ hasNot: ${body} })`;
|
|
312
|
-
case 'and':
|
|
313
|
-
return `and(${body})`;
|
|
314
|
-
case 'or':
|
|
315
|
-
return `or(${body})`;
|
|
316
|
-
case 'chain':
|
|
317
|
-
return `locator(${body})`;
|
|
318
|
-
case 'test-id':
|
|
319
|
-
return `getByTestId(${this.toTestIdValue(body)})`;
|
|
320
|
-
case 'text':
|
|
321
|
-
return this.toCallWithExact('getByText', body, !!options.exact);
|
|
322
|
-
case 'alt':
|
|
323
|
-
return this.toCallWithExact('getByAltText', body, !!options.exact);
|
|
324
|
-
case 'placeholder':
|
|
325
|
-
return this.toCallWithExact('getByPlaceholder', body, !!options.exact);
|
|
326
|
-
case 'label':
|
|
327
|
-
return this.toCallWithExact('getByLabel', body, !!options.exact);
|
|
328
|
-
case 'title':
|
|
329
|
-
return this.toCallWithExact('getByTitle', body, !!options.exact);
|
|
330
|
-
default:
|
|
331
|
-
throw new Error('Unknown selector kind ' + kind);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
chainLocators(locators) {
|
|
335
|
-
return locators.join('.');
|
|
336
|
-
}
|
|
337
|
-
regexToSourceString(re) {
|
|
338
|
-
return (0, _stringUtils.normalizeEscapedRegexQuotes)(String(re));
|
|
339
|
-
}
|
|
340
|
-
toCallWithExact(method, body, exact) {
|
|
341
|
-
if (isRegExp(body)) return `${method}(${this.regexToSourceString(body)})`;
|
|
342
|
-
return exact ? `${method}(${this.quote(body)}, { exact: true })` : `${method}(${this.quote(body)})`;
|
|
343
|
-
}
|
|
344
|
-
toHasText(body) {
|
|
345
|
-
if (isRegExp(body)) return this.regexToSourceString(body);
|
|
346
|
-
return this.quote(body);
|
|
347
|
-
}
|
|
348
|
-
toTestIdValue(value) {
|
|
349
|
-
if (isRegExp(value)) return this.regexToSourceString(value);
|
|
350
|
-
return this.quote(value);
|
|
351
|
-
}
|
|
352
|
-
quote(text) {
|
|
353
|
-
var _this$preferredQuote;
|
|
354
|
-
return (0, _stringUtils.escapeWithQuotes)(text, (_this$preferredQuote = this.preferredQuote) !== null && _this$preferredQuote !== void 0 ? _this$preferredQuote : '\'');
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
exports.JavaScriptLocatorFactory = JavaScriptLocatorFactory;
|
|
358
|
-
class PythonLocatorFactory {
|
|
359
|
-
generateLocator(base, kind, body, options = {}) {
|
|
360
|
-
switch (kind) {
|
|
361
|
-
case 'default':
|
|
362
|
-
if (options.hasText !== undefined) return `locator(${this.quote(body)}, has_text=${this.toHasText(options.hasText)})`;
|
|
363
|
-
if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, has_not_text=${this.toHasText(options.hasNotText)})`;
|
|
364
|
-
return `locator(${this.quote(body)})`;
|
|
365
|
-
case 'frame-locator':
|
|
366
|
-
return `frame_locator(${this.quote(body)})`;
|
|
367
|
-
case 'frame':
|
|
368
|
-
return `content_frame`;
|
|
369
|
-
case 'nth':
|
|
370
|
-
return `nth(${body})`;
|
|
371
|
-
case 'first':
|
|
372
|
-
return `first`;
|
|
373
|
-
case 'last':
|
|
374
|
-
return `last`;
|
|
375
|
-
case 'role':
|
|
376
|
-
const attrs = [];
|
|
377
|
-
if (isRegExp(options.name)) {
|
|
378
|
-
attrs.push(`name=${this.regexToString(options.name)}`);
|
|
379
|
-
} else if (typeof options.name === 'string') {
|
|
380
|
-
attrs.push(`name=${this.quote(options.name)}`);
|
|
381
|
-
if (options.exact) attrs.push(`exact=True`);
|
|
382
|
-
}
|
|
383
|
-
for (const {
|
|
384
|
-
name,
|
|
385
|
-
value
|
|
386
|
-
} of options.attrs) {
|
|
387
|
-
let valueString = typeof value === 'string' ? this.quote(value) : value;
|
|
388
|
-
if (typeof value === 'boolean') valueString = value ? 'True' : 'False';
|
|
389
|
-
attrs.push(`${(0, _stringUtils.toSnakeCase)(name)}=${valueString}`);
|
|
390
|
-
}
|
|
391
|
-
const attrString = attrs.length ? `, ${attrs.join(', ')}` : '';
|
|
392
|
-
return `get_by_role(${this.quote(body)}${attrString})`;
|
|
393
|
-
case 'has-text':
|
|
394
|
-
return `filter(has_text=${this.toHasText(body)})`;
|
|
395
|
-
case 'has-not-text':
|
|
396
|
-
return `filter(has_not_text=${this.toHasText(body)})`;
|
|
397
|
-
case 'has':
|
|
398
|
-
return `filter(has=${body})`;
|
|
399
|
-
case 'hasNot':
|
|
400
|
-
return `filter(has_not=${body})`;
|
|
401
|
-
case 'and':
|
|
402
|
-
return `and_(${body})`;
|
|
403
|
-
case 'or':
|
|
404
|
-
return `or_(${body})`;
|
|
405
|
-
case 'chain':
|
|
406
|
-
return `locator(${body})`;
|
|
407
|
-
case 'test-id':
|
|
408
|
-
return `get_by_test_id(${this.toTestIdValue(body)})`;
|
|
409
|
-
case 'text':
|
|
410
|
-
return this.toCallWithExact('get_by_text', body, !!options.exact);
|
|
411
|
-
case 'alt':
|
|
412
|
-
return this.toCallWithExact('get_by_alt_text', body, !!options.exact);
|
|
413
|
-
case 'placeholder':
|
|
414
|
-
return this.toCallWithExact('get_by_placeholder', body, !!options.exact);
|
|
415
|
-
case 'label':
|
|
416
|
-
return this.toCallWithExact('get_by_label', body, !!options.exact);
|
|
417
|
-
case 'title':
|
|
418
|
-
return this.toCallWithExact('get_by_title', body, !!options.exact);
|
|
419
|
-
default:
|
|
420
|
-
throw new Error('Unknown selector kind ' + kind);
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
chainLocators(locators) {
|
|
424
|
-
return locators.join('.');
|
|
425
|
-
}
|
|
426
|
-
regexToString(body) {
|
|
427
|
-
const suffix = body.flags.includes('i') ? ', re.IGNORECASE' : '';
|
|
428
|
-
return `re.compile(r"${(0, _stringUtils.normalizeEscapedRegexQuotes)(body.source).replace(/\\\//, '/').replace(/"/g, '\\"')}"${suffix})`;
|
|
429
|
-
}
|
|
430
|
-
toCallWithExact(method, body, exact) {
|
|
431
|
-
if (isRegExp(body)) return `${method}(${this.regexToString(body)})`;
|
|
432
|
-
if (exact) return `${method}(${this.quote(body)}, exact=True)`;
|
|
433
|
-
return `${method}(${this.quote(body)})`;
|
|
434
|
-
}
|
|
435
|
-
toHasText(body) {
|
|
436
|
-
if (isRegExp(body)) return this.regexToString(body);
|
|
437
|
-
return `${this.quote(body)}`;
|
|
438
|
-
}
|
|
439
|
-
toTestIdValue(value) {
|
|
440
|
-
if (isRegExp(value)) return this.regexToString(value);
|
|
441
|
-
return this.quote(value);
|
|
442
|
-
}
|
|
443
|
-
quote(text) {
|
|
444
|
-
return (0, _stringUtils.escapeWithQuotes)(text, '\"');
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
exports.PythonLocatorFactory = PythonLocatorFactory;
|
|
448
|
-
class JavaLocatorFactory {
|
|
449
|
-
generateLocator(base, kind, body, options = {}) {
|
|
450
|
-
let clazz;
|
|
451
|
-
switch (base) {
|
|
452
|
-
case 'page':
|
|
453
|
-
clazz = 'Page';
|
|
454
|
-
break;
|
|
455
|
-
case 'frame-locator':
|
|
456
|
-
clazz = 'FrameLocator';
|
|
457
|
-
break;
|
|
458
|
-
case 'locator':
|
|
459
|
-
clazz = 'Locator';
|
|
460
|
-
break;
|
|
461
|
-
}
|
|
462
|
-
switch (kind) {
|
|
463
|
-
case 'default':
|
|
464
|
-
if (options.hasText !== undefined) return `locator(${this.quote(body)}, new ${clazz}.LocatorOptions().setHasText(${this.toHasText(options.hasText)}))`;
|
|
465
|
-
if (options.hasNotText !== undefined) return `locator(${this.quote(body)}, new ${clazz}.LocatorOptions().setHasNotText(${this.toHasText(options.hasNotText)}))`;
|
|
466
|
-
return `locator(${this.quote(body)})`;
|
|
467
|
-
case 'frame-locator':
|
|
468
|
-
return `frameLocator(${this.quote(body)})`;
|
|
469
|
-
case 'frame':
|
|
470
|
-
return `contentFrame()`;
|
|
471
|
-
case 'nth':
|
|
472
|
-
return `nth(${body})`;
|
|
473
|
-
case 'first':
|
|
474
|
-
return `first()`;
|
|
475
|
-
case 'last':
|
|
476
|
-
return `last()`;
|
|
477
|
-
case 'role':
|
|
478
|
-
const attrs = [];
|
|
479
|
-
if (isRegExp(options.name)) {
|
|
480
|
-
attrs.push(`.setName(${this.regexToString(options.name)})`);
|
|
481
|
-
} else if (typeof options.name === 'string') {
|
|
482
|
-
attrs.push(`.setName(${this.quote(options.name)})`);
|
|
483
|
-
if (options.exact) attrs.push(`.setExact(true)`);
|
|
484
|
-
}
|
|
485
|
-
for (const {
|
|
486
|
-
name,
|
|
487
|
-
value
|
|
488
|
-
} of options.attrs) attrs.push(`.set${(0, _stringUtils.toTitleCase)(name)}(${typeof value === 'string' ? this.quote(value) : value})`);
|
|
489
|
-
const attrString = attrs.length ? `, new ${clazz}.GetByRoleOptions()${attrs.join('')}` : '';
|
|
490
|
-
return `getByRole(AriaRole.${(0, _stringUtils.toSnakeCase)(body).toUpperCase()}${attrString})`;
|
|
491
|
-
case 'has-text':
|
|
492
|
-
return `filter(new ${clazz}.FilterOptions().setHasText(${this.toHasText(body)}))`;
|
|
493
|
-
case 'has-not-text':
|
|
494
|
-
return `filter(new ${clazz}.FilterOptions().setHasNotText(${this.toHasText(body)}))`;
|
|
495
|
-
case 'has':
|
|
496
|
-
return `filter(new ${clazz}.FilterOptions().setHas(${body}))`;
|
|
497
|
-
case 'hasNot':
|
|
498
|
-
return `filter(new ${clazz}.FilterOptions().setHasNot(${body}))`;
|
|
499
|
-
case 'and':
|
|
500
|
-
return `and(${body})`;
|
|
501
|
-
case 'or':
|
|
502
|
-
return `or(${body})`;
|
|
503
|
-
case 'chain':
|
|
504
|
-
return `locator(${body})`;
|
|
505
|
-
case 'test-id':
|
|
506
|
-
return `getByTestId(${this.toTestIdValue(body)})`;
|
|
507
|
-
case 'text':
|
|
508
|
-
return this.toCallWithExact(clazz, 'getByText', body, !!options.exact);
|
|
509
|
-
case 'alt':
|
|
510
|
-
return this.toCallWithExact(clazz, 'getByAltText', body, !!options.exact);
|
|
511
|
-
case 'placeholder':
|
|
512
|
-
return this.toCallWithExact(clazz, 'getByPlaceholder', body, !!options.exact);
|
|
513
|
-
case 'label':
|
|
514
|
-
return this.toCallWithExact(clazz, 'getByLabel', body, !!options.exact);
|
|
515
|
-
case 'title':
|
|
516
|
-
return this.toCallWithExact(clazz, 'getByTitle', body, !!options.exact);
|
|
517
|
-
default:
|
|
518
|
-
throw new Error('Unknown selector kind ' + kind);
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
chainLocators(locators) {
|
|
522
|
-
return locators.join('.');
|
|
523
|
-
}
|
|
524
|
-
regexToString(body) {
|
|
525
|
-
const suffix = body.flags.includes('i') ? ', Pattern.CASE_INSENSITIVE' : '';
|
|
526
|
-
return `Pattern.compile(${this.quote((0, _stringUtils.normalizeEscapedRegexQuotes)(body.source))}${suffix})`;
|
|
527
|
-
}
|
|
528
|
-
toCallWithExact(clazz, method, body, exact) {
|
|
529
|
-
if (isRegExp(body)) return `${method}(${this.regexToString(body)})`;
|
|
530
|
-
if (exact) return `${method}(${this.quote(body)}, new ${clazz}.${(0, _stringUtils.toTitleCase)(method)}Options().setExact(true))`;
|
|
531
|
-
return `${method}(${this.quote(body)})`;
|
|
532
|
-
}
|
|
533
|
-
toHasText(body) {
|
|
534
|
-
if (isRegExp(body)) return this.regexToString(body);
|
|
535
|
-
return this.quote(body);
|
|
536
|
-
}
|
|
537
|
-
toTestIdValue(value) {
|
|
538
|
-
if (isRegExp(value)) return this.regexToString(value);
|
|
539
|
-
return this.quote(value);
|
|
540
|
-
}
|
|
541
|
-
quote(text) {
|
|
542
|
-
return (0, _stringUtils.escapeWithQuotes)(text, '\"');
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
exports.JavaLocatorFactory = JavaLocatorFactory;
|
|
546
|
-
class CSharpLocatorFactory {
|
|
547
|
-
generateLocator(base, kind, body, options = {}) {
|
|
548
|
-
switch (kind) {
|
|
549
|
-
case 'default':
|
|
550
|
-
if (options.hasText !== undefined) return `Locator(${this.quote(body)}, new() { ${this.toHasText(options.hasText)} })`;
|
|
551
|
-
if (options.hasNotText !== undefined) return `Locator(${this.quote(body)}, new() { ${this.toHasNotText(options.hasNotText)} })`;
|
|
552
|
-
return `Locator(${this.quote(body)})`;
|
|
553
|
-
case 'frame-locator':
|
|
554
|
-
return `FrameLocator(${this.quote(body)})`;
|
|
555
|
-
case 'frame':
|
|
556
|
-
return `ContentFrame`;
|
|
557
|
-
case 'nth':
|
|
558
|
-
return `Nth(${body})`;
|
|
559
|
-
case 'first':
|
|
560
|
-
return `First`;
|
|
561
|
-
case 'last':
|
|
562
|
-
return `Last`;
|
|
563
|
-
case 'role':
|
|
564
|
-
const attrs = [];
|
|
565
|
-
if (isRegExp(options.name)) {
|
|
566
|
-
attrs.push(`NameRegex = ${this.regexToString(options.name)}`);
|
|
567
|
-
} else if (typeof options.name === 'string') {
|
|
568
|
-
attrs.push(`Name = ${this.quote(options.name)}`);
|
|
569
|
-
if (options.exact) attrs.push(`Exact = true`);
|
|
570
|
-
}
|
|
571
|
-
for (const {
|
|
572
|
-
name,
|
|
573
|
-
value
|
|
574
|
-
} of options.attrs) attrs.push(`${(0, _stringUtils.toTitleCase)(name)} = ${typeof value === 'string' ? this.quote(value) : value}`);
|
|
575
|
-
const attrString = attrs.length ? `, new() { ${attrs.join(', ')} }` : '';
|
|
576
|
-
return `GetByRole(AriaRole.${(0, _stringUtils.toTitleCase)(body)}${attrString})`;
|
|
577
|
-
case 'has-text':
|
|
578
|
-
return `Filter(new() { ${this.toHasText(body)} })`;
|
|
579
|
-
case 'has-not-text':
|
|
580
|
-
return `Filter(new() { ${this.toHasNotText(body)} })`;
|
|
581
|
-
case 'has':
|
|
582
|
-
return `Filter(new() { Has = ${body} })`;
|
|
583
|
-
case 'hasNot':
|
|
584
|
-
return `Filter(new() { HasNot = ${body} })`;
|
|
585
|
-
case 'and':
|
|
586
|
-
return `And(${body})`;
|
|
587
|
-
case 'or':
|
|
588
|
-
return `Or(${body})`;
|
|
589
|
-
case 'chain':
|
|
590
|
-
return `Locator(${body})`;
|
|
591
|
-
case 'test-id':
|
|
592
|
-
return `GetByTestId(${this.toTestIdValue(body)})`;
|
|
593
|
-
case 'text':
|
|
594
|
-
return this.toCallWithExact('GetByText', body, !!options.exact);
|
|
595
|
-
case 'alt':
|
|
596
|
-
return this.toCallWithExact('GetByAltText', body, !!options.exact);
|
|
597
|
-
case 'placeholder':
|
|
598
|
-
return this.toCallWithExact('GetByPlaceholder', body, !!options.exact);
|
|
599
|
-
case 'label':
|
|
600
|
-
return this.toCallWithExact('GetByLabel', body, !!options.exact);
|
|
601
|
-
case 'title':
|
|
602
|
-
return this.toCallWithExact('GetByTitle', body, !!options.exact);
|
|
603
|
-
default:
|
|
604
|
-
throw new Error('Unknown selector kind ' + kind);
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
chainLocators(locators) {
|
|
608
|
-
return locators.join('.');
|
|
609
|
-
}
|
|
610
|
-
regexToString(body) {
|
|
611
|
-
const suffix = body.flags.includes('i') ? ', RegexOptions.IgnoreCase' : '';
|
|
612
|
-
return `new Regex(${this.quote((0, _stringUtils.normalizeEscapedRegexQuotes)(body.source))}${suffix})`;
|
|
613
|
-
}
|
|
614
|
-
toCallWithExact(method, body, exact) {
|
|
615
|
-
if (isRegExp(body)) return `${method}(${this.regexToString(body)})`;
|
|
616
|
-
if (exact) return `${method}(${this.quote(body)}, new() { Exact = true })`;
|
|
617
|
-
return `${method}(${this.quote(body)})`;
|
|
618
|
-
}
|
|
619
|
-
toHasText(body) {
|
|
620
|
-
if (isRegExp(body)) return `HasTextRegex = ${this.regexToString(body)}`;
|
|
621
|
-
return `HasText = ${this.quote(body)}`;
|
|
622
|
-
}
|
|
623
|
-
toTestIdValue(value) {
|
|
624
|
-
if (isRegExp(value)) return this.regexToString(value);
|
|
625
|
-
return this.quote(value);
|
|
626
|
-
}
|
|
627
|
-
toHasNotText(body) {
|
|
628
|
-
if (isRegExp(body)) return `HasNotTextRegex = ${this.regexToString(body)}`;
|
|
629
|
-
return `HasNotText = ${this.quote(body)}`;
|
|
630
|
-
}
|
|
631
|
-
quote(text) {
|
|
632
|
-
return (0, _stringUtils.escapeWithQuotes)(text, '\"');
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
exports.CSharpLocatorFactory = CSharpLocatorFactory;
|
|
636
|
-
class JsonlLocatorFactory {
|
|
637
|
-
generateLocator(base, kind, body, options = {}) {
|
|
638
|
-
return JSON.stringify({
|
|
639
|
-
kind,
|
|
640
|
-
body,
|
|
641
|
-
options
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
chainLocators(locators) {
|
|
645
|
-
const objects = locators.map(l => JSON.parse(l));
|
|
646
|
-
for (let i = 0; i < objects.length - 1; ++i) objects[i].next = objects[i + 1];
|
|
647
|
-
return JSON.stringify(objects[0]);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
exports.JsonlLocatorFactory = JsonlLocatorFactory;
|
|
651
|
-
const generators = {
|
|
652
|
-
javascript: JavaScriptLocatorFactory,
|
|
653
|
-
python: PythonLocatorFactory,
|
|
654
|
-
java: JavaLocatorFactory,
|
|
655
|
-
csharp: CSharpLocatorFactory,
|
|
656
|
-
jsonl: JsonlLocatorFactory
|
|
657
|
-
};
|
|
658
|
-
function isRegExp(obj) {
|
|
659
|
-
return obj instanceof RegExp;
|
|
660
|
-
}
|