- Clone repository
- Run
npm install
- Run
npm test
- Create new NodeJS project (or run
npm init
inside existing directory) - Run
npm i --save-dev @wdio/cli
- Run
npx wdio config -y
- Run
mkdir -p ./test/specs & mkdir -p ./test/pages
- Babel setup:
- create babel.config.js and copy/paste following code:
module.exports = {
presets: [
['@babel/preset-env', {
targets: {
node: 12
}
}]
]
}
- Run
npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/register
- In wdio.conf.js add babel to compilers:
mochaOpts: {
ui: 'bdd',
compilers: ['js:@babel/register'],
timeout: 60000
},
- Prettier setup:
- Run
npm install --save-dev prettier
- Create
prettier.config.js
and copy/paste following code:
module.exports = {
trailingComma: 'all',
tabWidth: 2,
semi: true,
singleQuote: true,
bracketSpacing: true,
arrowParens: 'avoid',
parser: 'babel',
printWidth: 100,
};
- Add Chai Assertions to your project:
- Run
npm install --save-dev chai
- Setup chai in beforeTest function (so you won't have to import it everytime).
Replace
beforeTest
function in wdio.conf js with following:
beforeTest: function () {
const chai = require('chai');
global.expect = chai.expect;
},
- To run your tests use
npx wdio wdio.conf.js
- Install Allure Reporter
npm install @wdio/allure-reporter --save-dev
- Add Allure to reporters in wdio.conf.js file:
reporters: ['spec', ['allure', {
outputDir: 'allure-results',
disableWebdriverStepsReporting: false,
disableWebdriverScreenshotsReporting: true,
}]],
- Install CLI for Allure
npm install allure-commandline --save-dev
- Add report script to your package.json file
"report": "allure generate allure-results --clean && allure open",