- Automated UI tests using Python + Playwright
- Validates:
- Z → A sorting
- Price high → low sorting
- Add to cart + checkout flow
- Visual screenshot checks
- Accessibility compliance (axe-core)
Before you begin, ensure that you have the following installed:
- Python 3.10+: Download from python.org.
- pip (Python package manager): Should come installed with Python.
- Google Chrome (or any Playwright-supported browser): Chrome is recommended, but Playwright will work with Chromium by default.
-
Clone the repository: First, clone the repository to your local machine:
git clone https://github.com/Vijay-QC/saucedemo.git cd saucedemo
-
Create and Activate a Virtual Environment It's recommended to create a virtual environment for this project to manage dependencies in isolation.
python -m venv venv
On Windows, activate the virtual environment:
venv\Scripts\activate
-
Install Required Dependencies Use pip to install the necessary dependencies:
pip install -r requirements.txt
This will install the required libraries, including Playwright and testing dependencies.
-
Install Playwright Browsers Playwright needs browser binaries (Chromium, Firefox, WebKit) to run tests. Install them using:
playwright install
This will download and install the necessary browser binaries for testing.
-
Run Tests in Headless Mode (Default)
pytest --html=reports/index.html
This will execute all the tests and generate an HTML report in the reports folder.
-
Run Tests in Headed Mode
pytest --headed --html=reports/index.html
This will open the browser window while running the tests, useful for debugging.
- Test Execution Logs/Reports Reports: After running the tests, you can view the results in the generated HTML report (reports/index.html).
To open the report: start reports/index.html
-
Commit Your Changes
git add . git commit -m "Initial Commit"
-
Push Changes to GitHub
git push -u origin main
-
Test Execution Videos You can find the video recordings of both headless and headed test runs in the Videos/ folder. These can be useful for debugging or showcasing the tests.
Headed mode: Videos/Headed_run.mp4 Headless mode: Videos/Headless_run.mp4