Skip to content

Web automation testing example project with WebdriverIO

Notifications You must be signed in to change notification settings

lynix28/web-webdriverio-example

Repository files navigation

web-webdriverio-example

CircleCI

Description:

An example project about Web automation testing using WebdriverIO. The test examples are created in Mocha Framework and Cucumber Framework.

Inside the project:

  • WebdriverIO Packages

    • Mocha and Cucumber as Test Framework
    • Allure as Test Reporter
    • selenium-standalone-service as service to run the test locally with your own browser
    • wdio-safaridriver-service as service to run the test locally in Safari browser
  • The Webdrivers

    • Chrome = chromedriver
    • Firefox = geckodriver
    • Ms Edge = edgedriver
    • Safari = safaridriver
      to enable the driver, run safaridriver --enable on terminal (need to use MacOS to enable the feature)

How to setup:

  • Clone the project
    Run npm install

  • Make sure the browser also installed and match with the webdriver version

How to run the test:

Mocha Framework:

  • all the test
    • npm run test
  • specific spec / test file
    • npm run test -- --spec ./to/file/location.js
  • specific suite / test suite
    • npm run test -- --suite "suiteName"
  • specific test case
    • npm run test -- --spec ./to/file/location.js --mochaOpts.grep "testcase name or testing tag"
    • npm run test -- --suite "suiteName" --mochaOpts.grep "testcase name or testing tag"
  • running test on Safari
    • start the driver with command safaridriver -p <your desire port> (make sure to use same port with the 'wdio configuration')
    • run the test npm run test-safari

Cucumber Framework:

  • all the test
    • npm run test-bdd (Cucumber)
  • specific spec / test file
    • npm run test-bdd -- --spec ./to/file/location.feature (Cucumber)