@toptal/davinci-qa 9.0.1 → 10.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 +6 -0
- package/README.md +10 -18
- package/dist-package/package.json +4 -5
- package/package.json +4 -5
- package/src/commands/integration-tests.js +1 -1
- package/src/commands/integration-tests.test.js +6 -6
- package/src/configs/cypress.config.js +39 -0
- package/src/configs/cypress/plugins/__snapshots__/extends.test.js.snap +0 -28
- package/src/configs/cypress/plugins/config-with-extends.test.json +0 -4
- package/src/configs/cypress/plugins/config-without-extends.test.json +0 -3
- package/src/configs/cypress/plugins/extends.test.js +0 -43
- package/src/configs/cypress/plugins/index.js +0 -22
- package/src/configs/cypress.config.json +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#1355](https://github.com/toptal/davinci/pull/1355) [`a59617c3`](https://github.com/toptal/davinci/commit/a59617c33ad153b1aaff797dd3492dc3d3678ca0) Thanks [@TomasSlama](https://github.com/TomasSlama)! - Update Cypress to v10. Follow [migration guide](https://docs.cypress.io/guides/references/migration-guide)
|
|
8
|
+
|
|
3
9
|
## 9.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ Example of execution unit tests in two separate threads:
|
|
|
29
29
|
```
|
|
30
30
|
GROUP_INDEX=0 GROUP_TOTAL=2 davinci qa unit --ci
|
|
31
31
|
GROUP_INDEX=1 GROUP_TOTAL=2 davinci qa unit --ci
|
|
32
|
-
|
|
32
|
+
```
|
|
33
33
|
|
|
34
34
|
To specify a Sequencer, need to specify two environment variables:
|
|
35
35
|
|
|
@@ -55,25 +55,17 @@ Options:
|
|
|
55
55
|
|
|
56
56
|
#### Extending Cypress config
|
|
57
57
|
|
|
58
|
-
By default [cypress.config.
|
|
59
|
-
|
|
60
|
-
To extend default config, create `/cypress.json` file in the root of the project and use `extends`:
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"extends": "@toptal/davinci-qa/src/configs/cypress.config.json",
|
|
64
|
-
...other custom configs
|
|
65
|
-
}
|
|
66
|
-
````
|
|
58
|
+
By default [cypress.config.js](https://github.com/toptal/davinci/blob/0f1f1485433573baeca66cf0c379259ca21b3f2f/packages/qa/src/configs/cypress.config.js#L1) is used.
|
|
67
59
|
|
|
68
|
-
|
|
60
|
+
To extend default config, create `/cypress.config.js` file in the root of the project and spread the default config into yours:
|
|
69
61
|
```js
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...
|
|
75
|
-
|
|
76
|
-
}
|
|
62
|
+
const davinciConfig = require('@toptal/davinci-qa/src/configs/cypress.config.js')
|
|
63
|
+
|
|
64
|
+
export default defineConfig({
|
|
65
|
+
...davinciConfig,
|
|
66
|
+
e2e: { ...davinciConfig.e2e, ...custom },
|
|
67
|
+
component: { ...davinciConfig.component, ...custom },
|
|
68
|
+
})
|
|
77
69
|
```
|
|
78
70
|
|
|
79
71
|
### Alias
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-qa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "QA package to test your application",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,15 +33,14 @@
|
|
|
33
33
|
"@babel/preset-env": "^7.18.0",
|
|
34
34
|
"@babel/preset-react": "^7.17.12",
|
|
35
35
|
"@babel/preset-typescript": "^7.17.12",
|
|
36
|
-
"@bahmutov/cypress-extends": "^1.1.0",
|
|
37
|
-
"@cypress/code-coverage": "^3.9.12",
|
|
38
|
-
"@cypress/webpack-preprocessor": "^5.11.0",
|
|
39
36
|
"@testing-library/jest-dom": "^5.16.4",
|
|
40
37
|
"@testing-library/react": "^12.1.2",
|
|
41
38
|
"@toptal/davinci-cli-shared": "1.5.2",
|
|
42
39
|
"@types/jest": "^27.5.1",
|
|
43
40
|
"babel-jest": "^28.1.0",
|
|
44
|
-
"cypress": "^
|
|
41
|
+
"@cypress/code-coverage": "^3.10.0",
|
|
42
|
+
"@cypress/webpack-preprocessor": "^5.12.0",
|
|
43
|
+
"cypress": "^10.0.3",
|
|
45
44
|
"enhanced-resolve": "^5.9.2",
|
|
46
45
|
"fs-extra": "^10.0.0",
|
|
47
46
|
"glob": "^8.0.3",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-qa",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "QA package to test your application",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -33,15 +33,14 @@
|
|
|
33
33
|
"@babel/preset-env": "^7.18.0",
|
|
34
34
|
"@babel/preset-react": "^7.17.12",
|
|
35
35
|
"@babel/preset-typescript": "^7.17.12",
|
|
36
|
-
"@bahmutov/cypress-extends": "^1.1.0",
|
|
37
|
-
"@cypress/code-coverage": "^3.9.12",
|
|
38
|
-
"@cypress/webpack-preprocessor": "^5.11.0",
|
|
39
36
|
"@testing-library/jest-dom": "^5.16.4",
|
|
40
37
|
"@testing-library/react": "^12.1.2",
|
|
41
38
|
"@toptal/davinci-cli-shared": "1.5.2",
|
|
42
39
|
"@types/jest": "^27.5.1",
|
|
43
40
|
"babel-jest": "^28.1.0",
|
|
44
|
-
"cypress": "^
|
|
41
|
+
"@cypress/code-coverage": "^3.10.0",
|
|
42
|
+
"@cypress/webpack-preprocessor": "^5.12.0",
|
|
43
|
+
"cypress": "^10.0.3",
|
|
45
44
|
"enhanced-resolve": "^5.9.2",
|
|
46
45
|
"fs-extra": "^10.0.0",
|
|
47
46
|
"glob": "^8.0.3",
|
|
@@ -13,7 +13,7 @@ const integrationTestCommand = ({
|
|
|
13
13
|
|
|
14
14
|
const configPath = files.getPackageFilePath(
|
|
15
15
|
'@toptal/davinci-qa',
|
|
16
|
-
'src/configs/cypress.config.
|
|
16
|
+
'src/configs/cypress.config.js'
|
|
17
17
|
)
|
|
18
18
|
const cypressReporterPath = files.getPackageFilePath(
|
|
19
19
|
'@toptal/davinci-qa',
|
|
@@ -20,7 +20,7 @@ describe('integrationTestCommand', () => {
|
|
|
20
20
|
it('runs cypress with default options', () => {
|
|
21
21
|
convertToCLIParametersMock.mockReturnValueOnce([])
|
|
22
22
|
getPackageFilePathMock.mockReturnValueOnce(
|
|
23
|
-
'packages/qa/src/configs/cypress.config.
|
|
23
|
+
'packages/qa/src/configs/cypress.config.js'
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
action({ options: {} })
|
|
@@ -29,13 +29,13 @@ describe('integrationTestCommand', () => {
|
|
|
29
29
|
'cypress',
|
|
30
30
|
'run',
|
|
31
31
|
'--config-file',
|
|
32
|
-
'packages/qa/src/configs/cypress.config.
|
|
32
|
+
'packages/qa/src/configs/cypress.config.js',
|
|
33
33
|
])
|
|
34
34
|
|
|
35
35
|
expect(convertToCLIParametersMock).toHaveBeenCalledWith({})
|
|
36
36
|
expect(getPackageFilePathMock).toHaveBeenCalledWith(
|
|
37
37
|
'@toptal/davinci-qa',
|
|
38
|
-
'src/configs/cypress.config.
|
|
38
|
+
'src/configs/cypress.config.js'
|
|
39
39
|
)
|
|
40
40
|
})
|
|
41
41
|
|
|
@@ -44,7 +44,7 @@ describe('integrationTestCommand', () => {
|
|
|
44
44
|
|
|
45
45
|
convertToCLIParametersMock.mockReturnValueOnce(['--spec', spec])
|
|
46
46
|
getPackageFilePathMock.mockReturnValueOnce(
|
|
47
|
-
'packages/qa/src/configs/cypress.config.
|
|
47
|
+
'packages/qa/src/configs/cypress.config.js'
|
|
48
48
|
)
|
|
49
49
|
|
|
50
50
|
action({ options: { spec } })
|
|
@@ -53,7 +53,7 @@ describe('integrationTestCommand', () => {
|
|
|
53
53
|
'cypress',
|
|
54
54
|
'run',
|
|
55
55
|
'--config-file',
|
|
56
|
-
'packages/qa/src/configs/cypress.config.
|
|
56
|
+
'packages/qa/src/configs/cypress.config.js',
|
|
57
57
|
'--spec',
|
|
58
58
|
spec,
|
|
59
59
|
])
|
|
@@ -63,7 +63,7 @@ describe('integrationTestCommand', () => {
|
|
|
63
63
|
})
|
|
64
64
|
expect(getPackageFilePathMock).toHaveBeenCalledWith(
|
|
65
65
|
'@toptal/davinci-qa',
|
|
66
|
-
'src/configs/cypress.config.
|
|
66
|
+
'src/configs/cypress.config.js'
|
|
67
67
|
)
|
|
68
68
|
})
|
|
69
69
|
})
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const { defineConfig } = require('cypress')
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
webpackPreprocessor,
|
|
5
|
+
} = require('./cypress/plugins/webpack-preprocessor')
|
|
6
|
+
const parallelization = require('./cypress/plugins/parallelization')
|
|
7
|
+
|
|
8
|
+
module.exports = defineConfig({
|
|
9
|
+
defaultCommandTimeout: 6000,
|
|
10
|
+
fixturesFolder: './cypress/fixtures',
|
|
11
|
+
chromeWebSecurity: false,
|
|
12
|
+
screenshotsFolder: './cypress/screenshots',
|
|
13
|
+
video: false,
|
|
14
|
+
|
|
15
|
+
component: {
|
|
16
|
+
viewportWidth: 1280,
|
|
17
|
+
viewportHeight: 1024,
|
|
18
|
+
slowTestThreshold: 250,
|
|
19
|
+
specPattern: 'src/**/*.cy.{js,jsx,ts,tsx}',
|
|
20
|
+
supportFile: 'cypress/support/component.{js,ts}',
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
e2e: {
|
|
24
|
+
setupNodeEvents(on, config) {
|
|
25
|
+
// generate code coverage
|
|
26
|
+
require('@cypress/code-coverage/task')(on, config)
|
|
27
|
+
|
|
28
|
+
// split spec files in CI
|
|
29
|
+
parallelization(config)
|
|
30
|
+
|
|
31
|
+
// instrument code for code coverage
|
|
32
|
+
on('file:preprocessor', webpackPreprocessor)
|
|
33
|
+
},
|
|
34
|
+
baseUrl: 'http://0.0.0.0:3000',
|
|
35
|
+
slowTestThreshold: 10000,
|
|
36
|
+
specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}',
|
|
37
|
+
supportFile: 'cypress/support/e2e.{js,ts}',
|
|
38
|
+
},
|
|
39
|
+
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`cypress extends tests when "extends" key exists in the source config file merges extended config into source config 1`] = `
|
|
4
|
-
"{
|
|
5
|
-
configFile: '@toptal/davinci-qa/src/configs/cypress/plugins/config-with-extends.test.json',
|
|
6
|
-
fixturesFolder: './cypress/fixtures',
|
|
7
|
-
integrationFolder: '.',
|
|
8
|
-
screenshotsFolder: './cypress/screenshots',
|
|
9
|
-
testFiles: [
|
|
10
|
-
'cypress/**/spec.{js,ts}',
|
|
11
|
-
'cypress/**/*.spec.{js,ts}',
|
|
12
|
-
],
|
|
13
|
-
ignoreTestFiles: '**/node_modules/**/*',
|
|
14
|
-
pluginsFile: './cypress/plugins/index.js',
|
|
15
|
-
baseUrl: 'http://0.0.0.0:3000',
|
|
16
|
-
chromeWebSecurity: false,
|
|
17
|
-
defaultCommandTimeout: 1000,
|
|
18
|
-
video: false,
|
|
19
|
-
extends: '@toptal/davinci-qa/src/configs/cypress.config.json',
|
|
20
|
-
}"
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
exports[`cypress extends tests when no "extends" exist in the source config file returns source config file without any change 1`] = `
|
|
24
|
-
"{
|
|
25
|
-
configFile: '@toptal/davinci-qa/src/configs/cypress/plugins/config-without-extends.test.json',
|
|
26
|
-
defaultCommandTimeout: 1000,
|
|
27
|
-
}"
|
|
28
|
-
`;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const json5 = require('json5')
|
|
2
|
-
|
|
3
|
-
const plugins = require('./index')
|
|
4
|
-
|
|
5
|
-
jest.mock('@cypress/code-coverage/task', () => jest.fn())
|
|
6
|
-
jest.mock('./parallelization', () => jest.fn())
|
|
7
|
-
|
|
8
|
-
const configWithExtendsPath =
|
|
9
|
-
'@toptal/davinci-qa/src/configs/cypress/plugins/config-with-extends.test.json'
|
|
10
|
-
const configWithoutExtendsPath =
|
|
11
|
-
'@toptal/davinci-qa/src/configs/cypress/plugins/config-without-extends.test.json'
|
|
12
|
-
|
|
13
|
-
describe('cypress extends tests', () => {
|
|
14
|
-
const onFunction = jest.fn()
|
|
15
|
-
|
|
16
|
-
describe('when no "extends" exist in the source config file', () => {
|
|
17
|
-
it('returns source config file without any change', () => {
|
|
18
|
-
const config = {
|
|
19
|
-
configFile: configWithoutExtendsPath,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
plugins(onFunction, config)
|
|
23
|
-
|
|
24
|
-
const serializedConfig = json5.stringify(config, null, 2)
|
|
25
|
-
|
|
26
|
-
expect(serializedConfig).toMatchSnapshot()
|
|
27
|
-
})
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
describe('when "extends" key exists in the source config file', () => {
|
|
31
|
-
it('merges extended config into source config', () => {
|
|
32
|
-
const config = {
|
|
33
|
-
configFile: configWithExtendsPath,
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
plugins(onFunction, config)
|
|
37
|
-
|
|
38
|
-
const serializedConfig = json5.stringify(config, null, 2)
|
|
39
|
-
|
|
40
|
-
expect(serializedConfig).toMatchSnapshot()
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
})
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const { webpackPreprocessor } = require('./webpack-preprocessor')
|
|
2
|
-
|
|
3
|
-
module.exports = (on, config) => {
|
|
4
|
-
// generate code coverage
|
|
5
|
-
require('@cypress/code-coverage/task')(on, config)
|
|
6
|
-
|
|
7
|
-
// instrument code for code coverage
|
|
8
|
-
on('file:preprocessor', webpackPreprocessor)
|
|
9
|
-
|
|
10
|
-
// split spec files in CI
|
|
11
|
-
require('./parallelization')(config)
|
|
12
|
-
|
|
13
|
-
// enable 'extends' support for cypress config files
|
|
14
|
-
const overriddenConfig = require('@bahmutov/cypress-extends')(
|
|
15
|
-
config.configFile
|
|
16
|
-
)
|
|
17
|
-
|
|
18
|
-
// mutate 'config' file directly to hide it from other projects
|
|
19
|
-
Object.assign(config, overriddenConfig)
|
|
20
|
-
|
|
21
|
-
return config
|
|
22
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"fixturesFolder": "./cypress/fixtures",
|
|
3
|
-
"integrationFolder": ".",
|
|
4
|
-
"screenshotsFolder": "./cypress/screenshots",
|
|
5
|
-
"testFiles": ["cypress/**/spec.{js,ts}", "cypress/**/*.spec.{js,ts}"],
|
|
6
|
-
"ignoreTestFiles": "**/node_modules/**/*",
|
|
7
|
-
"pluginsFile": "./cypress/plugins/index.js",
|
|
8
|
-
"baseUrl": "http://0.0.0.0:3000",
|
|
9
|
-
"chromeWebSecurity": false,
|
|
10
|
-
"defaultCommandTimeout": 6000,
|
|
11
|
-
"video": false
|
|
12
|
-
}
|