@applitools/nml-client 1.0.4 → 1.1.1
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/dist/broker.js +4 -1
- package/dist/client.js +8 -4
- package/package.json +3 -2
- package/types/broker.d.ts +2 -1
- package/types/client.d.ts +10 -2
package/dist/broker.js
CHANGED
|
@@ -7,11 +7,13 @@ async function publishMessageRequest(options) {
|
|
|
7
7
|
method: 'POST',
|
|
8
8
|
body: options.payload,
|
|
9
9
|
headers: { 'Content-Type': 'application/json' },
|
|
10
|
+
proxy: options.proxy,
|
|
10
11
|
hooks: {
|
|
11
12
|
afterResponse: async (response) => {
|
|
12
13
|
if (response.response.status != 200)
|
|
13
14
|
return;
|
|
14
15
|
return (0, req_1.req)(options.url + '-response', {
|
|
16
|
+
proxy: options.proxy,
|
|
15
17
|
retry: [{ statuses: [404] }],
|
|
16
18
|
});
|
|
17
19
|
},
|
|
@@ -23,10 +25,11 @@ async function publishMessageRequest(options) {
|
|
|
23
25
|
return response;
|
|
24
26
|
}
|
|
25
27
|
exports.publishMessageRequest = publishMessageRequest;
|
|
26
|
-
async function broker(url, request) {
|
|
28
|
+
async function broker(url, request, options) {
|
|
27
29
|
const response = await publishMessageRequest({
|
|
28
30
|
url,
|
|
29
31
|
payload: request,
|
|
32
|
+
...options,
|
|
30
33
|
});
|
|
31
34
|
const { payload } = await response.json();
|
|
32
35
|
if (!payload || (payload && payload.error))
|
package/dist/client.js
CHANGED
|
@@ -27,24 +27,28 @@ exports.takeSnapshot = exports.takeScreenshot = void 0;
|
|
|
27
27
|
const broker_1 = require("./broker");
|
|
28
28
|
const utils = __importStar(require("@applitools/utils"));
|
|
29
29
|
async function takeScreenshot(url, options) {
|
|
30
|
+
if (options && options.logger)
|
|
31
|
+
options.logger.log('[nml-client]: takeScreenshot called with', url, options);
|
|
30
32
|
const request = {
|
|
31
33
|
protocolVersion: '1.0',
|
|
32
34
|
name: 'TAKE_SCREENSHOT',
|
|
33
35
|
key: utils.general.guid(),
|
|
34
|
-
payload: options,
|
|
36
|
+
payload: options && options.settings,
|
|
35
37
|
};
|
|
36
|
-
const { screenshotURL } = await (0, broker_1.broker)(url, request);
|
|
38
|
+
const { screenshotURL } = await (0, broker_1.broker)(url, request, { proxy: options && options.proxy });
|
|
37
39
|
return screenshotURL;
|
|
38
40
|
}
|
|
39
41
|
exports.takeScreenshot = takeScreenshot;
|
|
40
42
|
async function takeSnapshot(url, options) {
|
|
43
|
+
if (options && options.logger)
|
|
44
|
+
options.logger.log('[nml-client]: takeSnapshot called with', url, options);
|
|
41
45
|
const request = {
|
|
42
46
|
protocolVersion: '1.0',
|
|
43
47
|
name: 'TAKE_SNAPSHOT',
|
|
44
48
|
key: utils.general.guid(),
|
|
45
|
-
payload: options,
|
|
49
|
+
payload: options && options.settings,
|
|
46
50
|
};
|
|
47
|
-
const result = await (0, broker_1.broker)(url, request);
|
|
51
|
+
const result = await (0, broker_1.broker)(url, request, { proxy: options && options.proxy });
|
|
48
52
|
return result;
|
|
49
53
|
}
|
|
50
54
|
exports.takeSnapshot = takeSnapshot;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/nml-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Client to integrate the SDKs to the Native Mobile Library (NML)",
|
|
5
5
|
"homepage": "https://applitools.com",
|
|
6
6
|
"bugs": {
|
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@applitools/bongo": "^2.2.0",
|
|
54
54
|
"@applitools/scripts": "^1.1.0",
|
|
55
|
-
"@applitools/spec-driver-selenium": "^1.3.
|
|
55
|
+
"@applitools/spec-driver-selenium": "^1.3.19",
|
|
56
|
+
"@applitools/test-server": "^1.1.4",
|
|
56
57
|
"@applitools/test-utils": "^1.5.1",
|
|
57
58
|
"@types/mocha": "^9.1.1",
|
|
58
59
|
"@types/node": "12",
|
package/types/broker.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function publishMessageRequest(options: {
|
|
2
2
|
url: string;
|
|
3
3
|
payload: any;
|
|
4
|
+
proxy?: any;
|
|
4
5
|
}): Promise<any>;
|
|
5
6
|
declare type CommonSelector = {
|
|
6
7
|
type: string;
|
|
@@ -30,5 +31,5 @@ export interface BrokerRequest {
|
|
|
30
31
|
key: string;
|
|
31
32
|
payload: ScreenshotSettings | SnapshotSettings;
|
|
32
33
|
}
|
|
33
|
-
export declare function broker(url: string, request: BrokerRequest): Promise<any>;
|
|
34
|
+
export declare function broker(url: string, request: BrokerRequest, options?: any): Promise<any>;
|
|
34
35
|
export {};
|
package/types/client.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { ScreenshotSettings, SnapshotSettings } from './broker';
|
|
2
|
-
export declare function takeScreenshot(url: any, options?:
|
|
3
|
-
|
|
2
|
+
export declare function takeScreenshot(url: any, options?: {
|
|
3
|
+
settings?: ScreenshotSettings;
|
|
4
|
+
proxy?: any;
|
|
5
|
+
logger?: any;
|
|
6
|
+
}): Promise<string>;
|
|
7
|
+
export declare function takeSnapshot(url: string, options?: {
|
|
8
|
+
settings?: SnapshotSettings;
|
|
9
|
+
proxy?: any;
|
|
10
|
+
logger?: any;
|
|
11
|
+
}): Promise<any>;
|