https://github.com/vans-codelab/pytest-selenium-login-test
Automated browser tests simulating user interactions, implemented with Selenium and Pytest
https://github.com/vans-codelab/pytest-selenium-login-test
pytest python selenium selenium-webdriver test-automation
Last synced: about 1 month ago
JSON representation
Automated browser tests simulating user interactions, implemented with Selenium and Pytest
- Host: GitHub
- URL: https://github.com/vans-codelab/pytest-selenium-login-test
- Owner: vans-codelab
- License: mit
- Created: 2025-10-12T14:46:17.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2026-01-11T15:10:49.000Z (5 months ago)
- Last Synced: 2026-01-11T17:53:52.086Z (5 months ago)
- Topics: pytest, python, selenium, selenium-webdriver, test-automation
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Test automation (web browsing)
Automated browser tests simulating user interactions, implemented with Selenium and Pytest.
## Project overview
This project automates user interactions in a browser, such as clicks and inputs, and verifies expected outcomes using assertions.
It is part of my personal learning journey into test automation.
Over time, I have been improving the project by adding features like structured tests, logging, and setup/teardown logic to simulate a more realistic project environment.
As I am still learning and growing in this area, I am always open to feedback and suggestions.
## Features
- Automated testing of browser-based user interactions
- Test case covers verifying successful login on a webpage
- Automated screenshots and logging during test run
- Clean folder structure
- Applied Object-Oriented Programming (OOP) principles
- Setup and teardown routines via `conftest.py`
- Easy to extend and maintain
## Project structure
The project follows a simple structure that separates application code from tests:
```
project/
├───src/ -> Source code
├───tests/ -> Test case(s) and related files
│ ├───logs/ -> Logs are generated during test run
│ ├───reports/ -> HTML test reports (can be generated from a command line)
│ ├───screenshots/ -> Sreenshots are captured during test run
```
## Requirements
- **Programming Language:**
Developed and tested with Python 3.11.
Download Python at: https://www.python.org/downloads/
- **Python Packages:**
See [requirements.txt](requirements.txt) for all dependencies.
## Project setup
### 1. Download the project
**Option A – Clone via Git**
```bash
git clone https://github.com/vans-codelab/pytest-selenium-login-test
cd pytest-selenium-login-test
```
**Option B – Download ZIP from GitHub**
Download ZIP from GitHub and extract it. Then navigate to the extracted folder with the following command:
```bash
cd # Replace with the actual folder path
```
### 2. Create a virtual environment and activate it
Windows:
```bash
python -m venv .venv
.venv\Scripts\activate
```
macOS/Linux:
```bash
python -m venv .venv
source .venv/bin/activate
```
### 3. Install required packages
```bash
pip install -r requirements.txt
```
## Run the test
### Option 1 (recommended) – Using the terminal or command line:
This option is recommended for executing the full test suite.
- Ensure that the virtual environment of the downloaded project is activated (if not already done).
```bash
cd # Replace with the actual folder path
```
Windows:
```bash
.venv\Scripts\activate
```
macOS/Linux:
```bash
source .venv/bin/activate
```
- Run all test cases
```bash
pytest
```
### Option 2 (optional) – Using an IDE (e.g. PyCharm):
To run a single test case or for easier debugging, an IDE can be used.
1. Open the project folder in an IDE (e.g. PyCharm).
2. Ensure that the virtual environment is selected.
3. Run individual test files using the IDE's built-in test runner.
## Test report (optional)
A `reports/` folder is included in the project structure to store HTML test reports.
After running the test, a report can be generated by running the following command:
```bash
pytest --html=tests/reports/report.html
```
This will create a HTML report inside the `reports/` folder.
The report provides an overview of the executed test case(s) and their results.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for more information.