@applitools/eyes-cypress 3.24.0-beta.7 → 3.25.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
@@ -3,15 +3,11 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
- ## 3.24.0-beta.2 - 2022/3/2
7
-
8
- - add bin folder
9
-
10
- ## 3.24.0-beta.1 - 2022/3/2
6
+ ## 3.25.0 - 2022/3/15
11
7
 
12
8
  - convert cypress to work on top of universal
13
- - updated to @applitools/logger@1.0.11 (from 1.0.9)
14
- - updated to @applitools/visual-grid-client@15.9.0 (from 15.8.57)
9
+ - expose `cy.eyesGetAllTestResults`
10
+ - updated to @applitools/visual-grid-client@15.10.1 (from 15.9.0)
15
11
 
16
12
  ## 3.23.9 - 2022/2/22
17
13
 
package/README.md CHANGED
@@ -195,6 +195,7 @@ Applitools will take screenshots and perform the visual comparisons in the backg
195
195
  - [waitBeforeCapture](#waitBeforeCapture)
196
196
  - [Close](#Close)
197
197
  - [GetAllTestResults](#GetAllTestResults)
198
+ - [deletTestResults](#deleteTestResults)
198
199
  - [Concurrency](#Concurrency)
199
200
  - [Advanced configuration](#Advanced-configuration)
200
201
  - [Scoped configuration](#Here-are-the-available-configuration-properties)
@@ -526,12 +527,26 @@ This should be called after `close`. For example:
526
527
 
527
528
  ```js
528
529
  after(() => {
529
- cy.eyesGetAllTestResults().then(results => {
530
- console.log(results)
530
+ cy.eyesGetAllTestResults().then(summary => {
531
+ console.log(summary)
531
532
  })
532
533
  })
533
534
  ```
534
535
 
536
+ #### deleteTestResults
537
+
538
+
539
+ ```js
540
+ after(() => {
541
+ cy.eyesGetAllTestResults().then(summary => {
542
+ for(const result of summary.getAllResults()) {
543
+ await result.getTestResults().delete()
544
+ }
545
+ })
546
+ })
547
+ ```
548
+
549
+
535
550
  ## Concurrency
536
551
 
537
552
  The default level of concurrency for free accounts is `5`. This means that only up to 5 visual tests can run in parallel, and therefore the execution might be slow.
@@ -561,6 +576,7 @@ The list above is also the order of precedence, which means that if you pass a p
561
576
  | `envName` | undefined | A name for the environment in which the application under test is running. |
562
577
  | `ignoreCaret` | false | Whether to ignore or the blinking caret or not when comparing images. |
563
578
  | `matchLevel` | Strict | The method to use when comparing two screenshots, which expresses the extent to which the two images are expected to match. Possible values are `Strict`, `Exact`, `Layout` and `Content`. Read more about match levels [here](http://support.applitools.com/customer/portal/articles/2088359). |
579
+ | `branchName` | default | The name of the current branch. |
564
580
  | `baselineBranchName` | undefined | The name of the baseline branch. |
565
581
  | `parentBranchName` | undefined | Sets the branch under which new branches are created. |
566
582
  | `saveFailedTests` | false | Set whether or not failed tests are saved by default. |
@@ -579,21 +595,26 @@ The list above is also the order of precedence, which means that if you pass a p
579
595
 
580
596
  The following configuration properties cannot be defined using the first method of passing them to `cy.eyesOpen`. They should be defined either in the `applitools.config.js` file or as environment variables.
581
597
 
582
- | Property name | Default value | Description |
583
- | ------------- |:------------- |:----------- |
584
- | `apiKey` | undefined | The API key used for working with the Applitools Eyes server. See more info in the [Applitools API key](#applitools-api-key) section above |
585
- | `showLogs` | false | Whether or not you want to see logs of the Eyes-Cypress plugin. Logs are written to the same output of the Cypress process. |
586
- | `serverUrl` | Default Eyes server URL | The URL of Eyes server |
587
- | `proxy` | undefined | Sets the proxy settings to be used in network requests to Eyes server. This can be either a string to the proxy URI, or an object containing the URI, username and password.<br/><br/>For example:<br/>`{url: 'https://myproxy.com:443', username: 'my_user', password: 'my_password', isHttpOnly: false}`<br/>or:<br/>`"https://username:password@myproxy.com:443"`|
588
- | `isDisabled` | false | If true, all calls to Eyes-Cypress commands will be silently ignored. |
589
- | `failCypressOnDiff` | true | If true, then the Cypress test fails if an eyes visual test fails. If false and an eyes test fails, then the Cypress test does not fail.
590
- | `tapDirPath` | undefined | Directory path of a results file. If set, then a [TAP](https://en.wikipedia.org/wiki/Test_Anything_Protocol#Specification) file is created in this directory, the tap file name is created with the name [ISO-DATE](https://en.wikipedia.org/wiki/ISO_8601)\-eyes.tap and contains the Eyes test results (Note that because of a current Cypress [limitation](https://github.com/cypress-io/cypress-documentation/issues/818) the results are scoped per spec file, this means that the results file is created once for each spec file).|
591
- | `tapFileName` | [ISO-DATE](https://en.wikipedia.org/wiki/ISO_8601)\-eyes.tap | The name of the tap file that is created in case `tapDirPath` is set
592
- | `testConcurrency` | 5 | The maximum number of tests that can run concurrently. The default value is the allowed amount for free accounts. For paid accounts, set this number to the quota set for your account. |
593
- |`dontCloseBatches`| false | If true, batches are not closed for [notifyOnCompletion](#advanced-configuration).|
594
- |`disableBrowserFetching`| false | If true, page resources for rendering on the UFG will be fetched from outside of the browser.|
595
- |`enablePatterns`| false | |
596
- |`useDom`| false | |
598
+ | Property name | Default value | Description |
599
+ | ------------- |:------------- |:----------- |
600
+ | `apiKey` | undefined | The API key used for working with the Applitools Eyes server. See more info in the [Applitools API key](#applitools-api-key) section above |
601
+ | `showLogs` | false | Whether or not you want to see logs of the Eyes-Cypress plugin. Logs are written to the same output of the Cypress process. |
602
+ | `serverUrl` | Default Eyes server URL | The URL of Eyes server |
603
+ | `proxy` | undefined | Sets the proxy settings to be used in network requests to Eyes server. This can be either a string to the proxy URI, or an object containing the URI, username and password.<br/><br/>For example:<br/>`{url: 'https://myproxy.com:443', username: 'my_user', password: 'my_password', isHttpOnly: false}`<br/>or:<br/>`"https://username:password@myproxy.com:443"`|
604
+ | `isDisabled` | false | If true, all calls to Eyes-Cypress commands will be silently ignored. |
605
+ | `failCypressOnDiff` | true | If true, then the Cypress test fails if an eyes visual test fails. If false and an eyes test fails, then the Cypress test does not fail.
606
+ | `tapDirPath` | undefined | Directory path of a results file. If set, then a [TAP](https://en.wikipedia.org/wiki/Test_Anything_Protocol#Specification) file is created in this directory, the tap file name is created with the name [ISO-DATE](https://en.wikipedia.org/wiki/ISO_8601)\-eyes.tap and contains the Eyes test results (Note that because of a current Cypress [limitation](https://github.com/cypress-io/cypress-documentation/issues/818) the results are scoped per spec file, this means that the results file is created once for each spec file).|
607
+ | `testConcurrency` | 5 | The maximum number of tests that can run concurrently. The default value is the allowed amount for free accounts. For paid accounts, set this number to the quota set for your account. |
608
+ |`dontCloseBatches` | false | If true, batches are not closed for [notifyOnCompletion](#advanced-configuration).|
609
+ |`disableBrowserFetching` | false | If true, page resources for rendering on the UFG will be fetched from outside of the browser.|
610
+ |`enablePatterns` | false | |
611
+ |`useDom` | false | |
612
+ | `batch` | undefined | An object which describes different aspects of the batch. The following lines in this table depict the various ways to configure the batch. |
613
+ | `batch.id` | random | Provides ability to group tests into batches. Read more about batches [here](https://applitools.com/docs/topics/working-with-test-batches/how-to-group-tests-into-batches.html). |
614
+ | `batch.name` | The name of the first test in the batch | Provides a name to the batch (for display purpose only). |
615
+ | `batch.sequenceName` | undefined | Name for managing batch statistics. |
616
+ | `batch.notifyOnCompletion` | false | If `true` batch completion notifications are sent. |
617
+ | `batch.properties` | undefined | Custom properties for the entire batch. The format is an array of objects with name/value properties. For example: `[{name: 'My prop', value:'My value'}]`. |
597
618
 
598
619
 
599
620
  ### Method 1: Arguments for `cy.eyesOpen`
@@ -73,8 +73,12 @@ function findElements(context, selector, parent) {
73
73
  const root = parent !== null && parent !== void 0 ? parent : context;
74
74
  const sel = typeof selector === 'string' ? selector : eyesSelector.selector;
75
75
  if (typeof selector !== 'string' && eyesSelector.type === 'xpath') {
76
- // TODO return multiple
77
- return context.evaluate(sel, context, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
76
+ const results = [];
77
+ const queryResult = document.evaluate(sel, context, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
78
+ for (let i = 0; i < queryResult.snapshotLength; i++) {
79
+ results.push(queryResult.snapshotItem(i));
80
+ }
81
+ return results;
78
82
  }
79
83
  else {
80
84
  return root.querySelectorAll(sel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-cypress",
3
- "version": "3.24.0-beta.7",
3
+ "version": "3.25.0",
4
4
  "main": "index.js",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "bin": {
@@ -12,20 +12,19 @@
12
12
  "test:unit": "mocha --no-timeouts 'test/unit/**/*.test.js'",
13
13
  "test:it": "mocha --no-timeouts 'test/it/**/*.test.js'",
14
14
  "test:e2e": "mkdir -p test/fixtures/testAppCopies && mocha --no-timeouts 'test/e2e/**/*.test.js'",
15
- "lint": "echo 'lint'",
16
- "test": "yarn test:unit && yarn test:it && yarn test:e2e && yarn lint",
15
+ "lint": "eslint \"**/*.js\"",
16
+ "test": "yarn test:unit && yarn test:it && yarn test:e2e && yarn test:coverage",
17
17
  "cypress": "cypress open --config-file test/fixtures/cypress-play.json",
18
18
  "cypress:new": "node_modules/cypress-new/bin/cypress open --config-file test/fixtures/cypress-play.json",
19
19
  "cypress:run": "cypress run --config-file test/fixtures/cypress-play.json --spec=test/fixtures/testApp/cypress/integration-play/play.js",
20
20
  "cypress:run:new": "node_modules/cypress-new/bin/cypress run --config-file test/fixtures/cypress-play.json --spec=test/fixtures/testApp/cypress/integration-play/play.js",
21
21
  "cypress:play": "cd test/fixtures/testApp && cypress run --config integrationFolder=cypress/integration-play,pluginsFile=cypress/plugins/index-play.js,supportFile=cypress/support/index-run.js --spec=cypress/integration-play/play.js",
22
- "preversion": "bongo preversion --skip-deps",
22
+ "preversion": "yarn build && bongo preversion --skip-deps",
23
23
  "version": "bongo version",
24
24
  "postversion": "bongo postversion --skip-release-notification",
25
25
  "deps": "bongo deps",
26
26
  "generate:tests": "coverage-tests generate",
27
- "test:coverage": "cd test/coverage/generic && cypress run ; cd -",
28
- "test:coverage-custom": "cd test/coverage/generic && cypress run --config integrationFolder=cypress/integration-custom/",
27
+ "test:coverage": "yarn generate:tests && cd test/coverage/generic && unset APPLITOOLS_API_KEY && APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-selenium' APPLITOOLS_BATCH_ID=$(uuidgen) cypress run ; cd -",
29
28
  "prepublish:setup": "sudo apt-get install xvfb"
30
29
  },
31
30
  "files": [
@@ -47,10 +46,11 @@
47
46
  },
48
47
  "dependencies": {
49
48
  "@applitools/dom-snapshot": "4.5.12",
50
- "@applitools/eyes-universal": "1.1.1-beta.2",
49
+ "@applitools/eyes-api": "1.2.0",
50
+ "@applitools/eyes-universal": "2.0.1",
51
51
  "@applitools/functional-commons": "1.6.0",
52
52
  "@applitools/logger": "1.0.11",
53
- "@applitools/visual-grid-client": "15.9.0",
53
+ "@applitools/visual-grid-client": "15.10.1",
54
54
  "body-parser": "1.19.0",
55
55
  "chalk": "3.0.0",
56
56
  "cors": "2.8.5",
@@ -65,7 +65,8 @@
65
65
  "@applitools/sdk-release-kit": "0.13.11",
66
66
  "@applitools/snaptdout": "1.0.1",
67
67
  "@applitools/test-server": "1.0.8",
68
- "@applitools/types": "^1.1.0",
68
+ "@applitools/test-utils": "1.1.5",
69
+ "@applitools/types": "^1.2.2",
69
70
  "@applitools/utils": "1.2.13",
70
71
  "@types/node": "17.0.13",
71
72
  "@types/ws": "^8.2.2",
@@ -76,7 +77,7 @@
76
77
  "cookie-parser": "1.4.4",
77
78
  "cypress": "6.5.0",
78
79
  "cypress-new": "npm:cypress@9",
79
- "eslint": "6.8.0",
80
+ "eslint": "8.10.0",
80
81
  "eslint-plugin-mocha-no-only": "1.1.0",
81
82
  "eslint-plugin-node": "7.0.1",
82
83
  "eslint-plugin-prettier": "2.7.0",
@@ -1,4 +1,4 @@
1
- /* global Cypress,cy,after,navigator */
1
+ /* global Cypress,cy,after */
2
2
  'use strict';
3
3
  const spec = require('../../dist/browser/spec-driver');
4
4
  const Refer = require('./refer');
@@ -6,6 +6,7 @@ const Socket = require('./socket');
6
6
  const {socketCommands} = require('./socketCommands');
7
7
  const {eyesOpenMapValues} = require('./eyesOpenMapping');
8
8
  const {eyesCheckMapValues} = require('./eyesCheckMapping');
9
+ const {TestResultsSummary} = require('@applitools/eyes-api');
9
10
 
10
11
  const refer = new Refer(value => {
11
12
  if (!value || !value.constructor || !value.constructor.name) return false;
@@ -41,24 +42,25 @@ Cypress.Commands.add('eyesGetAllTestResults', () => {
41
42
  }
42
43
  await Promise.all(closePromiseArr);
43
44
  const summary = await socket.request('EyesManager.closeManager', {manager, throwErr});
44
- return summary; // TODO delete this line
45
45
 
46
- // // TODO wrap with TestResultSummary class
47
- // const deleteTest = ({testId, batchId, secretToken}) => {
48
- // const {serverUrl, proxy, apiKey} = Cypress.config('appliConfFile')
49
- // return socket.request('Core.deleteTest', {testId, batchId, secretToken, serverUrl, proxy, apiKey})
50
- // }
46
+ const deleteTest = ({testId, batchId, secretToken}) => {
47
+ const {serverUrl, proxy, apiKey} = Cypress.config('appliConfFile');
48
+ return socket.request('Core.deleteTest', {
49
+ settings: {
50
+ testId,
51
+ batchId,
52
+ secretToken,
53
+ serverUrl,
54
+ proxy,
55
+ apiKey,
56
+ },
57
+ });
58
+ };
51
59
 
52
- // return new TestResultsSummary({summary, deleteTest})
60
+ return new TestResultsSummary({summary, deleteTest});
53
61
  });
54
62
  });
55
63
 
56
- // class TestResultSummary {
57
- // constructor({summary, deleteTest}) {
58
- // // same as in eyes-api
59
- // }
60
- // }
61
-
62
64
  if (shouldUseBrowserHooks) {
63
65
  after(() => {
64
66
  if (!manager) return;
@@ -81,7 +81,7 @@ function convertFloatingRegion(floatingRegions) {
81
81
  if (!floatingRegions) return floatingRegions;
82
82
 
83
83
  return floatingRegions.map(region => {
84
- const floatingRegion = {
84
+ const floatingRegion = {
85
85
  maxDownOffset: region.maxDownOffset || 0,
86
86
  maxLeftOffset: region.maxLeftOffset || 0,
87
87
  maxUpOffset: region.maxUpOffset || 0,
@@ -97,7 +97,7 @@ function convertFloatingRegion(floatingRegions) {
97
97
  height: region.height,
98
98
  };
99
99
  }
100
- return floatingRegion
100
+ return floatingRegion;
101
101
  });
102
102
  }
103
103
 
@@ -1,3 +1,4 @@
1
+ /* global WebSocket */
1
2
  const uuid = require('uuid');
2
3
 
3
4
  class Socket {
@@ -77,8 +77,14 @@ export function findElements(context: Context, selector: Selector, parent: Eleme
77
77
  const root = parent ?? context
78
78
  const sel = typeof selector === 'string' ? selector : eyesSelector.selector
79
79
  if (typeof selector !== 'string' && eyesSelector.type === 'xpath') {
80
- // TODO return multiple
81
- return context.evaluate(sel, context, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
80
+ const results = [];
81
+ const queryResult = document.evaluate(sel, context,
82
+ null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
83
+
84
+ for (let i = 0; i < queryResult.snapshotLength; i++) {
85
+ results.push(queryResult.snapshotItem(i));
86
+ }
87
+ return results;
82
88
  } else {
83
89
  return root.querySelectorAll(sel)
84
90
  }
@@ -26,14 +26,10 @@ function printTestResults(testResultsArr) {
26
26
  }
27
27
  }
28
28
  function handleBatchResultsFile(results, tapFileConfig) {
29
- try {
30
- const formatter = new TestResultsFormatter(results);
31
- const fileName = tapFileConfig.tapFileName || `${new Date().toISOString()}-eyes.tap`;
32
- const tapFile = resolve(tapFileConfig.tapDirPath, fileName);
33
- return writeFile(tapFile, formatter.asHierarchicTAPString(false, true));
34
- } catch (ex) {
35
- console.log(ex);
36
- }
29
+ const formatter = new TestResultsFormatter(results);
30
+ const fileName = tapFileConfig.tapFileName || `${new Date().toISOString()}-eyes.tap`;
31
+ const tapFile = resolve(tapFileConfig.tapDirPath, fileName);
32
+ return writeFile(tapFile, formatter.asHierarchicTAPString(false, true));
37
33
  }
38
34
 
39
35
  module.exports = {printTestResults, handleBatchResultsFile};
@@ -20,7 +20,7 @@ function makeGlobalRunHooks({closeManager, closeBatches, closeUniversalServer})
20
20
  const testResultsArr = [];
21
21
  for (const summary of summaries) {
22
22
  const testResults = summary.results.map(({testResults}) => testResults);
23
- for(const result of testResults){
23
+ for (const result of testResults) {
24
24
  testResultsArr.push(new TestResults(result));
25
25
  }
26
26
  }
@@ -42,7 +42,7 @@ function makeGlobalRunHooks({closeManager, closeBatches, closeUniversalServer})
42
42
 
43
43
  handleTestResults.printTestResults({testResults: testResultsArr, resultConfig});
44
44
  } finally {
45
- closeUniversalServer();
45
+ await closeUniversalServer();
46
46
  }
47
47
  },
48
48
  };
@@ -5,10 +5,10 @@ const {makeServerProcess} = require('@applitools/eyes-universal');
5
5
  const {TestResults} = require('@applitools/visual-grid-client');
6
6
  const handleTestResults = require('./handleTestResults');
7
7
 
8
- function makeStartServer() {
8
+ function makeStartServer({logger}) {
9
9
  return async function startServer() {
10
- const {server, port} = await makeHandler({});
11
- // const {port: universalPort, close: closeUniversalServer} = {port: 21077, close: () => {}}; //await makeServerProcess();
10
+ const {server, port} = await makeHandler({singleton: false});
11
+
12
12
  const {port: universalPort, close: closeUniversalServer} = await makeServerProcess();
13
13
 
14
14
  const managers = [];
@@ -18,7 +18,7 @@ function makeStartServer() {
18
18
  socketWithUniversal = connectSocket(`ws://localhost:${universalPort}/eyes`);
19
19
 
20
20
  socketWithUniversal.setPassthroughListener(message => {
21
- console.log('<== ', message.toString().slice(0, 1000));
21
+ logger.log('<== ', message.toString().slice(0, 1000));
22
22
  const {name, payload} = JSON.parse(message);
23
23
  if (name === 'Core.makeManager') {
24
24
  managers.push({manager: payload.result, socketWithUniversal});
@@ -29,7 +29,7 @@ function makeStartServer() {
29
29
 
30
30
  socketWithClient.on('message', message => {
31
31
  const msg = JSON.parse(message);
32
- console.log('==> ', message.toString().slice(0, 1000));
32
+ logger.log('==> ', message.toString().slice(0, 1000));
33
33
  if (msg.name === 'Test.printTestResults') {
34
34
  try {
35
35
  const resultArr = [];
@@ -89,7 +89,7 @@ function makeStartServer() {
89
89
  function closeBatches(settings) {
90
90
  if (socketWithUniversal)
91
91
  return socketWithUniversal.request('Core.closeBatches', {settings}).catch(err => {
92
- console.log('@@@', err);
92
+ logger.log('@@@', err);
93
93
  });
94
94
  }
95
95
  };
@@ -2,10 +2,12 @@
2
2
  const makePluginExport = require('./pluginExport');
3
3
  const makeConfig = require('./config');
4
4
  const makeStartServer = require('./server');
5
+ const {makeLogger} = require('@applitools/logger');
5
6
 
6
7
  const {config, eyesConfig} = makeConfig();
8
+ const logger = makeLogger({level: config.showLogs ? 'info' : 'silent', label: 'eyes'});
7
9
 
8
- const startServer = makeStartServer();
10
+ const startServer = makeStartServer({logger});
9
11
 
10
12
  module.exports = makePluginExport({
11
13
  startServer,
package/dist/.DS_Store DELETED
Binary file
@@ -1,17 +0,0 @@
1
- export declare type Selector = string;
2
- export declare type Context = Document;
3
- export declare type Element = HTMLElement;
4
- export declare function executeScript(context: Context, script: string, arg: any): any;
5
- export declare function isDriver(driver: Context): boolean;
6
- export declare function parentContext(currentContext: Context): Context;
7
- export declare function mainContext(): Context;
8
- export declare function isElement(element: Element): boolean;
9
- export declare function getViewportSize(): Object;
10
- export declare function setViewportSize(vs: any): void;
11
- export declare function findElement(context: Context, element: Selector, type: string, parent: Context): Node;
12
- export declare function findElements(context: Context, element: Selector, type: string, parent: Context): Node[];
13
- export declare function isSelector(selector: Selector): boolean;
14
- export declare function getTitle(context: Context): string;
15
- export declare function getUrl(context: Context): string;
16
- export declare function childContext(_context: Context, element: HTMLIFrameElement): Context;
17
- export declare function getCookies(): Promise<any>;
package/src/.DS_Store DELETED
Binary file
@@ -1,44 +0,0 @@
1
- class TestResultContainerData {
2
- /** @internal */
3
- constructor(container, deleteTest) {
4
- this.#container = container // eslint-disable-line
5
- this.#deleteTest = deleteTest // eslint-disable-line
6
- }
7
-
8
- get testResults() {
9
- return this.container.testResults
10
- }
11
- getTestResults() {
12
- return new TestResultsData(this.container.testResults, this.deleteTest.bind({batchId: this.container.testResults.batchId, secretToken: this.container.testResults.secretToken}))
13
- }
14
-
15
- get exception() {
16
- return this.container.exception
17
- }
18
- getException() {
19
- return this.exception
20
- }
21
-
22
- get browserInfo() {
23
- return this.container.browserInfo
24
- }
25
-
26
- getBrowserInfo() {
27
- return this.browserInfo
28
- }
29
-
30
- /** @internal */
31
- toObject() {
32
- return this.container
33
- }
34
-
35
- /** @internal */
36
- toJSON() {
37
- return utils.general.toJSON(this.container)
38
- }
39
-
40
- /** @internal */
41
- toString() {
42
- return `${this.testResults ? this.testResults : ''} - ${this.exception ? this.exception : ''}`
43
- }
44
- }
@@ -1,53 +0,0 @@
1
- const TestResultContainerData = require('./TestResultContainerData');
2
- class TestResultsSummary {
3
- constructor({summary, deleteTest}) {
4
- // same as in eyes-api
5
- if (!summary) return;
6
- this.results = summary.results.map(
7
- container => new TestResultContainerData({container, deleteTest}),
8
- );
9
- this.passed = summary.passed;
10
- this.unresolved = summary.unresolved;
11
- this.failed = summary.failed;
12
- this.exceptions = summary.exceptions;
13
- this.mismatches = summary.mismatches;
14
- this.missing = summary.missing;
15
- this.matches = summary.matches;
16
- }
17
-
18
- getAllResults() {
19
- return this.results;
20
- }
21
-
22
- [Symbol.iterator]() {
23
- return this.results[Symbol.iterator]();
24
- }
25
-
26
- /** @internal */
27
- toJSON() {
28
- return this.results.map(container => utils.general.toJSON(container));
29
- }
30
-
31
- /** @internal */
32
- toString() {
33
- return (
34
- 'result summary {' +
35
- '\n\tpassed=' +
36
- this.passed +
37
- '\n\tunresolved=' +
38
- this.unresolved +
39
- '\n\tfailed=' +
40
- this.failed +
41
- '\n\texceptions=' +
42
- this.exceptions +
43
- '\n\tmismatches=' +
44
- this.mismatches +
45
- '\n\tmissing=' +
46
- this.missing +
47
- '\n\tmatches=' +
48
- this.matches +
49
- '\n}'
50
- );
51
- }
52
- }
53
- module.exports = TestResultsSummary;