Some of the tests that I used to automate some manual tests using Selenium WebDriver
My Linkedin»
The tests were build with Selenium WebDriver and the code is JavaScript.
Additional libraries that were used.
- JavaScript
- Mocha
- Mochawesome
- Chai
Follow the step-by-step to set up the working enviorment.
Install Node.js from the website https://nodejs.org/en/
Open CMD Promt and check the version
- npm
node --v
Create new test project folder Open CMD terminal and navigate to the directory of the folder (cd /path/)
-
Once navigated type in the following command
-
Clone the repo
npm init
-
Install NPM package Selenium-Webdriver
npm install selenium-webdriver
-
Set up PATH Environmentals Method 2: Setting ChromeDriver Path in Windows Environment Variables • Step 1: Go to My Computer and Right click to get the context menu. MyComputer Properties • Step 2: Click on the Change Setting on the opened window. Change Settings • Step 3: Click on Advance tab and click on Environment Variables.
-
Select Path under System Variables and click on Edit.
-
Step 5: At the end of the string use semicolon and paste the path of the ChromeDriver. On my machine my ChromeDriver exe resides in D:\Drivers\
-
Install NPM package Google Chrome Driver
Npm install chromedriver
-
Install NPM Firefox driver
npm install geckodriver
Install Chai /for assertions/
Install Mocha for test reporting
We can run the code with npx mocha --no-timeouts /Tests/*.js (the path of the tests) 11.1 We can modify the package.json to "scripts": { "test": "mocha --no-timeouts *js" } and then proceed to execute the tests using the "npm test" in the terminal
We can add --parallel to the package.json - npx mocha --no-timeouts --parallel *.js to run tests simunteniously.
Generating test visualization reports with mochawesome
- Install NPM Mochawesome
update the package.json to include the following:
npm install mochawesome
"scripts": { "test": "mocha --no-timeouts --parallel --reporter mochawesome --require mochawesome/register *.js" },
Run using npm test
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
If you have any jobs offers you can reach me at LinkedIn
- Add README
- Update some tests to run in a cloud.
- Add the tests to Selenium Grid
- Add some API testing
Distributed under the MIT License. See LICENSE.txt
for more information.
Sava Barbarov - savabarbarov96@gmail.com
Project Link: https://github.com/savabarbarov96/testing-repo