This repository contains automated Selenium-based tests for interacting with Reddit’s user interface. The project is designed to test common Reddit functionalities.
Follow the steps below to set up the project and run .
Ensure that you have the following installed on your system:
- Python
- Chrome browser (or any other browser you plan to use)
- ChromeDriver (or the corresponding driver for your browser)
You can download the appropriate version of ChromeDriver here.
Start by cloning the repository to your local machine:
git clone https://github.com/atharvlokhande7/reddit-ui-automation.git
cd reddit-ui-automation
Install the required Python libraries by running:
pip install -r requirements.txt
This will install all necessary dependencies, including Selenium.
Configure the config.json file located in the config/ directory. This file contains key settings such as the base URL of Reddit, browser choice, and timeout values.
- base_url: The base URL of the site being tested.
- browser: The browser you wish to use (default is Chrome).
- timeout: The timeout in seconds for page loading or waiting for elements.
Ensure you set the correct browser (e.g., Chrome, Firefox) based on your installed drivers.
Edit the test_data.json file under the data/ directory. This file stores all necessary test data, including:
- Login credentials for valid and invalid login tests.
- Post details for testing content creation.
Make sure to replace placeholders like "USERNAME" and "PASSWORD" with actual values for testing.
Once your configuration is complete, run the tests using the following command:
pytest tests
This will automatically discover and execute all the test cases in the tests/ directory.
By default, the tests are configured to run with Chrome. If you wish to use a different browser (e.g., Firefox), change the "browser" setting in config/config.json to your desired browser. Ensure that you have the appropriate WebDriver installed for the chosen browser.
- ChromeDriver version mismatch: Ensure that your ChromeDriver version is compatible with your installed version of Google Chrome. You can download the correct version from the ChromeDriver download page.
- Dependency issues: If you face any issues with dependencies, try upgrading them:
- Driver not found: If you're using a browser other than Chrome, ensure you have the corresponding WebDriver installed (e.g., GeckoDriver for Firefox).
pip install --upgrade -r requirements.txt