@applitools/core 2.4.2 → 2.4.3

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
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 2.4.3 - 2023/3/22
6
+
7
+ ### Features
8
+ - Changed `makeManager` api to accept `settings`
9
+ ### Bug fixes
10
+ - Fixed retry interval during poll requests to eyes back-end
11
+
5
12
  ## 2.4.2 - 2023/3/17
6
13
 
7
14
  ### Features
@@ -31,16 +31,19 @@ const open_eyes_1 = require("./open-eyes");
31
31
  const get_manager_results_1 = require("./get-manager-results");
32
32
  const utils = __importStar(require("@applitools/utils"));
33
33
  function makeMakeManager({ spec, concurrency: defaultConcurrency = utils.general.getEnvValue('CONCURRENCY', 'number'), core, base, agentId: defaultAgentId, cwd = process.cwd(), logger: defaultLogger, }) {
34
- return async function makeManager({ type = 'classic', concurrency = defaultConcurrency, legacyConcurrency, batch, agentId = type === 'ufg' ? defaultAgentId === null || defaultAgentId === void 0 ? void 0 : defaultAgentId.replace(/(\/\d)/, '.visualgrid$1') : defaultAgentId, logger = defaultLogger, } = {}) {
35
- var _a, _b;
36
- concurrency !== null && concurrency !== void 0 ? concurrency : (concurrency = utils.types.isInteger(legacyConcurrency) ? legacyConcurrency * 5 : 5);
37
- batch !== null && batch !== void 0 ? batch : (batch = {});
38
- (_a = batch.id) !== null && _a !== void 0 ? _a : (batch.id = (_b = utils.general.getEnvValue('BATCH_ID')) !== null && _b !== void 0 ? _b : `generated-${utils.general.guid()}`);
39
- base !== null && base !== void 0 ? base : (base = (0, core_base_1.makeCore)({ agentId, concurrency, cwd, logger }));
34
+ return async function makeManager({ type = 'classic', settings, logger = defaultLogger, } = {}) {
35
+ var _a, _b, _c, _d, _e;
36
+ var _f;
37
+ settings !== null && settings !== void 0 ? settings : (settings = {});
38
+ (_a = settings.concurrency) !== null && _a !== void 0 ? _a : (settings.concurrency = defaultConcurrency !== null && defaultConcurrency !== void 0 ? defaultConcurrency : (utils.types.isInteger(settings.legacyConcurrency) ? settings.legacyConcurrency * 5 : 5));
39
+ (_b = settings.batch) !== null && _b !== void 0 ? _b : (settings.batch = {});
40
+ (_c = (_f = settings.batch).id) !== null && _c !== void 0 ? _c : (_f.id = (_d = utils.general.getEnvValue('BATCH_ID')) !== null && _d !== void 0 ? _d : `generated-${utils.general.guid()}`);
41
+ (_e = settings.agentId) !== null && _e !== void 0 ? _e : (settings.agentId = type === 'ufg' ? defaultAgentId === null || defaultAgentId === void 0 ? void 0 : defaultAgentId.replace(/(\/\d)/, '.visualgrid$1') : defaultAgentId);
42
+ base !== null && base !== void 0 ? base : (base = (0, core_base_1.makeCore)({ agentId: settings.agentId, concurrency: settings.concurrency, cwd, logger }));
40
43
  const cores = { ufg: (0, core_2.makeCore)({ spec, base, logger }), classic: (0, core_1.makeCore)({ spec, base, logger }) };
41
44
  const storage = [];
42
45
  return {
43
- openEyes: utils.general.wrap((0, open_eyes_1.makeOpenEyes)({ type, batch, spec, core, cores, logger }), async (openEyes, options) => {
46
+ openEyes: utils.general.wrap((0, open_eyes_1.makeOpenEyes)({ type, batch: settings.batch, spec, core, cores, logger }), async (openEyes, options) => {
44
47
  const eyes = await openEyes(options);
45
48
  storage.push(eyes);
46
49
  return eyes;
@@ -125,14 +125,25 @@ printStdout = false, ...handlerOptions } = {}) {
125
125
  const core = await corePromise;
126
126
  return core.extractText(options);
127
127
  });
128
- // TODO rename to getECClient
128
+ socket.command('Core.getECClient', async (options) => {
129
+ const core = await corePromise;
130
+ const client = await core.getECClient(options);
131
+ return { url: client.url };
132
+ });
133
+ // TODO remove
129
134
  socket.command('Core.makeECClient', async (options) => {
130
135
  const core = await corePromise;
131
136
  const client = await core.getECClient(options);
132
137
  return { url: client.url };
133
138
  });
134
139
  socket.command('Core.makeManager', async (options) => {
140
+ var _a, _b, _c, _d;
141
+ var _e, _f, _g;
135
142
  const core = await corePromise;
143
+ (_a = options.settings) !== null && _a !== void 0 ? _a : (options.settings = {});
144
+ (_b = (_e = options.settings).concurrency) !== null && _b !== void 0 ? _b : (_e.concurrency = options.concurrency);
145
+ (_c = (_f = options.settings).legacyConcurrency) !== null && _c !== void 0 ? _c : (_f.legacyConcurrency = options.legacyConcurrency);
146
+ (_d = (_g = options.settings).agentId) !== null && _d !== void 0 ? _d : (_g.agentId = options.agentId);
136
147
  return refer.ref(await core.makeManager(options));
137
148
  });
138
149
  socket.command('EyesManager.openEyes', async ({ manager, ...options }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/core",
3
- "version": "2.4.2",
3
+ "version": "2.4.3",
4
4
  "homepage": "https://applitools.com",
5
5
  "bugs": {
6
6
  "url": "https://github.com/applitools/eyes.sdk.javascript1/issues"
@@ -75,19 +75,19 @@
75
75
  ]
76
76
  },
77
77
  "dependencies": {
78
- "@applitools/core-base": "1.1.42",
78
+ "@applitools/core-base": "1.1.43",
79
79
  "@applitools/dom-capture": "11.2.1",
80
80
  "@applitools/dom-snapshot": "4.7.6",
81
81
  "@applitools/driver": "1.11.37",
82
- "@applitools/ec-client": "1.2.16",
82
+ "@applitools/ec-client": "1.2.17",
83
83
  "@applitools/logger": "1.1.48",
84
- "@applitools/nml-client": "1.3.40",
85
- "@applitools/req": "1.1.32",
84
+ "@applitools/nml-client": "1.3.41",
85
+ "@applitools/req": "1.1.33",
86
86
  "@applitools/screenshoter": "3.7.31",
87
87
  "@applitools/snippets": "2.4.17",
88
88
  "@applitools/socket": "1.0.10",
89
89
  "@applitools/spec-driver-webdriver": "1.0.17",
90
- "@applitools/ufg-client": "1.2.3",
90
+ "@applitools/ufg-client": "1.2.4",
91
91
  "@applitools/utils": "1.3.32",
92
92
  "@types/ws": "8.5.4",
93
93
  "abort-controller": "3.0.0",
@@ -98,7 +98,7 @@
98
98
  "yargs": "17.6.2"
99
99
  },
100
100
  "devDependencies": {
101
- "@applitools/bongo": "^3.0.1",
101
+ "@applitools/bongo": "^3.0.2",
102
102
  "@applitools/sdk-coverage-tests": "^3.0.0",
103
103
  "@applitools/spec-driver-puppeteer": "^1.1.49",
104
104
  "@applitools/spec-driver-selenium": "^1.5.34",
@@ -1,4 +1,4 @@
1
- import type { Core, EyesManager, Batch } from './types';
1
+ import type { Core, EyesManager, EyesManagerSettings } from './types';
2
2
  import type { Core as BaseCore } from '@applitools/core-base';
3
3
  import { type Logger } from '@applitools/logger';
4
4
  import { type SpecType, type SpecDriver } from '@applitools/driver';
@@ -11,13 +11,9 @@ type Options<TSpec extends SpecType> = {
11
11
  cwd?: string;
12
12
  logger: Logger;
13
13
  };
14
- export declare function makeMakeManager<TSpec extends SpecType>({ spec, concurrency: defaultConcurrency, core, base, agentId: defaultAgentId, cwd, logger: defaultLogger, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, concurrency, legacyConcurrency, batch, agentId, logger, }?: {
14
+ export declare function makeMakeManager<TSpec extends SpecType>({ spec, concurrency: defaultConcurrency, core, base, agentId: defaultAgentId, cwd, logger: defaultLogger, }: Options<TSpec>): <TType extends "classic" | "ufg" = "classic">({ type, settings, logger, }?: {
15
15
  type?: TType | undefined;
16
- concurrency?: number | undefined;
17
- /** @deprecated */
18
- legacyConcurrency?: number | undefined;
19
- batch?: Batch | undefined;
20
- agentId?: string | undefined;
16
+ settings?: EyesManagerSettings | undefined;
21
17
  logger?: Logger | undefined;
22
18
  }) => Promise<EyesManager<TSpec, TType>>;
23
19
  export {};
package/types/types.d.ts CHANGED
@@ -18,8 +18,7 @@ export interface Core<TSpec extends SpecType, TDefaultType extends 'classic' | '
18
18
  }): Promise<ECClient>;
19
19
  makeManager<TType extends 'classic' | 'ufg' = TDefaultType>(options?: {
20
20
  type: TType;
21
- concurrency?: TType extends 'ufg' ? number : never;
22
- agentId?: string;
21
+ settings?: EyesManagerSettings;
23
22
  logger?: Logger;
24
23
  }): Promise<EyesManager<TSpec, TType>>;
25
24
  openEyes<TType extends 'classic' | 'ufg' = TDefaultType>(options: {
@@ -98,6 +97,13 @@ export interface Eyes<TSpec extends SpecType, TDefaultType extends 'classic' | '
98
97
  logger?: Logger;
99
98
  }): Promise<TestResult<TDefaultType>[]>;
100
99
  }
100
+ export interface EyesManagerSettings {
101
+ concurrency?: number;
102
+ /** @deprecated */
103
+ legacyConcurrency?: number;
104
+ agentId?: string;
105
+ batch?: AutomationCore.Batch;
106
+ }
101
107
  export type Config<TSpec extends SpecType, TType extends 'classic' | 'ufg'> = {
102
108
  open: Partial<Omit<OpenSettings<TType>, 'userCommandId'>>;
103
109
  screenshot: Partial<Omit<ClassicCore.ScreenshotSettings<TSpec>, 'userCommandId'>>;