Skip to content

Add Selenium and a basic CI script#8

Merged
MatthewDaggitt merged 2 commits into
mainfrom
selenium-tests
May 15, 2026
Merged

Add Selenium and a basic CI script#8
MatthewDaggitt merged 2 commits into
mainfrom
selenium-tests

Conversation

@MatthewDaggitt
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 15, 2026 03:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a first pass at browser-based (Selenium) tests and a GitHub Actions workflow to run tests on PRs, along with small UI/controller tweaks intended to support those tests.

Changes:

  • Introduces new Selenium-based UI tests for group creation.
  • Adds a GitHub Actions workflow to run unit tests (and Selenium tests).
  • Modifies the index template to add DOM ids for student cells, and changes controller validation behavior around “extra” students.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.

File Description
tests/selenium_tests.py Adds Selenium tests and a (currently incomplete) page-object helper.
app/templates/index.html Adds id attributes to student <td> elements for Selenium selectors.
app/controllers.py Comments out validation logic for students beyond the selected group size.
.github/workflows/python-app.yml Adds a CI workflow to install deps and run unittest suites.
Comments suppressed due to low confidence (1)

tests/selenium_tests.py:84

  • CreateGroupPage is used as a fluent API in the test, but it is incomplete (set_group_members is missing, and there are no helpers for student3/student4). Either flesh out the page object to cover the form fields used by the tests, or remove it and keep the tests using direct driver.find_element calls consistently.
class CreateGroupPage:
    def __init__(self, driver):
        self.driver = driver

    def set_student1(self, student_id):
        self.driver.find_element(By.ID, "student1").send_keys(student_id)
        return self

    def set_student2(self, student_id):
        self.driver.find_element(By.ID, "student2").send_keys(student_id)
        return self

    def submit_form(self):
        self.driver.find_element(By.ID, "submitBtn").click()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/selenium_tests.py
@@ -1,5 +1,6 @@

import multiprocessing
import time
Comment thread tests/selenium_tests.py
Comment on lines +41 to +44
def test_group_creation(self):
page = CreateGroupPage(self.driver).set_group_members("3").set_student1("12345678").set_student2("87654321")

self.driver.get(localHost)
Comment thread tests/selenium_tests.py
Comment on lines +62 to +69
def test_invalid_group_creation(self):
self.driver.find_element(By.ID, "groupMembers").send_keys("4")
self.driver.find_element(By.ID, "student1").send_keys("12345678")
self.driver.find_element(By.ID, "student2").send_keys("87654321")
self.driver.find_element(By.ID, "student3").send_keys("11223344")

self.driver.find_element(By.ID, "submitBtn").click()

Comment thread app/templates/index.html
Comment on lines +47 to +50
<td id="{{group.student1}}">{{group.student1}}</td>
<td id="{{group.student2}}">{{group.student2}}</td>
<td id="{{group.student3}}">{{group.student3}}</td>
<td id="{{group.student4}}">{{group.student4}}</td>
Comment thread app/controllers.py
Comment on lines 49 to 54
def check_valid_student(expected_number, student_number, student_id: Optional[str]):
# print(expected_number, student_number, student_id, student_id is not None or student_id != '')
if student_number > expected_number:
if student_id is not None:
raise ValueError(f"Student {student_number} should not be provided for a group of {expected_number} members.")
# if student_id is not None or student_id != '':
# raise ValueError(f"Student {student_number} should not be provided for a group of {expected_number} members.")
return
Comment thread app/controllers.py
Comment on lines 49 to 54
def check_valid_student(expected_number, student_number, student_id: Optional[str]):
# print(expected_number, student_number, student_id, student_id is not None or student_id != '')
if student_number > expected_number:
if student_id is not None:
raise ValueError(f"Student {student_number} should not be provided for a group of {expected_number} members.")
# if student_id is not None or student_id != '':
# raise ValueError(f"Student {student_number} should not be provided for a group of {expected_number} members.")
return
Comment on lines +21 to +23
pip install -r requirements.txt

- name: Run tests
@MatthewDaggitt MatthewDaggitt merged commit e86598c into main May 15, 2026
1 check failed
@MatthewDaggitt MatthewDaggitt deleted the selenium-tests branch May 15, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants