@applitools/eyes-cypress 3.27.2 → 3.27.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
@@ -10,6 +10,15 @@
10
10
 
11
11
 
12
12
 
13
+ ## 3.27.3 - 2022/10/19
14
+
15
+ ### Features
16
+ - Changed default value of `sendDom` from `true` to dynamically calculated
17
+ ### Bug fixes
18
+ - Fix chrome emulation environment structure
19
+ - Fixed issue with ufg renders failing intermittently
20
+ - Fixed issue with universal process spawning is failing due to a timeout
21
+
13
22
  ## 3.27.2 - 2022/10/9
14
23
 
15
24
  ### Features
package/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  /// <reference types="cypress" />
2
-
3
- import type * as types from '@applitools/types'
4
2
  import type * as api from '@applitools/eyes-api'
5
3
 
6
4
  type MaybeArray<T> = T | T[]
@@ -21,14 +19,14 @@ interface CypressCheckSettings extends api.CheckSettingsPlain<Element, Selector>
21
19
  content?: MaybeArray<CypressCheckSettings['contentRegions'][number] | LegacyRegion>
22
20
  strict?: MaybeArray<CypressCheckSettings['strictRegions'][number] | LegacyRegion>
23
21
  floating?: MaybeArray<CypressCheckSettings['floatingRegions'][number] | (({element: Element} | Selector | LegacyRegion) & {maxUpOffset?: number; maxDownOffset?: number; maxLeftOffset?: number; maxRightOffset?: number})>
24
- accessibility?: MaybeArray<CypressCheckSettings['accessibilityRegions'][number] | (({element: Element} | Selector | LegacyRegion) & {accessibilityType?: types.AccessibilityRegionType})>
22
+ accessibility?: MaybeArray<CypressCheckSettings['accessibilityRegions'][number] | (({element: Element} | Selector | LegacyRegion) & {accessibilityType?: api.AccessibilityRegionTypePlain})>
25
23
  scriptHooks?: CypressCheckSettings['hooks']
26
24
  ignoreCaret?: boolean
27
25
  ignoreDisplacements?: boolean
28
26
  }
29
27
 
30
28
  interface CypressEyesConfig extends api.ConfigurationPlain<Element, Selector> {
31
- browser?: MaybeArray<CypressEyesConfig['browsersInfo'][number] | {deviceName: string; screenOrientation?: types.ScreenOrientation; name?: string}>
29
+ browser?: MaybeArray<CypressEyesConfig['browsersInfo'][number] | {deviceName: string; screenOrientation?: api.ScreenOrientationPlain; name?: string}>
32
30
 
33
31
  batchId?: CypressEyesConfig['batch']['id']
34
32
  batchName?: CypressEyesConfig['batch']['name']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-cypress",
3
- "version": "3.27.2",
3
+ "version": "3.27.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
@@ -55,11 +55,11 @@
55
55
  }
56
56
  },
57
57
  "dependencies": {
58
- "@applitools/eyes-api": "1.8.5",
59
- "@applitools/eyes-universal": "2.16.3",
58
+ "@applitools/core": "1.2.0",
59
+ "@applitools/eyes-api": "1.9.0",
60
+ "@applitools/eyes-universal": "2.16.5",
60
61
  "@applitools/functional-commons": "1.6.0",
61
- "@applitools/logger": "1.1.26",
62
- "@applitools/visual-grid-client": "15.14.1",
62
+ "@applitools/logger": "1.1.27",
63
63
  "chalk": "3.0.0",
64
64
  "semver": "7.3.7",
65
65
  "uuid": "8.3.2",
@@ -70,10 +70,9 @@
70
70
  "@applitools/scripts": "1.2.0",
71
71
  "@applitools/sdk-coverage-tests": "^2.3.20",
72
72
  "@applitools/snaptdout": "1.0.1",
73
- "@applitools/test-server": "1.1.5",
73
+ "@applitools/test-server": "1.1.6",
74
74
  "@applitools/test-utils": "1.5.2",
75
- "@applitools/types": "^1.5.19",
76
- "@applitools/utils": "1.3.12",
75
+ "@applitools/utils": "1.3.13",
77
76
  "@types/node": "12",
78
77
  "@types/ws": "^8.2.2",
79
78
  "@typescript-eslint/eslint-plugin": "^5.10.2",
@@ -93,7 +92,7 @@
93
92
  "ncp": "2.0.0",
94
93
  "node-fetch": "2.6.0",
95
94
  "prettier": "1.19.1",
96
- "typescript": "4.6.4"
95
+ "typescript": "4.8.4"
97
96
  },
98
97
  "engines": {
99
98
  "node": ">=12.13.0"
@@ -52,7 +52,7 @@ Cypress.Commands.add('eyesGetAllTestResults', () => {
52
52
  });
53
53
  };
54
54
  summary.results = summary.results.map(res => {
55
- return {...res, result: res.testResults, error: res.exception};
55
+ return {...res, result: res.testResults, error: res.exception, renderer: res.browserInfo};
56
56
  });
57
57
  return new TestResultsSummary({summary, deleteTest});
58
58
  });
@@ -47,10 +47,11 @@ function eyesOpenMapValues({args, appliConfFile, testName, shouldUseBrowserHooks
47
47
 
48
48
  if (browsersInfo) {
49
49
  if (Array.isArray(browsersInfo)) {
50
- browsersInfo.forEach(fillDefaultBrowserName);
50
+ for (const [index, value] of browsersInfo.entries()) {
51
+ browsersInfo[index] = fillDefaultBrowserName(value);
52
+ }
51
53
  } else {
52
- fillDefaultBrowserName(browsersInfo);
53
- browsersInfo = [browsersInfo];
54
+ browsersInfo = [fillDefaultBrowserName(browsersInfo)];
54
55
  }
55
56
  }
56
57
 
@@ -90,6 +91,12 @@ function eyesOpenMapValues({args, appliConfFile, testName, shouldUseBrowserHooks
90
91
  function fillDefaultBrowserName(browser) {
91
92
  if (!browser.name && !browser.iosDeviceInfo && !browser.chromeEmulationInfo) {
92
93
  browser.name = 'chrome';
94
+ if (browser.deviceName) {
95
+ browser = {chromeEmulationInfo: browser};
96
+ }
97
+ return browser;
98
+ } else {
99
+ return browser;
93
100
  }
94
101
  }
95
102
 
@@ -78,19 +78,6 @@ function socketCommands(socket, refer) {
78
78
  return arg;
79
79
  }
80
80
  }
81
-
82
- function getType(value) {
83
- if (!value) return;
84
- if (value.nodeType === Node.ELEMENT_NODE) {
85
- return 'element';
86
- } else if (
87
- value.nodeType === Node.DOCUMENT_NODE ||
88
- value.ownerDocument ||
89
- (value.constructor && value.constructor.name === 'Window')
90
- ) {
91
- return 'context';
92
- }
93
- }
94
81
  }
95
82
 
96
83
  module.exports = {socketCommands};
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  const utils = require('@applitools/utils');
3
- const {configParams, TypeUtils} = require('@applitools/visual-grid-client');
3
+ const {configParams} = require('./configParams');
4
4
  const DEFAULT_TEST_CONCURRENCY = 5;
5
5
  const uuid = require('uuid');
6
6
 
@@ -24,11 +24,11 @@ function makeConfig() {
24
24
  config.failCypressOnDiff = false;
25
25
  }
26
26
 
27
- if (TypeUtils.isString(config.showLogs)) {
27
+ if (utils.types.isString(config.showLogs)) {
28
28
  config.showLogs = config.showLogs === 'true' || config.showLogs === '1';
29
29
  }
30
30
 
31
- if (TypeUtils.isString(config.testConcurrency)) {
31
+ if (utils.types.isString(config.testConcurrency)) {
32
32
  config.testConcurrency = Number(config.testConcurrency);
33
33
  }
34
34
 
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ const configParams = [
4
+ 'appName',
5
+ 'testName',
6
+ 'displayName',
7
+ 'browser',
8
+ 'url',
9
+ 'apiKey',
10
+ 'showLogs',
11
+ 'batch',
12
+ 'batchId',
13
+ 'batchName',
14
+ 'batchSequenceName',
15
+ 'batchSequence',
16
+ 'properties',
17
+ 'baselineBranchName',
18
+ 'baselineBranch',
19
+ 'baselineEnvName',
20
+ 'baselineName',
21
+ 'envName',
22
+ 'ignoreCaret',
23
+ 'isDisabled',
24
+ 'matchLevel',
25
+ 'parentBranchName',
26
+ 'parentBranch',
27
+ 'branchName',
28
+ 'branch',
29
+ 'proxy',
30
+ 'autProxy',
31
+ 'saveDiffs',
32
+ 'saveFailedTests',
33
+ 'saveNewTests',
34
+ 'compareWithParentBranch',
35
+ 'ignoreBaseline',
36
+ 'serverUrl',
37
+ 'concurrency',
38
+ 'testConcurrency',
39
+ 'useDom',
40
+ 'enablePatterns',
41
+ 'ignoreDisplacements',
42
+ 'accessibilitySettings',
43
+ 'notifyOnCompletion',
44
+ 'batchNotify',
45
+ 'dontCloseBatches',
46
+ ];
47
+
48
+ module.exports = {configParams};
@@ -30,7 +30,7 @@ function errorDigest({passed, failed, diffs, logger, isInteractive}) {
30
30
  logger.log('errorDigest: diff errors', diffs);
31
31
  logger.log('errorDigest: test errors', failed);
32
32
 
33
- const testResultsUrl = diffs.length ? colorify(diffs[0].getUrl(), 'teal') : '';
33
+ const testResultsUrl = diffs.length ? colorify(diffs[0].url, 'teal') : '';
34
34
  const testResultsPrefix = testResultsUrl ? 'See details at:' : '';
35
35
  const footer = testResultsUrl
36
36
  ? `\n${indent()}${colorify(testResultsPrefix)} ${testResultsUrl}`
@@ -69,9 +69,9 @@ function errorDigest({passed, failed, diffs, logger, isInteractive}) {
69
69
  }
70
70
 
71
71
  function stringifyTestResults(testResults) {
72
- const hostDisplaySize = testResults.getHostDisplaySize();
73
- const viewport = hostDisplaySize ? `[${hostDisplaySize}]` : '';
74
- const testName = `${testResults.getName()} ${viewport}`;
72
+ const hostDisplaySize = testResults.hostDisplaySize;
73
+ const viewport = hostDisplaySize ? `[${hostDisplaySize.width}x${hostDisplaySize.height}]` : '';
74
+ const testName = `${testResults.name} ${viewport}`;
75
75
  return testName + (testResults.error ? ` : ${testResults.error}` : '');
76
76
  }
77
77
 
@@ -1,19 +1,18 @@
1
1
  'use strict';
2
-
3
2
  function getErrorsAndDiffs(testResultsArr) {
4
3
  return testResultsArr.reduce(
5
4
  ({failed, diffs, passed}, testResults) => {
6
5
  if (testResults instanceof Error || testResults.error) {
7
6
  failed.push(testResults);
8
7
  } else {
9
- const testStatus = testResults.getStatus();
8
+ const testStatus = testResults.status;
10
9
  if (testStatus === 'Passed') {
11
10
  passed.push(testResults);
12
11
  } else {
13
12
  if (testStatus === 'Unresolved') {
14
- if (testResults.getIsNew()) {
13
+ if (testResults.isNew) {
15
14
  testResults.error = new Error(
16
- `${testResults.getName()}. Please approve the new baseline at ${testResults.getUrl()}`,
15
+ `${testResults.name}. Please approve the new baseline at ${testResults.url}`,
17
16
  );
18
17
  failed.push(testResults);
19
18
  } else {
@@ -4,7 +4,7 @@ const getErrorsAndDiffs = require('./getErrorsAndDiffs');
4
4
  const {promisify} = require('util');
5
5
  const fs = require('fs');
6
6
  const writeFile = promisify(fs.writeFile);
7
- const {TestResultsFormatter} = require('@applitools/visual-grid-client');
7
+ const {formatters} = require('@applitools/core');
8
8
  const {resolve} = require('path');
9
9
 
10
10
  function printTestResults(testResultsArr) {
@@ -12,6 +12,7 @@ function printTestResults(testResultsArr) {
12
12
  level: testResultsArr.resultConfig.showLogs ? 'info' : 'silent',
13
13
  label: 'eyes',
14
14
  });
15
+ if (!testResultsArr.testResults) return;
15
16
  const {passed, failed, diffs} = getErrorsAndDiffs(testResultsArr.testResults);
16
17
  if ((failed.length || diffs.length) && !!testResultsArr.resultConfig.eyesFailCypressOnDiff) {
17
18
  throw new Error(
@@ -26,10 +27,12 @@ function printTestResults(testResultsArr) {
26
27
  }
27
28
  }
28
29
  function handleBatchResultsFile(results, tapFileConfig) {
29
- const formatter = new TestResultsFormatter(results);
30
30
  const fileName = tapFileConfig.tapFileName || `${new Date().toISOString()}-eyes.tap`;
31
31
  const tapFile = resolve(tapFileConfig.tapDirPath, fileName);
32
- return writeFile(tapFile, formatter.asHierarchicTAPString(false, true));
32
+ return writeFile(
33
+ tapFile,
34
+ formatters.toHierarchicTAPString(results, {includeSubTests: false, markNewAsPassed: true}),
35
+ );
33
36
  }
34
37
 
35
38
  module.exports = {printTestResults, handleBatchResultsFile};
@@ -1,5 +1,4 @@
1
1
  'use strict';
2
- const {TestResults} = require('@applitools/visual-grid-client');
3
2
  const handleTestResults = require('./handleTestResults');
4
3
 
5
4
  function makeGlobalRunHooks({closeManager, closeBatches, closeUniversalServer}) {
@@ -17,12 +16,10 @@ function makeGlobalRunHooks({closeManager, closeBatches, closeUniversalServer})
17
16
  isTextTerminal: config.isTextTerminal,
18
17
  };
19
18
  const summaries = await closeManager();
20
- const testResultsArr = [];
19
+
20
+ let testResults;
21
21
  for (const summary of summaries) {
22
- const testResults = summary.results.map(({testResults}) => testResults);
23
- for (const result of testResults) {
24
- testResultsArr.push(new TestResults(result));
25
- }
22
+ testResults = summary.results.map(({testResults}) => testResults);
26
23
  }
27
24
  if (!config.appliConfFile.dontCloseBatches) {
28
25
  await closeBatches({
@@ -34,13 +31,13 @@ function makeGlobalRunHooks({closeManager, closeBatches, closeUniversalServer})
34
31
  }
35
32
 
36
33
  if (config.appliConfFile.tapDirPath) {
37
- await handleTestResults.handleBatchResultsFile(testResultsArr, {
34
+ await handleTestResults.handleBatchResultsFile(testResults, {
38
35
  tapDirPath: config.appliConfFile.tapDirPath,
39
36
  tapFileName: config.appliConfFile.tapFileName,
40
37
  });
41
38
  }
42
39
 
43
- handleTestResults.printTestResults({testResults: testResultsArr, resultConfig});
40
+ handleTestResults.printTestResults({testResults, resultConfig});
44
41
  } finally {
45
42
  await closeUniversalServer();
46
43
  }
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
  const connectSocket = require('./webSocket');
3
3
  const {makeServerProcess} = require('@applitools/eyes-universal');
4
- const {TestResults} = require('@applitools/visual-grid-client');
5
4
  const handleTestResults = require('./handleTestResults');
6
5
  const path = require('path');
7
6
  const fs = require('fs');
@@ -70,18 +69,14 @@ function makeStartServer({logger}) {
70
69
  socketWithUniversal.send(newMessage);
71
70
  } else if (msg.name === 'Test.printTestResults') {
72
71
  try {
73
- const resultArr = [];
74
- for (const result of msg.payload.testResults) {
75
- resultArr.push(new TestResults(result));
76
- }
77
72
  if (msg.payload.resultConfig.tapDirPath) {
78
- handleTestResults.handleBatchResultsFile(resultArr, {
73
+ handleTestResults.handleBatchResultsFile(msg.payload.testResults, {
79
74
  tapFileName: msg.payload.resultConfig.tapFileName,
80
75
  tapDirPath: msg.payload.resultConfig.tapDirPath,
81
76
  });
82
77
  }
83
78
  handleTestResults.printTestResults({
84
- testResults: resultArr,
79
+ testResults: msg.payload.testResults,
85
80
  resultConfig: msg.payload.resultConfig,
86
81
  });
87
82
  socketWithClient.send(