-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create-cypress-tests installation wizard #9563
Merged
Merged
Changes from all commits
Commits
Show all changes
102 commits
Select commit
Hold shift + click to select a range
6d3454d
Remove unused stuff
dmtrKovalenko 37fe4e4
Fix eslint errors
dmtrKovalenko 1159576
Use local cypress running script
dmtrKovalenko 01a70be
Fix dependency resolution
dmtrKovalenko 5405445
Revert "Fix dependency resolution"
dmtrKovalenko 67f8bde
Add @cypress/react CI
dmtrKovalenko d698ce1
Properly resolve @types pacakges
dmtrKovalenko f52b5b5
Run tests with mocha
dmtrKovalenko 2a2e5ca
Fix cypress tests
dmtrKovalenko 7c15e6e
Fix or skip some specs
dmtrKovalenko 1892590
Add retries to the card-spec.js
dmtrKovalenko 0a4a576
Remove jest mocks
dmtrKovalenko d65280e
Run e2e examples on CI
dmtrKovalenko 72b1dd3
Fix yarn cache key
dmtrKovalenko efcc7c4
Fix e2e examples jobs
dmtrKovalenko 4febfcc
Rename cypress-react-unit-test with @cypress/react
dmtrKovalenko 7f25f05
Fix circleci.yml
dmtrKovalenko b9b4ecb
Revert "Fix e2e examples jobs"
dmtrKovalenko 18da2e8
Revert " Rename cypress-react-unit-test with @cypress/react"
dmtrKovalenko badbe3e
Replce cypress-react-unit-test with @cypress/react
dmtrKovalenko 4cae939
Persist build artifacts
dmtrKovalenko 3467961
Fix working directory paths circle.yml
dmtrKovalenko b5f31da
Fix more CI
dmtrKovalenko 66c07b2
adding yarn.lock files
JessicaSachs c7583d1
Make package.json for folder
dmtrKovalenko 0138206
Remove .npmrc
dmtrKovalenko e9e875c
Update circle.yml
dmtrKovalenko e0e7789
Remove unused files
dmtrKovalenko 6625b73
Copy plugins files to the "dist" folder
dmtrKovalenko 49dfab8
Fix links to the github repos
dmtrKovalenko e39ffd6
Merge branch 'master' into 'fix/make-imported-cypress/react-work'
dmtrKovalenko 6cd445c
Move init wizard from npm/react/init to npm/wizard
dmtrKovalenko 0711c6c
Move init wizard from npm/react/init to npm/wizard
dmtrKovalenko 04d5bf3
Implement initial vue template
dmtrKovalenko f98bbd9
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 8d0aed7
Run wizard tests on CI
dmtrKovalenko b34035e
Refactor continue: bool to success: bool for better code readability
dmtrKovalenko cbc5eb4
Fix circleci.yml
dmtrKovalenko 62c3d89
Use only absolute paths for tests
dmtrKovalenko 0a15585
Merge conflicts
dmtrKovalenko b528fc3
Stub process.exit calls
dmtrKovalenko b52eac2
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 8b91dbe
Remove useless comments
dmtrKovalenko f4b5d7f
Add installation cypress to the wizard logic
dmtrKovalenko abb34ba
More improvements
dmtrKovalenko f15d78b
Include packages/examples/cypress into git
dmtrKovalenko 31ea113
Commit new files
dmtrKovalenko c3e4774
Use packages/example as SST for generated files
dmtrKovalenko f266f40
Last improvements for wizard
dmtrKovalenko a509b78
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 5fc8159
Update packages/server/lib/scaffold.js
dmtrKovalenko e0b2125
Rename wizard to create-cypress-tests
dmtrKovalenko 9c21804
Fix circleci config
dmtrKovalenko 585732c
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 7dc1d7b
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko b53fb1a
Fix snapshot tests
dmtrKovalenko 2d5e5c4
Run all create-cypress-tests on ci
dmtrKovalenko cf5ed8f
Do not install plugins and scaffold files from kitchensink
dmtrKovalenko 41e8b06
Ignore integration/examples folder for packages/example
dmtrKovalenko 911b921
Run create-cypress-tests-tests on CI
dmtrKovalenko 47470bf
Add copy example cross-platform script
dmtrKovalenko d0f74b1
Use copy example script in tests
dmtrKovalenko 1cb6d06
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 8f34fae
feat: create-cypress-tests auto-inject config (#9116)
dmtrKovalenko 76fbb9a
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 805d9f1
Prepeare package for the release
dmtrKovalenko eb69592
Fix inquirer name
dmtrKovalenko 389e92b
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 66aeb47
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 1653460
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 62124ca
v0.0.125
dmtrKovalenko 665b87f
v0.0.127
dmtrKovalenko 22bcb3c
v0.0.128
dmtrKovalenko 92545dd
v0.0.130
dmtrKovalenko 0df98bc
v0.0.131
dmtrKovalenko d86c100
Add more UX features
dmtrKovalenko 398a7ff
Add vue-cli template
dmtrKovalenko 2f4cb8c
Make src as default folder for vue-cli template
dmtrKovalenko c82cbd5
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 8069c6e
Revert dev-time changes
dmtrKovalenko 499b05c
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko c0ecb3e
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko d5ebbf2
Run appveyour windows build
dmtrKovalenko 9d01c59
Merge branch 'master' into feature/cross-platform-wizard
dmtrKovalenko 2bdca5c
Run full appveyour build
dmtrKovalenko 7724181
Merge remote-tracking branch 'origin' into feature/cross-platform-wizard
dmtrKovalenko d6445fb
Fix circle.yml
dmtrKovalenko 5b33ada
Update plugins
dmtrKovalenko 6301fc4
Join paths for windows
dmtrKovalenko fff46bf
Revert example/lib changes
dmtrKovalenko 7b1e88a
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 80a2b27
Fix tests
dmtrKovalenko 96e5d86
Revert unnecessary changes
dmtrKovalenko b51a5dd
Merge branch 'feature/cross-platform-wizard' of github.com:cypress-io…
dmtrKovalenko 0bc0be4
Implement dev-server dependency installation
dmtrKovalenko c2e22a5
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 1b739a6
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko 14c47dd
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko ca5736c
Update npm/create-cypress-tests/README.md
dmtrKovalenko ab9707d
Include webpack-options template in dist
dmtrKovalenko b958986
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko e9de263
Merge branch 'develop' into feature/cross-platform-wizard
dmtrKovalenko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"plugins": [ | ||
"cypress", | ||
"@cypress/dev" | ||
], | ||
"extends": [ | ||
"plugin:@cypress/dev/general", | ||
"plugin:@cypress/dev/tests" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"env": { | ||
"cypress/globals": true | ||
}, | ||
"rules": { | ||
"no-console": "off", | ||
"mocha/no-global-tests": "off", | ||
"@typescript-eslint/no-unused-vars": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"lib/*" | ||
], | ||
"rules": { | ||
"no-console": 1 | ||
} | ||
}, | ||
{ | ||
"files": [ | ||
"**/*.json" | ||
], | ||
"rules": { | ||
"quotes": "off", | ||
"comma-dangle": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"watch-ignore": [ | ||
"node_modules" | ||
], | ||
"require": "ts-node/register", | ||
"exit": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
./src/ | ||
./initial-template/ | ||
scripts/ | ||
__snapshots__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Create Cypress Tests | ||
|
||
Installs and injects all the required configuration to run cypress tests. | ||
|
||
## Quick overview | ||
|
||
``` | ||
cd my-app | ||
npx create-cypress-test | ||
npx cypress open | ||
``` | ||
|
||
![demo](./demo.gif) | ||
|
||
## Package manager | ||
|
||
This wizard will automatically determine which package do you use. If `yarn` available as global dependency it will use yarn to install dependencies and create lock file. | ||
|
||
If you need to use `npm` over `yarn` you can do the following | ||
|
||
``` | ||
npx create-cypress-tests --use-npm | ||
``` | ||
|
||
By the way you can use yarn to run the installation wizard 😉 | ||
|
||
``` | ||
yarn create cypress-tests | ||
``` | ||
|
||
## Typescript | ||
|
||
This package will also automatically determine if typescript if available in this project and inject the required typescript configuration for cypress. If you are starting a new project and want to create typescript configuration, please do the following: | ||
|
||
``` | ||
npm init | ||
npm install typescript | ||
npx create-cypress-tests | ||
``` | ||
|
||
## Configuration | ||
|
||
Here is a list of available configuration options: | ||
|
||
`--use-npm` – use npm if yarn available | ||
`--ignore-typescript` – will not create typescript configuration if available | ||
`--ignore-examples` – will create a 1 empty spec file (`cypress/integration/spec.js`) to start with | ||
`--component-tests` – will not ask should setup component testing or not | ||
|
||
## License | ||
|
||
The project is licensed under the terms of [MIT license](../../LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exports['babel installation template correctly generates plugins config 1'] = ` | ||
const preprocessor = require('@cypress/react/plugins/babel'); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
` |
50 changes: 50 additions & 0 deletions
50
npm/create-cypress-tests/__snapshots__/init-component-testing.test.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
exports['Injects guessed next.js template cypress.json'] = ` | ||
const preprocessor = require("@cypress/react/plugins/next"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
|
||
` | ||
|
||
exports['Injects guessed next.js template plugins/index.js'] = ` | ||
const preprocessor = require("@cypress/react/plugins/next"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
|
||
` | ||
|
||
exports['Injects guessed next.js template support/index.js'] = ` | ||
import "@cypress/react/support"; | ||
|
||
` | ||
|
||
exports['Injected overridden webpack template cypress.json'] = ` | ||
const preprocessor = require("@cypress/react/plugins/react-scripts"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
|
||
` | ||
|
||
exports['Injected overridden webpack template plugins/index.js'] = ` | ||
const preprocessor = require("@cypress/react/plugins/react-scripts"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
|
||
` | ||
|
||
exports['Injected overridden webpack template support/index.js'] = ` | ||
import "./commands.js"; | ||
import "@cypress/react/support"; | ||
|
||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exports['next.js install template correctly generates plugins config 1'] = ` | ||
const preprocessor = require('@cypress/react/plugins/next'); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
` |
10 changes: 10 additions & 0 deletions
10
npm/create-cypress-tests/__snapshots__/react-scripts.test.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
exports['create-react-app install template correctly generates plugins config 1'] = ` | ||
const preprocessor = require('@cypress/react/plugins/react-scripts'); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
` |
24 changes: 24 additions & 0 deletions
24
npm/create-cypress-tests/__snapshots__/reactWebpackFile.test.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
exports['webpack-file install template correctly generates plugins config when webpack config path is missing 1'] = ` | ||
const preprocessor = require("@cypress/react/plugins/load-webpack"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
// TODO replace with valid webpack config path | ||
config.env.webpackFilename = './webpack.config.js'; | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
` | ||
|
||
exports['webpack-file install template correctly generates plugins config when webpack config path is provided 1'] = ` | ||
const preprocessor = require("@cypress/react/plugins/load-webpack"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
config.env.webpackFilename = 'config/webpack.config.js'; | ||
preprocessor(on, config); | ||
return config; // IMPORTANT to return the config object | ||
}; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
exports['rollup-file install template correctly generates plugins config when webpack config path is missing 1'] = ` | ||
const rollupPreprocessor = require("@bahmutov/cy-rollup"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
on('file:preprocessor', rollupPreprocessor({ | ||
// TODO replace with valid rollup config path | ||
configFile: 'rollup.config.js' | ||
})); | ||
|
||
require('@cypress/code-coverage/task')(on, config); | ||
|
||
return config; // IMPORTANT to return the config object | ||
}; | ||
` | ||
|
||
exports['rollup-file install template correctly generates plugins config when webpack config path is provided 1'] = ` | ||
const rollupPreprocessor = require("@bahmutov/cy-rollup"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
on('file:preprocessor', rollupPreprocessor({ | ||
configFile: 'config/rollup.config.js' | ||
})); | ||
|
||
require('@cypress/code-coverage/task')(on, config); | ||
|
||
return config; // IMPORTANT to return the config object | ||
}; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
exports['vue webpack-file install template correctly generates plugins for vue-cli-service 1'] = ` | ||
const preprocessor = require("@cypress/vue/dist/plugins/webpack"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
preprocessor(on, config); // IMPORTANT return the config object | ||
|
||
return config; | ||
}; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
exports['vue: vite template correctly generates plugins config 1'] = ` | ||
const { | ||
startDevServer | ||
} = require("@cypress/vite-dev-server"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
on("dev-server:start", async options => startDevServer({ | ||
options | ||
})); | ||
}; | ||
` |
24 changes: 24 additions & 0 deletions
24
npm/create-cypress-tests/__snapshots__/vueWebpackFile.test.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
exports['vue webpack-file install template correctly generates plugins config when webpack config path is missing 1'] = ` | ||
const { | ||
onFilePreprocessor | ||
} = require('@cypress/vue/dist/preprocessor/webpack'); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
// TODO replace with valid webpack config path | ||
on('file:preprocessor', onFilePreprocessor('./webpack.config.js')); | ||
}; | ||
` | ||
|
||
exports['vue webpack-file install template correctly generates plugins config when webpack config path is provided 1'] = ` | ||
const { | ||
onFilePreprocessor | ||
} = require('@cypress/vue/dist/preprocessor/webpack'); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
on('file:preprocessor', onFilePreprocessor('build/webpack.config.js')); | ||
}; | ||
` |
34 changes: 34 additions & 0 deletions
34
npm/create-cypress-tests/__snapshots__/webpackOptions.test.ts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
exports['webpack-options template correctly generates plugins config 1'] = ` | ||
const webpackPreprocessor = require("@cypress/webpack-preprocessor"); | ||
|
||
const something = require("something"); | ||
|
||
module.exports = (on, config) => { | ||
/** @type import("webpack").Configuration */ | ||
const webpackConfig = { | ||
resolve: { | ||
extensions: ['.js', '.ts', '.jsx', '.tsx'] | ||
}, | ||
mode: 'development', | ||
devtool: false, | ||
output: { | ||
publicPath: '/', | ||
chunkFilename: '[name].bundle.js' | ||
}, | ||
// TODO: update with valid configuration for your app | ||
module: { | ||
rules: [{ | ||
test: /\\.(js|jsx|mjs|ts|tsx)$/, | ||
loader: 'babel-loader', | ||
options: { ...babelConfig, | ||
cacheDirectory: path.resolve(__dirname, '..', '..', '.babel-cache') | ||
} | ||
}] | ||
} | ||
}; | ||
on('dev-server:start', options => startDevServer({ | ||
options, | ||
webpackConfig | ||
})); | ||
}; | ||
` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eslint has an
extends
feature, I wonder if we can use that to save the boilerplate