An example project about Web automation testing using WebdriverIO. The test examples are created in Mocha Framework and Cucumber Framework.
-
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 browserwdio-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, runsafaridriver --enable
on terminal (need to use MacOS to enable the feature)
-
Clone the project
Runnpm install
-
Make sure the browser also installed and match with the webdriver version
- 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
- start the driver with command
- all the test
npm run test-bdd
(Cucumber)
- specific spec / test file
npm run test-bdd -- --spec ./to/file/location.feature
(Cucumber)