Skip to content

010V/wdio-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webdriver IO Template

To run tests:

  • Clone repository
  • Run npm install
  • Run npm test

WebDriverIO v6 project setup from scratch:

  1. Create new NodeJS project (or run npm init inside existing directory)
  2. Run npm i --save-dev @wdio/cli
  3. Run npx wdio config -y
  4. Run mkdir -p ./test/specs & mkdir -p ./test/pages
  5. 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
},
  1. 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,
};
  1. 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;
  },
  1. To run your tests use npx wdio wdio.conf.js

Add Allure Reporter to existing WDIO framework:

  1. Install Allure Reporter npm install @wdio/allure-reporter --save-dev
  2. Add Allure to reporters in wdio.conf.js file:
  reporters: ['spec', ['allure', {
    outputDir: 'allure-results',
    disableWebdriverStepsReporting: false,
    disableWebdriverScreenshotsReporting: true,
  }]],
  1. Install CLI for Allure npm install allure-commandline --save-dev
  2. Add report script to your package.json file
    "report": "allure generate allure-results --clean && allure open",

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published