This is a template that can run your Selenium tests locally and/or on GitHub Actions.
- src/test_firefox.py will run the tests on FireFox
- src/test_chrome.py will run the tests on Chrome
- src/test_edge.py will run the tests on Edge
You can either Fork/Clone my repository. Instructions are down below
- Fork/Clone the Repository linked above
- In the directory, go to the src folder and find
utilities.py
- Add the link of your website to test on the
'''INSERT URL HERE'''
prompt inutilities.py
- Write all your tests in the try block on the
ui_test
function inutilities.py
- Once you push/PR all your progress on the main branch, GitHub Actions will be ran
- Tests will be ran on each browser simultaneously on GitHub Actions (Edge, Chrome and Firefox) via Docker Compose
- Fork/Clone the Repository linked above
- In the directory, go to the src folder and find
utilities.py
- Add the link of your website to test on the
'''INSERT URL HERE'''
prompt inutilities.py
- Write all your tests in the try block on the
ui_test
function inutilities.py
- Run the docker-compose file with the command to spin up the containers for the Selenium Grid Server:
docker-compose -f docker-compose.yaml up -d
- Run a Python script based on the browser that you want to test on:
python src/test_<browser>.py
- Go to the link http://localhost:4444/ui to access the Selenium Grid Server
- Then click on “Sessions” and then click on the session you want to access. Each session will run each instance of an UI test.
- Type “secret” as the password for that session (each session will have this as the password regardless)
- Let the test run.
- Once you finish testing, run the docker-compose file again with this command to deactivate the containers:
docker-compose -f docker-compose.yaml down
- Fork/Clone the Repository linked above
- In the directory, go to the src folder and find
utilities.py
- Inside the
'''INSERT URL HERE'''
comment, replace it with the URL you want to conduct your UI tests in. - Inside the try block of the ui_test function, write your UI tests for your URL.
- Run this command on one terminal to start the Selenium Grid server (make sure the terminal is in the same directory as the repository):
java -jar selenium-server-4.8.1.jar standalone
- On another terminal, run a Python script based on the browser that you want to test on (once again make sure that this terminal is in the same directory as the repository):
python src/test_<browser>.py
- The tests will pop out automatically based on the browser of your choice
- Once the script has ran, you can terminate the server via
ctrl + c
on the terminal from step 5.