aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/users
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-05-28 16:36:45 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-05-28 16:36:45 +0100
commit3fe0659a634f9cb55d50f308aa88ba78445953a1 (patch)
tree016ccaa06a11e15a6013635cfb7b5eb7aeeb9c35 /ctrack/users
parentacf875c2bca1727306cb70aaa37e6f4595209786 (diff)
setting up for testing incident report work
Diffstat (limited to 'ctrack/users')
-rw-r--r--ctrack/users/tests/test_functional.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/ctrack/users/tests/test_functional.py b/ctrack/users/tests/test_functional.py
index 5622ab3..6ea818f 100644
--- a/ctrack/users/tests/test_functional.py
+++ b/ctrack/users/tests/test_functional.py
@@ -122,3 +122,46 @@ def test_stakeholder_user_can_see_requisite_subtitles_on_home_page(
assert "Audits and Inspections" in [x.text for x in h2]
assert "NIS systems" in [x.text for x in h2]
assert "DfT Engagement" in [x.text for x in h2]
+
+
+def test_stakeholder_logs_into_system_and_submits_incident_form(
+ browser, live_server, stakeholder
+):
+ user = User.objects.create_user(username="toss", password="knob")
+ user.stakeholder = stakeholder
+ user.save()
+ browser.get(live_server + "/accounts/login")
+ browser.find_element_by_id("id_login").send_keys("toss")
+ browser.find_element_by_id("id_password").send_keys("knob")
+ browser.find_element_by_id("sign_in_button").submit()
+ time.sleep(1)
+ current_url = browser.current_url
+ browser.get(current_url)
+
+ # Clicks the Report a NIS incident button
+ browser.find_element_by_id("id_submit_incident_button").submit()
+
+ # Gets to the correct page
+ assert "Submit a new NIS Incident Report to DfT" in browser.title
+
+ # The name of her organisation is already there in the first field
+ assert (
+ browser.find_element_by_id("id_org_field").text
+ == user.stakeholder.person.get_organisation_name()
+ )
+
+ # Her name is already in the "Name of person reporting field"
+ assert (
+ browser.find_element_by_id("id_person_reporting_field").text
+ == user.stakeholder.person
+ )
+
+ # Her role is already in the "Role" field
+ assert browser.find_element_by_id("id_role_field").text == user.stakeholder.role
+
+ # Her phone number is already in the "Phone Number" field
+ assert (
+ browser.find_element_by_id("id_phone_number_field").text
+ == user.stakeholder.mobile
+ )
+ assert pytest.fail("WE GO NO FURTHER")