@applitools/ec-client 1.6.1 → 1.7.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 CHANGED
@@ -1,5 +1,63 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.7.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/ec-client@1.6.2...js/ec-client@1.7.0) (2023-07-13)
4
+
5
+
6
+ ### Features
7
+
8
+ * added internal function to prepare environment before running tunnels ([3d19ec3](https://github.com/applitools/eyes.sdk.javascript1/commit/3d19ec3b274702ffdf26b766b7351ec1f4b66a6d))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * @applitools/driver bumped from 1.13.0 to 1.13.1
14
+ #### Bug Fixes
15
+
16
+ * replaced NML prefixed appium env vars with APPLITOOLS prefixed ([8905b90](https://github.com/applitools/eyes.sdk.javascript1/commit/8905b90e7c4ec6e310f6e52c03bbcc7acf1ff2ab))
17
+ * @applitools/tunnel-client bumped from 1.0.2 to 1.1.0
18
+ #### Features
19
+
20
+ * added internal function to prepare environment before running tunnels ([3d19ec3](https://github.com/applitools/eyes.sdk.javascript1/commit/3d19ec3b274702ffdf26b766b7351ec1f4b66a6d))
21
+
22
+
23
+ #### Bug Fixes
24
+
25
+ * prevent tunnel binaries from overriding itself ([5609a36](https://github.com/applitools/eyes.sdk.javascript1/commit/5609a36c93622c9b8eeb4b4ab25f95907df8baa4))
26
+
27
+
28
+
29
+ * @applitools/spec-driver-webdriver bumped from 1.0.37 to 1.0.38
30
+
31
+ * @applitools/execution-grid-tunnel bumped to 2.1.8
32
+
33
+
34
+ ## [1.6.2](https://github.com/applitools/eyes.sdk.javascript1/compare/js/ec-client@1.6.1...js/ec-client@1.6.2) (2023-07-10)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * fixed issue that caused creation of unnecessary tunnels ([b38fe37](https://github.com/applitools/eyes.sdk.javascript1/commit/b38fe3754f97c5f312ceffd74406255654466ab7))
40
+ * start tunnels with proper regional server ([2a34ed8](https://github.com/applitools/eyes.sdk.javascript1/commit/2a34ed8cd72dc9ac54957348cbe8ba9e67032340))
41
+
42
+
43
+ ### Dependencies
44
+
45
+ * @applitools/core-base bumped from 1.3.0 to 1.4.0
46
+ #### Features
47
+
48
+ * support custom property per renderer ([#1715](https://github.com/applitools/eyes.sdk.javascript1/issues/1715)) ([8cf6b1f](https://github.com/applitools/eyes.sdk.javascript1/commit/8cf6b1fb0563b2485ca18eebc2efd236c2287db8))
49
+
50
+
51
+
52
+ * @applitools/image bumped from 1.0.36 to 1.1.0
53
+ #### Features
54
+
55
+ * prevent animated gif images from playing in ufg ([#1721](https://github.com/applitools/eyes.sdk.javascript1/issues/1721)) ([30f39cc](https://github.com/applitools/eyes.sdk.javascript1/commit/30f39cc8ef2cdfa1d85bd7a0037b818db1b52e1b))
56
+ * @applitools/tunnel-client bumped from 1.0.1 to 1.0.2
57
+ #### Bug Fixes
58
+
59
+ * start tunnels with proper regional server ([2a34ed8](https://github.com/applitools/eyes.sdk.javascript1/commit/2a34ed8cd72dc9ac54957348cbe8ba9e67032340))
60
+
3
61
  ## [1.6.1](https://github.com/applitools/eyes.sdk.javascript1/compare/js/ec-client@1.6.0...js/ec-client@1.6.1) (2023-07-05)
4
62
 
5
63
 
@@ -24,8 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.makeStartSession = void 0;
27
- //@ts-ignore
28
- const execution_grid_tunnel_1 = require("@applitools/execution-grid-tunnel");
27
+ const tunnel_client_1 = require("@applitools/tunnel-client");
29
28
  const abort_controller_1 = require("abort-controller");
30
29
  const utils = __importStar(require("@applitools/utils"));
31
30
  const SERVER_URLS = {
@@ -73,8 +72,8 @@ function makeStartSession({ settings, req, tunnels }) {
73
72
  }
74
73
  if (options.tunnel && tunnels) {
75
74
  // TODO should be removed once tunnel spawning issue is solved
76
- await (0, execution_grid_tunnel_1.prepareEnvironment)();
77
- session.tunnels = await tunnels.acquire(session.credentials);
75
+ await (0, tunnel_client_1.prepareTunnelEnvironment)({ settings: { tunnelServerUrl: session.serverUrl }, logger });
76
+ session.tunnels = await tunnels.acquire({ ...session.credentials, tunnelServerUrl: session.serverUrl });
78
77
  }
79
78
  const applitoolsCapabilities = Object.fromEntries([
80
79
  ...Object.entries(options).map(([key, value]) => [`applitools:${key}`, value]),
@@ -54,6 +54,7 @@ async function makeTunnelManager({ settings, logger, }) {
54
54
  exports.makeTunnelManager = makeTunnelManager;
55
55
  function makePool(options) {
56
56
  const pool = new Map();
57
+ const pending = new Set();
57
58
  return {
58
59
  acquire,
59
60
  add,
@@ -65,12 +66,29 @@ function makePool(options) {
65
66
  async function acquire(resourceOptions) {
66
67
  let resource = await get();
67
68
  if (!resource) {
68
- resource = await options.create(resourceOptions);
69
+ resource = await create(resourceOptions);
69
70
  await add(resource);
70
71
  }
71
72
  await use(resource);
72
73
  return resource;
73
74
  }
75
+ async function create(resourceOptions) {
76
+ const availableItem = [...pending].reduce((availableItem, item) => {
77
+ return (!options.maxInuse || item.waiting < options.maxInuse) &&
78
+ (!availableItem || availableItem.waiting > item.waiting)
79
+ ? item
80
+ : availableItem;
81
+ }, null);
82
+ if (availableItem) {
83
+ availableItem.waiting += 1;
84
+ return availableItem.resource;
85
+ }
86
+ const resource = options.create(resourceOptions);
87
+ const item = { resource, waiting: 1 };
88
+ resource.finally(() => pending.delete(item));
89
+ pending.add(item);
90
+ return resource;
91
+ }
74
92
  async function add(resource) {
75
93
  var _a, _b;
76
94
  const item = {
@@ -87,11 +105,13 @@ function makePool(options) {
87
105
  }
88
106
  async function get() {
89
107
  var _a;
90
- const freeItem = Array.from(pool.values()).reduce((freeItem, item) => !item.destroyed &&
91
- (!options.maxInuse || item.inuse < options.maxInuse) &&
92
- (!freeItem || freeItem.inuse > item.inuse)
93
- ? item
94
- : freeItem, null);
108
+ const freeItem = [...pool.values()].reduce((freeItem, item) => {
109
+ return !item.destroyed &&
110
+ (!options.maxInuse || item.inuse < options.maxInuse) &&
111
+ (!freeItem || freeItem.inuse > item.inuse)
112
+ ? item
113
+ : freeItem;
114
+ }, null);
95
115
  return (_a = freeItem === null || freeItem === void 0 ? void 0 : freeItem.resource) !== null && _a !== void 0 ? _a : null;
96
116
  }
97
117
  async function use(resource) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/ec-client",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -52,14 +52,13 @@
52
52
  "test:it": "MOCHA_GROUP=it run --top-level mocha './test/it/*.spec.ts'"
53
53
  },
54
54
  "dependencies": {
55
- "@applitools/core-base": "1.3.0",
56
- "@applitools/driver": "1.13.0",
57
- "@applitools/execution-grid-tunnel": "2.1.6",
55
+ "@applitools/core-base": "1.4.0",
56
+ "@applitools/driver": "1.13.1",
58
57
  "@applitools/logger": "2.0.5",
59
58
  "@applitools/req": "1.4.0",
60
59
  "@applitools/socket": "1.1.5",
61
- "@applitools/spec-driver-webdriver": "1.0.37",
62
- "@applitools/tunnel-client": "1.0.1",
60
+ "@applitools/spec-driver-webdriver": "1.0.38",
61
+ "@applitools/tunnel-client": "1.1.0",
63
62
  "@applitools/utils": "1.5.0",
64
63
  "abort-controller": "3.0.0",
65
64
  "webdriver": "7",