Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce UI Automation Demo


1. Project Overview

A personal UI automation framework built with Python, Selenium WebDriver and PyTest using the Page Object Model (POM).

This project demonstrates practical UI test automation for an e-commerce web application, covering login validation, product verification, shopping cart operations and product sorting.


2. Project Purpose

The purpose of this project is to demonstrate practical skills in:

  • Python-based UI automation
  • Selenium WebDriver
  • PyTest test execution
  • Page Object Model (POM)
  • Reusable locators and page methods
  • Maintainable automation structure
  • Automated HTML test reporting

This is a personal portfolio project and contains no employer, client or confidential code.


3. Tech Stack

Technology Purpose
Python Programming language
Selenium WebDriver Browser automation
PyTest Test framework
pytest-html HTML test reporting
Page Object Model (POM) Test automation architecture
Google Chrome Test browser

4. Automated Test Scenarios

The framework currently contains 6 automated test cases.

# Test Scenario Expected Result
1 Verify valid user login User successfully logs in
2 Verify invalid login is rejected Appropriate error message is displayed
3 Verify products are displayed Products are available on the inventory page
4 Verify product can be added to cart Selected product is added to the cart
5 Verify product can be removed from cart Selected product is removed from the cart
6 Verify products can be sorted by price Products are sorted from low to high price

5. Project Structure

AUTOMATIONPRO/
│
├── pages/
│   ├── __init__.py
│   ├── inventory_page.py
│   └── login_page.py
│
├── reports/
│   └── report.html
│
├── tests/
│   ├── __init__.py
│   ├── test_inventory.py
│   └── test_login.py
│
├── .gitignore
├── conftest.py
├── pytest.ini
├── README.md
└── requirements.txt

Folder Responsibilities

pages/
Contains Page Object classes, locators and reusable methods for interacting with application pages.

tests/
Contains PyTest test cases that validate application functionality.

reports/
Contains the generated HTML test execution report.

conftest.py
Contains shared PyTest fixtures and Selenium WebDriver configuration.

pytest.ini
Contains PyTest configuration and HTML reporting options.

requirements.txt
Contains the Python dependencies required to run the project.


6. Installation

Clone the Repository

git clone https://github.com/nikhilshendgetech-sudo/AutomationPro.git

Navigate to the Project Directory

cd AUTOMATIONPRO

Create a Virtual Environment

python -m venv .venv

Activate the Virtual Environment

Windows:

.venv\Scripts\activate

macOS / Linux:

source .venv/bin/activate

Install Dependencies

pip install -r requirements.txt

7. Run Tests

Run all automated tests using:

pytest -v

PyTest automatically discovers the test files inside the tests/ directory.

The project is configured through pytest.ini for HTML test reporting.

To explicitly generate the HTML report:

pytest --html=reports/report.html --self-contained-html

8. Test Application

The tests use the publicly available SauceDemo practice application.

Application:
https://www.saucedemo.com/

The application provides a practice environment for demonstrating web UI automation.


9. Test Reporting

The project uses pytest-html to generate an HTML execution report.

The report provides:

  • Test execution summary
  • Passed, failed and skipped test results
  • Test duration
  • Environment information
  • Individual test details
  • Test execution logs

The generated report is available at:

reports/report.html

A sample execution report is included in the reports/ directory.


10. Test Architecture

The framework follows the Page Object Model (POM) design pattern.

Test Case
    │
    ▼
Page Object
    │
    ▼
Selenium WebDriver
    │
    ▼
SauceDemo Application

Page-specific locators and actions are maintained inside the pages/ directory, while test scenarios are maintained separately inside the tests/ directory.

This separation keeps the test cases readable and makes the automation code easier to maintain.


11. Test Execution Flow

PyTest
   │
   ▼
conftest.py
   │
   ▼
Create Chrome WebDriver
   │
   ▼
Open SauceDemo
   │
   ▼
Execute Test Cases
   │
   ├── Login Tests
   │
   └── Inventory Tests
          │
          ├── Product Validation
          ├── Add to Cart
          ├── Remove from Cart
          └── Product Sorting
   │
   ▼
Test Results
   │
   ▼
HTML Report

12. Note

This is a personal automation demonstration project created to showcase Python and Selenium UI automation capabilities.

The project uses a publicly available practice application and contains no employer, client or confidential information.

About

Python + Selenium + PyTest UI automation framework using Page Object Model (POM)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages