Test Environment Setup Guide for running the Automated Scripts for APInf Web Portal.
Ensure you have Chrome and Firefox installed. If not please install before you proceed further.
Download and install node.js Profile to be updated with the path of node.js installation.
$ nano ~/.profile
Go to the end of the file and just add the below lines, if you have downloaded the node.js to Downloads folder. If its a seperate folder change the folder location in the path accordingly.
#set PATH for Node JS
if [ -d "$HOME/Downloads/node-v4.4.5-linux-x64/bin" ] ; then
PATH="$HOME/Downloads/node-v4.4.5-linux-x64/bin:$PATH"
fi
Exit(Ctrl+x) and save the file. Reload the changes to your profile by executing the below command.
$ source ~/.profile
To verify whether node.js was successfully installed or not, just goto terminal and enter
$ node
>
If you see ">" then proceed to next step. You can exit from that prompt by executing
> .exit
Goto Terminal and execute the below command.
$ sudo apt-get install npm
If you already have it, then no action needed.
- Create a folder called bin under HOME Directory
- Download Chrome Driver
- Extract the downloaded driver to bin
Under bin folder you should find file named: chromedriver
Create a 'test' folder and extract the test script files exactly under this folder. So that directly the files are present. Navigate via terminal to this folder, before you continue with next step.
Execute the below command in terminal
$ npm install
-
Scenerio 1- You want to execute all scripts at once, navigate to the parent directory where the test files are placed and execute the below command.
$ mocha
-
Scenerio 2: Executing only single test file
$ mocha testfile.js
-
Scenerio 3: Executing only single test case in a test file
$ mocha testfile.js - g 'TestCaseID' EX: mocha testfile.js -g '1.3'