@mablhq/mabl-cli 1.48.22 → 1.48.35

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.
@@ -201,9 +201,13 @@ class MablApiClient extends basicApiClient_1.BasicApiClient {
201
201
  throw toApiError(`Failed to get credentials`, error);
202
202
  }
203
203
  }
204
- async getCredential(credentialId) {
204
+ async getCredential(credentialId, withSecrets, withComputedTotpCount) {
205
+ const queryStringParams = queryString.stringify({
206
+ with_secrets: withSecrets,
207
+ with_computed_totp_count: withComputedTotpCount,
208
+ });
205
209
  try {
206
- return await this.makeGetRequest(`${this.baseApiUrl}/credentials/${credentialId}`);
210
+ return await this.makeGetRequest(`${this.baseApiUrl}/credentials/${credentialId}?${queryStringParams}`);
207
211
  }
208
212
  catch (error) {
209
213
  throw toApiError(`Failed to get credential`, error);
@@ -38,6 +38,9 @@ class ChromiumElementHandleDelegate {
38
38
  (0, logUtils_1.logInternal)(`Unable to get the element handle's implementation. Error: ${e}`);
39
39
  }
40
40
  }
41
+ getInnerText() {
42
+ return this.elementHandle.evaluate((el) => el.innerText);
43
+ }
41
44
  focusAndSelect(element) {
42
45
  return (0, elementHandle_1.commonFocusAndSelect)(element);
43
46
  }
@@ -116,13 +116,17 @@ class ChromiumPageDelegate {
116
116
  }
117
117
  async enableScreencastMode() {
118
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', {});
119
+ const cdp = await this.createCDPSession();
120
+ if (cdp) {
121
+ cdp.on('Page.screencastFrame', async (params) => {
122
+ await cdp
123
+ .send('Page.screencastFrameAck', { sessionId: params.sessionId })
124
+ .catch(() => { });
125
+ });
126
+ await cdp.send('Page.startScreencast', {
127
+ everyNthFrame: 100,
128
+ });
129
+ }
126
130
  }
127
131
  catch (e) {
128
132
  (0, logUtils_1.logInternal)(`Unable to enable screencast mode. No CDP session found. Error: ${e}`);
@@ -35,6 +35,17 @@ class NonChromiumAbstractElementHandleDelegate {
35
35
  catch {
36
36
  }
37
37
  }
38
+ getInnerText() {
39
+ return this.elementHandle.evaluate((el) => {
40
+ if (el.tagName.toUpperCase() === 'SELECT') {
41
+ return Array.from(el.options)
42
+ .filter((option) => { var _a; return (_a = option.text) === null || _a === void 0 ? void 0 : _a.trim(); })
43
+ .map((option) => option.text)
44
+ .join('\n');
45
+ }
46
+ return el.innerText;
47
+ });
48
+ }
38
49
  highlight(_highlightDurationMillis, _highlightPhases) {
39
50
  (0, logUtils_1.logInternal)('Highlighting is not supported on non-chromium browsers.');
40
51
  return Promise.resolve();
@@ -42,24 +53,21 @@ class NonChromiumAbstractElementHandleDelegate {
42
53
  getElementImpl() {
43
54
  return this.elementImpl;
44
55
  }
45
- checkCDPSession() {
46
- var _a, _b, _c;
56
+ getCDPSession() {
57
+ var _a, _b, _c, _d, _e, _f;
58
+ const session = (_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._session;
47
59
  if (this.elementImpl === undefined) {
48
60
  (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.`);
49
61
  }
50
- else if (this.getCDPSession() === undefined) {
51
- const undefinedField = ((_b = (_a = this.elementImpl) === null || _a === void 0 ? void 0 : _a._context) === null || _b === void 0 ? void 0 : _b._delegate) !== undefined
62
+ else if (session === undefined) {
63
+ const undefinedField = ((_e = (_d = this.elementImpl) === null || _d === void 0 ? void 0 : _d._context) === null || _e === void 0 ? void 0 : _e._delegate) !== undefined
52
64
  ? '_client'
53
- : ((_c = this.elementImpl) === null || _c === void 0 ? void 0 : _c._context) !== undefined
65
+ : ((_f = this.elementImpl) === null || _f === void 0 ? void 0 : _f._context) !== undefined
54
66
  ? '_delegate'
55
67
  : '_context';
56
68
  (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.`);
57
69
  }
58
- }
59
- getCDPSession() {
60
- var _a, _b, _c;
61
- this.checkCDPSession();
62
- 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._session;
70
+ return session;
63
71
  }
64
72
  }
65
73
  exports.NonChromiumAbstractElementHandleDelegate = NonChromiumAbstractElementHandleDelegate;
@@ -91,7 +91,11 @@ class PlaywrightBrowser extends events_1.default {
91
91
  return Promise.resolve(this);
92
92
  }
93
93
  async newPage() {
94
- return this.getOrCreatePage(await this.defaultContext.newPage());
94
+ const page = await this.getOrCreatePage(await this.defaultContext.newPage());
95
+ if (this.defaultViewportSize) {
96
+ await page.setViewport(this.defaultViewportSize);
97
+ }
98
+ return page;
95
99
  }
96
100
  isConnected() {
97
101
  return this.browserDelegate.getBrowser().isConnected();
@@ -161,6 +165,11 @@ class PlaywrightBrowser extends events_1.default {
161
165
  supportsTracing() {
162
166
  return this.browserDelegate.supportsTracing();
163
167
  }
168
+ maybeSetDefaultViewportSize(viewport) {
169
+ if (!this.defaultViewportSize) {
170
+ this.defaultViewportSize = viewport;
171
+ }
172
+ }
164
173
  }
165
174
  exports.PlaywrightBrowser = PlaywrightBrowser;
166
175
  function getBrowserDelegate(browserType, browserContext) {
@@ -251,7 +251,7 @@ class PlaywrightElementHandle extends PlaywrightJsHandle {
251
251
  return innerText ? innerText : this.getSlotText();
252
252
  }
253
253
  async getInnerText() {
254
- const result = await this.element.evaluate((el) => el.innerText);
254
+ const result = await this.delegate.getInnerText();
255
255
  return (0, pureUtil_1.isNullish)(result) ? undefined : result;
256
256
  }
257
257
  async getSlotText() {
@@ -302,6 +302,7 @@ class PlaywrightPage extends events_1.default {
302
302
  }
303
303
  async setViewport(viewport) {
304
304
  try {
305
+ this.browser.maybeSetDefaultViewportSize(viewport);
305
306
  await this.page.setViewportSize(viewport);
306
307
  await this.delegate.setBrowserBounds(viewport.width, viewport.height);
307
308
  }
@@ -334,8 +335,8 @@ class PlaywrightPage extends events_1.default {
334
335
  async waitForSelector(selector, options) {
335
336
  return (0, utils_1.mapIfNotNull)(await this.page.waitForSelector(selector, options), (handle) => new playwrightDom_1.PlaywrightElementHandle(handle, this, this.delegate.createElementHandleDelegate(handle)));
336
337
  }
337
- acceptDialogs(dialog) {
338
- return dialog.accept();
338
+ async acceptDialogs(dialog) {
339
+ await dialog.accept();
339
340
  }
340
341
  opener() {
341
342
  return this.openerPage;