@mablhq/mabl-cli 1.48.7 → 1.48.22

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 (34) hide show
  1. package/api/mablApiClient.js +11 -0
  2. package/browserEngines/chromiumBrowserEngine.js +3 -0
  3. package/browserEngines/firefoxBrowserEngine.js +8 -2
  4. package/browserEngines/unsupportedBrowserEngine.js +3 -0
  5. package/browserEngines/webkitBrowerEngine.js +11 -0
  6. package/browserLauncher/elementHandle.js +10 -1
  7. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumElementHandleDelegate.js +63 -0
  8. package/browserLauncher/playwrightBrowserLauncher/chromium/chromiumPageDelegate.js +25 -10
  9. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxBrowserDelegate.js +36 -0
  10. package/browserLauncher/playwrightBrowserLauncher/firefox/firefoxElementHandleDelegate.js +4 -0
  11. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractBrowserDelegate.js +0 -35
  12. package/browserLauncher/playwrightBrowserLauncher/nonChromium/nonChromiumAbstractElementHandleDelegate.js +4 -0
  13. package/browserLauncher/playwrightBrowserLauncher/playwrightDom.js +35 -52
  14. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitBrowserDelegate.js +36 -0
  15. package/browserLauncher/playwrightBrowserLauncher/webkit/webkitElementHandleDelegate.js +9 -0
  16. package/commands/constants.js +5 -2
  17. package/commands/datatables/datatables_cmds/create.js +148 -0
  18. package/commands/datatables/datatables_cmds/export.js +1 -2
  19. package/commands/tests/testsUtil.js +19 -1
  20. package/commands/tests/tests_cmds/run.js +1 -15
  21. package/execution/index.js +1 -1
  22. package/mablApi/index.js +1 -1
  23. package/mablscript/importer.js +2 -0
  24. package/mablscript/steps/DoubleClickStep.js +1 -1
  25. package/mablscript/steps/RightClickStep.js +57 -0
  26. package/mablscriptFind/index.js +1 -1
  27. package/package.json +2 -1
  28. package/popupDismissal/index.js +7 -2
  29. package/resources/mablFind.js +1 -1
  30. package/resources/popupDismissal.js +1 -1
  31. package/util/asyncUtil.js +1 -1
  32. package/util/browserTestUtils.js +2 -2
  33. package/util/clickUtil.js +24 -14
  34. package/util/csvUtil.js +6 -1
@@ -481,6 +481,17 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
481
481
  throw toApiError(`Failed to get datatable`, error);
482
482
  }
483
483
  }
484
+ async createDatatable(workspaceId, options) {
485
+ try {
486
+ const datatablesQueryString = queryString.stringify({
487
+ organization_id: workspaceId,
488
+ });
489
+ return await this.makePostRequest(`${this.baseApiUrl}/variables/tables?${datatablesQueryString}`, options).then((result) => result);
490
+ }
491
+ catch (error) {
492
+ throw toApiError(`Failed to create datatable`, error);
493
+ }
494
+ }
484
495
  async getDatatableRows(datatableId) {
485
496
  try {
486
497
  return await this.makeGetRequest(`${this.baseApiUrl}/variables/tables/${datatableId}/rows`).then((result) => { var _a; return (_a = result.variableRows) !== null && _a !== void 0 ? _a : []; });
@@ -171,5 +171,8 @@ class ChromiumBrowserEngine {
171
171
  chrome.includes('beta'));
172
172
  })[0];
173
173
  }
174
+ getProxySpec(_proxyInfo) {
175
+ return;
176
+ }
174
177
  }
175
178
  exports.ChromiumBrowserEngine = ChromiumBrowserEngine;
@@ -52,11 +52,14 @@ class FirefoxBrowserEngine {
52
52
  prepareBrowserPreferencesDirectory(_windowPlacement, proxyInfo) {
53
53
  const customPreferences = {};
54
54
  if (proxyInfo === null || proxyInfo === void 0 ? void 0 : proxyInfo.pacProxy) {
55
- customPreferences['network.proxy.autoconfig_url'] = proxyInfo === null || proxyInfo === void 0 ? void 0 : proxyInfo.pacProxy;
55
+ customPreferences['network.proxy.autoconfig_url'] = proxyInfo.pacProxy;
56
56
  customPreferences['network.proxy.type'] = 2;
57
57
  }
58
58
  else if (proxyInfo === null || proxyInfo === void 0 ? void 0 : proxyInfo.socksProxy) {
59
- customPreferences['network.proxy.socks'] = proxyInfo === null || proxyInfo === void 0 ? void 0 : proxyInfo.socksProxy;
59
+ const socksUrl = new URL(proxyInfo.socksProxy);
60
+ customPreferences['network.proxy.socks'] = socksUrl.hostname;
61
+ customPreferences['network.proxy.socks_port'] = Number.parseInt(socksUrl.port);
62
+ customPreferences['network.proxy.socks_version'] = 5;
60
63
  customPreferences['network.proxy.type'] = 1;
61
64
  }
62
65
  return (0, async_retry_1.default)(() => {
@@ -123,5 +126,8 @@ class FirefoxBrowserEngine {
123
126
  'network.proxy.socks_remote_dns': true,
124
127
  };
125
128
  }
129
+ getProxySpec(_proxyInfo) {
130
+ return;
131
+ }
126
132
  }
127
133
  exports.FirefoxBrowserEngine = FirefoxBrowserEngine;
@@ -22,5 +22,8 @@ class UnsupportedBrowserEngine {
22
22
  findBrowserExecutable() {
23
23
  throw new Error('Unsupported browser engine');
24
24
  }
25
+ getProxySpec(_proxyInfo) {
26
+ throw new Error('Unsupported browser engine');
27
+ }
25
28
  }
26
29
  exports.UnsupportedBrowserEngine = UnsupportedBrowserEngine;
@@ -35,5 +35,16 @@ class WebkitBrowserEngine {
35
35
  findBrowserExecutable() {
36
36
  return Promise.resolve('');
37
37
  }
38
+ getProxySpec(proxyInfo) {
39
+ const { httpProxy, socksProxy, excludeFromProxy } = proxyInfo;
40
+ const server = httpProxy !== null && httpProxy !== void 0 ? httpProxy : socksProxy;
41
+ if (!server) {
42
+ throw new Error('no proxy provided for cloud run');
43
+ }
44
+ const bypass = (excludeFromProxy === null || excludeFromProxy === void 0 ? void 0 : excludeFromProxy.length)
45
+ ? excludeFromProxy.join(',')
46
+ : undefined;
47
+ return { server, bypass };
48
+ }
38
49
  }
39
50
  exports.WebkitBrowserEngine = WebkitBrowserEngine;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isElementHandle = exports.getHighlightColor = exports.MAX_HIGHLIGHT_OPACITY = void 0;
3
+ exports.isElementHandle = exports.commonFocusAndSelect = exports.getHighlightColor = exports.MAX_HIGHLIGHT_OPACITY = void 0;
4
4
  exports.MAX_HIGHLIGHT_OPACITY = 0.9;
5
5
  const getHighlightColor = (transparency) => ({
6
6
  r: 196,
@@ -9,6 +9,15 @@ const getHighlightColor = (transparency) => ({
9
9
  a: transparency,
10
10
  });
11
11
  exports.getHighlightColor = getHighlightColor;
12
+ function commonFocusAndSelect(element) {
13
+ return element.evaluate((element) => {
14
+ var _a;
15
+ element.focus();
16
+ (_a = element.select) === null || _a === void 0 ? void 0 : _a.call(element);
17
+ return element.value;
18
+ });
19
+ }
20
+ exports.commonFocusAndSelect = commonFocusAndSelect;
12
21
  function isElementHandle(value) {
13
22
  return (value &&
14
23
  typeof value === 'object' &&
@@ -25,7 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ChromiumElementHandleDelegate = void 0;
27
27
  const playwright = __importStar(require("@playwright/test"));
28
+ const testsUtil_1 = require("../../../commands/tests/testsUtil");
28
29
  const logUtils_1 = require("../../../util/logUtils");
30
+ const elementHandle_1 = require("../../elementHandle");
29
31
  class ChromiumElementHandleDelegate {
30
32
  constructor(elementHandle) {
31
33
  this.elementHandle = elementHandle;
@@ -36,6 +38,9 @@ class ChromiumElementHandleDelegate {
36
38
  (0, logUtils_1.logInternal)(`Unable to get the element handle's implementation. Error: ${e}`);
37
39
  }
38
40
  }
41
+ focusAndSelect(element) {
42
+ return (0, elementHandle_1.commonFocusAndSelect)(element);
43
+ }
39
44
  getElementImpl() {
40
45
  return this.elementImpl;
41
46
  }
@@ -57,6 +62,64 @@ class ChromiumElementHandleDelegate {
57
62
  this.checkCDPSession();
58
63
  return this.getInternalCDPSession();
59
64
  }
65
+ async highlight(highlightDurationMillis, highlightPhases) {
66
+ var _a;
67
+ await this.enableDom();
68
+ await this.enableOverlay();
69
+ const nodeInfo = await ((_a = this.getInternalCDPSession()) === null || _a === void 0 ? void 0 : _a.send('DOM.describeNode', {
70
+ objectId: this.getRemoteObjectId(),
71
+ depth: -1,
72
+ pierce: true,
73
+ }));
74
+ if (!nodeInfo) {
75
+ return;
76
+ }
77
+ const highlightConfig = {
78
+ backendNodeId: nodeInfo.node.backendNodeId,
79
+ highlightConfig: {
80
+ borderColor: (0, elementHandle_1.getHighlightColor)(0),
81
+ contentColor: (0, elementHandle_1.getHighlightColor)(1),
82
+ colorFormat: 'rgb',
83
+ },
84
+ };
85
+ await this.fadeInOutHighlight(highlightConfig, highlightDurationMillis, highlightPhases);
86
+ await this.hideHighlight();
87
+ }
88
+ async fadeInOutHighlight(highlightConfig, highlightDurationMillis, highlightPhases) {
89
+ var _a, _b;
90
+ if (highlightPhases <= 0) {
91
+ throw new Error('Highlight phases must be greater than 0');
92
+ }
93
+ const phaseIntervalMilliseconds = highlightDurationMillis / highlightPhases;
94
+ for (let iteration = 0; iteration < highlightPhases; iteration++) {
95
+ if (((_a = highlightConfig.highlightConfig.contentColor) === null || _a === void 0 ? void 0 : _a.a) !== undefined) {
96
+ const x = iteration / highlightPhases;
97
+ highlightConfig.highlightConfig.contentColor.a =
98
+ x * (1 - x) * 4 * elementHandle_1.MAX_HIGHLIGHT_OPACITY;
99
+ }
100
+ await ((_b = this.getInternalCDPSession()) === null || _b === void 0 ? void 0 : _b.send('Overlay.highlightNode', highlightConfig));
101
+ await (0, testsUtil_1.sleep)(phaseIntervalMilliseconds);
102
+ }
103
+ }
104
+ async enableDom() {
105
+ var _a;
106
+ await ((_a = this.getInternalCDPSession()) === null || _a === void 0 ? void 0 : _a.send('DOM.enable'));
107
+ }
108
+ async enableOverlay() {
109
+ var _a;
110
+ await ((_a = this.getInternalCDPSession()) === null || _a === void 0 ? void 0 : _a.send('Overlay.enable'));
111
+ }
112
+ async hideHighlight() {
113
+ var _a;
114
+ await ((_a = this.getInternalCDPSession()) === null || _a === void 0 ? void 0 : _a.send('Overlay.hideHighlight'));
115
+ }
116
+ getRemoteObjectId() {
117
+ var _a, _b, _c;
118
+ if (((_a = this.getElementImpl()) === null || _a === void 0 ? void 0 : _a._objectId) === undefined) {
119
+ (0, logUtils_1.logInternal)('ObjectId of an element handle was not found.');
120
+ }
121
+ return (_c = (_b = this.getElementImpl()) === null || _b === void 0 ? void 0 : _b._objectId) !== null && _c !== void 0 ? _c : '';
122
+ }
60
123
  getInternalCDPSession() {
61
124
  var _a, _b, _c;
62
125
  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;
@@ -74,7 +74,11 @@ class ChromiumPageDelegate {
74
74
  getCDPSession() {
75
75
  var _a, _b, _c, _d;
76
76
  this.checkCDPSession();
77
- return ((_d = (_c = (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._mainFrameSession) === null || _c === void 0 ? void 0 : _c._client) !== null && _d !== void 0 ? _d : this.fallbackCDPSession);
77
+ const session = (_d = (_c = (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._mainFrameSession) === null || _c === void 0 ? void 0 : _c._client) !== null && _d !== void 0 ? _d : this.fallbackCDPSession;
78
+ if (!session) {
79
+ throw new Error('Unable to get the CDP Session of the page');
80
+ }
81
+ return session;
78
82
  }
79
83
  checkCDPSession() {
80
84
  var _a, _b, _c, _d, _e, _f;
@@ -95,8 +99,14 @@ class ChromiumPageDelegate {
95
99
  var _a, _b;
96
100
  return (_b = (_a = this.pageImpl) === null || _a === void 0 ? void 0 : _a._delegate) === null || _b === void 0 ? void 0 : _b._targetId;
97
101
  }
98
- createCDPSession() {
99
- return this.page.context().newCDPSession(this.page);
102
+ async createCDPSession() {
103
+ try {
104
+ return await this.page.context().newCDPSession(this.page);
105
+ }
106
+ catch (e) {
107
+ (0, logUtils_1.logInternal)(`Unable to create a CDP session. Error: ${e}`);
108
+ return;
109
+ }
100
110
  }
101
111
  createElementHandleDelegate(element) {
102
112
  return new chromiumElementHandleDelegate_1.ChromiumElementHandleDelegate(element);
@@ -105,13 +115,18 @@ class ChromiumPageDelegate {
105
115
  return new chromiumFrameDelegate_1.ChromiumFrameDelegate(frame);
106
116
  }
107
117
  async enableScreencastMode() {
108
- const cdp = await this.createCDPSession();
109
- cdp.on('Page.screencastFrame', async (params) => {
110
- await cdp
111
- .send('Page.screencastFrameAck', { sessionId: params.sessionId })
112
- .catch(() => { });
113
- });
114
- await cdp.send('Page.startScreencast', {});
118
+ try {
119
+ const cdp = this.getCDPSession();
120
+ cdp.on('Page.screencastFrame', async (params) => {
121
+ await cdp
122
+ .send('Page.screencastFrameAck', { sessionId: params.sessionId })
123
+ .catch(() => { });
124
+ });
125
+ await cdp.send('Page.startScreencast', {});
126
+ }
127
+ catch (e) {
128
+ (0, logUtils_1.logInternal)(`Unable to enable screencast mode. No CDP session found. Error: ${e}`);
129
+ }
115
130
  }
116
131
  }
117
132
  exports.ChromiumPageDelegate = ChromiumPageDelegate;
@@ -1,11 +1,47 @@
1
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.FirefoxBrowserDelegate = void 0;
27
+ const playwright = __importStar(require("@playwright/test"));
4
28
  const firefoxPageDelegate_1 = require("./firefoxPageDelegate");
5
29
  const nonChromiumAbstractBrowserDelegate_1 = require("../nonChromium/nonChromiumAbstractBrowserDelegate");
6
30
  class FirefoxBrowserDelegate extends nonChromiumAbstractBrowserDelegate_1.NonChromiumAbstractBrowserDelegate {
31
+ constructor(context) {
32
+ super();
33
+ this.context = context;
34
+ const contextImpl = playwright._toImpl(context);
35
+ this._browser = contextImpl._browser;
36
+ }
37
+ getBrowser() {
38
+ return this._browser;
39
+ }
7
40
  createPageDelegate(page) {
8
41
  return new firefoxPageDelegate_1.FirefoxPageDelegate(page);
9
42
  }
43
+ getCDPSession() {
44
+ return this._browser._connection;
45
+ }
10
46
  }
11
47
  exports.FirefoxBrowserDelegate = FirefoxBrowserDelegate;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FirefoxElementHandleDelegate = void 0;
4
+ const elementHandle_1 = require("../../elementHandle");
4
5
  const nonChromiumAbstractElementHandleDelegate_1 = require("../nonChromium/nonChromiumAbstractElementHandleDelegate");
5
6
  class FirefoxElementHandleDelegate extends nonChromiumAbstractElementHandleDelegate_1.NonChromiumAbstractElementHandleDelegate {
7
+ focusAndSelect(element) {
8
+ return (0, elementHandle_1.commonFocusAndSelect)(element);
9
+ }
6
10
  }
7
11
  exports.FirefoxElementHandleDelegate = FirefoxElementHandleDelegate;
@@ -1,45 +1,10 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  exports.NonChromiumAbstractBrowserDelegate = void 0;
27
- const playwright = __importStar(require("@playwright/test"));
28
4
  class NonChromiumAbstractBrowserDelegate {
29
- constructor(context) {
30
- this.context = context;
31
- const contextImpl = playwright._toImpl(context);
32
- this._browser = contextImpl._browser;
33
- }
34
5
  setDownloadBehavior(_downloadDirectory) {
35
6
  return Promise.resolve();
36
7
  }
37
- getCDPSession() {
38
- return this._browser._connection;
39
- }
40
- getBrowser() {
41
- return this._browser;
42
- }
43
8
  downloadsUsingGuids() {
44
9
  return true;
45
10
  }
@@ -35,6 +35,10 @@ class NonChromiumAbstractElementHandleDelegate {
35
35
  catch {
36
36
  }
37
37
  }
38
+ highlight(_highlightDurationMillis, _highlightPhases) {
39
+ (0, logUtils_1.logInternal)('Highlighting is not supported on non-chromium browsers.');
40
+ return Promise.resolve();
41
+ }
38
42
  getElementImpl() {
39
43
  return this.elementImpl;
40
44
  }
@@ -1,11 +1,33 @@
1
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.PlaywrightElementHandle = exports.PlaywrightJsHandle = exports.NAVIGATION_ERROR_MESSAGE = void 0;
27
+ const playwright = __importStar(require("@playwright/test"));
4
28
  const types_1 = require("../types");
5
29
  const utils_1 = require("../utils");
6
30
  const logUtils_1 = require("../../util/logUtils");
7
- const elementHandle_1 = require("../elementHandle");
8
- const testsUtil_1 = require("../../commands/tests/testsUtil");
9
31
  const pureUtil_1 = require("../../util/pureUtil");
10
32
  exports.NAVIGATION_ERROR_MESSAGE = 'waiting for scheduled navigations to finish';
11
33
  class PlaywrightJsHandle {
@@ -34,6 +56,11 @@ class PlaywrightJsHandle {
34
56
  jsonValue() {
35
57
  return this.handle.jsonValue();
36
58
  }
59
+ isContextDestroyed() {
60
+ var _a, _b, _c;
61
+ const elementImpl = playwright._toImpl(this.handle);
62
+ return (_c = (_b = (_a = elementImpl._context) === null || _a === void 0 ? void 0 : _a._destroyedPromise) === null || _b === void 0 ? void 0 : _b._isDone) !== null && _c !== void 0 ? _c : true;
63
+ }
37
64
  static unwrapProperties(arg, addSecondaryWorldFlag = false) {
38
65
  if (arg === undefined) {
39
66
  return addSecondaryWorldFlag ? { secondaryWorldValue: undefined } : null;
@@ -114,6 +141,7 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
114
141
  const trial = (_a = options === null || options === void 0 ? void 0 : options.trial) !== null && _a !== void 0 ? _a : false;
115
142
  try {
116
143
  await this.element.click({
144
+ button: options === null || options === void 0 ? void 0 : options.button,
117
145
  clickCount: (_b = options === null || options === void 0 ? void 0 : options.clickCount) !== null && _b !== void 0 ? _b : 1,
118
146
  force: (_c = options === null || options === void 0 ? void 0 : options.force) !== null && _c !== void 0 ? _c : !trial,
119
147
  timeout: this.getActionTimeout(options),
@@ -201,60 +229,12 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
201
229
  minimizeScrollIntoView: options === null || options === void 0 ? void 0 : options.minimizeScrollIntoView,
202
230
  });
203
231
  }
204
- getRemoteObjectId() {
205
- var _a, _b, _c;
206
- if (((_a = this.delegate.getElementImpl()) === null || _a === void 0 ? void 0 : _a._objectId) === undefined) {
207
- (0, logUtils_1.logInternal)('ObjectId of an element handle was not found.');
208
- }
209
- return (_c = (_b = this.delegate.getElementImpl()) === null || _b === void 0 ? void 0 : _b._objectId) !== null && _c !== void 0 ? _c : '';
210
- }
211
- async highlight(highlightDurationMillis, highlightPhases) {
212
- await this.enableDom();
213
- await this.enableOverlay();
214
- const nodeInfo = await this.makeCDPCall('DOM.describeNode', {
215
- objectId: this.getRemoteObjectId(),
216
- depth: -1,
217
- pierce: true,
218
- });
219
- const highlightConfig = {
220
- backendNodeId: nodeInfo.node.backendNodeId,
221
- highlightConfig: {
222
- borderColor: (0, elementHandle_1.getHighlightColor)(0),
223
- contentColor: (0, elementHandle_1.getHighlightColor)(1),
224
- colorFormat: 'rgb',
225
- },
226
- };
227
- await this.fadeInOutHighlight(highlightConfig, highlightDurationMillis, highlightPhases);
228
- await this.hideHighlight();
232
+ highlight(highlightDurationMillis, highlightPhases) {
233
+ return this.delegate.highlight(highlightDurationMillis, highlightPhases);
229
234
  }
230
235
  async getValue() {
231
236
  return this.element.inputValue();
232
237
  }
233
- async fadeInOutHighlight(highlightConfig, highlightDurationMillis, highlightPhases) {
234
- var _a;
235
- if (highlightPhases <= 0) {
236
- throw new Error('Highlight phases must be greater than 0');
237
- }
238
- const phaseIntervalMilliseconds = highlightDurationMillis / highlightPhases;
239
- for (let iteration = 0; iteration < highlightPhases; iteration++) {
240
- if (((_a = highlightConfig.highlightConfig.contentColor) === null || _a === void 0 ? void 0 : _a.a) !== undefined) {
241
- const x = iteration / highlightPhases;
242
- highlightConfig.highlightConfig.contentColor.a =
243
- x * (1 - x) * 4 * elementHandle_1.MAX_HIGHLIGHT_OPACITY;
244
- }
245
- await this.makeCDPCall('Overlay.highlightNode', highlightConfig);
246
- await (0, testsUtil_1.sleep)(phaseIntervalMilliseconds);
247
- }
248
- }
249
- async enableDom() {
250
- await this.makeCDPCall('DOM.enable');
251
- }
252
- async enableOverlay() {
253
- await this.makeCDPCall('Overlay.enable');
254
- }
255
- async hideHighlight() {
256
- await this.makeCDPCall('Overlay.hideHighlight');
257
- }
258
238
  async makeCDPCall(method, paramArgs) {
259
239
  var _a;
260
240
  return ((_a = this.cdpSession) !== null && _a !== void 0 ? _a : this.page.getCDPSession()).send(method, paramArgs);
@@ -291,6 +271,9 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
291
271
  async isInShadowRoot() {
292
272
  return this.element.evaluate((el) => el.getRootNode().nodeName === '#document-fragment');
293
273
  }
274
+ focusAndSelect() {
275
+ return this.delegate.focusAndSelect(this);
276
+ }
294
277
  getActionTimeout(options) {
295
278
  var _a;
296
279
  const defaultTimeout = (options === null || options === void 0 ? void 0 : options.trial)
@@ -1,11 +1,47 @@
1
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
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
3
26
  exports.WebkitBrowserDelegate = void 0;
27
+ const playwright = __importStar(require("@playwright/test"));
4
28
  const webkitPageDelegate_1 = require("./webkitPageDelegate");
5
29
  const nonChromiumAbstractBrowserDelegate_1 = require("../nonChromium/nonChromiumAbstractBrowserDelegate");
6
30
  class WebkitBrowserDelegate extends nonChromiumAbstractBrowserDelegate_1.NonChromiumAbstractBrowserDelegate {
31
+ constructor(context) {
32
+ super();
33
+ this.context = context;
34
+ const contextImpl = playwright._toImpl(context);
35
+ this._browser = contextImpl._browser;
36
+ }
37
+ getBrowser() {
38
+ return this._browser;
39
+ }
7
40
  createPageDelegate(page) {
8
41
  return new webkitPageDelegate_1.WebkitPageDelegate(page);
9
42
  }
43
+ getCDPSession() {
44
+ return this._browser._connection.browserSession;
45
+ }
10
46
  }
11
47
  exports.WebkitBrowserDelegate = WebkitBrowserDelegate;
@@ -3,5 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WebkitElementHandleDelegate = void 0;
4
4
  const nonChromiumAbstractElementHandleDelegate_1 = require("../nonChromium/nonChromiumAbstractElementHandleDelegate");
5
5
  class WebkitElementHandleDelegate extends nonChromiumAbstractElementHandleDelegate_1.NonChromiumAbstractElementHandleDelegate {
6
+ async focusAndSelect(element) {
7
+ const frame = await element.frame();
8
+ return frame.evaluate((element) => {
9
+ var _a;
10
+ element.focus();
11
+ (_a = element.select) === null || _a === void 0 ? void 0 : _a.call(element);
12
+ return element.value;
13
+ }, element);
14
+ }
6
15
  }
7
16
  exports.WebkitElementHandleDelegate = WebkitElementHandleDelegate;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommandArgUrl = exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMablBranchChangesOnly = exports.CommandArgMablBranch = exports.CommandArgMablAutoLogin = exports.CommandArgMablAutoBranch = exports.CommandArgLinkBypass = exports.CommandArgLinkLabel = exports.CommandArgLimitOutput = exports.CommandArgLabels = exports.CommandArgLabelsInclude = exports.CommandArgLabelsExclude = exports.CommandArgTestInteractionSpeed = exports.CommandArgTestRunId = exports.CommandArgTestFile = exports.CommandArgId = exports.CommandArgUserAgent = exports.CommandArgHttpHeaders = exports.CommandArgHelp = exports.CommandArgFromPlanId = exports.CommandArgFrom = exports.CommandArgFormat = exports.CommandArgFastFailure = exports.CommandArgOverrideEnvironmentId = exports.CommandArgEnvironmentId = exports.CommandArgEnableLink = exports.CommandArgDetailLevel = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDataTables = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgApplicationId = exports.CommandArgApiKey = void 0;
4
- exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = void 0;
3
+ exports.CommandArgTrainerVersion = exports.CommandArgTo = exports.CommandArgSilent = exports.CommandArgRevision = exports.CommandArgMaxHeartbeatAge = exports.CommandArgPlanId = exports.CommandArgContentTypes = exports.CommandArgPreview = exports.CommandArgOutputFilePath = exports.CommandArgOutput = exports.CommandArgNoPrompt = exports.CommandArgPrompt = exports.CommandArgPortNumber = exports.CommandArgName = exports.CommandArgMablBranchChangesOnly = exports.CommandArgMablBranch = exports.CommandArgMablAutoLogin = exports.CommandArgMablAutoBranch = exports.CommandArgLinkBypass = exports.CommandArgLinkLabel = exports.CommandArgLimitOutput = exports.CommandArgLabels = exports.CommandArgLabelsInclude = exports.CommandArgLabelsExclude = exports.CommandArgTestInteractionSpeed = exports.CommandArgTestRunId = exports.CommandArgTestFile = exports.CommandArgInput = exports.CommandArgId = exports.CommandArgUserAgent = exports.CommandArgHttpHeaders = exports.CommandArgHelp = exports.CommandArgFromPlanId = exports.CommandArgFrom = exports.CommandArgFormat = exports.CommandArgFastFailure = exports.CommandArgOverrideEnvironmentId = exports.CommandArgEnvironmentId = exports.CommandArgEnableLink = exports.CommandArgDetailLevel = exports.CommandArgDescription = exports.CommandArgDeploymentId = exports.CommandArgDecrypt = exports.CommandArgDataTables = exports.CommandArgCredentials = exports.CommandArgBasicAuthCredentials = exports.CommandArgBrowsers = exports.CommandArgBrowser = exports.CommandArgApplicationId = exports.CommandArgApiKey = void 0;
4
+ exports.SCENARIO_NAME_HEADER = exports.ValidBrowserTypesForLocalRuns = exports.BrowserTypeSelections = exports.DefaultBrowserType = exports.DefaultBranchName = exports.DefaultOutputFormatChoices = exports.DetailLevelFormats = exports.ReporterOptions = exports.OutputFormats = exports.CommandArgAliases = exports.CommandArgBrowserEnableExtensions = exports.CommandArgBrowserIgnoreCertificateErrors = exports.CommandArgBrowserDisableIsolation = exports.ListTimeFormat = exports.CommandArgReporterOptions = exports.CommandArgReporter = exports.CommandArgWorkspaceId = exports.CommandArgVersion = exports.CommandArgVariables = exports.CommandArgUrlApi = exports.CommandArgUrlApp = exports.CommandArgUrl = void 0;
5
5
  const browserTypes_1 = require("./browserTypes");
6
6
  exports.CommandArgApiKey = 'api-key';
7
7
  exports.CommandArgApplicationId = 'application-id';
@@ -25,6 +25,7 @@ exports.CommandArgHelp = 'help';
25
25
  exports.CommandArgHttpHeaders = 'http-headers';
26
26
  exports.CommandArgUserAgent = 'user-agent';
27
27
  exports.CommandArgId = 'id';
28
+ exports.CommandArgInput = 'input';
28
29
  exports.CommandArgTestFile = 'test-file';
29
30
  exports.CommandArgTestRunId = 'run-id';
30
31
  exports.CommandArgTestInteractionSpeed = 'interaction-speed';
@@ -120,4 +121,6 @@ exports.ValidBrowserTypesForLocalRuns = [
120
121
  browserTypes_1.BrowserType.Chrome,
121
122
  browserTypes_1.BrowserType.Edge,
122
123
  browserTypes_1.BrowserType.Firefox,
124
+ browserTypes_1.BrowserType.Webkit,
123
125
  ];
126
+ exports.SCENARIO_NAME_HEADER = 'Scenario name';