@mablhq/mabl-cli 1.45.8 → 1.47.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/api/basicApiClient.js +6 -0
  2. package/api/featureSet.js +0 -4
  3. package/api/mablApiClient.js +8 -0
  4. package/browserEngines/browserEngine.js +40 -0
  5. package/browserEngines/browserEngines.js +14 -0
  6. package/browserEngines/chromiumBrowserEngine.js +176 -0
  7. package/browserEngines/firefoxBrowserEngine.js +84 -0
  8. package/browserEngines/unsupportedBrowserEngine.js +27 -0
  9. package/browserLauncher/frameBase.js +5 -1
  10. package/browserLauncher/pageEvent.js +1 -0
  11. package/browserLauncher/playwrightBrowserLauncher/browserDelegate.js +2 -0
  12. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumBrowserDelegate.js +55 -0
  13. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +62 -0
  14. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumFrameDelegate.js +12 -0
  15. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +117 -0
  16. package/browserLauncher/playwrightBrowserLauncher/elementHandleDelegate.js +2 -0
  17. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +51 -0
  18. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxElementHandleDelegate.js +61 -0
  19. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxFrameDelegate.js +23 -0
  20. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxPageDelegate.js +83 -0
  21. package/browserLauncher/playwrightBrowserLauncher/frameDelegate.js +2 -0
  22. package/browserLauncher/playwrightBrowserLauncher/pageDelegate.js +2 -0
  23. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +41 -35
  24. package/browserLauncher/playwrightBrowserLauncher/playwrightBrowserLauncher.js +28 -3
  25. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +32 -63
  26. package/browserLauncher/playwrightBrowserLauncher/playwrightFrame.js +35 -11
  27. package/browserLauncher/playwrightBrowserLauncher/playwrightHttpRequest.js +1 -25
  28. package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +28 -50
  29. package/commands/constants.js +6 -1
  30. package/commands/tests/testsUtil.js +14 -153
  31. package/commands/tests/tests_cmds/import.js +2 -2
  32. package/commands/tests/tests_cmds/run.js +9 -9
  33. package/commands/workspaces/workspace_cmds/copy.js +1 -2
  34. package/domUtil/index.js +1 -1
  35. package/execution/index.js +1 -1
  36. package/functions/apiTest/utils.js +47 -0
  37. package/functions/types.js +2 -0
  38. package/functions/utils.js +12 -0
  39. package/mablApi/index.js +1 -1
  40. package/mablscript/types/VariableNamespace.js +3 -3
  41. package/mablscriptFind/index.js +1 -1
  42. package/package.json +4 -3
  43. package/popupDismissal/index.js +7 -20
  44. package/resources/mablFind.js +1 -1
  45. package/resources/popupDismissal.js +1 -1
  46. package/util/actionabilityUtil.js +4 -4
  47. package/util/clickUtil.js +2 -2
  48. package/util/fileUploadUtil.js +1 -1
  49. package/util/jestUtil.js +21 -0
  50. package/mablscript/types/VariableDataType.js +0 -28
@@ -71,12 +71,18 @@ class BasicApiClient {
71
71
  config.maxContentLength = Infinity;
72
72
  switch (options.authType) {
73
73
  case types_1.AuthType.ApiKey:
74
+ if (!options.token) {
75
+ throw new Error(`Auth type [${options.authType}] requires token`);
76
+ }
74
77
  config.auth = {
75
78
  username: 'key',
76
79
  password: options.token,
77
80
  };
78
81
  break;
79
82
  case types_1.AuthType.Bearer:
83
+ if (!options.token) {
84
+ throw new Error(`Auth type [${options.authType}] requires token`);
85
+ }
80
86
  config.headers.authorization = `Bearer ${options.token}`;
81
87
  break;
82
88
  case types_1.AuthType.None:
package/api/featureSet.js CHANGED
@@ -4,7 +4,6 @@ exports.FeatureSet = exports.FindImplementationVersion = void 0;
4
4
  const types_1 = require("../browserLauncher/types");
5
5
  const ACCESSIBILITY_CHECK_FEATURE_FLAG = 'accessibility_checks';
6
6
  const SMARTER_WAIT_FEATURE_FLAG = 'smarter_wait';
7
- const EXECUTION_SCREENCAST_MODE = 'execution_screencast_mode';
8
7
  var FindImplementationVersion;
9
8
  (function (FindImplementationVersion) {
10
9
  FindImplementationVersion[FindImplementationVersion["V1"] = 0] = "V1";
@@ -25,8 +24,5 @@ class FeatureSet {
25
24
  hasAccessibilityChecksEnabled() {
26
25
  return this.featureFlags.has(ACCESSIBILITY_CHECK_FEATURE_FLAG);
27
26
  }
28
- isExecutionScreencastModeEnabled() {
29
- return this.featureFlags.has(EXECUTION_SCREENCAST_MODE);
30
- }
31
27
  }
32
28
  exports.FeatureSet = FeatureSet;
@@ -469,6 +469,14 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
469
469
  throw toApiError(`Failed to get datatable rows`, error);
470
470
  }
471
471
  }
472
+ async getDatatableRow(datatableRowId) {
473
+ try {
474
+ return await this.makeGetRequest(`${this.baseApiUrl}/variables/rows/${datatableRowId}`);
475
+ }
476
+ catch (error) {
477
+ throw toApiError(`Failed to get datatable row`, error);
478
+ }
479
+ }
472
480
  async getSessionEmails(sessionId) {
473
481
  try {
474
482
  const contextId = sessionId === null || sessionId === void 0 ? void 0 : sessionId.slice(0, 8);
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getTempBrowserPrefDirectory = void 0;
27
+ const tmp = require('tmp-promise');
28
+ const path = __importStar(require("path"));
29
+ const env_1 = require("../env/env");
30
+ const fs = __importStar(require("fs-extra"));
31
+ function getTempBrowserPrefDirectory(browserName = 'chrome') {
32
+ const tempDir = tmp.dirSync({
33
+ mode: 0o777,
34
+ prefix: `${env_1.CONF_FILE_PROJECT_NAME}-`,
35
+ });
36
+ const preferencesPath = path.normalize(`${tempDir.name}/${browserName}Preferences`);
37
+ fs.ensureDirSync(preferencesPath, 0o777);
38
+ return preferencesPath;
39
+ }
40
+ exports.getTempBrowserPrefDirectory = getTempBrowserPrefDirectory;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultBrowserEngine = exports.BrowserTypeToBrowserEngine = void 0;
4
+ const browserTypes_1 = require("../commands/browserTypes");
5
+ const chromiumBrowserEngine_1 = require("./chromiumBrowserEngine");
6
+ const firefoxBrowserEngine_1 = require("./firefoxBrowserEngine");
7
+ const unsupportedBrowserEngine_1 = require("./unsupportedBrowserEngine");
8
+ exports.BrowserTypeToBrowserEngine = {
9
+ [browserTypes_1.BrowserType.Chrome]: new chromiumBrowserEngine_1.ChromiumBrowserEngine(),
10
+ [browserTypes_1.BrowserType.Edge]: new chromiumBrowserEngine_1.ChromiumBrowserEngine(),
11
+ [browserTypes_1.BrowserType.Firefox]: new firefoxBrowserEngine_1.FirefoxBrowserEngine(),
12
+ [browserTypes_1.BrowserType.Safari]: new unsupportedBrowserEngine_1.UnsupportedBrowserEngine(),
13
+ };
14
+ exports.DefaultBrowserEngine = exports.BrowserTypeToBrowserEngine[browserTypes_1.BrowserType.Chrome];
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ChromiumBrowserEngine = void 0;
30
+ const path_1 = __importDefault(require("path"));
31
+ const async_retry_1 = __importDefault(require("async-retry"));
32
+ const fs = __importStar(require("fs-extra"));
33
+ const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
34
+ const resourceUtil_1 = require("../util/resourceUtil");
35
+ const browserEngine_1 = require("./browserEngine");
36
+ const cliConfigProvider_1 = require("../providers/cliConfigProvider");
37
+ const configKeys_1 = require("../commands/config/config_cmds/configKeys");
38
+ const loggingProvider_1 = require("../providers/logging/loggingProvider");
39
+ const chromeFinder = require('chrome-launcher/dist/chrome-finder');
40
+ const launchUtils = require('chrome-launcher/dist/utils');
41
+ const baseExecutionEngineLaunchArgs = [
42
+ '--unlimited-storage',
43
+ '--disable-dev-shm-usage',
44
+ '--enable-print-preview-register-promos',
45
+ '--kiosk-printing',
46
+ '--disable-infobars',
47
+ '--enable-logging',
48
+ '--v=0',
49
+ '--enable-features=NetworkService,NetworkServiceInProcess',
50
+ '--disable-features=site-per-process',
51
+ '--disable-component-update',
52
+ ];
53
+ const ExecutionEngineFakeAudioFilePath = '/opt/media/mabl_test_audio.wav';
54
+ const ExecutionEngineFakeVideoFilePath = '/opt/media/mabl_test_pattern.y4m';
55
+ class ChromiumBrowserEngine {
56
+ name() {
57
+ return 'chromium';
58
+ }
59
+ getBrowserLaunchOptions(containerTesting, options, browserWidth, browserHeight, ignoreCertificateErrors, emulationConfig, enableExtensions, disableIsolation, resourcesDirectoryOverride) {
60
+ const commandLineArgs = [];
61
+ const ignoreCommandLineDefaultArgs = [];
62
+ const disableFeaturesFlags = [];
63
+ if (containerTesting) {
64
+ commandLineArgs.push('--no-sandbox');
65
+ }
66
+ if (disableIsolation) {
67
+ disableFeaturesFlags.push('IsolateOrigins');
68
+ }
69
+ disableFeaturesFlags.push('site-per-process');
70
+ commandLineArgs.push(`--disable-features=${disableFeaturesFlags.join(',')}`);
71
+ if (options.autoOpenDevtoolsForTabs) {
72
+ commandLineArgs.push('--auto-open-devtools-for-tabs');
73
+ }
74
+ const fakeMicrophoneMedia = (0, resourceUtil_1.findResource)('media/mabl_test_audio.wav', resourcesDirectoryOverride);
75
+ const fakeWebcamMedia = (0, resourceUtil_1.findResource)('media/mabl_test_pattern.y4m', resourcesDirectoryOverride);
76
+ const defaultDeviceDescriptor = (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig);
77
+ this.addBasicLaunchArgs(commandLineArgs, browserWidth, browserHeight, fakeMicrophoneMedia, fakeWebcamMedia, ignoreCertificateErrors, defaultDeviceDescriptor);
78
+ if (enableExtensions) {
79
+ ignoreCommandLineDefaultArgs.push('--disable-extensions');
80
+ }
81
+ return {
82
+ commandLineArgs,
83
+ engineSpecificOptions: undefined,
84
+ ignoreCommandLineDefaultArgs,
85
+ defaultDeviceDescriptor,
86
+ };
87
+ }
88
+ getExecutionEngineBrowserLaunchOptions(browserWidth, browserHeight, proxyInfo, emulationConfig) {
89
+ const launchArgs = [...baseExecutionEngineLaunchArgs];
90
+ if (proxyInfo.pacProxy) {
91
+ launchArgs.push(`--proxy-pac-url=${proxyInfo.pacProxy}`);
92
+ }
93
+ else if (proxyInfo.socksProxy) {
94
+ launchArgs.push(`--proxy-server=socks=${proxyInfo.socksProxy}`);
95
+ }
96
+ else {
97
+ throw new Error('no proxy provided for cloud run');
98
+ }
99
+ const defaultDeviceDescriptor = (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig);
100
+ this.addBasicLaunchArgs(launchArgs, browserWidth, browserHeight, ExecutionEngineFakeAudioFilePath, ExecutionEngineFakeVideoFilePath, true, defaultDeviceDescriptor);
101
+ loggingProvider_1.logger.debug(`launchArgs: ${JSON.stringify(launchArgs)}`);
102
+ return { defaultDeviceDescriptor, launchArgs };
103
+ }
104
+ addBasicLaunchArgs(launchArgs, browserWidth, browserHeight, fakeMicrophoneMediaPath, fakeWebcamMediaPath, ignoreCertificateErrors, deviceDescriptor) {
105
+ var _a, _b;
106
+ launchArgs.push(`--window-size=${(_a = deviceDescriptor === null || deviceDescriptor === void 0 ? void 0 : deviceDescriptor.width) !== null && _a !== void 0 ? _a : browserWidth},${(_b = deviceDescriptor === null || deviceDescriptor === void 0 ? void 0 : deviceDescriptor.height) !== null && _b !== void 0 ? _b : browserHeight}`);
107
+ launchArgs.push('--use-fake-ui-for-media-stream');
108
+ launchArgs.push('--use-fake-device-for-media-stream');
109
+ launchArgs.push(`--use-file-for-fake-audio-capture=${fakeMicrophoneMediaPath}`);
110
+ launchArgs.push(`--use-file-for-fake-video-capture=${fakeWebcamMediaPath}`);
111
+ launchArgs.push('--disable-notifications');
112
+ if (ignoreCertificateErrors) {
113
+ launchArgs.push('--ignore-certificate-errors');
114
+ }
115
+ }
116
+ prepareBrowserPreferencesDirectory(windowPlacement) {
117
+ return (0, async_retry_1.default)(() => {
118
+ const tempBrowserPreferencesDirectory = (0, browserEngine_1.getTempBrowserPrefDirectory)();
119
+ {
120
+ fs.ensureDirSync(path_1.default.normalize(`${tempBrowserPreferencesDirectory}/Default`));
121
+ }
122
+ const prefFilePath = path_1.default.normalize(`${tempBrowserPreferencesDirectory}/Default/Preferences`);
123
+ fs.writeFileSync(prefFilePath, JSON.stringify(this.generateChromiumPreferencesFile(windowPlacement), null, 3));
124
+ fs.chmodSync(path_1.default.normalize(`${tempBrowserPreferencesDirectory}/Default`), 0o777);
125
+ fs.chmodSync(prefFilePath, 0o777);
126
+ return tempBrowserPreferencesDirectory;
127
+ }, {
128
+ retries: 5,
129
+ });
130
+ }
131
+ generateChromiumPreferencesFile(windowPlacement) {
132
+ const preferences = {
133
+ download: {
134
+ open_pdf_in_system_reader: true,
135
+ prompt_for_download: false,
136
+ },
137
+ profile: {
138
+ avatar_index: 5,
139
+ name: 'mabl',
140
+ },
141
+ plugins: {
142
+ always_open_pdf_externally: true,
143
+ },
144
+ };
145
+ if (windowPlacement) {
146
+ preferences.browser = {
147
+ window_placement: {
148
+ always_on_top: false,
149
+ ...windowPlacement,
150
+ },
151
+ };
152
+ }
153
+ return preferences;
154
+ }
155
+ async findBrowserExecutable() {
156
+ const existingLocation = await cliConfigProvider_1.CliConfigProvider.getConfigProperty(configKeys_1.configKeys.browserPath);
157
+ if (typeof existingLocation === 'string' &&
158
+ existingLocation &&
159
+ fs.existsSync(existingLocation)) {
160
+ return existingLocation;
161
+ }
162
+ const chromePath = this.searchForChrome();
163
+ await cliConfigProvider_1.CliConfigProvider.setConfigProperty(configKeys_1.configKeys.browserPath, chromePath);
164
+ return chromePath;
165
+ }
166
+ searchForChrome() {
167
+ const chromes = chromeFinder[launchUtils.getPlatform()]();
168
+ return chromes.filter((chrome) => {
169
+ chrome = chrome.toLowerCase();
170
+ return !(chrome.includes('canary') ||
171
+ chrome.includes('dev') ||
172
+ chrome.includes('beta'));
173
+ })[0];
174
+ }
175
+ }
176
+ exports.ChromiumBrowserEngine = ChromiumBrowserEngine;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.FirefoxBrowserEngine = void 0;
7
+ const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
8
+ const browserEngine_1 = require("./browserEngine");
9
+ const async_retry_1 = __importDefault(require("async-retry"));
10
+ const browserTypes_1 = require("../commands/browserTypes");
11
+ class FirefoxBrowserEngine {
12
+ name() {
13
+ return 'firefox';
14
+ }
15
+ getBrowserLaunchOptions(_containerTesting, _options, _browserWidth, _browserHeight, _ignoreCertificateErrors, emulationConfig, _enableExtensions, _disableIsolation, _resourcesDirectoryOverride) {
16
+ return {
17
+ commandLineArgs: [],
18
+ engineSpecificOptions: {
19
+ browserType: browserTypes_1.BrowserType.Firefox,
20
+ firefoxUserPrefs: this.getFirefoxUserPrefs(),
21
+ },
22
+ ignoreCommandLineDefaultArgs: [],
23
+ defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig),
24
+ };
25
+ }
26
+ getExecutionEngineBrowserLaunchOptions(_browserWidth, _browserHeight, _proxyInfo, emulationConfig) {
27
+ return {
28
+ defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig),
29
+ launchArgs: [],
30
+ };
31
+ }
32
+ prepareBrowserPreferencesDirectory(_windowPlacement) {
33
+ return (0, async_retry_1.default)(() => (0, browserEngine_1.getTempBrowserPrefDirectory)(this.name()), {
34
+ retries: 5,
35
+ });
36
+ }
37
+ findBrowserExecutable() {
38
+ return Promise.resolve('');
39
+ }
40
+ getFirefoxUserPrefs() {
41
+ return {
42
+ 'xpinstall.signatures.required': false,
43
+ 'browser.preferences.defaultPerformanceSettings.enabled': false,
44
+ 'layers.acceleration.disabled': true,
45
+ 'browser.cache.memory.enable': false,
46
+ 'browser.cache.offline.enable': false,
47
+ 'browser.cache.disk.capacity': 262144,
48
+ 'browser.sessionhistory.max_entries': 1,
49
+ 'browser.sessionhistory.max_total_viewers': 0,
50
+ 'media.memory_caches_combined_limit_kb': 65536,
51
+ 'media.memory_caches_combined_limit_pc_sysmem': 1,
52
+ 'pdfjs.enabledCache.state': false,
53
+ 'plugin.disable_full_page_plugin_for_types': 'application/pdf,application/vnd.adobe.xfdf,application/vnd.adobe.xdp+xml',
54
+ 'browser.helperApps.alwaysAsk.force': true,
55
+ 'browser.helperApps.neverAsk.saveToDisk': [
56
+ 'application/csv',
57
+ 'application/force-download',
58
+ 'application/gzip',
59
+ 'application/pdf',
60
+ 'application/vnd.ms-excel',
61
+ 'application/msword',
62
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
63
+ 'application/x-7z-compressed',
64
+ 'application/x-bzip',
65
+ 'application/x-bzip2',
66
+ 'application/x-gzip',
67
+ 'application/zip',
68
+ 'binary/octet-stream',
69
+ 'application/octet-stream',
70
+ 'image/png',
71
+ 'image/jpeg',
72
+ 'image/gif',
73
+ 'text/csv',
74
+ 'text/comma-separated-values',
75
+ 'text/plain',
76
+ ].join(','),
77
+ 'media.navigator.permission.disabled': true,
78
+ 'media.navigator.streams.fake': true,
79
+ 'dom.webnotifications.enabled': true,
80
+ 'network.proxy.socks_remote_dns': true,
81
+ };
82
+ }
83
+ }
84
+ exports.FirefoxBrowserEngine = FirefoxBrowserEngine;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedBrowserEngine = void 0;
4
+ const mobileEmulationUtil_1 = require("../commands/tests/mobileEmulationUtil");
5
+ class UnsupportedBrowserEngine {
6
+ name() {
7
+ throw new Error('Unsupported browser engine');
8
+ }
9
+ getBrowserLaunchOptions(_containerTesting, _options, _browserWidth, _browserHeight, _ignoreCertificateErrors, emulationConfig, _enableExtensions, _disableIsolation, _resourcesDirectoryOverride) {
10
+ return {
11
+ commandLineArgs: [],
12
+ engineSpecificOptions: undefined,
13
+ ignoreCommandLineDefaultArgs: [],
14
+ defaultDeviceDescriptor: (0, mobileEmulationUtil_1.getDeviceDescriptorForEmulation)(emulationConfig),
15
+ };
16
+ }
17
+ getExecutionEngineBrowserLaunchOptions(_browserWidth, _browserHeight, _proxyInfo, _emulationConfig) {
18
+ throw new Error('Unsupported browser engine');
19
+ }
20
+ prepareBrowserPreferencesDirectory(_windowPlacement) {
21
+ throw new Error('Unsupported browser engine');
22
+ }
23
+ findBrowserExecutable() {
24
+ throw new Error('Unsupported browser engine');
25
+ }
26
+ }
27
+ exports.UnsupportedBrowserEngine = UnsupportedBrowserEngine;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.FrameBase = void 0;
4
- class FrameBase {
7
+ const events_1 = __importDefault(require("events"));
8
+ class FrameBase extends events_1.default {
5
9
  }
6
10
  exports.FrameBase = FrameBase;
@@ -11,6 +11,7 @@ var PageEvent;
11
11
  PageEvent["Request"] = "request";
12
12
  PageEvent["RequestWillBeSentExtraInfo"] = "requestwillbesentextrainfo";
13
13
  PageEvent["Response"] = "response";
14
+ PageEvent["SecondaryWorldCreated"] = "secondaryworldcreated";
14
15
  PageEvent["TracingBufferUsage"] = "tracingbufferusage";
15
16
  PageEvent["TracingComplete"] = "tracingcomplete";
16
17
  PageEvent["TracingDataCollected"] = "TracingDataCollected";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ChromiumBrowserDelegate = void 0;
27
+ const playwright = __importStar(require("@playwright/test"));
28
+ const chromiumPageDelegate_1 = require("./chromiumPageDelegate");
29
+ class ChromiumBrowserDelegate {
30
+ constructor(context) {
31
+ this.context = context;
32
+ const contextImpl = playwright._toImpl(context);
33
+ this._browser = contextImpl._browser;
34
+ }
35
+ createPageDelegate(page) {
36
+ return new chromiumPageDelegate_1.ChromiumPageDelegate(page);
37
+ }
38
+ getCDPSession() {
39
+ return this._browser._connection.rootSession;
40
+ }
41
+ getBrowser() {
42
+ return this._browser;
43
+ }
44
+ async setDownloadBehavior(downloadDirectory) {
45
+ await this.getCDPSession().send('Browser.setDownloadBehavior', {
46
+ behavior: 'allow',
47
+ downloadPath: downloadDirectory,
48
+ eventsEnabled: true,
49
+ });
50
+ }
51
+ downloadsUsingGuids() {
52
+ return false;
53
+ }
54
+ }
55
+ exports.ChromiumBrowserDelegate = ChromiumBrowserDelegate;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ChromiumElementHandleDelegate = void 0;
27
+ const playwright = __importStar(require("@playwright/test"));
28
+ const logUtils_1 = require("../../../util/logUtils");
29
+ class ChromiumElementHandleDelegate {
30
+ constructor(elementHandle) {
31
+ this.elementHandle = elementHandle;
32
+ try {
33
+ this.elementImpl = playwright._toImpl(elementHandle);
34
+ }
35
+ catch (e) {
36
+ (0, logUtils_1.logInternal)(`Unable to get the element handle's implementation. Error: ${e}`);
37
+ }
38
+ }
39
+ getElementImpl() {
40
+ return this.elementImpl;
41
+ }
42
+ checkCDPSession() {
43
+ var _a, _b, _c;
44
+ if (this.elementImpl === undefined) {
45
+ (0, logUtils_1.logInternal)(`Unable to get the Element's internal implementation. Some functionality, such as getting the clickable point or element highlighting might not work.`);
46
+ }
47
+ else if (this.getCDPSession() === undefined) {
48
+ const undefinedField = ((_b = (_a = this.elementImpl) === null || _a === void 0 ? void 0 : _a._context) === null || _b === void 0 ? void 0 : _b._delegate) !== undefined
49
+ ? '_client'
50
+ : ((_c = this.elementImpl) === null || _c === void 0 ? void 0 : _c._context) !== undefined
51
+ ? '_delegate'
52
+ : '_context';
53
+ (0, logUtils_1.logInternal)(`Unable to get the CDP Session of the element handle. ${undefinedField} is undefined. Some functionality, such as element highlighting will not work.`);
54
+ }
55
+ }
56
+ getCDPSession() {
57
+ var _a, _b, _c;
58
+ this.checkCDPSession();
59
+ return (_c = (_b = (_a = this.elementImpl) === null || _a === void 0 ? void 0 : _a._context) === null || _b === void 0 ? void 0 : _b._delegate) === null || _c === void 0 ? void 0 : _c._client;
60
+ }
61
+ }
62
+ exports.ChromiumElementHandleDelegate = ChromiumElementHandleDelegate;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChromiumFrameDelegate = void 0;
4
+ class ChromiumFrameDelegate {
5
+ constructor(page) {
6
+ this.page = page;
7
+ }
8
+ addBindingToSecondaryWorld(_binding) {
9
+ return Promise.resolve();
10
+ }
11
+ }
12
+ exports.ChromiumFrameDelegate = ChromiumFrameDelegate;