This project provides a suite of Selenium tests for automated browser testing. It includes various tests such as form submission, navigation, and smoke tests. The project is designed to be easily configurable and extendable to meet different testing needs.
Follow these steps to install and set up the project:
-
Clone the repository: First, you need to clone the repository to your local machine.
git clone https://github.com/jrh89/selenium-testing.git
-
Navigate to the project directory: Change your current directory to the project directory.
cd selenium-testing
-
Install dependencies: Install all the necessary dependencies using npm.
npm install
To run the tests, use the following command:
npm test
The project includes a config.js file where you can set various configuration options to customize the tests according to your needs. This file includes URLs, credentials, and other parameters used in the tests.
To customize the tests, follow these steps:
-
Open the config.js file: Locate and open the config.js file in the project directory. This file contains configuration settings for various tests.
-
Modify the configuration settings: Update the values in the
config.js
file to suit your testing requirements. Below is an example config.js file with explanations of each field:export const config = {
url: 'http://www.hookerhillstudios.com/Login', validCredentials: { email: 'testuser@testuser.com', password: 'Testing123!', }, loginButtonText: 'Login', expectedUrl: 'https://www.hookerhillstudios.com/', google: { url: 'http://www.google.com', searchQuery: 'Selenium WebDriver', expectedTitle: 'Selenium WebDriver', homeTitle: 'Google' }, formSubmissionTest: { url: 'http://www.hookerhillstudios.com/Login', credentials: { email: 'testuser@testuser.com', password: 'Testing123!' }, loginButtonText: 'Login', expectedUrl: 'https://www.hookerhillstudios.com/' }, hackerNewsTest: { url: 'https://news.ycombinator.com/newest', // Use the 'newest' section URL for the test expectedNumberOfArticles: 100, timestampSelector: '.age', // Selector for timestamps articleSelector: '.athing', // Selector for article containers articleTitleSelector: '.storylink', // Selector for article titles } ```
-
Edit the URLs, credentials, and other parameters: Modify the values in the
config.js
file to suit your testing needs. -
Save the config.js file: After making the necessary changes, save the file.
-
Run the tests:
npm test
By following these steps, you can customize the Selenium tests to work with different websites, credentials, and other parameters, making the testing framework versatile and adaptable to various use cases.