@applitools/core 4.17.0 → 4.18.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/CHANGELOG.md +41 -0
- package/dist/automation/get-nml-client.js +12 -3
- package/dist/classic/core.js +1 -1
- package/dist/cli/cli.js +7 -0
- package/dist/core.js +1 -1
- package/dist/open-eyes.js +3 -0
- package/dist/troubleshoot/check-network.js +5 -1
- package/dist/troubleshoot/eyes.js +2 -2
- package/dist/troubleshoot/ufg.js +6 -4
- package/dist/ufg/core.js +1 -1
- package/dist/universal/core.js +3 -0
- package/package.json +12 -12
- package/types/automation/get-nml-client.d.ts +8 -5
- package/types/automation/types.d.ts +4 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.18.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.17.0...js/core@4.18.0) (2024-07-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* disable broker url cache ([#2428](https://github.com/Applitools-Dev/sdk/issues/2428)) ([cb8d5fe](https://github.com/Applitools-Dev/sdk/commit/cb8d5fefb13d3ab42984d2bd4d4ac3d4e10646b0))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* @applitools/driver bumped to 1.18.0
|
|
14
|
+
#### Features
|
|
15
|
+
|
|
16
|
+
* disable broker url cache ([#2428](https://github.com/Applitools-Dev/sdk/issues/2428)) ([cb8d5fe](https://github.com/Applitools-Dev/sdk/commit/cb8d5fefb13d3ab42984d2bd4d4ac3d4e10646b0))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* executing web script on mobile environment ([#2380](https://github.com/Applitools-Dev/sdk/issues/2380)) ([da2e551](https://github.com/Applitools-Dev/sdk/commit/da2e551e01082d3cc21b9da5b43e6680233c080d))
|
|
22
|
+
* @applitools/spec-driver-puppeteer bumped to 1.4.11
|
|
23
|
+
|
|
24
|
+
* @applitools/ufg-client bumped to 1.12.3
|
|
25
|
+
#### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* update makeUploadResource to include apiKey in the cache key ([#2411](https://github.com/Applitools-Dev/sdk/issues/2411)) ([4114c58](https://github.com/Applitools-Dev/sdk/commit/4114c58ec16fa855374b23810cef1e36d4bb53a7))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#### Performance Improvements
|
|
31
|
+
|
|
32
|
+
* trim file content when logging it ([#2437](https://github.com/Applitools-Dev/sdk/issues/2437)) ([02ec1f7](https://github.com/Applitools-Dev/sdk/commit/02ec1f79a323af2e89a7428b75212707c761d1ca))
|
|
33
|
+
* @applitools/spec-driver-webdriver bumped to 1.1.11
|
|
34
|
+
|
|
35
|
+
* @applitools/spec-driver-selenium bumped to 1.5.82
|
|
36
|
+
|
|
37
|
+
* @applitools/screenshoter bumped to 3.8.35
|
|
38
|
+
|
|
39
|
+
* @applitools/nml-client bumped to 1.8.9
|
|
40
|
+
|
|
41
|
+
* @applitools/ec-client bumped to 1.9.3
|
|
42
|
+
|
|
43
|
+
|
|
3
44
|
## [4.17.0](https://github.com/Applitools-Dev/sdk/compare/js/core@4.16.5...js/core@4.17.0) (2024-06-26)
|
|
4
45
|
|
|
5
46
|
|
|
@@ -4,12 +4,16 @@ exports.makeGetNMLClient = void 0;
|
|
|
4
4
|
const nml_client_1 = require("@applitools/nml-client");
|
|
5
5
|
const clients = new Map();
|
|
6
6
|
function makeGetNMLClient({ client, logger: mainLogger }) {
|
|
7
|
-
return
|
|
7
|
+
return {
|
|
8
|
+
getNMLClient,
|
|
9
|
+
clearNMLClientCache,
|
|
10
|
+
};
|
|
11
|
+
async function getNMLClient({ driver, settings, logger, }) {
|
|
8
12
|
if (client)
|
|
9
13
|
return client;
|
|
10
14
|
logger = logger.extend(mainLogger);
|
|
11
15
|
const { sessionId } = await driver.getDriverInfo();
|
|
12
|
-
const cacheKey = sessionId
|
|
16
|
+
const cacheKey = sessionId !== null && sessionId !== void 0 ? sessionId : driver.guid;
|
|
13
17
|
const clientFromCache = clients.get(cacheKey);
|
|
14
18
|
if (clientFromCache) {
|
|
15
19
|
return clientFromCache;
|
|
@@ -22,6 +26,11 @@ function makeGetNMLClient({ client, logger: mainLogger }) {
|
|
|
22
26
|
clients.set(cacheKey, nmlClient);
|
|
23
27
|
return nmlClient;
|
|
24
28
|
}
|
|
25
|
-
}
|
|
29
|
+
}
|
|
30
|
+
async function clearNMLClientCache(driver) {
|
|
31
|
+
const { sessionId } = await driver.getDriverInfo();
|
|
32
|
+
const cacheKey = sessionId !== null && sessionId !== void 0 ? sessionId : driver.guid;
|
|
33
|
+
clients.delete(cacheKey);
|
|
34
|
+
}
|
|
26
35
|
}
|
|
27
36
|
exports.makeGetNMLClient = makeGetNMLClient;
|
package/dist/classic/core.js
CHANGED
|
@@ -47,7 +47,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency, agentId = 'co
|
|
|
47
47
|
locate: (0, locate_1.makeLocate)({ spec, core, logger }),
|
|
48
48
|
locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
|
|
49
49
|
extractText: (0, extract_text_1.makeExtractText)({ spec, core, logger }),
|
|
50
|
-
|
|
50
|
+
...(0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
|
|
51
51
|
openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, core, logger }),
|
|
52
52
|
};
|
|
53
53
|
});
|
package/dist/cli/cli.js
CHANGED
|
@@ -31,6 +31,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
const core_server_1 = require("../universal/core-server");
|
|
32
32
|
const core_server_process_1 = require("../universal/core-server-process");
|
|
33
33
|
const logs_1 = require("../troubleshoot/logs");
|
|
34
|
+
const check_network_1 = require("../troubleshoot/check-network");
|
|
34
35
|
const yargs_1 = __importDefault(require("yargs"));
|
|
35
36
|
const utils = __importStar(require("@applitools/utils"));
|
|
36
37
|
yargs_1.default
|
|
@@ -142,5 +143,11 @@ yargs_1.default
|
|
|
142
143
|
console.log(JSON.stringify(logs, null, 2));
|
|
143
144
|
}
|
|
144
145
|
},
|
|
146
|
+
})
|
|
147
|
+
.command({
|
|
148
|
+
command: 'check-network',
|
|
149
|
+
handler: async () => {
|
|
150
|
+
await (0, check_network_1.checkNetwork)();
|
|
151
|
+
},
|
|
145
152
|
})
|
|
146
153
|
.wrap(yargs_1.default.terminalWidth()).argv;
|
package/dist/core.js
CHANGED
|
@@ -61,7 +61,7 @@ function makeCore({ spec, clients, base: defaultBase, concurrency = utils.genera
|
|
|
61
61
|
base: base,
|
|
62
62
|
getViewportSize: spec && (0, get_viewport_size_1.makeGetViewportSize)({ spec, logger }),
|
|
63
63
|
setViewportSize: spec && (0, set_viewport_size_1.makeSetViewportSize)({ spec, logger }),
|
|
64
|
-
|
|
64
|
+
...(0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
|
|
65
65
|
getECClient: (0, get_ec_client_1.makeGetECClient)({ logger }),
|
|
66
66
|
getAccountInfo: (0, get_account_info_1.makeGetAccountInfo)({ core, logger }),
|
|
67
67
|
// Note: `defaultBase` is passesd for `base`, and `cores` is not passed here on purpose, so that a manager will create its own base, which would apply the correct concurrency value that was passed to the manager.
|
package/dist/open-eyes.js
CHANGED
|
@@ -85,6 +85,9 @@ function makeOpenEyes({ type: defaultType = 'classic', clients, batch, removeDup
|
|
|
85
85
|
},
|
|
86
86
|
logger,
|
|
87
87
|
});
|
|
88
|
+
if (settings.disableBrokerUrlCache && driver) {
|
|
89
|
+
await core.clearNMLClientCache(driver);
|
|
90
|
+
}
|
|
88
91
|
const getTypedEyes = (0, get_typed_eyes_1.makeGetTypedEyes)({
|
|
89
92
|
type,
|
|
90
93
|
settings: settings,
|
|
@@ -65,9 +65,11 @@ async function checkNetwork({ stream = process.stdout, eyes = eyes_1.default, uf
|
|
|
65
65
|
const proxyMsg = '\nYour proxy seems to be blocking requests to Applitools. Please make sure the following command succeeds:';
|
|
66
66
|
if (curlRenderErr) {
|
|
67
67
|
printErr(proxyMsg, '\n', eyes.cmd, '\n');
|
|
68
|
+
throw new Error('Your proxy seems to be blocking requests to Applitools.');
|
|
68
69
|
}
|
|
69
70
|
else if (curlVgErr) {
|
|
70
71
|
printErr(proxyMsg, '\n', await ufg.getCmd());
|
|
72
|
+
throw new Error('Your proxy seems to be blocking requests to Applitools.');
|
|
71
73
|
}
|
|
72
74
|
async function doTest(func, name) {
|
|
73
75
|
const delimiterLength = 30 - name.length;
|
|
@@ -111,4 +113,6 @@ async function checkNetwork({ stream = process.stdout, eyes = eyes_1.default, uf
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
exports.checkNetwork = checkNetwork;
|
|
114
|
-
|
|
116
|
+
if (require.main === module) {
|
|
117
|
+
checkNetwork();
|
|
118
|
+
}
|
|
@@ -40,7 +40,7 @@ const validateRawAccountInfo = (res) => {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
const validateAccountInfo = (res) => {
|
|
43
|
-
if (!res || !res.
|
|
43
|
+
if (!res || !res.ufgServer || !res.ufgServer.accessToken || !res.uploadUrl) {
|
|
44
44
|
throw new Error(`bad render info result ${JSON.stringify(res)}`);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -59,7 +59,7 @@ exports.default = {
|
|
|
59
59
|
},
|
|
60
60
|
async testServer() {
|
|
61
61
|
const server = (0, core_base_1.makeCoreRequestsWithCache)();
|
|
62
|
-
const result = await server.getAccountInfo({ settings: utils_1.config });
|
|
62
|
+
const result = await server.getAccountInfo({ settings: { eyesServerUrl: utils_1.config.serverUrl, ...utils_1.config } });
|
|
63
63
|
validateAccountInfo(result);
|
|
64
64
|
},
|
|
65
65
|
testHttps: async () => {
|
package/dist/troubleshoot/ufg.js
CHANGED
|
@@ -35,13 +35,15 @@ const utils_1 = require("./utils");
|
|
|
35
35
|
const eyes_1 = require("./eyes");
|
|
36
36
|
const utils = __importStar(require("@applitools/utils"));
|
|
37
37
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
38
|
-
const
|
|
39
|
-
const
|
|
38
|
+
const rawValue = JSON.stringify({ resources: {}, domNodes: [] });
|
|
39
|
+
const encodedValue = new TextEncoder().encode(rawValue);
|
|
40
|
+
const hash = (0, crypto_1.createHash)('sha256').update(encodedValue).digest('hex');
|
|
40
41
|
const contentType = 'x-applitools-html/cdt';
|
|
41
42
|
const resource = {
|
|
42
43
|
id: 'id',
|
|
43
44
|
url: 'https://localhost:2107',
|
|
44
|
-
value,
|
|
45
|
+
value: encodedValue,
|
|
46
|
+
rawValue: rawValue,
|
|
45
47
|
hash: { hashFormat: 'sha256', hash, contentType },
|
|
46
48
|
contentType,
|
|
47
49
|
};
|
|
@@ -55,7 +57,7 @@ const accessTokenPromise = new Promise(async (resolve) => {
|
|
|
55
57
|
throw new Error('could not receive auth token since cURL command to get it failed.');
|
|
56
58
|
resolve(accessToken);
|
|
57
59
|
});
|
|
58
|
-
const getCmd = async () => `curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: ${await accessTokenPromise}" -d '${resource.
|
|
60
|
+
const getCmd = async () => `curl -X PUT -H "Content-Type: application/json" -H "X-Auth-Token: ${await accessTokenPromise}" -d '${resource.rawValue}' ${UFG_PUT_RESOURCE_URL} ${(0, utils_1.getProxyCurlArg)()}`;
|
|
59
61
|
exports.getCmd = getCmd;
|
|
60
62
|
const validateVgResult = (res, sha) => {
|
|
61
63
|
if (!res || res.hash !== sha) {
|
package/dist/ufg/core.js
CHANGED
|
@@ -51,7 +51,7 @@ function makeCore({ spec, clients, base: defaultBase, asyncCache, concurrency, f
|
|
|
51
51
|
locateText: (0, locate_text_1.makeLocateText)({ spec, core, logger }),
|
|
52
52
|
extractText: (0, extract_text_1.makeExtractText)({ spec, core, logger }),
|
|
53
53
|
getUFGClient: (0, get_ufg_client_1.makeGetUFGClient)({ client: clients === null || clients === void 0 ? void 0 : clients.ufg, fetchConcurrency, asyncCache, logger }),
|
|
54
|
-
|
|
54
|
+
...(0, get_nml_client_1.makeGetNMLClient)({ client: clients === null || clients === void 0 ? void 0 : clients.nml, logger }),
|
|
55
55
|
openEyes: (0, open_eyes_1.makeOpenEyes)({ spec, core, logger }),
|
|
56
56
|
};
|
|
57
57
|
});
|
package/dist/universal/core.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.18.0",
|
|
4
4
|
"homepage": "https://applitools.com",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
44
|
"lint": "run --top-level eslint '**/*.ts'",
|
|
45
|
-
"build": "yarn build:dist",
|
|
45
|
+
"build": "yarn build:dist && yarn build:bin",
|
|
46
|
+
"build:short": "yarn build:dist",
|
|
46
47
|
"build:dist": "run --top-level tsc --project ./tsconfig.build.json",
|
|
47
48
|
"build:bin": "sea",
|
|
48
49
|
"build:bin:zip": "zip -j ./bin/core.zip $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
49
50
|
"build:bin:tgz": "tar -czf ./bin/core.tar.gz $(find ./bin -type f -not -name '*.zip' -not -name '*.tar.gz' | xargs)",
|
|
50
|
-
"build:full": "yarn build:dist && yarn build:bin",
|
|
51
51
|
"test": "run --top-level mocha './test/**/*.spec.ts' --exclude './test/bin/**' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
52
52
|
"test:local": "MOCHA_OMIT_TAGS=sauce run test",
|
|
53
53
|
"test:sauce": "MOCHA_ONLY_TAGS=sauce run test",
|
|
@@ -77,16 +77,16 @@
|
|
|
77
77
|
"@applitools/core-base": "1.16.0",
|
|
78
78
|
"@applitools/dom-capture": "11.3.0",
|
|
79
79
|
"@applitools/dom-snapshot": "4.11.3",
|
|
80
|
-
"@applitools/driver": "1.
|
|
81
|
-
"@applitools/ec-client": "1.9.
|
|
80
|
+
"@applitools/driver": "1.18.0",
|
|
81
|
+
"@applitools/ec-client": "1.9.3",
|
|
82
82
|
"@applitools/logger": "2.0.18",
|
|
83
|
-
"@applitools/nml-client": "1.8.
|
|
83
|
+
"@applitools/nml-client": "1.8.9",
|
|
84
84
|
"@applitools/req": "1.7.2",
|
|
85
|
-
"@applitools/screenshoter": "3.8.
|
|
85
|
+
"@applitools/screenshoter": "3.8.35",
|
|
86
86
|
"@applitools/snippets": "2.4.27",
|
|
87
87
|
"@applitools/socket": "1.1.18",
|
|
88
|
-
"@applitools/spec-driver-webdriver": "1.1.
|
|
89
|
-
"@applitools/ufg-client": "1.12.
|
|
88
|
+
"@applitools/spec-driver-webdriver": "1.1.11",
|
|
89
|
+
"@applitools/ufg-client": "1.12.3",
|
|
90
90
|
"@applitools/utils": "1.7.4",
|
|
91
91
|
"@types/ws": "8.5.5",
|
|
92
92
|
"abort-controller": "3.0.0",
|
|
@@ -94,14 +94,14 @@
|
|
|
94
94
|
"node-fetch": "2.6.7",
|
|
95
95
|
"semver": "7.6.2",
|
|
96
96
|
"webdriver": "7.31.1",
|
|
97
|
-
"ws": "8.
|
|
97
|
+
"ws": "8.17.1",
|
|
98
98
|
"yargs": "17.7.2"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@applitools/bongo": "^5.10.0",
|
|
102
102
|
"@applitools/sea": "^1.0.0",
|
|
103
|
-
"@applitools/spec-driver-puppeteer": "^1.4.
|
|
104
|
-
"@applitools/spec-driver-selenium": "^1.5.
|
|
103
|
+
"@applitools/spec-driver-puppeteer": "^1.4.11",
|
|
104
|
+
"@applitools/spec-driver-selenium": "^1.5.82",
|
|
105
105
|
"@applitools/test-server": "^1.2.2",
|
|
106
106
|
"@applitools/test-utils": "^1.5.17",
|
|
107
107
|
"@applitools/tunnel-client": "^1.5.7",
|
|
@@ -5,9 +5,12 @@ type Options = {
|
|
|
5
5
|
client?: NMLClient;
|
|
6
6
|
logger: Logger;
|
|
7
7
|
};
|
|
8
|
-
export declare function makeGetNMLClient({ client, logger: mainLogger }: Options):
|
|
9
|
-
driver:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export declare function makeGetNMLClient({ client, logger: mainLogger }: Options): {
|
|
9
|
+
getNMLClient: ({ driver, settings, logger, }: {
|
|
10
|
+
driver: Driver<SpecType>;
|
|
11
|
+
settings: Omit<NMLClientSettings, 'brokerUrl'>;
|
|
12
|
+
logger: Logger;
|
|
13
|
+
}) => Promise<NMLClient>;
|
|
14
|
+
clearNMLClientCache: (driver: Driver<SpecType>) => Promise<void>;
|
|
15
|
+
};
|
|
13
16
|
export {};
|
|
@@ -62,6 +62,7 @@ export interface Core<TSpec extends SpecType> extends Omit<BaseCore.Core, 'openE
|
|
|
62
62
|
driver: Driver<TSpec>;
|
|
63
63
|
logger: Logger;
|
|
64
64
|
}): Promise<NMLClient>;
|
|
65
|
+
clearNMLClientCache(driver: Driver<TSpec>): Promise<void>;
|
|
65
66
|
openEyes(options: {
|
|
66
67
|
target?: DriverTarget<TSpec>;
|
|
67
68
|
settings: BaseCore.OpenSettings;
|
|
@@ -163,3 +164,6 @@ export type AbortSettings = BaseCore.AbortSettings & {
|
|
|
163
164
|
export type TestResult = BaseCore.TestResult & {
|
|
164
165
|
readonly environment: ExactEnvironment;
|
|
165
166
|
};
|
|
167
|
+
export type OpenSettings = BaseCore.OpenSettings & {
|
|
168
|
+
disableBrokerUrlCache?: boolean;
|
|
169
|
+
};
|