Install the latest Node.js Recommended For Most Users from https://nodejs.org/en/
https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
https://developer.apple.com/xcode/
Open Terminal and run
touch ~/.bash_profile
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
Re-open Terminal
===
Additional Windows prerequisite:
Open Command Prompt as administrator and run the following script:
npm install --global --production windows-build-tools
TODO: link here
Open terminal and navigate to desired folder where you're going to store all of your projects. For example projects folder:
cd projects
Create a folder for automation project. For example, automation-webdriverio:
mkdir test-automation-webdriverio
And navigate to the created folder:
cd test-automation-webdriverio
npm init
Click 'Enter' for every item to accept default values or specify whatever you like.
This action creates package.json file.
npm i --save-dev webdriverio@4.13.2
npm i --save-dev wdio-selenium-standalone-service
./node_modules/.bin/wdio config
Click Enter for the following items:
Where do you want to execute your tests?:
On my local machine
Which framework do you want to use?:
mocha
Type Y and click Enter for the following:
Shall I install the framework adapter for you? (Y/n):
Y
Type ./test/**/*.js and click Enter for the following:
Where are your test specs located?
./test/**/*.js
Just click Enter for the following items:
Which reporter do you want to use?
dot
Do you want to add a service to your test setup?
selenium-standalone
Level of logging verbosity
silent
In which directory should screenshots gets saved if a command fails? (./errorShots/)
Type https://reactbugtracker.com/ and click Enter for the following:
What is the base url?
https://reactbugtracker.com/
Wait till the end of the installation process.
mkdir test
cd test
touch test.js
open test.js
const assert = require('assert');
describe('Page opening', function () {
it('get title', function(){
browser.url('/Bug-Tracker'); //open baseUrl + string passed in .url() function
let title = browser.getTitle(); //get page title and assign it to the "title" variable
browser.pause(5000); //just pause to visually see that something is happening on the page
console.log(title); //log "title" variable
assert.equal(title, 'Bug Tracker', 'Title is incorrect'); //compare that "title" variable equals to "Bug Tracker" and error-message if not
})
});
Open package.json and modify test script:
"test": "wdio wdio.conf.js"
Now you can start your tests using npm test script.
npm install wdio-spec-reporter --save-dev
npm install wdio-allure-reporter --save-dev
maxInstances: 1,
browserName: 'chrome'
uncomment // services: [],
and then replace by:
services: ['selenium-standalone'],
uncomment // reporters: ['dot'],
and then replace by:
reporters: ['dot', 'spec', 'allure'],
reporterOptions: {
allure: {
outputDir: 'allure-results'
}
},
npm test
Wait until test is finished. You should see the message that 1 test passed.
GIT .gitignore