@mablhq/mabl-cli 2.46.4 → 2.49.0
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/api/mablApiClient.js +27 -14
- package/commands/test-runs/test-runs_cmds/export.js +1 -0
- package/core/entityValidation/stepValidation.js +15 -0
- package/core/execution/ApiTestUtils.js +16 -1
- package/domUtil/index.js +1 -1
- package/execution/index.js +3 -3
- package/http/httpUtil.js +26 -7
- package/index.d.ts +5 -1
- package/mablApi/index.js +1 -1
- package/mablscript/actions/ConditionAction.js +9 -1
- package/mablscript/actions/GetViewportAction.js +17 -0
- package/mablscript/steps/AssertStep.js +27 -6
- package/mablscript/steps/AssertStepOld.js +4 -1
- package/mablscript/types/ConditionDescriptor.js +2 -0
- package/mablscript/types/GetViewportDescriptor.js +12 -0
- package/mablscriptFind/index.js +1 -1
- package/package.json +1 -1
- package/resources/mablFind.js +1 -1
- package/upload/index.js +1 -1
- package/util/analytics-events.js +1 -0
package/http/httpUtil.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.postProcessHeaders = exports.getHttpAgent = exports.GENERAL_API_STEP_EXECUTION_ERROR_CODE = exports.EXECUTION_ENGINE_SSL_VERIFY = exports.USER_AGENT_HEADER = exports.USER_AGENT = void 0;
|
|
4
|
+
const agent_base_1 = require("agent-base");
|
|
4
5
|
const socks_proxy_agent_1 = require("socks-proxy-agent");
|
|
5
6
|
const pureUtil_1 = require("../util/pureUtil");
|
|
6
7
|
const MablHttpAgent_1 = require("./MablHttpAgent");
|
|
@@ -9,8 +10,8 @@ exports.USER_AGENT = `${(0, pureUtil_1.getCliName)()}@${(0, pureUtil_1.getCliVer
|
|
|
9
10
|
exports.USER_AGENT_HEADER = 'User-Agent';
|
|
10
11
|
exports.EXECUTION_ENGINE_SSL_VERIFY = false;
|
|
11
12
|
exports.GENERAL_API_STEP_EXECUTION_ERROR_CODE = '-1';
|
|
12
|
-
function getHttpAgent(shouldFilterHttpRequests,
|
|
13
|
-
const linkAgent = maybeGetSocksAgent(
|
|
13
|
+
function getHttpAgent(shouldFilterHttpRequests, linkServers, proxyConfig) {
|
|
14
|
+
const linkAgent = maybeGetSocksAgent(linkServers);
|
|
14
15
|
if (linkAgent) {
|
|
15
16
|
return MablHttpAgent_1.MablHttpAgent.createNewInstance({
|
|
16
17
|
httpAgent: linkAgent,
|
|
@@ -23,11 +24,11 @@ function getHttpAgent(shouldFilterHttpRequests, linkServer, proxyConfig) {
|
|
|
23
24
|
return MablHttpAgent_1.MablHttpAgent.createNewInstance({ proxyConfig });
|
|
24
25
|
}
|
|
25
26
|
exports.getHttpAgent = getHttpAgent;
|
|
26
|
-
function maybeGetSocksAgent(
|
|
27
|
-
if (!
|
|
27
|
+
function maybeGetSocksAgent(linkServers) {
|
|
28
|
+
if (!(linkServers === null || linkServers === void 0 ? void 0 : linkServers.length)) {
|
|
28
29
|
return;
|
|
29
30
|
}
|
|
30
|
-
const agentOptions = {
|
|
31
|
+
const agentOptions = linkServers.map((linkServer) => ({
|
|
31
32
|
host: linkServer.forwarding_host,
|
|
32
33
|
port: linkServer.forwarding_port,
|
|
33
34
|
userId: linkServer.workspace_id,
|
|
@@ -35,8 +36,26 @@ function maybeGetSocksAgent(linkServer) {
|
|
|
35
36
|
tls: {
|
|
36
37
|
rejectUnauthorized: false,
|
|
37
38
|
},
|
|
38
|
-
};
|
|
39
|
-
|
|
39
|
+
}));
|
|
40
|
+
if (agentOptions.length === 1) {
|
|
41
|
+
return new socks_proxy_agent_1.SocksProxyAgent(agentOptions[0]);
|
|
42
|
+
}
|
|
43
|
+
return new MultiSocksProxyAgent(agentOptions);
|
|
44
|
+
}
|
|
45
|
+
class MultiSocksProxyAgent extends agent_base_1.Agent {
|
|
46
|
+
constructor(options) {
|
|
47
|
+
super();
|
|
48
|
+
this.agents = options.map((proxy) => new socks_proxy_agent_1.SocksProxyAgent(proxy));
|
|
49
|
+
}
|
|
50
|
+
async callback(req, opts) {
|
|
51
|
+
return this.selectAgent().callback(req, opts);
|
|
52
|
+
}
|
|
53
|
+
selectAgent() {
|
|
54
|
+
return this.agents[Math.floor(Math.random() * this.agents.length)];
|
|
55
|
+
}
|
|
56
|
+
destroy() {
|
|
57
|
+
this.agents.forEach((agent) => agent.destroy());
|
|
58
|
+
}
|
|
40
59
|
}
|
|
41
60
|
function postProcessHeaders(response) {
|
|
42
61
|
var _a, _b, _c;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {BrowserContext, Locator, Page, Frame} from 'playwright-core';
|
|
2
|
+
import {TestType} from '@playwright/test';
|
|
2
3
|
|
|
3
4
|
declare module '@mablhq/mabl-cli' {
|
|
4
5
|
export enum TestResultStatus {
|
|
@@ -147,8 +148,10 @@ export declare enum MobilePlatformEnum {
|
|
|
147
148
|
// Playwright external tool types
|
|
148
149
|
|
|
149
150
|
export interface MablToolsetOptions {
|
|
151
|
+
apiKey: string;
|
|
150
152
|
browserContext?: BrowserContext;
|
|
151
153
|
workspaceId?: string;
|
|
154
|
+
test: TestType<any, any>;
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
export interface GenAiAssertionResponse {
|
|
@@ -181,7 +184,7 @@ export interface DatabaseQueryResultSet {
|
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
export interface MablToolset {
|
|
184
|
-
constructor(options
|
|
187
|
+
constructor(options: MablToolsetOptions);
|
|
185
188
|
evaluateGenAiAssertion(
|
|
186
189
|
// TODO this is any because it needs to align with the @playwright/test package's Page and we don't have that as a dependency of the CLI right now
|
|
187
190
|
page: any,
|
|
@@ -205,6 +208,7 @@ export interface MablToolset {
|
|
|
205
208
|
environmentId?: string,
|
|
206
209
|
timeoutMillis?: number,
|
|
207
210
|
): Promise<DatabaseQueryResultSet>;
|
|
211
|
+
openPdfFile(filePath: string, page: Page): Promise<void>;
|
|
208
212
|
}
|
|
209
213
|
|
|
210
214
|
export interface MablFixtures {
|