@applitools/eyes-cypress 3.26.2 → 3.26.5
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 +25 -0
- package/README.md +15 -5
- package/bin/eyes-setup.js +22 -6
- package/package.json +24 -20
- package/src/browser/commands.js +0 -1
- package/src/browser/eyesCheckMapping.js +4 -0
- package/src/plugin/isGlobalHooksSupported.js +3 -2
- package/src/plugin/pluginExport.js +9 -2
- package/src/plugin/server.js +11 -1
- package/src/setup/addEyesCypressPlugin.js +1 -2
- package/src/setup/handleCommands.js +33 -1
- package/src/setup/handlePlugin.js +16 -8
- package/src/setup/handleTypeScript.js +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,31 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
## 3.26.5 - 2022/7/12
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
### Bug fixes
|
|
16
|
+
- Support string tag name in eyesCheck
|
|
17
|
+
|
|
18
|
+
## 3.26.4 - 2022/7/7
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
- Add support for cypress 10
|
|
22
|
+
### Bug fixes
|
|
23
|
+
- Fix use cases where we fail to serialize elements
|
|
24
|
+
- Fixed bug where a failure in a single UFG environment fails all other environments in the same configuration
|
|
25
|
+
|
|
26
|
+
## 3.26.3 - 2022/6/17
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
- Add special attribute for pseudo elements
|
|
30
|
+
- Add the ability for the SDK to lazy load the page prior to performing a check window
|
|
31
|
+
- Support padding for regions in the following region types - ignoreRegions, layoutRegions, strictRegions, contentRegions
|
|
32
|
+
- Allow configuration file to be loaded from ancestor directories
|
|
33
|
+
### Bug fixes
|
|
34
|
+
- Fix rendering issues with Salesforce Lightning design system
|
|
35
|
+
- Fix issue that prevented self-signed certificates from working when connecting through a proxy server
|
|
36
|
+
|
|
12
37
|
## 3.26.2 - 2022/6/8
|
|
13
38
|
|
|
14
39
|
### Features
|
package/README.md
CHANGED
|
@@ -27,9 +27,12 @@ The above command will add the necessary imports to your cypress `pluginsFile` a
|
|
|
27
27
|
#### Manual configuration
|
|
28
28
|
|
|
29
29
|
##### 1. Configure Eyes-Cypress plugin
|
|
30
|
-
|
|
30
|
+
<br>
|
|
31
|
+
|
|
31
32
|
Eyes-Cypress acts as a [Cypress plugin](https://docs.cypress.io/guides/tooling/plugins-guide.html), so it should be configured as such.
|
|
32
|
-
Unfortunately there's no easy way to do this automatically, so you need to manually
|
|
33
|
+
Unfortunately there's no easy way to do this automatically, so you need to manually:
|
|
34
|
+
#### Cypress version < 10:
|
|
35
|
+
Add the following code to your `pluginsFile`:
|
|
33
36
|
|
|
34
37
|
**Important**: add this code **after** the definition of `module.exports`:
|
|
35
38
|
|
|
@@ -38,7 +41,16 @@ require('@applitools/eyes-cypress')(module)
|
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
Normally, this is `cypress/plugins/index.js`. You can read more about it in Cypress' docs [here](https://docs.cypress.io/guides/references/configuration.html#Folders-Files).
|
|
44
|
+
<br>
|
|
45
|
+
|
|
46
|
+
#### Cypress version >= 10:
|
|
41
47
|
|
|
48
|
+
Add the following code to your `cypress.config.js` file after `module.exports`:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
require('@applitools/eyes-cypress')(module)
|
|
52
|
+
```
|
|
53
|
+
This file is normally at the root of the project
|
|
42
54
|
##### 2. Configure custom commands
|
|
43
55
|
|
|
44
56
|
Eyes-Cypress exposes new commands to your tests. This means that more methods will be available on the `cy` object. To enable this, it's required to configure these custom commands.
|
|
@@ -48,7 +60,7 @@ As with the plugin, there's no automatic way to configure this in cypress, so yo
|
|
|
48
60
|
import '@applitools/eyes-cypress/commands'
|
|
49
61
|
```
|
|
50
62
|
|
|
51
|
-
Normally, this is `cypress/support/index.js
|
|
63
|
+
Normally, this is `cypress/support/index.js` for cypress version < 10 and `cypress/support/e2e.js` for cypress version >= 10. You can read more about it in Cypress' docs [here](https://docs.cypress.io/guides/references/configuration.html#Folders-Files).
|
|
52
64
|
|
|
53
65
|
##### 3. (Optional) TypeScript configuration
|
|
54
66
|
|
|
@@ -66,8 +78,6 @@ Add this file to your project with either:
|
|
|
66
78
|
```
|
|
67
79
|
cp node_modules/@applitools/eyes-cypress/eyes-index.d.ts ./cypress/support/
|
|
68
80
|
```
|
|
69
|
-
|
|
70
|
-
|
|
71
81
|
### Applitools API key
|
|
72
82
|
|
|
73
83
|
In order to authenticate via the Applitools server, you need to supply the Eyes-Cypress SDK with the API key you got from Applitools. Read more about how to obtain the API key [here](https://applitools.com/docs/topics/overview/obtain-api-key.html).
|
package/bin/eyes-setup.js
CHANGED
|
@@ -2,18 +2,34 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
const handlePlugin = require('../src/setup/handlePlugin');
|
|
6
|
-
const handleCommands = require('../src/setup/handleCommands');
|
|
7
|
-
const handleTypeScript = require('../src/setup/handleTypeScript');
|
|
5
|
+
const {handlePlugin} = require('../src/setup/handlePlugin');
|
|
6
|
+
const {handleCommands, handlerCommandsCypress10} = require('../src/setup/handleCommands');
|
|
7
|
+
const {handleTypeScript, handlerTypeScriptCypress10} = require('../src/setup/handleTypeScript');
|
|
8
8
|
const {version} = require('../package');
|
|
9
|
+
const fs = require('fs');
|
|
9
10
|
const cwd = process.cwd();
|
|
10
11
|
|
|
11
12
|
console.log(chalk.cyan('Setup eyes-cypress', version));
|
|
13
|
+
const packageJson = JSON.parse(fs.readFileSync('package.json'));
|
|
14
|
+
let cypressVersion;
|
|
12
15
|
|
|
16
|
+
if (packageJson.dependencies && packageJson.dependencies.cypress) {
|
|
17
|
+
cypressVersion = packageJson.dependencies.cypress;
|
|
18
|
+
} else if (packageJson.devDependencies && packageJson.devDependencies.cypress) {
|
|
19
|
+
cypressVersion = packageJson.devDependencies.cypress;
|
|
20
|
+
}
|
|
21
|
+
console.log(chalk.cyan('Cypress version that was found', cypressVersion));
|
|
22
|
+
const isCypress10 = parseFloat(cypressVersion, 10) >= 10 ? true : false;
|
|
13
23
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
if (!isCypress10) {
|
|
25
|
+
handlePlugin(cwd, isCypress10);
|
|
26
|
+
handleCommands(cwd);
|
|
27
|
+
handleTypeScript(cwd);
|
|
28
|
+
} else {
|
|
29
|
+
handlePlugin(cwd, isCypress10);
|
|
30
|
+
const supportFilePath = handlerCommandsCypress10(cwd);
|
|
31
|
+
handlerTypeScriptCypress10(supportFilePath);
|
|
32
|
+
}
|
|
17
33
|
} catch (e) {
|
|
18
34
|
console.log(chalk.red('Setup error:\n', e));
|
|
19
35
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-cypress",
|
|
3
|
-
"version": "3.26.
|
|
3
|
+
"version": "3.26.5",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git://github.com/applitools/eyes.sdk.javascript1.git",
|
|
7
|
-
"directory": "packages/eyes-cypress"
|
|
7
|
+
"directory": "js/packages/eyes-cypress"
|
|
8
8
|
},
|
|
9
9
|
"license": "SEE LICENSE IN LICENSE",
|
|
10
|
+
"aliases": [
|
|
11
|
+
"cypress",
|
|
12
|
+
"cy"
|
|
13
|
+
],
|
|
10
14
|
"main": "index.js",
|
|
11
15
|
"types": "./index.d.ts",
|
|
12
16
|
"bin": {
|
|
@@ -25,17 +29,18 @@
|
|
|
25
29
|
"build": "tsc",
|
|
26
30
|
"generate:tests": "coverage-tests generate",
|
|
27
31
|
"test": "yarn test:unit && yarn test:it && yarn test:e2e && yarn test:ts && yarn test:coverage",
|
|
32
|
+
"test:sanity": "yarn test:unit && yarn test:it && yarn test:ts",
|
|
28
33
|
"test:unit": "mocha --no-timeouts 'test/unit/**/*.test.js'",
|
|
29
|
-
"test:it": "mocha --no-timeouts 'test/it/**/*.test.js'",
|
|
30
|
-
"test:
|
|
34
|
+
"test:it": "yarn build && mocha --no-timeouts 'test/it/**/*.test.js'",
|
|
35
|
+
"test:ts": "yarn test:ts:compile && yarn test:ts:run",
|
|
31
36
|
"test:ts:compile": "tsc --project test/e2e/ts/cypress",
|
|
32
37
|
"test:ts:run": "cypress run --config-file test/e2e/ts/cypress-ts.json",
|
|
33
|
-
"test:
|
|
34
|
-
"test:
|
|
38
|
+
"test:coverage": "yarn generate:tests && cd test/coverage/generic && yarn && unset APPLITOOLS_API_KEY && APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-selenium' APPLITOOLS_BATCH_ID=$(uuidgen) npx cypress run",
|
|
39
|
+
"test:e2e": "mkdir -p test/fixtures/testAppCopies && mocha --no-timeouts 'test/e2e/**/*.test.js'",
|
|
35
40
|
"cypress": "cypress open --config-file test/fixtures/cypress-play.json",
|
|
36
|
-
"cypress:new": "
|
|
41
|
+
"cypress:new": "cd test/play && yarn && npx cypress open",
|
|
37
42
|
"cypress:run": "cypress run --config-file test/fixtures/cypress-play.json --spec=test/fixtures/testApp/cypress/integration-play/play.js",
|
|
38
|
-
"cypress:run:new": "
|
|
43
|
+
"cypress:run:new": "cd test/play && yarn && npx cypress run --spec=../fixtures/testApp/cypress/integration-play/play.js",
|
|
39
44
|
"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
45
|
"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
46
|
"prepublish:setup": "sudo apt-get install xvfb",
|
|
@@ -50,24 +55,24 @@
|
|
|
50
55
|
}
|
|
51
56
|
},
|
|
52
57
|
"dependencies": {
|
|
53
|
-
"@applitools/eyes-api": "1.
|
|
54
|
-
"@applitools/eyes-universal": "2.
|
|
58
|
+
"@applitools/eyes-api": "1.7.4",
|
|
59
|
+
"@applitools/eyes-universal": "2.9.6",
|
|
55
60
|
"@applitools/functional-commons": "1.6.0",
|
|
56
|
-
"@applitools/logger": "1.1.
|
|
57
|
-
"@applitools/visual-grid-client": "15.
|
|
61
|
+
"@applitools/logger": "1.1.15",
|
|
62
|
+
"@applitools/visual-grid-client": "15.13.6",
|
|
58
63
|
"chalk": "3.0.0",
|
|
59
64
|
"uuid": "8.3.2",
|
|
60
65
|
"ws": "8.5.0"
|
|
61
66
|
},
|
|
62
67
|
"devDependencies": {
|
|
63
|
-
"@applitools/bongo": "^2.1.
|
|
68
|
+
"@applitools/bongo": "^2.1.6",
|
|
64
69
|
"@applitools/scripts": "1.1.0",
|
|
65
|
-
"@applitools/sdk-coverage-tests": "^2.3.
|
|
70
|
+
"@applitools/sdk-coverage-tests": "^2.3.19",
|
|
66
71
|
"@applitools/snaptdout": "1.0.1",
|
|
67
|
-
"@applitools/test-server": "1.
|
|
68
|
-
"@applitools/test-utils": "1.
|
|
69
|
-
"@applitools/types": "^1.
|
|
70
|
-
"@applitools/utils": "1.3.
|
|
72
|
+
"@applitools/test-server": "1.1.4",
|
|
73
|
+
"@applitools/test-utils": "1.4.2",
|
|
74
|
+
"@applitools/types": "^1.5.5",
|
|
75
|
+
"@applitools/utils": "1.3.10",
|
|
71
76
|
"@types/node": "12",
|
|
72
77
|
"@types/ws": "^8.2.2",
|
|
73
78
|
"@typescript-eslint/eslint-plugin": "^5.10.2",
|
|
@@ -75,8 +80,7 @@
|
|
|
75
80
|
"chai": "4.2.0",
|
|
76
81
|
"chai-spies": "1.0.0",
|
|
77
82
|
"cookie-parser": "1.4.4",
|
|
78
|
-
"cypress": "
|
|
79
|
-
"cypress-new": "npm:cypress@9",
|
|
83
|
+
"cypress": "8.0.0",
|
|
80
84
|
"eslint": "8.10.0",
|
|
81
85
|
"eslint-plugin-mocha-no-only": "1.1.0",
|
|
82
86
|
"eslint-plugin-node": "7.0.1",
|
package/src/browser/commands.js
CHANGED
|
@@ -116,7 +116,6 @@ Cypress.Commands.add('eyesOpen', function(args = {}) {
|
|
|
116
116
|
name: 'eyes.cypress',
|
|
117
117
|
version: require('../../package.json').version,
|
|
118
118
|
commands: Object.keys(spec).concat(['isSelector', 'isDriver', 'isElement']), // TODO fix spec.isSelector and spec.isDriver and spec.isElement in driver utils
|
|
119
|
-
cwd: process.cwd(),
|
|
120
119
|
});
|
|
121
120
|
|
|
122
121
|
manager =
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* global Node */
|
|
2
2
|
function eyesCheckMapValues({args, refer}) {
|
|
3
|
+
if (typeof args === `string`) {
|
|
4
|
+
args = {tag: args};
|
|
5
|
+
}
|
|
3
6
|
const config = args; // just did it for having less git changes at this moment
|
|
4
7
|
const mappedValues = [
|
|
5
8
|
'tag',
|
|
@@ -12,6 +15,7 @@ function eyesCheckMapValues({args, refer}) {
|
|
|
12
15
|
'accessibility',
|
|
13
16
|
'region',
|
|
14
17
|
'selector',
|
|
18
|
+
'element',
|
|
15
19
|
];
|
|
16
20
|
|
|
17
21
|
let regionSettings = {};
|
|
@@ -5,8 +5,9 @@ function isGlobalHooksSupported(config) {
|
|
|
5
5
|
const {version, experimentalRunEvents} = config;
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
|
-
version >= CYPRESS_NO_FLAG_VERSION ||
|
|
9
|
-
(version >= CYPRESS_SUPPORTED_VERSION &&
|
|
8
|
+
parseFloat(version, 10) >= parseFloat(CYPRESS_NO_FLAG_VERSION, 10) ||
|
|
9
|
+
(parseFloat(version, 10) >= parseFloat(CYPRESS_SUPPORTED_VERSION, 10) &&
|
|
10
|
+
!!experimentalRunEvents)
|
|
10
11
|
);
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -6,8 +6,10 @@ const makeGlobalRunHooks = require('./hooks');
|
|
|
6
6
|
function makePluginExport({startServer, eyesConfig}) {
|
|
7
7
|
return function pluginExport(pluginModule) {
|
|
8
8
|
let eyesServer;
|
|
9
|
-
const pluginModuleExports = pluginModule.exports
|
|
10
|
-
|
|
9
|
+
const pluginModuleExports = pluginModule.exports.e2e
|
|
10
|
+
? pluginModule.exports.e2e.setupNodeEvents
|
|
11
|
+
: pluginModule.exports;
|
|
12
|
+
const setupNodeEvents = async function(...args) {
|
|
11
13
|
const {server, port, closeManager, closeBatches, closeUniversalServer} = await startServer();
|
|
12
14
|
eyesServer = server;
|
|
13
15
|
|
|
@@ -51,6 +53,11 @@ function makePluginExport({startServer, eyesConfig}) {
|
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
};
|
|
56
|
+
if (pluginModule.exports.e2e) {
|
|
57
|
+
pluginModule.exports.e2e.setupNodeEvents = setupNodeEvents;
|
|
58
|
+
} else {
|
|
59
|
+
pluginModule.exports = setupNodeEvents;
|
|
60
|
+
}
|
|
54
61
|
return function getCloseServer() {
|
|
55
62
|
return eyesServer.close();
|
|
56
63
|
};
|
package/src/plugin/server.js
CHANGED
|
@@ -55,7 +55,17 @@ function makeStartServer({logger}) {
|
|
|
55
55
|
socketWithClient.on('message', message => {
|
|
56
56
|
const msg = JSON.parse(message);
|
|
57
57
|
logger.log('==> ', message.toString().slice(0, 1000));
|
|
58
|
-
if (msg.name === '
|
|
58
|
+
if (msg.name === 'Core.makeSDK') {
|
|
59
|
+
const newMessage = Buffer.from(
|
|
60
|
+
JSON.stringify({
|
|
61
|
+
name: msg.name,
|
|
62
|
+
key: msg.key,
|
|
63
|
+
payload: Object.assign(msg.payload, {cwd: process.cwd()}),
|
|
64
|
+
}),
|
|
65
|
+
'utf-8',
|
|
66
|
+
);
|
|
67
|
+
socketWithUniversal.send(newMessage);
|
|
68
|
+
} else if (msg.name === 'Test.printTestResults') {
|
|
59
69
|
try {
|
|
60
70
|
const resultArr = [];
|
|
61
71
|
for (const result of msg.payload.testResults) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
3
6
|
const chalk = require('chalk');
|
|
4
7
|
const {readFileSync, writeFileSync} = require('fs');
|
|
5
8
|
const addEyesCommands = require('./addEyesCommands');
|
|
@@ -20,4 +23,33 @@ function handleCommands(cwd) {
|
|
|
20
23
|
}
|
|
21
24
|
}
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
function handlerCommandsCypress10(cwd) {
|
|
27
|
+
const configContent = fs.readFileSync(path.resolve(cwd, 'cypress.config.js'), 'utf-8');
|
|
28
|
+
let supportFilePath;
|
|
29
|
+
if (configContent.includes('supportFile')) {
|
|
30
|
+
const regex = new RegExp(/(?:supportFile:)(?:\s*)(.*)/g);
|
|
31
|
+
const filePath = regex.exec(configContent)[1].replace(/['|"|,]*/g, '');
|
|
32
|
+
supportFilePath = path.resolve(cwd, filePath);
|
|
33
|
+
} else {
|
|
34
|
+
if (fs.existsSync(path.resolve(cwd, 'cypress/support/e2e.js'))) {
|
|
35
|
+
supportFilePath = path.resolve(cwd, 'cypress/support/e2e.js');
|
|
36
|
+
} else if (fs.existsSync(path.resolve(cwd, 'cypress/support/component.js'))) {
|
|
37
|
+
supportFilePath = path.resolve(cwd, 'cypress/support/component.js');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (supportFilePath) {
|
|
42
|
+
const commandsFileContent = fs.readFileSync(supportFilePath, 'utf-8');
|
|
43
|
+
if (!isCommandsDefined(commandsFileContent)) {
|
|
44
|
+
writeFileSync(supportFilePath, addEyesCommands(commandsFileContent));
|
|
45
|
+
console.log(chalk.cyan('Commands defined.'));
|
|
46
|
+
} else {
|
|
47
|
+
console.log(chalk.cyan('Commands already defined.'));
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
throw new Error('Commands file not found!');
|
|
51
|
+
}
|
|
52
|
+
return supportFilePath;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = {handleCommands, handlerCommandsCypress10};
|
|
@@ -2,22 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
const {readFileSync, writeFileSync} = require('fs');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
-
const addEyesCypressPlugin = require('./addEyesCypressPlugin');
|
|
5
|
+
const {addEyesCypressPlugin} = require('./addEyesCypressPlugin');
|
|
6
6
|
const isPluginDefined = require('./isPluginDefined');
|
|
7
7
|
const getFilePath = require('./getFilePath');
|
|
8
8
|
const getCypressConfig = require('./getCypressConfig');
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
9
11
|
|
|
10
|
-
function handlePlugin(cwd) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
function handlePlugin(cwd, isCypress10) {
|
|
13
|
+
let fileContent, filePath;
|
|
14
|
+
if (!isCypress10) {
|
|
15
|
+
const cypressConfig = getCypressConfig(cwd);
|
|
16
|
+
filePath = getFilePath('plugins', cypressConfig, cwd);
|
|
17
|
+
fileContent = readFileSync(filePath).toString();
|
|
18
|
+
} else {
|
|
19
|
+
filePath = path.resolve(cwd, 'cypress.config.js');
|
|
20
|
+
fileContent = fs.readFileSync(filePath, 'utf-8');
|
|
21
|
+
}
|
|
14
22
|
|
|
15
|
-
if (!isPluginDefined(
|
|
16
|
-
writeFileSync(
|
|
23
|
+
if (!isPluginDefined(fileContent)) {
|
|
24
|
+
writeFileSync(filePath, addEyesCypressPlugin(fileContent));
|
|
17
25
|
console.log(chalk.cyan('Plugins defined.'));
|
|
18
26
|
} else {
|
|
19
27
|
console.log(chalk.cyan('Plugins already defined'));
|
|
20
28
|
}
|
|
21
29
|
}
|
|
22
30
|
|
|
23
|
-
module.exports = handlePlugin;
|
|
31
|
+
module.exports = {handlePlugin};
|
|
@@ -4,6 +4,7 @@ const {writeFileSync, existsSync} = require('fs');
|
|
|
4
4
|
const getFilePath = require('./getFilePath');
|
|
5
5
|
const getCypressConfig = require('./getCypressConfig');
|
|
6
6
|
const eyesIndexContent = `import "@applitools/eyes-cypress"`;
|
|
7
|
+
const {resolve, dirname} = require('path');
|
|
7
8
|
|
|
8
9
|
function handleTypeScript(cwd) {
|
|
9
10
|
const cypressConfig = getCypressConfig(cwd);
|
|
@@ -17,5 +18,16 @@ function handleTypeScript(cwd) {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
function handlerTypeScriptCypress10(suportFilePath) {
|
|
22
|
+
const supportDir = dirname(suportFilePath);
|
|
23
|
+
const typeScriptFilePath = resolve(supportDir, 'index.d.ts');
|
|
24
|
+
if (!existsSync(typeScriptFilePath)) {
|
|
25
|
+
writeFileSync(typeScriptFilePath, eyesIndexContent);
|
|
26
|
+
console.log(chalk.cyan('Typescript defined.'));
|
|
27
|
+
} else {
|
|
28
|
+
console.log(chalk.cyan('Typescript already defined.'));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {handleTypeScript, handlerTypeScriptCypress10};
|
|
21
33
|
module.exports.eyesIndexContent = eyesIndexContent;
|