Skip to content

Mocha framework using Selenium, TypeScript, Mocha, Chai, Docker to test web application

Notifications You must be signed in to change notification settings

sadabnepal/selenium-javascript-test

Repository files navigation

Selenium Webdriver Test Framework

This is a sample project that uses selenium, typescript, mocha and chai.

Requirements

NodeJs Docker VSCode

Getting Started

Clone Repository

git clone https://github.com/sadabnepal/selenium-javascript-test.git
cd selenium-javascript-test

Install packages:

npm install

Setup husky:

npm run prepare

Run tests:

npm run test

Lint & fix

npm run lint
npm run lint:fix

Run test on Docker

npm run docker:start        [ start the docker container ]
npm run docker:stop         [ stop the docker container ]

npm run docker:start:arm    [ start the docker container for mac m1 chip ]
npm run docker:stop:arm     [ stop the docker container for mac m1 chip ]

Sample Report SampleReport

Key Features

  • Custom types for browser
  • Support to run test with all major browser
  • Parallel execution with mocha framework
  • Docker for testing against/using containerization
  • dotenv to support multiple environment
  • eslint linting tools integrated
  • husky git hooks for pre-commit checks (eslint)

learning references:

topic references
selenium https://www.npmjs.com/package/selenium-webdriver
mocha https://ricostacruz.com/mocha/
mocha config https://github.com/mochajs/mocha/tree/master/example/config
chai https://www.chaijs.com
report https://github.com/adamgruber/mochawesome
dotenv https://www.npmjs.com/package/dotenv
eslint https://eslint.org/docs/latest/use/getting-started
vscode settings https://code.visualstudio.com/docs/getstarted/settings