Install the latest Node.js Recommended For Most Users from https://nodejs.org/en/
https://www.oracle.com/java/technologies/javase-jdk14-downloads.html
https://developer.apple.com/xcode/
- Open WebStorm
- Go to File => Settings
- Go to Tools => Terminal
- Specify Shell Path to Git Bash e.g.
C:\Program Files\Git\bin\sh.exe
- 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 & mkdir -p ./test/data
- 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 add
npx wdio wdio.conf.js
in package.json
- 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",
- To take screenshot in wdio.conf.js add:
afterTest: function(test, context, { error, result, duration, passed, retries }) {
if (!passed) {
browser.takeScreenshot();
}
}