@toptal/davinci-qa 11.3.2 → 12.0.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
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 12.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1516](https://github.com/toptal/davinci/pull/1516) [`6d5172aa`](https://github.com/toptal/davinci/commit/6d5172aae41ed558291fa23a17760c00d0fa2e46) Thanks [@TomasSlama](https://github.com/TomasSlama)! - ---
|
|
8
|
+
- Remove davinci-engine from dependencies of davinci-qa and keep it only as peerDependency
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- [#1523](https://github.com/toptal/davinci/pull/1523) [`321793e3`](https://github.com/toptal/davinci/commit/321793e3e4af2460ec790e00fde0134518f3f80a) Thanks [@rafael-anachoreta](https://github.com/rafael-anachoreta)! - ---
|
|
13
|
+
- Replace Jest Anvil reporter's inconsistent failureDetails data with failureMessages
|
|
14
|
+
- Updated dependencies [[`fa3423f1`](https://github.com/toptal/davinci/commit/fa3423f1f9211b4d8899064aa4afdf5ca2198483)]:
|
|
15
|
+
- @toptal/davinci-cli-shared@1.6.0
|
|
16
|
+
- @toptal/davinci-engine@7.4.4
|
|
17
|
+
|
|
3
18
|
## 11.3.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-qa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "QA package to test your application",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
"@cypress/webpack-preprocessor": "^5.12.0",
|
|
38
38
|
"@testing-library/jest-dom": "^5.16.4",
|
|
39
39
|
"@testing-library/react": "^12.1.2",
|
|
40
|
-
"@toptal/davinci-cli-shared": "1.
|
|
41
|
-
"@toptal/davinci-engine": "7.4.3",
|
|
40
|
+
"@toptal/davinci-cli-shared": "1.6.0",
|
|
42
41
|
"@types/jest": "^27.5.1",
|
|
43
42
|
"babel-jest": "^28.1.3",
|
|
44
43
|
"cypress": "^10.0.3",
|
|
@@ -64,6 +63,6 @@
|
|
|
64
63
|
"mocha": "^10.0.0"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
67
|
-
"@toptal/davinci-engine": "
|
|
66
|
+
"@toptal/davinci-engine": "7.4.4"
|
|
68
67
|
}
|
|
69
68
|
}
|
package/docs/integration.md
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
# Integration
|
|
2
2
|
|
|
3
|
-
> Prerequisites
|
|
3
|
+
> **Prerequisites:**
|
|
4
|
+
>
|
|
4
5
|
> - project uses latest [davinci-engine](https://github.com/toptal/davinci/tree/master/packages/engine) to build (based on webpack 5) or webpack 5
|
|
5
6
|
> - project follows [Integration testing](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/1194985097/Frontend+Testing+-+Integration+testing) and [Cypress tests location](https://toptal-core.atlassian.net/wiki/spaces/ENG/pages/2827780782/Frontend+Testing+-+Cypress+Component+tests+location) guidelines
|
|
7
|
+
> - for `integration` and `component` testing users should add files from below
|
|
8
|
+
> table to their project
|
|
9
|
+
|
|
10
|
+
| | e2e | component |
|
|
11
|
+
| -------------------------------------------------------------------------------------------------------- | ------------------ | ------------------ |
|
|
12
|
+
| [`tsconfig.json`](https://github.com/toptal/davinci/blob/master/packages/skeleton/tsconfig.json) | :heavy_check_mark: | :heavy_check_mark: |
|
|
13
|
+
| [`cypress.config.js`](https://github.com/toptal/davinci/blob/master/packages/skeleton/cypress.config.js) | :heavy_check_mark: | :heavy_check_mark: |
|
|
14
|
+
| [`.browserslistrc`](https://github.com/toptal/davinci/blob/master/packages/skeleton/.browserslistrc) | | :heavy_check_mark: |
|
|
15
|
+
|
|
16
|
+
> **NOTE:**
|
|
17
|
+
>
|
|
18
|
+
> .browserslistrc is necessary for Cypress
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
6
21
|
|
|
7
22
|
| command | description |
|
|
8
23
|
| ----------------------------- | ---------------------------------------- |
|
|
@@ -18,39 +33,28 @@ Options:
|
|
|
18
33
|
|
|
19
34
|
[Cypress CLI docs](https://docs.cypress.io/guides/guides/command-line.html)
|
|
20
35
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
By default, [cypress.config.js](https://github.com/toptal/davinci/blob/master/packages/qa/src/configs/cypress.config.js) is used.
|
|
24
|
-
|
|
25
|
-
To extend default config, create `/cypress.config.js` file in the root of the project and spread the default config into yours:
|
|
26
|
-
|
|
27
|
-
```js
|
|
28
|
-
const davinciConfig = require('@toptal/davinci-qa/src/configs/cypress.config.js')
|
|
29
|
-
|
|
30
|
-
module.exports = defineConfig({
|
|
31
|
-
...davinciConfig,
|
|
32
|
-
e2e: { ...davinciConfig.e2e, ...custom },
|
|
33
|
-
component: { ...davinciConfig.component, ...custom },
|
|
34
|
-
})
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Visual tests
|
|
36
|
+
## Visual tests
|
|
38
37
|
|
|
39
38
|
Both `--component` (Cypress Component tests) and `--e2e` (Cypress E2E tests) support visual tests via [Happo](https://happo.io/).
|
|
40
39
|
|
|
41
40
|
If you have your project bootstrapped from the Davinci - you just need to create your account in [Happo](https://happo.io/) and specify the Happo secrets in environment variables on CI:
|
|
41
|
+
|
|
42
42
|
```shell
|
|
43
43
|
HAPPO_PROJECT=<happo project name>
|
|
44
44
|
HAPPO_API_KEY=<happo api key>
|
|
45
45
|
HAPPO_API_SECRET=<happo api secret>
|
|
46
46
|
```
|
|
47
|
+
|
|
47
48
|
After that you can start doing visual screenshots by using `happoScreenshot` function ([docs](https://docs.happo.io/docs/cypress#usage)):
|
|
49
|
+
|
|
48
50
|
```js
|
|
49
51
|
cy.get('body').happoScreenshot()
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
If you want to start using visual testing in the existing application:
|
|
55
|
+
|
|
53
56
|
- add `.happo.js` file in the root of your application
|
|
57
|
+
|
|
54
58
|
```js
|
|
55
59
|
// .happo.js
|
|
56
60
|
|
|
@@ -66,12 +70,15 @@ module.exports = {
|
|
|
66
70
|
```
|
|
67
71
|
|
|
68
72
|
- install packages
|
|
73
|
+
|
|
69
74
|
```
|
|
70
75
|
yarn add --dev @cypress/react @types/happo-cypress
|
|
71
76
|
```
|
|
77
|
+
|
|
72
78
|
(right now you also have to add a resolution for `cypress` to `package.json` to be resolved to version `^10.0.0`, because of dependencies of `@types/happo-cypress`)
|
|
73
79
|
|
|
74
80
|
- change your npm scripts
|
|
81
|
+
|
|
75
82
|
```diff
|
|
76
83
|
- "test:cypress:run": "davinci qa integration run"
|
|
77
84
|
+ "test:cypress:run": "happo-e2e -- -- davinci qa integration run"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-qa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "QA package to test your application",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -37,8 +37,7 @@
|
|
|
37
37
|
"@cypress/webpack-preprocessor": "^5.12.0",
|
|
38
38
|
"@testing-library/jest-dom": "^5.16.4",
|
|
39
39
|
"@testing-library/react": "^12.1.2",
|
|
40
|
-
"@toptal/davinci-cli-shared": "1.
|
|
41
|
-
"@toptal/davinci-engine": "7.4.3",
|
|
40
|
+
"@toptal/davinci-cli-shared": "1.6.0",
|
|
42
41
|
"@types/jest": "^27.5.1",
|
|
43
42
|
"babel-jest": "^28.1.3",
|
|
44
43
|
"cypress": "^10.0.3",
|
|
@@ -64,6 +63,6 @@
|
|
|
64
63
|
"mocha": "^10.0.0"
|
|
65
64
|
},
|
|
66
65
|
"peerDependencies": {
|
|
67
|
-
"@toptal/davinci-engine": "
|
|
66
|
+
"@toptal/davinci-engine": "7.4.4"
|
|
68
67
|
}
|
|
69
68
|
}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
try {
|
|
3
|
-
require.resolve(pkg)
|
|
1
|
+
const { files } = require('@toptal/davinci-cli-shared')
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
} catch {
|
|
7
|
-
return false
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
if (hasPackage('styled-components')) {
|
|
3
|
+
if (files.projectHasPackage('styled-components')) {
|
|
12
4
|
require('jest-styled-components')
|
|
13
5
|
}
|
|
14
6
|
|
|
@@ -37,12 +37,12 @@ class JestAnvilReporter {
|
|
|
37
37
|
.join('/'),
|
|
38
38
|
description: testResult.title,
|
|
39
39
|
error:
|
|
40
|
-
testResult.
|
|
41
|
-
? testResult.
|
|
40
|
+
testResult.failureMessages.length > 0
|
|
41
|
+
? testResult.failureMessages[0]
|
|
42
42
|
: null,
|
|
43
43
|
backtrace:
|
|
44
|
-
testResult.
|
|
45
|
-
? testResult.
|
|
44
|
+
testResult.failureMessages.length > 0
|
|
45
|
+
? testResult.failureMessages
|
|
46
46
|
: null,
|
|
47
47
|
testType: 'unit',
|
|
48
48
|
pendingMessage: null,
|
|
@@ -44,7 +44,7 @@ describe('Jest Anvil reporter', () => {
|
|
|
44
44
|
scenario_name: 'Example test suite/1 + 1 returns 3',
|
|
45
45
|
description: '1 + 1 returns 3',
|
|
46
46
|
error:
|
|
47
|
-
'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m',
|
|
47
|
+
'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m\n at Object.<anonymous> (/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js:3:17)\n at Object.asyncJestTest (/davinci/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n at new Promise (<anonymous>)\n at mapper (/davinci/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:75:41',
|
|
48
48
|
backtrace: [
|
|
49
49
|
'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m\n at Object.<anonymous> (/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js:3:17)\n at Object.asyncJestTest (/davinci/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n at new Promise (<anonymous>)\n at mapper (/davinci/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:75:41',
|
|
50
50
|
],
|
|
@@ -112,7 +112,7 @@ describe('Jest Anvil reporter', () => {
|
|
|
112
112
|
scenario_name: 'Example test suite/1 + 1 returns 3 (failed)',
|
|
113
113
|
description: '1 + 1 returns 3 (failed)',
|
|
114
114
|
error:
|
|
115
|
-
'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m',
|
|
115
|
+
'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m\n at Object.<anonymous> (/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js:7:17)\n at Object.asyncJestTest (/davinci/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n at new Promise (<anonymous>)\n at mapper (/davinci/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:75:41',
|
|
116
116
|
backtrace: [
|
|
117
117
|
'Error: \u001b[2mexpect(\u001b[22m\u001b[31mreceived\u001b[39m\u001b[2m).\u001b[22mtoBe\u001b[2m(\u001b[22m\u001b[32mexpected\u001b[39m\u001b[2m) // Object.is equality\u001b[22m\n\nExpected: \u001b[32m3\u001b[39m\nReceived: \u001b[31m2\u001b[39m\n at Object.<anonymous> (/davinci/packages/qa/src/reporters/jest-anvil-reporter-mocker.test.js:7:17)\n at Object.asyncJestTest (/davinci/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:106:37)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:45:12\n at new Promise (<anonymous>)\n at mapper (/davinci/node_modules/jest-jasmine2/build/queueRunner.js:28:19)\n at /davinci/node_modules/jest-jasmine2/build/queueRunner.js:75:41',
|
|
118
118
|
],
|