Check the dependencies: node and npm is installed in the system node -v # version on system is: v14.16.1 npm -v # version on system is : 7.10.0
Steps:
- Create a folder/directory and cd to that directory $mkdir webdriverIO && cd webdriverIO
- Install WebdriverIO CLI tool npm install @wdio/cli
- create the empty NPM project and y means, take the default and no questions npm init -y
- create a project: $npx wdio config
- run all spec files: npx wdio
- run particular spec file npx wdio --spec ./test/specs/shop2.e2e.js
To run a particular spec.js: npx wdio --spec ./test/specs/digialert_sub.e2e.js
npm install -g allure-commandline --save-dev or sudo npm install -g allure-commandline
allure generate allure-results && allure open allure generate allure-results --clean && allure open
In VS code, for mocha boiler plate, install “ES6 Mocha Snippets” extension.
add a video to report?
1 . install the dependency :
npm install wdio-video-reporter
modify wdio.conf.js:
reporters: [
[video, {
saveAllVideos: false, // If true, also saves videos for successful test cases, false
videoSlowdownMultiplier: 3, // Higher to get slower videos, lower for faster videos [Value 1-100]
}],
'spec',
['allure', {outputDir: 'allure-results'}]],
Test case:
Cart validation: few key concepts covered for Webdriver.io
- read a table, and perform expecpt at cart level(so test can be pipeline or regression)
- read data, config_data for products and check_out_data for filling billing data.
- Page object model. Selecetors and key validation on page been kept in POM. For example, in cart POM, it also contains validation for cart i.e. price times quantity equals subtotal ( and do this for each row/product, and also get the sum of all subtotals) then Sum(subtotal) + shipping(get amount using regex) + tax equals Total. This total equals amount charged in checkout.
Install nodejs → sudo apt install nodejs
install npm - sudo apt intall npm
instal git --> sudo apt install git-all
configure git - git config user.name 'simpleappdesigner'
email : git config --global user.email "simpleappdesigner.gmail.com"
mkdir WebdriverioECom && cd WebdriverioECom
git init
git clone https://github.com/simpleappdesigner/webdriverioCheckOut.git
npm install ( this will install dependencies listed in package.json
mkdir Screensnaps → this is needed to save screen snaps
install allure -- > sudo npm install -g allure-commandline
install java and set JAVA_HOME or JAVA is in path. This is needed for running allure report.
sudo apt install default-jre
which java→ to get the path
npx wdio -l error
allure generate allure-results --clean && allure open