@applitools/eyes-cypress 3.26.0 → 3.26.1

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
@@ -8,6 +8,16 @@
8
8
 
9
9
 
10
10
 
11
+ ## 3.26.1 - 2022/6/2
12
+
13
+ ### Features
14
+ - Improve type definitions
15
+ - Dorp support for Node.js versions <=12
16
+ ### Bug fixes
17
+ - Support `cy.eyesGetAllTestResults` in TypeScript
18
+ - Set EyesExceptions (such as new test, diffs exception and failed test exception) to exception property in TestResultsSummary
19
+ - Improve error message when failed to set viewport size
20
+
11
21
  ## 3.26.0 - 2022/5/19
12
22
 
13
23
  ### Features
package/index.d.ts ADDED
@@ -0,0 +1,89 @@
1
+ /// <reference types="cypress" />
2
+
3
+ import type * as types from '@applitools/types'
4
+ import type * as api from '@applitools/eyes-api'
5
+
6
+ type MaybeArray<T> = T | T[]
7
+
8
+ type LegacyRegion = {left: number; top: number; width: number; height: number}
9
+ type Selector = {selector: string; type?: 'css' | 'xpath', nodeType?: 'element' | 'shadow-root'} | 'string'
10
+ type Element = HTMLElement | JQuery<HTMLElement>
11
+
12
+ interface CypressCheckSettings extends types.CheckSettings<Element, Selector> {
13
+ tag?: CypressCheckSettings['name']
14
+
15
+ target?: 'window' | 'region'
16
+ selector?: Selector
17
+ element?: Element
18
+
19
+ ignore?: MaybeArray<CypressCheckSettings['ignoreRegions'][number] | LegacyRegion>
20
+ layout?: MaybeArray<CypressCheckSettings['layoutRegions'][number] | LegacyRegion>
21
+ content?: MaybeArray<CypressCheckSettings['contentRegions'][number] | LegacyRegion>
22
+ strict?: MaybeArray<CypressCheckSettings['strictRegions'][number] | LegacyRegion>
23
+ 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})>
25
+
26
+ scriptHooks?: CypressCheckSettings['hooks']
27
+ }
28
+
29
+ interface CypressEyesConfig extends types.EyesConfig<Element, Selector> {
30
+ browser?: MaybeArray<CypressEyesConfig['browsersInfo'][number] | {deviceName: string; screenOrientation?: types.ScreenOrientation; name?: string}>
31
+
32
+ batchId?: CypressEyesConfig['batch']['id']
33
+ batchName?: CypressEyesConfig['batch']['name']
34
+ batchSequence?: CypressEyesConfig['batch']['sequenceName']
35
+ notifyOnCompletion?: CypressEyesConfig['batch']['notifyOnCompletion']
36
+
37
+ envName?: CypressEyesConfig['environmentName']
38
+
39
+ ignoreCaret?: CypressEyesConfig['defaultMatchSettings']['ignoreCaret']
40
+ matchLevel?: CypressEyesConfig['defaultMatchSettings']['matchLevel']
41
+ accessibilitySettings?: CypressEyesConfig['defaultMatchSettings']['accessibilitySettings']
42
+ ignoreDisplacements?: CypressEyesConfig['defaultMatchSettings']['ignoreDisplacements']
43
+ }
44
+
45
+ declare global {
46
+ namespace Cypress {
47
+ interface Chainable {
48
+ /**
49
+ * Create an Applitools test.
50
+ * This will start a session with the Applitools server.
51
+ * @example
52
+ * cy.eyesOpen({ appName: 'My App' })
53
+ */
54
+ eyesOpen(config?: CypressEyesConfig): null
55
+
56
+ /**
57
+ * Generate a screenshot of the current page and add it to the Applitools Test.
58
+ * @example
59
+ * cy.eyesCheckWindow()
60
+ *
61
+ * OR
62
+ *
63
+ * cy.eyesCheckWindow({
64
+ * target: 'region',
65
+ * selector: '.my-element'
66
+ * });
67
+ */
68
+ eyesCheckWindow(tag?: string): null
69
+ eyesCheckWindow(settings?: CypressCheckSettings): null
70
+
71
+ /**
72
+ * Close the applitools test and check that all screenshots are valid.
73
+ * @example cy.eyesClose()
74
+ */
75
+ eyesClose(): null
76
+
77
+ /**
78
+ * Returns an object with the applitools test results from a given test / test file. This should be called after close.
79
+ * @example
80
+ * after(() => {
81
+ * cy.eyesGetAllTestResults().then(summary => {
82
+ * console.log(summary)
83
+ * })
84
+ * })
85
+ */
86
+ eyesGetAllTestResults(): Chainable<api.TestResultsSummary>
87
+ }
88
+ }
89
+ }
package/package.json CHANGED
@@ -1,77 +1,74 @@
1
1
  {
2
2
  "name": "@applitools/eyes-cypress",
3
- "version": "3.26.0",
4
- "main": "index.js",
3
+ "version": "3.26.1",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
7
+ "directory": "packages/eyes-cypress"
8
+ },
5
9
  "license": "SEE LICENSE IN LICENSE",
10
+ "main": "index.js",
11
+ "types": "./index.d.ts",
6
12
  "bin": {
7
13
  "eyes-setup": "./bin/eyes-setup.js"
8
14
  },
15
+ "files": [
16
+ "src",
17
+ "dist",
18
+ "bin",
19
+ "index.js",
20
+ "commands.js",
21
+ "index.d.ts"
22
+ ],
9
23
  "scripts": {
24
+ "lint": "eslint \"**/*.js\"",
10
25
  "build": "tsc",
11
- "render": "run(){ npx cypress run --config integrationFolder=test/fixtures/testApp/cypress/render,pluginsFile=test/fixtures/testApp/cypress/plugins/index-render.js,supportFile=test/fixtures/testApp/cypress/support/index-run.js --env url=$1; }; run",
26
+ "generate:tests": "coverage-tests generate",
27
+ "test": "yarn test:unit && yarn test:it && yarn test:e2e && yarn test:ts && yarn test:coverage",
12
28
  "test:unit": "mocha --no-timeouts 'test/unit/**/*.test.js'",
13
29
  "test:it": "mocha --no-timeouts 'test/it/**/*.test.js'",
14
30
  "test:e2e": "mkdir -p test/fixtures/testAppCopies && mocha --no-timeouts 'test/e2e/**/*.test.js'",
15
31
  "test:ts:compile": "tsc --project test/e2e/ts/cypress",
16
32
  "test:ts:run": "cypress run --config-file test/e2e/ts/cypress-ts.json",
17
33
  "test:ts": "yarn test:ts:compile && yarn test:ts:run",
18
- "lint": "eslint \"**/*.js\"",
19
- "test": "yarn test:unit && yarn test:it && yarn test:e2e && yarn test:ts && yarn test:coverage",
34
+ "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",
20
35
  "cypress": "cypress open --config-file test/fixtures/cypress-play.json",
21
36
  "cypress:new": "node_modules/cypress-new/bin/cypress open --config-file test/fixtures/cypress-play.json",
22
37
  "cypress:run": "cypress run --config-file test/fixtures/cypress-play.json --spec=test/fixtures/testApp/cypress/integration-play/play.js",
23
38
  "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",
24
39
  "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",
40
+ "render": "run(){ npx cypress run --config integrationFolder=test/fixtures/testApp/cypress/render,pluginsFile=test/fixtures/testApp/cypress/plugins/index-render.js,supportFile=test/fixtures/testApp/cypress/support/index-run.js --env url=$1; }; run",
41
+ "prepublish:setup": "sudo apt-get install xvfb",
42
+ "deps": "bongo deps",
25
43
  "preversion": "yarn build && bongo preversion --skip-deps --verifyPendingChanges",
26
44
  "version": "bongo version --withPendingChanges",
27
- "postversion": "bongo postversion --skip-release-notification",
28
- "deps": "bongo deps",
29
- "generate:tests": "coverage-tests generate",
30
- "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",
31
- "prepublish:setup": "sudo apt-get install xvfb"
32
- },
33
- "files": [
34
- "src",
35
- "dist",
36
- "bin",
37
- "index.js",
38
- "commands.js",
39
- "eyes-index.d.ts"
40
- ],
41
- "types": "./eyes-index.d.ts",
42
- "engines": {
43
- "node": ">=8.0.0"
45
+ "postversion": "bongo postversion --skip-release-notification"
44
46
  },
45
- "repository": {
46
- "type": "git",
47
- "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
48
- "directory": "packages/eyes-cypress"
47
+ "husky": {
48
+ "hooks": {
49
+ "pre-push": "yarn bongo lint"
50
+ }
49
51
  },
50
52
  "dependencies": {
51
- "@applitools/dom-snapshot": "4.5.12",
52
- "@applitools/eyes-api": "1.4.1",
53
- "@applitools/eyes-universal": "2.5.15",
53
+ "@applitools/eyes-api": "1.5.2",
54
+ "@applitools/eyes-universal": "2.6.1",
54
55
  "@applitools/functional-commons": "1.6.0",
55
- "@applitools/logger": "1.1.5",
56
- "@applitools/visual-grid-client": "15.12.28",
57
- "body-parser": "1.19.0",
56
+ "@applitools/logger": "1.1.8",
57
+ "@applitools/visual-grid-client": "15.12.38",
58
58
  "chalk": "3.0.0",
59
- "cors": "2.8.5",
60
- "express": "4.17.1",
61
- "lodash.flatten": "4.4.0",
62
59
  "uuid": "8.3.2",
63
60
  "ws": "8.5.0"
64
61
  },
65
62
  "devDependencies": {
66
- "@applitools/bongo": "^2.1.0",
63
+ "@applitools/bongo": "^2.1.1",
67
64
  "@applitools/scripts": "1.1.0",
68
65
  "@applitools/sdk-coverage-tests": "^2.3.18",
69
66
  "@applitools/snaptdout": "1.0.1",
70
- "@applitools/test-server": "1.0.8",
67
+ "@applitools/test-server": "1.0.10",
71
68
  "@applitools/test-utils": "1.3.2",
72
- "@applitools/types": "^1.4.3",
73
- "@applitools/utils": "1.3.0",
74
- "@types/node": "17.0.13",
69
+ "@applitools/types": "^1.4.5",
70
+ "@applitools/utils": "1.3.3",
71
+ "@types/node": "12",
75
72
  "@types/ws": "^8.2.2",
76
73
  "@typescript-eslint/eslint-plugin": "^5.10.2",
77
74
  "@typescript-eslint/parser": "^5.10.2",
@@ -93,9 +90,7 @@
93
90
  "prettier": "1.19.1",
94
91
  "typescript": "4.6.4"
95
92
  },
96
- "husky": {
97
- "hooks": {
98
- "pre-push": "yarn bongo lint"
99
- }
93
+ "engines": {
94
+ "node": ">=12.13.0"
100
95
  }
101
96
  }
@@ -1,11 +1,12 @@
1
1
  'use strict';
2
- const {configParams, ConfigUtils, TypeUtils} = require('@applitools/visual-grid-client');
2
+ const utils = require('@applitools/utils');
3
+ const {configParams, TypeUtils} = require('@applitools/visual-grid-client');
3
4
  const DEFAULT_TEST_CONCURRENCY = 5;
4
5
  const uuid = require('uuid');
5
6
 
6
7
  function makeConfig() {
7
- const config = ConfigUtils.getConfig({
8
- configParams: [
8
+ const config = utils.config.getConfig({
9
+ params: [
9
10
  ...configParams,
10
11
  'failCypressOnDiff',
11
12
  'tapDirPath',
@@ -6,12 +6,12 @@ function getFilePath(type, cypressConfig, cwd) {
6
6
  let filePath = {
7
7
  plugins: join('cypress', 'plugins', 'index.js'),
8
8
  support: join('cypress', 'support', 'index.js'),
9
- typeScript: join('cypress', 'support', 'eyes-index.d.ts'),
9
+ typeScript: join('cypress', 'support', 'index.d.ts'),
10
10
  }[type];
11
11
 
12
12
  if (type === 'typeScript' && cypressConfig && cypressConfig[`supportFile`]) {
13
13
  const supportDir = dirname(cypressConfig[`supportFile`]);
14
- filePath = resolve(supportDir, 'eyes-index.d.ts');
14
+ filePath = resolve(supportDir, 'index.d.ts');
15
15
  }
16
16
 
17
17
  filePath = (cypressConfig && cypressConfig[`${type}File`]) || filePath;
package/eyes-index.d.ts DELETED
@@ -1,48 +0,0 @@
1
- /// <reference types="Cypress" />
2
- /// <reference types="@applitools/visual-grid-client" />
3
- import {TestResultsSummary} from '@applitools/eyes-api';
4
-
5
- declare global {
6
- namespace Cypress {
7
- interface Chainable {
8
- /**
9
- * Create an Applitools test.
10
- * This will start a session with the Applitools server.
11
- * @example
12
- * cy.eyesOpen({ appName: 'My App' })
13
- */
14
- eyesOpen(options?: Eyes.Open.Options): null // add isDisabled
15
-
16
- /**
17
- * Generate a screenshot of the current page and add it to the Applitools Test.
18
- * @example
19
- * cy.eyesCheckWindow()
20
- *
21
- * OR
22
- *
23
- * cy.eyesCheckWindow({
24
- * target: 'region',
25
- * selector: '.my-element'
26
- * });
27
- */
28
- eyesCheckWindow(config?: Eyes.Check.Options|String): null
29
-
30
- /**
31
- * Close the applitools test and check that all screenshots are valid.
32
- * @example cy.eyesClose()
33
- */
34
- eyesClose(): null
35
-
36
- /**
37
- * Returns an object with the applitools test results from a given test / test file. This should be called after close.
38
- * @example
39
- * after(() => {
40
- * cy.eyesGetAllTestResults().then(summary => {
41
- * console.log(summary)
42
- * })
43
- * })
44
- */
45
- eyesGetAllTestResults(): Chainable<TestResultsSummary>
46
- }
47
- }
48
- }