diff options
-rw-r--r-- | ctrack/organisations/tests/test_incident_report.py | 2 | ||||
-rw-r--r-- | ctrack/templates/pages/stakeholder_home.html | 2 | ||||
-rw-r--r-- | ctrack/users/tests/test_functional.py | 43 |
3 files changed, 46 insertions, 1 deletions
diff --git a/ctrack/organisations/tests/test_incident_report.py b/ctrack/organisations/tests/test_incident_report.py new file mode 100644 index 0000000..0bf76ef --- /dev/null +++ b/ctrack/organisations/tests/test_incident_report.py @@ -0,0 +1,2 @@ +def test_there_is_a_view_function_for_incident_report(): + pass diff --git a/ctrack/templates/pages/stakeholder_home.html b/ctrack/templates/pages/stakeholder_home.html index fd40c7a..bcd5ecf 100644 --- a/ctrack/templates/pages/stakeholder_home.html +++ b/ctrack/templates/pages/stakeholder_home.html @@ -64,7 +64,7 @@ <td><strong><span class="badge badge-success">RESOLVED</span></strong></td> </tr> </table> - <button class="btn btn-primary">Report a NIS incident</button> + <a class="btn btn-primary" id="id_submit_incident_button">Report a NIS incident</a> </div> </div> <hr> 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") |