Installed:
-
Cucumber.js
-
Run Configuration for Typescript
-
Asciidoc
Built-in:
-
Node.js
Disabled built-in:
-
Cucumber for Java
Following fullstackhq.io/the-no-tears-cypress-setup from Nov 2019:
-
install cypress
npm install -D cypress
-
configured script in
package.json
to start cypress:{ "scripts": { "cypress:open": "npx cypress open" },
-
setup typescript:
npm install -D ts-loader @cypress/webpack-preprocessor @babel/core @babel/preset-env babel-loader webpack typescript
-
setup webpack
cypress/webpack.config.jsmodule.exports = { resolve: { extensions: [".ts", ".js"] }, node: { fs: "empty", child_process: "empty", readline: "empty" }, module: { rules: [ { test: /\.ts$/, exclude: [/node_modules/], use: [ { loader: "ts-loader" } ] } ] } };
-
setup typescript config
cypress/tsconfig.json{ "compilerOptions": { "strict": true, "baseUrl": "../node_modules", "target": "es5", "lib": ["es5", "dom"], "types": ["cypress"] }, "include": [ "**/*.ts" ] }
-
setup preprocessor:
cypress/plugins/preprocess.jsconst webpack = require('@cypress/webpack-preprocessor') const options = { webpackOptions: require("../webpack.config.js") }; module.exports = webpack(options)
and:
cypress/plugins/index.jsconst preprocess = require('./preprocess'); /** * @type {Cypress.PluginConfig} */ module.exports = (on, config) => { on("file:preprocessor", preprocess); const targetEnv = config.env.TARGET_ENV || 'qa'; const environmentConfig = require(`./config/${targetEnv}`); return { ...config, ...environmentConfig, }; }
-
setup environment configs
see original documentation …
plugins/config/{local|qa|prod}.js
-
install cucumber support:
npm install -D cypress-cucumber-preprocessor
-
configure cypress:
cypress.json{ "testFiles": "**/*.feature" }
and
package.json"cypress-cucumber-preprocessor": { "nonGlobalStepDefinitions": true }
and this rule:
cypress/webpack.config.js{ test: /\.feature$/, use: [ { loader: "cypress-cucumber-preprocessor/loader" } ] }
-
create example
search.feature
and spec (see article).