@mablhq/mabl-cli 2.51.18 → 2.51.28
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/browserLauncher/index.js +1 -1
- package/commands/tests/testsUtil.js +4 -0
- package/commands/tests/tests_cmds/run-cloud.js +9 -3
- package/core/execution/ApiTestUtils.js +63 -8
- package/core/execution/PostmanUtils.js +3 -2
- package/core/execution/VariableUtils.js +6 -4
- package/core/execution/newman-types.js +1 -0
- package/core/trainer/trainingSessions.js +3 -0
- package/execution/index.js +1 -1
- package/index.d.ts +119 -11
- package/package.json +1 -1
- package/proxy/index.js +1 -1
- package/socketTunnel/index.js +1 -1
- package/upload/index.js +1 -1
- package/util/rbacUtils.js +15 -0
- package/util/runUtil.js +15 -0
- package/util/testUtil.js +24 -0
package/index.d.ts
CHANGED
|
@@ -145,19 +145,42 @@ export declare enum MobilePlatformEnum {
|
|
|
145
145
|
Ios = 'ios',
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
/**
|
|
149
|
+
* Options for the MablToolset
|
|
150
|
+
*/
|
|
150
151
|
export interface MablToolsetOptions {
|
|
152
|
+
/** an API key to use to authenticate the MablApiClient */
|
|
151
153
|
apiKey: string;
|
|
154
|
+
/** A playwright browser context to use */
|
|
152
155
|
browserContext?: BrowserContext;
|
|
156
|
+
/** The workspace ID to use with the mabl tools, if not supplied an API request will be attempted to determine the correct ID */
|
|
153
157
|
workspaceId?: string;
|
|
158
|
+
/** The Playwright test */
|
|
154
159
|
test: TestType<any, any>;
|
|
155
160
|
}
|
|
156
161
|
|
|
162
|
+
/**
|
|
163
|
+
* The response from the gen AI assertion.
|
|
164
|
+
*/
|
|
157
165
|
export interface GenAiAssertionResponse {
|
|
166
|
+
/**
|
|
167
|
+
* Whether the assertion passed or failed
|
|
168
|
+
*/
|
|
158
169
|
success: boolean;
|
|
170
|
+
/**
|
|
171
|
+
* The explanation for the assertion
|
|
172
|
+
*/
|
|
159
173
|
explanation?: string;
|
|
174
|
+
/**
|
|
175
|
+
* The summary of the assertion
|
|
176
|
+
*/
|
|
177
|
+
summary?: string;
|
|
178
|
+
/**
|
|
179
|
+
* The criteria for the assertion
|
|
180
|
+
*/
|
|
181
|
+
assertionCriteria?: string[];
|
|
160
182
|
}
|
|
183
|
+
|
|
161
184
|
export interface DatabaseQueryParameter {
|
|
162
185
|
id?: string;
|
|
163
186
|
type: 'String' | 'Number' | 'Boolean';
|
|
@@ -183,24 +206,73 @@ export interface DatabaseQueryResultSet {
|
|
|
183
206
|
}>;
|
|
184
207
|
}
|
|
185
208
|
|
|
209
|
+
/**
|
|
210
|
+
* The MablToolset is set of mabl features that can be used in Playwright tests
|
|
211
|
+
*/
|
|
186
212
|
export interface MablToolset {
|
|
187
213
|
constructor(options: MablToolsetOptions);
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Evaluates a gen AI prompt against the current state of the browser or specified element and returns the result of the evaluation.
|
|
217
|
+
* @param page The page to evaluate the gen AI prompt against
|
|
218
|
+
* @param prompt The gen AI prompt to evaluate
|
|
219
|
+
* @param locator optional element to run the prompt against, the bounding box of the element will be used to produce the screenshot used in the assertion
|
|
220
|
+
* @returns
|
|
221
|
+
*/
|
|
188
222
|
evaluateGenAiAssertion(
|
|
189
|
-
|
|
190
|
-
page: any,
|
|
223
|
+
page: Page,
|
|
191
224
|
prompt: string,
|
|
192
225
|
locator?: Locator,
|
|
193
226
|
): Promise<GenAiAssertionResponse>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Initializes the mabl tooling and execution context to work with the provided Playwright BrowserContext
|
|
230
|
+
* @param browserContext the Playwright BrowserContext to use with the MablTools
|
|
231
|
+
*/
|
|
194
232
|
initializeContext(browserContext: BrowserContext): Promise<void>;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Calls into the mabl API to create a new email address that can be used to receive emails during the external test run.
|
|
236
|
+
* @returns a new email address that can be used to receive emails
|
|
237
|
+
*/
|
|
195
238
|
createMailBoxAddress(): Promise<string>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Run an email find action to locate an email that matches the provided email descriptor.
|
|
242
|
+
* @param emailAddress the email address to wait for
|
|
243
|
+
* @param page the page to wait for the email on
|
|
244
|
+
* @param emailFindOptions optional options to use in locating the email
|
|
245
|
+
* @returns a URL that can be used to open the email in a browser
|
|
246
|
+
*/
|
|
196
247
|
waitForEmail(
|
|
197
248
|
emailAddress: string,
|
|
198
249
|
page: Page | Frame,
|
|
199
250
|
emailFindOptions?: EmailFindOptions,
|
|
200
251
|
): Promise<MablMailboxEmail>;
|
|
201
|
-
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Get a the username/password from a mabl credential to use in a playwright test
|
|
255
|
+
* @param credentialId The ID of the credential to get
|
|
256
|
+
* @returns The username/password credential
|
|
257
|
+
*/
|
|
202
258
|
getCredentials(credentialsId: string): Promise<UsernamePasswordCredential>;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Get an MFA code for a credential
|
|
262
|
+
* @param credentialId The ID of the credential to get the MFA code for
|
|
263
|
+
* @returns The MFA code
|
|
264
|
+
*/
|
|
203
265
|
getMfaCode(credentialsId: string): Promise<string>;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Executes a database query
|
|
269
|
+
* @param dbConnectionId The ID of the database connection to use
|
|
270
|
+
* @param query The query to execute
|
|
271
|
+
* @param queryParameters Optional parameters to use in the query
|
|
272
|
+
* @param environmentId Optional environment ID to use in the query
|
|
273
|
+
* @param timeoutMillis Optional timeout in milliseconds for the query
|
|
274
|
+
* @returns The result of the query
|
|
275
|
+
*/
|
|
204
276
|
executeQuery(
|
|
205
277
|
dbConnectionId: string,
|
|
206
278
|
query: string,
|
|
@@ -208,6 +280,12 @@ export interface MablToolset {
|
|
|
208
280
|
environmentId?: string,
|
|
209
281
|
timeoutMillis?: number,
|
|
210
282
|
): Promise<DatabaseQueryResultSet>;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Opens a PDF file in the supplied Page for use in Playwright
|
|
286
|
+
* @param filePath The path to the PDF file to open
|
|
287
|
+
* @param page The page to open the PDF file in
|
|
288
|
+
*/
|
|
211
289
|
openPdfFile(filePath: string, page: Page): Promise<void>;
|
|
212
290
|
}
|
|
213
291
|
|
|
@@ -247,16 +325,46 @@ export interface EmailFindOptions {
|
|
|
247
325
|
timeoutMillis?: number;
|
|
248
326
|
}
|
|
249
327
|
|
|
328
|
+
/**
|
|
329
|
+
* A username and password credential
|
|
330
|
+
*/
|
|
250
331
|
export interface UsernamePasswordCredential {
|
|
332
|
+
/**
|
|
333
|
+
* The username for the credential
|
|
334
|
+
*/
|
|
251
335
|
username: string;
|
|
336
|
+
/**
|
|
337
|
+
* The password for the credential
|
|
338
|
+
*/
|
|
252
339
|
password: string;
|
|
253
340
|
}
|
|
254
341
|
|
|
342
|
+
/**
|
|
343
|
+
* A mailbox email
|
|
344
|
+
*/
|
|
255
345
|
export interface MablMailboxEmail {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
346
|
+
/**
|
|
347
|
+
* The URL to access to the email preview.
|
|
348
|
+
*/
|
|
349
|
+
readonly emailUrl: string;
|
|
350
|
+
/**
|
|
351
|
+
* The page the email is on
|
|
352
|
+
*/
|
|
353
|
+
readonly page: Page;
|
|
354
|
+
/**
|
|
355
|
+
* The locator in the email preview for the to address of the email.
|
|
356
|
+
*/
|
|
357
|
+
readonly toAddress: Locator;
|
|
358
|
+
/**
|
|
359
|
+
* The locator for the subject of the email
|
|
360
|
+
*/
|
|
361
|
+
readonly subject: Locator;
|
|
362
|
+
/**
|
|
363
|
+
* The locator in the email preview for the body of the email.
|
|
364
|
+
*/
|
|
365
|
+
readonly body: Locator;
|
|
366
|
+
/**
|
|
367
|
+
* The locator in the email preview for the from address of the email.
|
|
368
|
+
*/
|
|
369
|
+
readonly fromAddress: Locator;
|
|
262
370
|
}
|