@applitools/eyes-cypress 3.30.0 → 3.30.2

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
@@ -12,6 +12,19 @@
12
12
 
13
13
 
14
14
 
15
+ ## 3.30.2 - 2023/3/28
16
+
17
+ ### Features
18
+ ### Bug fixes
19
+ - map visualGridOptions to ufgOptions
20
+
21
+ ## 3.30.1 - 2023/3/22
22
+
23
+ ### Features
24
+ ### Bug fixes
25
+ - Fixed cypress 8 not working with core v2
26
+ - Fixed closeBatch issue
27
+
15
28
  ## 3.30.0 - 2023/3/19
16
29
 
17
30
  ### Features
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const handleTestResults_1 = __importDefault(require("./handleTestResults"));
7
- function makeGlobalRunHooks({ closeManager, closeBatches, closeUniversalServer }) {
7
+ function makeGlobalRunHooks({ closeManager, closeBatches, closeUniversalServer, }) {
8
8
  return {
9
9
  'before:run': ({ config }) => {
10
10
  if (!config.isTextTerminal)
@@ -21,7 +21,7 @@ function makeGlobalRunHooks({ closeManager, closeBatches, closeUniversalServer }
21
21
  }
22
22
  if (!config.appliConfFile.dontCloseBatches) {
23
23
  await closeBatches({
24
- batchIds: [config.appliConfFile.batchId || config.appliConfFile.batch.id],
24
+ batchId: config.appliConfFile.batchId || config.appliConfFile.batch.id,
25
25
  serverUrl: config.appliConfFile.serverUrl,
26
26
  proxy: config.appliConfFile.proxy,
27
27
  apiKey: config.appliConfFile.apiKey,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const isGlobalHooksSupported_1 = __importDefault(require("./isGlobalHooksSupported"));
7
7
  const functional_commons_1 = require("@applitools/functional-commons");
8
8
  const hooks_1 = __importDefault(require("./hooks"));
9
- function makePluginExport({ startServer, eyesConfig }) {
9
+ function makePluginExport({ startServer, eyesConfig, }) {
10
10
  return function pluginExport(pluginInitArgs) {
11
11
  let eyesServer, pluginModuleExports, pluginExportsE2E, pluginExportsComponent;
12
12
  let pluginExports;
@@ -58,7 +58,7 @@ function makePluginExport({ startServer, eyesConfig }) {
58
58
  return new Promise(res => eyesServer.close(() => res()));
59
59
  };
60
60
  async function setupNodeEvents(origOn, cypressConfig) {
61
- const { server, port, closeManager, closeBatches, closeUniversalServer } = await startServer();
61
+ const { server, port, closeManager, closeBatches, closeUniversalServer } = await startServer(cypressConfig);
62
62
  eyesServer = server;
63
63
  const globalHooks = (0, hooks_1.default)({
64
64
  closeManager,
@@ -14,7 +14,7 @@ const ws_1 = require("ws");
14
14
  const which_1 = __importDefault(require("which"));
15
15
  const util_1 = require("util");
16
16
  function makeStartServer({ logger }) {
17
- return async function startServer() {
17
+ return async function startServer(options) {
18
18
  const key = fs_1.default.readFileSync(path_1.default.resolve(__dirname, '../../src/pem/server.key'));
19
19
  const cert = fs_1.default.readFileSync(path_1.default.resolve(__dirname, '../../src/pem/server.cert'));
20
20
  const https = new https_1.Server({
@@ -29,7 +29,9 @@ function makeStartServer({ logger }) {
29
29
  detached: true,
30
30
  };
31
31
  const cypressVersion = require('cypress/package.json').version;
32
- if ((0, semver_1.lt)(cypressVersion, '7.0.0')) {
32
+ const isCypressVersionBelow7 = (0, semver_1.lt)(cypressVersion, '7.0.0');
33
+ const isNodeVersionSystem = !!(options === null || options === void 0 ? void 0 : options.nodeVersion) && options.nodeVersion !== 'system';
34
+ if (isCypressVersionBelow7 || isNodeVersionSystem) {
33
35
  forkOptions.execPath = await (0, which_1.default)('node');
34
36
  }
35
37
  const { port: universalPort, close: closeUniversalServer } = await (0, core_1.makeCoreServerProcess)({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-cypress",
3
- "version": "3.30.0",
3
+ "version": "3.30.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git://github.com/applitools/eyes.sdk.javascript1.git",
@@ -36,6 +36,8 @@
36
36
  "test:ts": "yarn test:ts:compile && yarn test:ts:run",
37
37
  "test:ts:compile": "tsc --project test/e2e/ts/cypress",
38
38
  "test:ts:run:legacy": "yarn cypress9 run --config-file ./test/e2e/ts/cypress-ts-legacy.json",
39
+ "cypress8": "./node_modules/cypress8/bin/cypress",
40
+ "test:ts:run:8": "yarn cypress8 run --project ./test/e2e/ts --config-file ./cypress-8.config.ts",
39
41
  "cypress9": "./node_modules/cypress9/bin/cypress",
40
42
  "test:ts:run:9": "yarn cypress9 run --project ./test/e2e/ts --config-file ./cypress-9.config.ts",
41
43
  "cypress10": "./node_modules/cypress10/bin/cypress",
@@ -54,7 +56,8 @@
54
56
  "cypress:run:new": "cd test/play && yarn && npx cypress run --spec=../fixtures/testApp/cypress/integration-play/play.js",
55
57
  "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",
56
58
  "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",
57
- "prepublish:setup": "sudo apt-get install xvfb",
59
+ "setup": "yarn xvfb:setup",
60
+ "xvfb:setup": "sudo apt-get install -y xvfb; Xvfb -ac $DISPLAY -screen 0 1280x1024x16 & echo 'Run xvfb'; sleep 10",
58
61
  "deps": "bongo deps",
59
62
  "preversion": "yarn build && bongo preversion --skip-deps --verifyPendingChanges --skipVerifyInstalledVersions",
60
63
  "version": "bongo version --withPendingChanges",
@@ -66,7 +69,7 @@
66
69
  }
67
70
  },
68
71
  "dependencies": {
69
- "@applitools/core": "2.4.2",
72
+ "@applitools/core": "2.4.3",
70
73
  "@applitools/eyes-api": "1.13.12",
71
74
  "@applitools/functional-commons": "1.6.0",
72
75
  "@applitools/logger": "1.1.48",
@@ -80,7 +83,7 @@
80
83
  },
81
84
  "devDependencies": {
82
85
  "@applitools/api-extractor": "^1.2.12",
83
- "@applitools/bongo": "^3.0.1",
86
+ "@applitools/bongo": "^3.0.3",
84
87
  "@applitools/sdk-coverage-tests": "^3.0.0",
85
88
  "@applitools/snaptdout": "1.0.1",
86
89
  "@applitools/test-server": "1.1.28",
@@ -97,6 +100,7 @@
97
100
  "cypress10": "npm:cypress@^10.0.0",
98
101
  "cypress11": "npm:cypress@^11.0.0",
99
102
  "cypress12": "npm:cypress@^12.0.0",
103
+ "cypress8": "npm:cypress@^8.7.0",
100
104
  "cypress9": "npm:cypress@^9.0.0",
101
105
  "eslint": "8.10.0",
102
106
  "eslint-plugin-mocha-no-only": "1.1.1",
@@ -19,6 +19,9 @@ function eyesCheckMapValues({openToCheckSettingsArgs, args, refer, appliConfFile
19
19
  'region',
20
20
  'selector',
21
21
  'element',
22
+ 'variationGroupId',
23
+ 'accessibilitySettings',
24
+ 'visualGridOptions',
22
25
  ]
23
26
 
24
27
  let regionSettings = {}
@@ -53,6 +56,10 @@ function eyesCheckMapValues({openToCheckSettingsArgs, args, refer, appliConfFile
53
56
  checkSettings.accessibilitySettings = accessibilitySettings
54
57
  }
55
58
 
59
+ if (args.visualGridOptions) {
60
+ checkSettings.ufgOptions = args.visualGridOptions
61
+ }
62
+
56
63
  if (args.target === 'region') {
57
64
  if (!Array.isArray(args.selector)) {
58
65
  if (args.element) {
@@ -1,4 +1,5 @@
1
1
  import handleTestResults from './handleTestResults'
2
+ import {type StartServerReturn} from './server'
2
3
  export type EyesCypressAction = 'before:run' | 'after:run'
3
4
 
4
5
  declare global {
@@ -9,7 +10,7 @@ declare global {
9
10
  dontCloseBatches: boolean
10
11
  batch: any
11
12
  serverUrl: string
12
- proxy: string
13
+ proxy: any // TODO: add proxy type
13
14
  apiKey: string
14
15
  batchId: string
15
16
  tapDirPath: string
@@ -19,7 +20,11 @@ declare global {
19
20
  }
20
21
  }
21
22
 
22
- export default function makeGlobalRunHooks({closeManager, closeBatches, closeUniversalServer}: any): {
23
+ export default function makeGlobalRunHooks({
24
+ closeManager,
25
+ closeBatches,
26
+ closeUniversalServer,
27
+ }: Omit<StartServerReturn, 'server' | 'port'>): {
23
28
  'after:run': (results: CypressCommandLine.CypressRunResult) => void | Promise<void>
24
29
  'before:run': (runDetails: Cypress.BeforeRunDetails) => void | Promise<void>
25
30
  } {
@@ -39,7 +44,7 @@ export default function makeGlobalRunHooks({closeManager, closeBatches, closeUni
39
44
  }
40
45
  if (!config.appliConfFile.dontCloseBatches) {
41
46
  await closeBatches({
42
- batchIds: [config.appliConfFile.batchId || config.appliConfFile.batch.id],
47
+ batchId: config.appliConfFile.batchId || config.appliConfFile.batch.id,
43
48
  serverUrl: config.appliConfFile.serverUrl,
44
49
  proxy: config.appliConfFile.proxy,
45
50
  apiKey: config.appliConfFile.apiKey,
@@ -22,6 +22,7 @@ export type EyesPluginConfig = {
22
22
  eyesTestConcurrency: number
23
23
  eyesWaitBeforeCapture: number
24
24
  eyesPort?: number
25
+ eyesIsGlobalHooksSupported?: boolean
25
26
  }
26
27
 
27
28
  const {config, eyesConfig} = makeConfig()
@@ -3,8 +3,15 @@ import isGlobalHooksSupported from './isGlobalHooksSupported'
3
3
  import {presult} from '@applitools/functional-commons'
4
4
  import makeGlobalRunHooks from './hooks'
5
5
  import {type EyesPluginConfig} from './'
6
+ import {type StartServerReturn} from './server'
6
7
 
7
- export default function makePluginExport({startServer, eyesConfig}: any) {
8
+ export default function makePluginExport({
9
+ startServer,
10
+ eyesConfig,
11
+ }: {
12
+ startServer: (options?: Cypress.PluginConfigOptions) => Promise<StartServerReturn>
13
+ eyesConfig: EyesPluginConfig
14
+ }) {
8
15
  return function pluginExport(pluginInitArgs: Cypress.ConfigOptions | NodeJS.Module) {
9
16
  let eyesServer: any, pluginModuleExports: any, pluginExportsE2E: any, pluginExportsComponent: any
10
17
  let pluginExports
@@ -62,7 +69,7 @@ export default function makePluginExport({startServer, eyesConfig}: any) {
62
69
  origOn: Cypress.PluginEvents,
63
70
  cypressConfig: Cypress.PluginConfigOptions,
64
71
  ): Promise<EyesPluginConfig> {
65
- const {server, port, closeManager, closeBatches, closeUniversalServer} = await startServer()
72
+ const {server, port, closeManager, closeBatches, closeUniversalServer} = await startServer(cypressConfig)
66
73
  eyesServer = server
67
74
 
68
75
  const globalHooks: any = makeGlobalRunHooks({
@@ -1,5 +1,5 @@
1
1
  import connectSocket, {type SocketWithUniversal} from './webSocket'
2
- import {makeCoreServerProcess} from '@applitools/core'
2
+ import {type CloseBatchSettings, makeCoreServerProcess} from '@applitools/core'
3
3
  import handleTestResults from './handleTestResults'
4
4
  import path from 'path'
5
5
  import fs from 'fs'
@@ -10,9 +10,16 @@ import which from 'which'
10
10
  import {type Logger} from '@applitools/logger'
11
11
  import {AddressInfo} from 'net'
12
12
  import {promisify} from 'util'
13
+ export type StartServerReturn = {
14
+ server: Omit<SocketWithUniversal, 'disconnect' | 'ref' | 'unref' | 'send' | 'request' | 'setPassthroughListener'>
15
+ port: number
16
+ closeManager: () => Promise<any[]>
17
+ closeBatches: (settings: CloseBatchSettings | CloseBatchSettings[]) => Promise<void>
18
+ closeUniversalServer: () => void
19
+ }
13
20
 
14
21
  export default function makeStartServer({logger}: {logger: Logger}) {
15
- return async function startServer() {
22
+ return async function startServer(options?: Cypress.PluginConfigOptions): Promise<StartServerReturn> {
16
23
  const key = fs.readFileSync(path.resolve(__dirname, '../../src/pem/server.key'))
17
24
  const cert = fs.readFileSync(path.resolve(__dirname, '../../src/pem/server.cert'))
18
25
  const https = new HttpsServer({
@@ -38,7 +45,18 @@ export default function makeStartServer({logger}: {logger: Logger}) {
38
45
  // `cypress` version below `7.0.0` has an old Electron version which not support async shell process.
39
46
  // By passing `execPath` with the node process cwd it will switch the `node` process to be the like the OS have
40
47
  // and will not use the unsupported `Cypress Helper.app` with the not supported shell process Electron
41
- if (semverLt(cypressVersion, '7.0.0')) {
48
+ const isCypressVersionBelow7 = semverLt(cypressVersion, '7.0.0')
49
+
50
+ // `nodeVersion` property set the way the `node` process will be executed
51
+ // if set to `system` it will use the `node` process that the OS have
52
+ // if set to `bundled` it will use the `node` process that the `Cypress Helper.app` have
53
+ //
54
+ // [doc link](https://docs.cypress.io/guides/references/configuration#Node-version)
55
+ //
56
+ // this is why if `nodeVersion` exits and not set to `system` we need to tell to the `universal` server the `execPath` to `node`
57
+ const isNodeVersionSystem = !!options?.nodeVersion && options.nodeVersion !== 'system'
58
+
59
+ if (isCypressVersionBelow7 || isNodeVersionSystem) {
42
60
  forkOptions.execPath = await which('node')
43
61
  }
44
62
 
@@ -128,7 +146,7 @@ export default function makeStartServer({logger}: {logger: Logger}) {
128
146
  ),
129
147
  )
130
148
  }
131
- function closeBatches(settings: any) {
149
+ function closeBatches(settings: CloseBatchSettings | CloseBatchSettings[]) {
132
150
  if (socketWithUniversal)
133
151
  return socketWithUniversal.request('Core.closeBatch', {settings}).catch((err: Error) => {
134
152
  logger.log('@@@', err)
package/types/expose.d.ts CHANGED
@@ -537,6 +537,7 @@ export type EyesPluginConfig = {
537
537
  eyesTestConcurrency: number;
538
538
  eyesWaitBeforeCapture: number;
539
539
  eyesPort?: number;
540
+ eyesIsGlobalHooksSupported?: boolean;
540
541
  };
541
542
  declare const _default: (pluginInitArgs: Cypress.ConfigOptions | NodeJS.Module) => Cypress.ConfigOptions | NodeJS.Module | (() => Promise<void>);
542
543
  export default _default;