https://github.com/akarsh/selenium-webdriver-cucumber-js-example-project
This project demonstrates the usage of selenium-webdriver, cucumberjs in a Node.js project with Docker and Jenkins CI
https://github.com/akarsh/selenium-webdriver-cucumber-js-example-project
cucumber-js docker jenkins selenium-webdriver
Last synced: 8 months ago
JSON representation
This project demonstrates the usage of selenium-webdriver, cucumberjs in a Node.js project with Docker and Jenkins CI
- Host: GitHub
- URL: https://github.com/akarsh/selenium-webdriver-cucumber-js-example-project
- Owner: akarsh
- License: gpl-3.0
- Created: 2023-05-28T10:23:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-22T07:41:37.000Z (over 1 year ago)
- Last Synced: 2025-02-16T07:17:44.189Z (10 months ago)
- Topics: cucumber-js, docker, jenkins, selenium-webdriver
- Language: JavaScript
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# selenium-webdriver-cucumber-js-example-project
[](https://github.com/akarsh/selenium-webdriver-cucumber-js-example-project/actions/workflows/create-pr-on-push-to-develop.yml)
[](https://github.com/akarsh/selenium-webdriver-cucumber-js-example-project/actions/workflows/test-on-push.yml)
This project demonstrates the usage of selenium-webdriver, cucumberjs in a Node.js project with Docker and Jenkins CI
## Project file structure
```
├── cucumber.js
├── package-lock.json
└── package.json
└── README.md
```
1. Scenarios are defined in .feature files, which are stored in the features directory
2. Step definitions are defined in .js files which are stored in the step_definitions directory
3. Reports in,
- html format is stored in cucumber-report.html
- json format is stored in cucumber-report.json
4. package.json holds important information about the project. It contains human-readable metadata about the project (like the project name and description) as well as functional metadata like the package version number and a list of dependencies required by the application
5. README.md file to communicate important information about Selenium WebDriver, CucumberJS example project
6. Dockerfile informs Docker what base image we would like to use for the Node.js application project
7. Jenkinsfile is a text file that contains the definition of a Jenkins Pipeline and is checked into source control
## Development
### Install
Install dependencies
```sh
npm install
```
### Test
Run standalone
```sh
npx cucumber-js
```
# Docker CI
## Docker multi-stage build for install
docker build command with --target install flag so that we specifically run the install build stage
```sh
docker build -t selenium-webdriver-cucumber-js-example-project-install --target install .
```
### Docker run install
Docker command to start the container and run install
```sh
docker run --rm -v ${PWD}:/usr/src/app/ --name selenium-webdriver-cucumber-js-example-project-install selenium-webdriver-cucumber-js-example-project-install
```
## Docker multi-stage build for testing
docker build command with --target test flag so that we specifically run the test build stage
```sh
docker build -t selenium-webdriver-cucumber-js-example-project-test --target test .
```
### Docker run test
Docker command to start the container and run test
```sh
docker run --rm -v ${PWD}:/usr/src/app/ --name selenium-webdriver-cucumber-js-example-project-test selenium-webdriver-cucumber-js-example-project-test
```