From 7f42ecb86786a9b9841aa5a01c7fc4b04b322d71 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Fri, 17 May 2024 13:03:08 -0700 Subject: [PATCH 01/39] Adding biz logic in --- src/registrar/assets/sass/_theme/_forms.scss | 7 +- .../templates/domain_request_form.html | 17 +++ .../templates/domain_request_review.html | 2 +- src/registrar/views/domain_request.py | 101 +++++++++++++++--- 4 files changed, 112 insertions(+), 15 deletions(-) diff --git a/src/registrar/assets/sass/_theme/_forms.scss b/src/registrar/assets/sass/_theme/_forms.scss index 058a9f6c8..bdef522eb 100644 --- a/src/registrar/assets/sass/_theme/_forms.scss +++ b/src/registrar/assets/sass/_theme/_forms.scss @@ -32,6 +32,11 @@ border-left: none; } +.incomplete { + color: red; + font-weight: bold; +} + legend.float-left-tablet + button.float-right-tablet { margin-top: .5rem; @include at-media('tablet') { @@ -52,4 +57,4 @@ legend.float-left-tablet + button.float-right-tablet { background-color: var(--body-fg); color: var(--close-button-hover-bg); } -} \ No newline at end of file +} diff --git a/src/registrar/templates/domain_request_form.html b/src/registrar/templates/domain_request_form.html index cde12ad80..405876da6 100644 --- a/src/registrar/templates/domain_request_form.html +++ b/src/registrar/templates/domain_request_form.html @@ -84,6 +84,13 @@ value="save_and_return" class="usa-button usa-button--outline" >Save and return to manage your domains + {% else %} + + {% block after_form_content %}{% endblock %} diff --git a/src/registrar/templates/domain_request_review.html b/src/registrar/templates/domain_request_review.html index 5f359e95f..88a9c128e 100644 --- a/src/registrar/templates/domain_request_review.html +++ b/src/registrar/templates/domain_request_review.html @@ -37,7 +37,7 @@ {% if step == Step.TRIBAL_GOVERNMENT %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% if domain_request.federally_recognized_tribe %}

Federally-recognized tribe

{% endif %} diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index f93976138..c233b01d0 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -374,25 +374,100 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): } return [key for key, value in history_dict.items() if value] + + def _form_complete(self): + # So in theory each part of the form individually should be already doing the check, correct? + # In theory, that means we just only need to check for the title pages that are completed which is + # Technically some of these don't even show up at all depending on which "state" its in or chosen + + # If we choose Federal -> check "Federal government branch (has defaults) + # If we choose Interstate -> check "About your organization" + # If we choose State -> check "Election office" (has default) + # If we choose Tribal -> check "Tribal name" and "Election office" + # County -> "Election office" + # City -> "Election office" + # Special district -> "Election office" and "About your organization" + # School district -> clears common + + + if ( + # (self.domain_request.tribe_name is None) + (self.domain_request.generic_org_type is None) + or (self.domain_request.tribe_name is None) + or (self.domain_request.federal_type is None) + or (self.domain_request.is_election_board is None) + or ( + self.domain_request.federal_agency is None + or self.domain_request.organization_name is None + or self.domain_request.address_line1 is None + or self.domain_request.city is None + or self.domain_request.state_territory is None + or self.domain_request.zipcode is None + or self.domain_request.urbanization is None + ) # organization contact + or (self.domain_request.about_your_organization is None) + or (self.domain_request.authorizing_official is None) + or ( + self.domain_request.current_websites.exists() or self.domain_request.requested_domain is None + ) # for current_sites + or (self.domain_request.requested_domain is None) # for dotgov_domain + or (self.domain_request.purpose is None) + or (self.domain_request.submitter is None) # your_contact + or (self.domain_request.other_contacts is None) + or ( + (self.domain_request.anything_else is None and self.domain_request.cisa_representative_email) + or self.domain_request.is_policy_acknowledged is None + ) # additional detail + or (self.domain_request.is_policy_acknowledged is None) # review + ): + # print("!!!!!! self.domain_request.tribe_name is", self.domain_request.tribe_name) + # context = self.get_context_data() + # context["forms"] = self.get_forms() + # context["form_is_not_complete"] = False + + return False + else: + # print("!!!!!! self.domain_request.tribe_name is", self.domain_request.tribe_name) + return True + + # return None + def get_context_data(self): """Define context for access on all wizard pages.""" # Build the submit button that we'll pass to the modal. modal_button = '" # Concatenate the modal header that we'll pass to the modal. - if self.domain_request.requested_domain: - modal_heading = "You are about to submit a domain request for " + str(self.domain_request.requested_domain) - else: - modal_heading = "You are about to submit an incomplete request" - return { - "form_titles": self.TITLES, - "steps": self.steps, - # Add information about which steps should be unlocked - "visited": self.storage.get("step_history", []), - "is_federal": self.domain_request.is_federal(), - "modal_button": modal_button, - "modal_heading": modal_heading, - } + # TODO: Still need to log! + context_stuff = {} + print("!!!!!!!!! before form complete") + print("!!!!!!!!! self.form_complete is", self._form_complete()) + if self._form_complete(): + print("!!!!!!!in form complete section") + context_stuff = { + "form_titles": self.TITLES, + "steps": self.steps, + # Add information about which steps should be unlocked + "visited": self.storage.get("step_history", []), + "is_federal": self.domain_request.is_federal(), + "modal_button": modal_button, + "modal_heading": "You are about to submit a domain request for " + + str(self.domain_request.requested_domain), + } + else: # form is not complete + print("!!!!!!! form is not complete") + context_stuff = { + "form_titles": self.TITLES, + "steps": self.steps, + # Add information about which steps should be unlocked + "visited": self.storage.get("step_history", []), + "is_federal": self.domain_request.is_federal(), + # "modal_button": We'll have to set some kind of go back button + # And fix wording in text for domain_request_form + "modal_heading": "You can’t submit this request", + } + + return context_stuff def get_step_list(self) -> list: """Dynamically generated list of steps in the form wizard.""" From ee90567700dd045d84a6ef6631d4e2e023aa5262 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Mon, 20 May 2024 16:27:52 -0700 Subject: [PATCH 02/39] Add bizniz logic for incomplete forms and red colour coding on review page --- src/registrar/assets/sass/_theme/_forms.scss | 2 +- .../templates/domain_request_form.html | 19 +- .../templates/domain_request_review.html | 22 +- src/registrar/templates/includes/modal.html | 2 +- src/registrar/views/domain_request.py | 237 +++++++++++++----- 5 files changed, 191 insertions(+), 91 deletions(-) diff --git a/src/registrar/assets/sass/_theme/_forms.scss b/src/registrar/assets/sass/_theme/_forms.scss index bdef522eb..490bf7986 100644 --- a/src/registrar/assets/sass/_theme/_forms.scss +++ b/src/registrar/assets/sass/_theme/_forms.scss @@ -33,7 +33,7 @@ } .incomplete { - color: red; + color: #950E24; font-weight: bold; } diff --git a/src/registrar/templates/domain_request_form.html b/src/registrar/templates/domain_request_form.html index 405876da6..b176866cc 100644 --- a/src/registrar/templates/domain_request_form.html +++ b/src/registrar/templates/domain_request_form.html @@ -84,13 +84,6 @@ value="save_and_return" class="usa-button usa-button--outline" >Save and return to manage your domains - {% else %}
- {% include 'includes/modal.html' with modal_heading=modal_heading|safe modal_description="Once you submit this request, you won’t be able to edit it until we review it. You’ll only be able to withdraw your request." modal_button=modal_button|safe %} + {% include 'includes/modal.html' with review_form_is_complete=review_form_is_complete modal_heading=modal_heading|safe modal_description=modal_description|safe modal_button=modal_button|safe %} - - {% block after_form_content %}{% endblock %} diff --git a/src/registrar/templates/domain_request_review.html b/src/registrar/templates/domain_request_review.html index 88a9c128e..2960e40c7 100644 --- a/src/registrar/templates/domain_request_review.html +++ b/src/registrar/templates/domain_request_review.html @@ -25,11 +25,11 @@ {% if step == Step.ORGANIZATION_TYPE %} {% namespaced_url 'domain-request' step as domain_request_url %} {% if domain_request.generic_org_type is not None %} - {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete" %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -47,7 +47,7 @@ {% if step == Step.ORGANIZATION_FEDERAL %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -66,7 +66,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url address='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value='Incomplete' %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -74,7 +74,7 @@ {% if step == Step.ABOUT_YOUR_ORGANIZATION %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -86,7 +86,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete" %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -107,7 +107,7 @@ {% if step == Step.DOTGOV_DOMAIN %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe%} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} @@ -123,7 +123,7 @@ {% if step == Step.PURPOSE %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -135,7 +135,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete" %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -148,7 +148,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' list='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -157,7 +157,7 @@ {% if step == Step.ADDITIONAL_DETAILS %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete" %} + {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title sub_header_text='CISA regional representative' value=domain_request.cisa_representative_email heading_level=heading_level editable=True edit_link=domain_request_url custom_text_for_value_none='No' %} {% endwith %} diff --git a/src/registrar/templates/includes/modal.html b/src/registrar/templates/includes/modal.html index 8e6cb66d5..24b581516 100644 --- a/src/registrar/templates/includes/modal.html +++ b/src/registrar/templates/includes/modal.html @@ -39,7 +39,7 @@ Cancel - {% else %} + {% elif review_form_is_complete %} " # Concatenate the modal header that we'll pass to the modal. - # TODO: Still need to log! context_stuff = {} - print("!!!!!!!!! before form complete") - print("!!!!!!!!! self.form_complete is", self._form_complete()) if self._form_complete(): print("!!!!!!!in form complete section") + modal_button = '" context_stuff = { "form_titles": self.TITLES, "steps": self.steps, @@ -453,20 +564,24 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "modal_button": modal_button, "modal_heading": "You are about to submit a domain request for " + str(self.domain_request.requested_domain), + "modal_description": "Once you submit this request, you won’t be able to edit it until we review it.\ + You’ll only be able to withdraw your request.", + "review_form_is_complete": True, } else: # form is not complete print("!!!!!!! form is not complete") + modal_button = '" context_stuff = { "form_titles": self.TITLES, "steps": self.steps, - # Add information about which steps should be unlocked "visited": self.storage.get("step_history", []), "is_federal": self.domain_request.is_federal(), - # "modal_button": We'll have to set some kind of go back button - # And fix wording in text for domain_request_form + "modal_button": modal_button, "modal_heading": "You can’t submit this request", + "modal_description": "You can’t submit this request because it’s incomplete.\ + Click return to request and complete the sections that are missing information.", + "review_form_is_complete": False, } - return context_stuff def get_step_list(self) -> list: @@ -727,6 +842,8 @@ class Review(DomainRequestWizard): forms = [] # type: ignore def get_context_data(self): + if self._form_complete() is False: + logger.warning("User arrived at review page with an incomplete form.") context = super().get_context_data() context["Step"] = Step.__members__ context["domain_request"] = self.domain_request From 0effa8198840cc723db19ce44c458f9a9bffd804 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 21 May 2024 13:58:43 -0700 Subject: [PATCH 03/39] Add tests --- src/registrar/tests/test_views_request.py | 370 ++++++++++++++++++++++ src/registrar/views/domain_request.py | 69 ---- 2 files changed, 370 insertions(+), 69 deletions(-) diff --git a/src/registrar/tests/test_views_request.py b/src/registrar/tests/test_views_request.py index 2b577b41a..515aff55b 100644 --- a/src/registrar/tests/test_views_request.py +++ b/src/registrar/tests/test_views_request.py @@ -470,6 +470,376 @@ class DomainRequestTests(TestWithUser, WebTest): # check that any new pages are added to this test self.assertEqual(num_pages, num_pages_tested) + @boto3_mocking.patching + def test_domain_request_form_submission_incomplete(self): + """ + Can fill out the entire form and submit. + As we add additional form pages, we need to include them here to make + this test work. + + This test also looks for the long organization name on the summary page. + + This also tests for the presence of a modal trigger and the dynamic test + in the modal header on the submit page. + """ + num_pages_tested = 0 + # elections, type_of_work, tribal (on purpose) + SKIPPED_PAGES = 2 + num_pages = len(self.TITLES) - SKIPPED_PAGES + + intro_page = self.app.get(reverse("domain-request:")) + # django-webtest does not handle cookie-based sessions well because it keeps + # resetting the session key on each new request, thus destroying the concept + # of a "session". We are going to do it manually, saving the session ID here + # and then setting the cookie on each request. + session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] + + intro_form = intro_page.forms[0] + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + intro_result = intro_form.submit() + + # follow first redirect + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + type_page = intro_result.follow() + session_id = self.app.cookies[settings.SESSION_COOKIE_NAME] + + # ---- TYPE PAGE ---- + type_form = type_page.forms[0] + type_form["generic_org_type-generic_org_type"] = "tribal" + # test next button and validate data + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + type_result = type_form.submit() + # should see results in db + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.generic_org_type, "tribal") + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(type_result.status_code, 302) + self.assertEqual(type_result["Location"], "/request/tribal_government/") + num_pages_tested += 1 + + # -- TRIBAL PAGE -- + # We want to skip the tribal page right?? but how do we not fill it out............. + type_form = type_page.forms[0] + type_form["generic_org_type-generic_org_type"] = DomainRequest.OrganizationChoices.TRIBAL + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + type_result = type_form.submit() + # the tribal government page comes immediately afterwards + self.assertIn("/tribal_government", type_result.headers["Location"]) + # follow first redirect + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + tribal_government_page = type_result.follow() + + # and the step is on the sidebar list. + self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT]) + + + # ---- ORG CONTACT PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + org_contact_page = type_result.follow() + org_contact_form = org_contact_page.forms[0] + # federal agency so we have to fill in federal_agency + # federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration") + # org_contact_form["organization_contact-federal_agency"] = federal_agency.id + org_contact_form["organization_contact-organization_name"] = "Testorg" + org_contact_form["organization_contact-address_line1"] = "address 1" + org_contact_form["organization_contact-address_line2"] = "address 2" + org_contact_form["organization_contact-city"] = "NYC" + org_contact_form["organization_contact-state_territory"] = "NY" + org_contact_form["organization_contact-zipcode"] = "10002" + org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks" + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + org_contact_result = org_contact_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.organization_name, "Testorg") + self.assertEqual(domain_request.address_line1, "address 1") + self.assertEqual(domain_request.address_line2, "address 2") + self.assertEqual(domain_request.city, "NYC") + self.assertEqual(domain_request.state_territory, "NY") + self.assertEqual(domain_request.zipcode, "10002") + self.assertEqual(domain_request.urbanization, "URB Royal Oaks") + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(org_contact_result.status_code, 302) + self.assertEqual(org_contact_result["Location"], "/request/authorizing_official/") + num_pages_tested += 1 + + # ---- AUTHORIZING OFFICIAL PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + ao_page = org_contact_result.follow() + ao_form = ao_page.forms[0] + ao_form["authorizing_official-first_name"] = "Testy ATO" + ao_form["authorizing_official-last_name"] = "Tester ATO" + ao_form["authorizing_official-title"] = "Chief Tester" + ao_form["authorizing_official-email"] = "testy@town.com" + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + ao_result = ao_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.authorizing_official.first_name, "Testy ATO") + self.assertEqual(domain_request.authorizing_official.last_name, "Tester ATO") + self.assertEqual(domain_request.authorizing_official.title, "Chief Tester") + self.assertEqual(domain_request.authorizing_official.email, "testy@town.com") + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(ao_result.status_code, 302) + self.assertEqual(ao_result["Location"], "/request/current_sites/") + num_pages_tested += 1 + + # ---- CURRENT SITES PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + current_sites_page = ao_result.follow() + current_sites_form = current_sites_page.forms[0] + current_sites_form["current_sites-0-website"] = "www.city.com" + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + current_sites_result = current_sites_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual( + domain_request.current_websites.filter(website="http://www.city.com").count(), + 1, + ) + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(current_sites_result.status_code, 302) + self.assertEqual(current_sites_result["Location"], "/request/dotgov_domain/") + num_pages_tested += 1 + + # ---- DOTGOV DOMAIN PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + dotgov_page = current_sites_result.follow() + dotgov_form = dotgov_page.forms[0] + dotgov_form["dotgov_domain-requested_domain"] = "city" + dotgov_form["dotgov_domain-0-alternative_domain"] = "city1" + + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + dotgov_result = dotgov_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.requested_domain.name, "city.gov") + self.assertEqual(domain_request.alternative_domains.filter(website="city1.gov").count(), 1) + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(dotgov_result.status_code, 302) + self.assertEqual(dotgov_result["Location"], "/request/purpose/") + num_pages_tested += 1 + + # ---- PURPOSE PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + purpose_page = dotgov_result.follow() + purpose_form = purpose_page.forms[0] + purpose_form["purpose-purpose"] = "For all kinds of things." + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + purpose_result = purpose_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.purpose, "For all kinds of things.") + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(purpose_result.status_code, 302) + self.assertEqual(purpose_result["Location"], "/request/your_contact/") + num_pages_tested += 1 + + # ---- YOUR CONTACT INFO PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + your_contact_page = purpose_result.follow() + your_contact_form = your_contact_page.forms[0] + + your_contact_form["your_contact-first_name"] = "Testy you" + your_contact_form["your_contact-last_name"] = "Tester you" + your_contact_form["your_contact-title"] = "Admin Tester" + your_contact_form["your_contact-email"] = "testy-admin@town.com" + your_contact_form["your_contact-phone"] = "(201) 555 5556" + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + your_contact_result = your_contact_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.submitter.first_name, "Testy you") + self.assertEqual(domain_request.submitter.last_name, "Tester you") + self.assertEqual(domain_request.submitter.title, "Admin Tester") + self.assertEqual(domain_request.submitter.email, "testy-admin@town.com") + self.assertEqual(domain_request.submitter.phone, "(201) 555 5556") + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(your_contact_result.status_code, 302) + self.assertEqual(your_contact_result["Location"], "/request/other_contacts/") + num_pages_tested += 1 + + # ---- OTHER CONTACTS PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + other_contacts_page = your_contact_result.follow() + + # This page has 3 forms in 1. + # Let's set the yes/no radios to enable the other contacts fieldsets + other_contacts_form = other_contacts_page.forms[0] + + other_contacts_form["other_contacts-has_other_contacts"] = "True" + + other_contacts_form["other_contacts-0-first_name"] = "Testy2" + other_contacts_form["other_contacts-0-last_name"] = "Tester2" + other_contacts_form["other_contacts-0-title"] = "Another Tester" + other_contacts_form["other_contacts-0-email"] = "testy2@town.com" + other_contacts_form["other_contacts-0-phone"] = "(201) 555 5557" + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + other_contacts_result = other_contacts_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual( + domain_request.other_contacts.filter( + first_name="Testy2", + last_name="Tester2", + title="Another Tester", + email="testy2@town.com", + phone="(201) 555 5557", + ).count(), + 1, + ) + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(other_contacts_result.status_code, 302) + self.assertEqual(other_contacts_result["Location"], "/request/additional_details/") + num_pages_tested += 1 + + # ---- ADDITIONAL DETAILS PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + additional_details_page = other_contacts_result.follow() + additional_details_form = additional_details_page.forms[0] + + # load inputs with test data + + additional_details_form["additional_details-has_cisa_representative"] = "True" + additional_details_form["additional_details-has_anything_else_text"] = "True" + additional_details_form["additional_details-cisa_representative_email"] = "FakeEmail@gmail.com" + additional_details_form["additional_details-anything_else"] = "Nothing else." + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + additional_details_result = additional_details_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.cisa_representative_email, "FakeEmail@gmail.com") + self.assertEqual(domain_request.anything_else, "Nothing else.") + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(additional_details_result.status_code, 302) + self.assertEqual(additional_details_result["Location"], "/request/requirements/") + num_pages_tested += 1 + + # ---- REQUIREMENTS PAGE ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + requirements_page = additional_details_result.follow() + requirements_form = requirements_page.forms[0] + + requirements_form["requirements-is_policy_acknowledged"] = True + + # test next button + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + requirements_result = requirements_form.submit() + # validate that data from this step are being saved + domain_request = DomainRequest.objects.get() # there's only one + self.assertEqual(domain_request.is_policy_acknowledged, True) + # the post request should return a redirect to the next form in + # the domain request page + self.assertEqual(requirements_result.status_code, 302) + self.assertEqual(requirements_result["Location"], "/request/review/") + num_pages_tested += 1 + + # ---- REVIEW AND FINSIHED PAGES ---- + # Follow the redirect to the next form page + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + review_page = requirements_result.follow() + review_form = review_page.forms[0] + print("$$$$$$$$$$$$$$$$$$$$$$", review_page) + + # Review page contains all the previously entered data + # Let's make sure the long org name is displayed + self.assertContains(review_page, "Incomplete") + # In theory we just need to check that tribal is incomplete + # I don't need to re-look at any of these underneath + # self.assertContains(review_page, "Executive") + # self.assertContains(review_page, "Testorg") + # self.assertContains(review_page, "address 1") + # self.assertContains(review_page, "address 2") + # self.assertContains(review_page, "NYC") + # self.assertContains(review_page, "NY") + # self.assertContains(review_page, "10002") + # self.assertContains(review_page, "URB Royal Oaks") + # self.assertContains(review_page, "Testy ATO") + # self.assertContains(review_page, "Tester ATO") + # self.assertContains(review_page, "Chief Tester") + # self.assertContains(review_page, "testy@town.com") + # self.assertContains(review_page, "city.com") + # self.assertContains(review_page, "city.gov") + # self.assertContains(review_page, "city1.gov") + # self.assertContains(review_page, "For all kinds of things.") + # self.assertContains(review_page, "Testy you") + # self.assertContains(review_page, "Tester you") + # self.assertContains(review_page, "Admin Tester") + # self.assertContains(review_page, "testy-admin@town.com") + # self.assertContains(review_page, "(201) 555-5556") + # self.assertContains(review_page, "Testy2") + # self.assertContains(review_page, "Tester2") + # self.assertContains(review_page, "Another Tester") + # self.assertContains(review_page, "testy2@town.com") + # self.assertContains(review_page, "(201) 555-5557") + # self.assertContains(review_page, "FakeEmail@gmail.com") + # self.assertContains(review_page, "Nothing else.") + + # We can't test the modal itself as it relies on JS for init and triggering, + # but we can test for the existence of its trigger: + # self.assertContains(review_page, "toggle-submit-domain-request") + # And the existence of the modal's data parked and ready for the js init. + # The next assert also tests for the passed requested domain context from + # the view > domain_request_form > modal + self.assertContains(review_page, "You can’t submit this request") + + # final submission results in a redirect to the "finished" URL + self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + with less_console_noise(): + review_result = review_form.submit() + print("!!!!!!!!!!!!!!!!!!! review_result", review_result) + + print("!!!!!!!!!!!!!!!!!!! review_result.status_code", review_result.status_code) + print("!!!!!!!!!!!!!!!!!!! review_results location", review_result["Location"]) + + self.assertEqual(review_result.status_code, 302) + self.assertEqual(review_result["Location"], "/request/finished/") + + # self.assertEqual(review_result["Location"], "/tribal_government/") + num_pages_tested += 1 + + # following this redirect is a GET request, so include the cookie + # here too. + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # with less_console_noise(): + # final_result = review_result.follow() + # self.assertContains(final_result, "Thanks for your domain request!") + + # check that any new pages are added to this test + self.assertEqual(num_pages, num_pages_tested) + # This is the start of a test to check an existing domain_request, it currently # does not work and results in errors as noted in: # https://github.com/cisagov/getgov/pull/728 diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 9623da62f..8659fcd70 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -477,75 +477,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): print("!!!! We are in the True if statement - form is complete") return True - # def _form_complete(self): - # if ( - # ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL - # and (self.domain_request.federal_type is None or self.domain_request.federal_agency is None) - # ) - # or ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.INTERSTATE - # and self.domain_request.about_your_organization is None - # ) # State -> ""Election office" page can't be empty - # or ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.STATE_OR_TERRITORY - # and self.domain_request.is_election_board is None - # ) # Tribal -> "Tribal name" and "Election office" page can't be empty - # or ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL - # and (self.domain_request.tribe_name is None or self.domain_request.is_election_board is None) - # ) # County -> "Election office" page can't be empty - # or ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.COUNTY - # and self.domain_request.is_election_board is None - # ) # City -> "Election office" page can't be empty - # or ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.CITY - # and self.domain_request.is_election_board is None - # ) # Special District -> "Election office" and "About your organization" page can't be empty - # or ( - # self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.SPECIAL_DISTRICT - # and ( - # self.domain_request.is_election_board is None or self.domain_request.about_your_organization is None - # ) - # ) # all other logics - # or (self.domain_request.generic_org_type is None) - # # or (self.domain_request.tribe_name is None) -- Dont need bc above - # # or (self.domain_request.federal_type is None) -- Dont need bc not every is federal type - # # or (self.domain_request.is_election_board is None) -- Dont need bc above - # or ( - # # self.domain_request.federal_agency is None or -- Dont need bc above - # self.domain_request.organization_name is None - # or self.domain_request.address_line1 is None - # or self.domain_request.city is None - # or self.domain_request.state_territory is None - # or self.domain_request.zipcode is None - # ) # for organization contact - # # or (self.domain_request.about_your_organization is None) - Dont need bc above - # or (self.domain_request.authorizing_official is None) - # # # or ( - # # # self.domain_request.current_websites.exists() or self.domain_request.requested_domain is None - # # # ) # for current_sites -- don't need current site bc not required - # or (self.domain_request.requested_domain is None) # for dotgov_domain - # or (self.domain_request.purpose is None) - # or (self.domain_request.submitter is None) # for your_contact - # or (self.domain_request.other_contacts is None) - # or (self.domain_request.has_cisa_representative is None) - # or (self.domain_request.has_anything_else_text is None) - # # you click yes on having a cisa rep but you dont type in email -- this is insanely rare if not impossible edge case - # or (self.domain_request.has_cisa_representative is True and self.domain_request.cisa_representative_email is None) - # or (self.domain_request.is_policy_acknowledged is None) # for review - # # logger.debug(function name found missing org type conditional) - # ): - # print("!!!! We are in the False if statement - form is not complete") - - # return False - # else: - # print("!!!! We are in the True if statement - form is complete") - # return True - - # # return None - def get_context_data(self): """Define context for access on all wizard pages.""" # Build the submit button that we'll pass to the modal. From 27906bc3100547b96d565ae63c0a6727cea6583a Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Wed, 22 May 2024 13:36:20 -0700 Subject: [PATCH 04/39] Update from views to models to testing in backend --- src/registrar/models/domain_request.py | 104 +++++ src/registrar/tests/test_models.py | 195 +++++++++ src/registrar/tests/test_views_request.py | 511 ++++++++++++---------- src/registrar/views/domain_request.py | 175 ++++---- 4 files changed, 660 insertions(+), 325 deletions(-) diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py index 2501cdc87..4a1d71964 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_request.py @@ -938,3 +938,107 @@ class DomainRequest(TimeStampedModel): for field in opts.many_to_many: data[field.name] = field.value_from_object(self) return data + + def _is_federal_complete(self): + # Federal -> "Federal government branch" page can't be empty + Federal Agency selection can't be None + return not (self.federal_type is None or self.federal_agency is None) + + def _is_interstate_complete(self): + # Interstate -> "About your organization" page can't be empty + return self.about_your_organization is not None + + def _is_state_or_territory_complete(self): + # State -> ""Election office" page can't be empty + return self.is_election_board is not None + + def _is_tribal_complete(self): + # Tribal -> "Tribal name" and "Election office" page can't be empty + return self.tribe_name is not None and self.is_election_board is not None + + def _is_county_complete(self): + # County -> "Election office" page can't be empty + return self.is_election_board is not None + + def _is_city_complete(self): + # City -> "Election office" page can't be empty + return self.is_election_board is not None + + def _is_special_district_complete(self): + # Special District -> "Election office" and "About your organization" page can't be empty + return ( + self.is_election_board is not None + and self.about_your_organization is not None + ) + + def _is_organization_name_and_address_complete(self): + return not ( + self.organization_name is None + or self.address_line1 is None + or self.city is None + or self.state_territory is None + or self.zipcode is None + ) + + def _is_authorizing_official_complete(self): + return self.authorizing_official is not None + + def _is_requested_domain_complete(self): + return self.requested_domain is not None + + def _is_purpose_complete(self): + return self.purpose is not None + + def _is_submitter_complete(self): + return self.submitter is not None + + def _is_other_contacts_complete(self): + return self.other_contacts is not None + + def _is_additional_details_complete(self): + return not ( + self.has_cisa_representative is None + or self.has_anything_else_text is None + # RARE EDGE CASE: You click yes on having a cisa rep, but you dont type in email (should block in form) + or ( + self.has_cisa_representative is True + and self.cisa_representative_email is None + ) + or self.is_policy_acknowledged is None + ) + + def _is_general_form_complete(self): + return ( + self._is_organization_name_and_address_complete() + and self._is_authorizing_official_complete() + and self._is_requested_domain_complete() + and self._is_purpose_complete() + and self._is_submitter_complete() + and self._is_other_contacts_complete() + and self._is_additional_details_complete() + ) + + def _form_complete(self): + if self.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL: + is_complete = self._is_federal_complete() + elif self.generic_org_type == DomainRequest.OrganizationChoices.INTERSTATE: + is_complete = self._is_interstate_complete() + elif self.generic_org_type == DomainRequest.OrganizationChoices.STATE_OR_TERRITORY: + is_complete = self._is_state_or_territory_complete() + elif self.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL: + is_complete = self._is_tribal_complete() + elif self.generic_org_type == DomainRequest.OrganizationChoices.COUNTY: + is_complete = self._is_county_complete() + elif self.generic_org_type == DomainRequest.OrganizationChoices.CITY: + is_complete = self._is_city_complete() + elif self.generic_org_type == DomainRequest.OrganizationChoices.SPECIAL_DISTRICT: + is_complete = self._is_special_district_complete() + else: + # NOTE: This shouldn't happen, this is only if somehow they didn't choose an org type + is_complete = False + + if not is_complete or not self._is_general_form_complete(): + print("!!!! We are in the False if statement - form is not complete") + return False + + print("!!!! We are in the True if statement - form is complete") + return True \ No newline at end of file diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index fa074c3c6..849f92176 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -1,6 +1,7 @@ from django.test import TestCase from django.db.utils import IntegrityError from unittest.mock import patch +from django.contrib.auth import get_user_model from registrar.models import ( Contact, @@ -1602,3 +1603,197 @@ class TestDomainInformationCustomSave(TestCase): ) self.assertEqual(domain_information_election.is_election_board, True) self.assertEqual(domain_information_election.generic_org_type, DomainRequest.OrganizationChoices.CITY) + +class TestDomainRequestIncomplete(TestCase): + def setUp(self): + super().setUp() + username = "test_user" + first_name = "First" + last_name = "Last" + email = "info@example.com" + self.user = get_user_model().objects.create( + username=username, first_name=first_name, last_name=last_name, email=email + ) + ao, _ = Contact.objects.get_or_create( + first_name="Meowy", + last_name="Meoward", + title="Chief Cat", + email="meoward@chiefcat.com", + phone="(206) 206 2060", + ) + draft_domain, _ = DraftDomain.objects.get_or_create(name="MeowardMeowardMeoward.gov") + you, _ = Contact.objects.get_or_create( + first_name="Testy you", + last_name="Tester you", + title="Admin Tester", + email="testy-admin@town.com", + phone="(555) 555 5556", + ) + other, _ = Contact.objects.get_or_create( + first_name="Testy2", + last_name="Tester2", + title="Another Tester", + email="testy2@town.com", + phone="(555) 555 5557", + ) + # domain, _ = Domain.objects.get_or_create(name="MeowardMeowardMeoward.gov") + alt, _ = Website.objects.get_or_create(website="MeowardMeowardMeoward1.gov") + current, _ = Website.objects.get_or_create(website="MeowardMeowardMeoward.com") + self.domain_request = DomainRequest.objects.create( + generic_org_type=DomainRequest.OrganizationChoices.FEDERAL, + federal_type="executive", + federal_agency=FederalAgency.objects.get(agency="AMTRAK"), + about_your_organization="Some description", + is_election_board=True, + tribe_name="Some tribe name", + organization_name="Some organization", + address_line1="address 1", + state_territory="CA", + zipcode="94044", + authorizing_official=ao, + requested_domain=draft_domain, + purpose="Some purpose", + submitter=you, + has_cisa_representative=False, + has_anything_else_text="Some text", + is_policy_acknowledged=True, + creator=self.user, + ) + + self.domain_request.other_contacts.add(other) + self.domain_request.current_websites.add(current) + self.domain_request.alternative_domains.add(alt) + + def test_is_federal_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.FEDERAL + self.assertTrue(self.domain_request._is_federal_complete()) + self.domain_request.federal_type = None + self.assertFalse(self.domain_request._is_federal_complete()) + + def test_is_interstate_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.INTERSTATE + self.assertTrue(self.domain_request._is_interstate_complete()) + self.domain_request.about_your_organization = None + self.assertFalse(self.domain_request._is_interstate_complete()) + + def test_is_state_or_territory_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.STATE_OR_TERRITORY + self.assertTrue(self.domain_request._is_state_or_territory_complete()) + self.domain_request.is_election_board = None + self.assertFalse(self.domain_request._is_state_or_territory_complete()) + + def test_is_tribal_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.TRIBAL + self.assertTrue(self.domain_request._is_tribal_complete()) + self.domain_request.tribe_name = None + self.assertFalse(self.domain_request._is_tribal_complete()) + + def test_is_county_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.COUNTY + self.assertTrue(self.domain_request._is_county_complete()) + self.domain_request.is_election_board = None + self.assertFalse(self.domain_request._is_county_complete()) + + def test_is_city_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.CITY + self.assertTrue(self.domain_request._is_city_complete()) + self.domain_request.is_election_board = None + self.assertFalse(self.domain_request._is_city_complete()) + + def test_is_special_district_complete(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.SPECIAL_DISTRICT + self.assertTrue(self.domain_request._is_special_district_complete()) + self.domain_request.about_your_organization = None + self.assertFalse(self.domain_request._is_special_district_complete()) + + def test_is_organization_name_and_address_complete(self): + self.assertTrue(self.domain_request._is_organization_name_and_address_complete()) + self.domain_request.organization_name = None + self.assertFalse(self.domain_request._is_organization_name_and_address_complete()) + + def test_is_authorizing_official_complete(self): + self.assertTrue(self.domain_request._is_authorizing_official_complete()) + self.domain_request.authorizing_official = None + self.assertFalse(self.domain_request._is_authorizing_official_complete()) + + def test_is_requested_domain_complete(self): + self.assertTrue(self.domain_request._is_requested_domain_complete()) + self.domain_request.requested_domain = None + self.assertFalse(self.domain_request._is_requested_domain_complete()) + + def test_is_purpose_complete(self): + self.assertTrue(self.domain_request._is_purpose_complete()) + self.domain_request.purpose = None + self.assertFalse(self.domain_request._is_purpose_complete()) + + def test_is_submitter_complete(self): + self.assertTrue(self.domain_request._is_submitter_complete()) + self.domain_request.submitter = None + self.assertFalse(self.domain_request._is_submitter_complete()) + + def test_is_other_contacts_complete(self): + self.assertTrue(self.domain_request._is_other_contacts_complete()) + none_other_contacts, _ = Contact.objects.get_or_create( + first_name=None, + last_name=None, + title=None, + email=None, + phone=None, + ) + self.domain_request.other_contacts.add(none_other_contacts) + self.assertFalse(self.domain_request._is_other_contacts_complete()) + + def test_is_additional_details_complete(self): + self.assertTrue(self.domain_request._is_additional_details_complete()) + self.domain_request.has_cisa_representative = None + self.assertFalse(self.domain_request._is_additional_details_complete()) + self.domain_request.has_cisa_representative = True + self.domain_request.cisa_representative_email = None + self.assertFalse(self.domain_request._is_additional_details_complete()) + + def test_is_general_form_complete(self): + self.assertTrue(self.domain_request._is_general_form_complete()) + self.domain_request.organization_name = None + self.assertFalse(self.domain_request._is_general_form_complete()) + + def test_form_complete_for_federal(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.FEDERAL + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.federal_type = None + self.assertFalse(self.domain_request._form_complete()) + + def test_form_complete_for_interstate(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.INTERSTATE + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.about_your_organization = None + self.assertFalse(self.domain_request._form_complete()) + + def test_form_complete_for_state_or_territory(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.STATE_OR_TERRITORY + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.is_election_board = None + self.assertFalse(self.domain_request._form_complete()) + + def test_form_complete_for_tribal(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.TRIBAL + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.tribe_name = None + self.assertFalse(self.domain_request._form_complete()) + + def test_form_complete_for_county(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.COUNTY + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.is_election_board = None + self.assertFalse(self.domain_request._form_complete()) + + def test_form_complete_for_city(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.CITY + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.is_election_board = None + self.assertFalse(self.domain_request._form_complete()) + + def test_form_complete_for_special_district(self): + self.domain_request.generic_org_type = DomainRequest.OrganizationChoices.SPECIAL_DISTRICT + self.assertTrue(self.domain_request._form_complete()) + self.domain_request.about_your_organization = None + self.assertFalse(self.domain_request._form_complete()) \ No newline at end of file diff --git a/src/registrar/tests/test_views_request.py b/src/registrar/tests/test_views_request.py index 515aff55b..83c9589bf 100644 --- a/src/registrar/tests/test_views_request.py +++ b/src/registrar/tests/test_views_request.py @@ -511,271 +511,306 @@ class DomainRequestTests(TestWithUser, WebTest): type_result = type_form.submit() # should see results in db domain_request = DomainRequest.objects.get() # there's only one + session = self.client.session + print("$$$$$$$$$$$$$$$$$$$ 514!!!!!!", session.values()) + self.assertEqual(domain_request.generic_org_type, "tribal") # the post request should return a redirect to the next form in # the domain request page self.assertEqual(type_result.status_code, 302) self.assertEqual(type_result["Location"], "/request/tribal_government/") - num_pages_tested += 1 + # num_pages_tested += 1 # -- TRIBAL PAGE -- - # We want to skip the tribal page right?? but how do we not fill it out............. type_form = type_page.forms[0] - type_form["generic_org_type-generic_org_type"] = DomainRequest.OrganizationChoices.TRIBAL self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - type_result = type_form.submit() - # the tribal government page comes immediately afterwards - self.assertIn("/tribal_government", type_result.headers["Location"]) - # follow first redirect + + # session_id = self.app.cookies[settings.SESSION_COOKIE_NAME]" + url = reverse("domain-request:review") self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - tribal_government_page = type_result.follow() + session = self.client.session + # print("$$$$$$$$$$$$$$$$$$$ BEFORE", session.request) + print("$$$$$$$$$$$$$$$$$$$ BEFORE", session.values()) - # and the step is on the sidebar list. - self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT]) - - - # ---- ORG CONTACT PAGE ---- - # Follow the redirect to the next form page + review_page = self.client.get(url, follow=True) + session = self.client.session + # print("$$$$$$$$$$$$$$$$$$$ AFTER", session.request) + print("$$$$$$$$$$$$$$$$$$$ AFTER", session.values()) self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - org_contact_page = type_result.follow() - org_contact_form = org_contact_page.forms[0] - # federal agency so we have to fill in federal_agency - # federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration") - # org_contact_form["organization_contact-federal_agency"] = federal_agency.id - org_contact_form["organization_contact-organization_name"] = "Testorg" - org_contact_form["organization_contact-address_line1"] = "address 1" - org_contact_form["organization_contact-address_line2"] = "address 2" - org_contact_form["organization_contact-city"] = "NYC" - org_contact_form["organization_contact-state_territory"] = "NY" - org_contact_form["organization_contact-zipcode"] = "10002" - org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks" + # Org type is filled in + self.assertContains(review_page, "Tribal") + self.assertContains(review_page, "Incomplete", count=9) - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - org_contact_result = org_contact_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.organization_name, "Testorg") - self.assertEqual(domain_request.address_line1, "address 1") - self.assertEqual(domain_request.address_line2, "address 2") - self.assertEqual(domain_request.city, "NYC") - self.assertEqual(domain_request.state_territory, "NY") - self.assertEqual(domain_request.zipcode, "10002") - self.assertEqual(domain_request.urbanization, "URB Royal Oaks") - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(org_contact_result.status_code, 302) - self.assertEqual(org_contact_result["Location"], "/request/authorizing_official/") - num_pages_tested += 1 + # In theory we just need to check that tribal is incomplete + # I don't need to re-look at any of these underneath + # self.assertContains(review_page, "Executive") + # self.assertContains(review_page, "You can’t submit this request") - # ---- AUTHORIZING OFFICIAL PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - ao_page = org_contact_result.follow() - ao_form = ao_page.forms[0] - ao_form["authorizing_official-first_name"] = "Testy ATO" - ao_form["authorizing_official-last_name"] = "Tester ATO" - ao_form["authorizing_official-title"] = "Chief Tester" - ao_form["authorizing_official-email"] = "testy@town.com" + # # final submission results in a redirect to the "finished" URL + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # with less_console_noise(): + # review_result = review_form.submit() + # print("!!!!!!!!!!!!!!!!!!! review_result", review_result) - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - ao_result = ao_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.authorizing_official.first_name, "Testy ATO") - self.assertEqual(domain_request.authorizing_official.last_name, "Tester ATO") - self.assertEqual(domain_request.authorizing_official.title, "Chief Tester") - self.assertEqual(domain_request.authorizing_official.email, "testy@town.com") - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(ao_result.status_code, 302) - self.assertEqual(ao_result["Location"], "/request/current_sites/") - num_pages_tested += 1 + # print("!!!!!!!!!!!!!!!!!!! review_result.status_code", review_result.status_code) + # print("!!!!!!!!!!!!!!!!!!! review_results location", review_result["Location"]) - # ---- CURRENT SITES PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - current_sites_page = ao_result.follow() - current_sites_form = current_sites_page.forms[0] - current_sites_form["current_sites-0-website"] = "www.city.com" + # self.assertEqual(review_result.status_code, 302) + # self.assertEqual(review_result["Location"], "/request/finished/") - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - current_sites_result = current_sites_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual( - domain_request.current_websites.filter(website="http://www.city.com").count(), - 1, - ) - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(current_sites_result.status_code, 302) - self.assertEqual(current_sites_result["Location"], "/request/dotgov_domain/") - num_pages_tested += 1 + # type_result = type_form.submit() + # # the tribal government page comes immediately afterwards + # self.assertIn("/tribal_government", type_result.headers["Location"]) + # # follow first redirect + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # tribal_government_page = type_result.follow() - # ---- DOTGOV DOMAIN PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - dotgov_page = current_sites_result.follow() - dotgov_form = dotgov_page.forms[0] - dotgov_form["dotgov_domain-requested_domain"] = "city" - dotgov_form["dotgov_domain-0-alternative_domain"] = "city1" + # # and the step is on the sidebar list. + # self.assertContains(tribal_government_page, self.TITLES[Step.TRIBAL_GOVERNMENT]) - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - dotgov_result = dotgov_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.requested_domain.name, "city.gov") - self.assertEqual(domain_request.alternative_domains.filter(website="city1.gov").count(), 1) - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(dotgov_result.status_code, 302) - self.assertEqual(dotgov_result["Location"], "/request/purpose/") - num_pages_tested += 1 - # ---- PURPOSE PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - purpose_page = dotgov_result.follow() - purpose_form = purpose_page.forms[0] - purpose_form["purpose-purpose"] = "For all kinds of things." + # # ---- ORG CONTACT PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # org_contact_page = type_result.follow() + # org_contact_form = org_contact_page.forms[0] + # # federal agency so we have to fill in federal_agency + # # federal_agency, _ = FederalAgency.objects.get_or_create(agency="General Services Administration") + # # org_contact_form["organization_contact-federal_agency"] = federal_agency.id + # org_contact_form["organization_contact-organization_name"] = "Testorg" + # org_contact_form["organization_contact-address_line1"] = "address 1" + # org_contact_form["organization_contact-address_line2"] = "address 2" + # org_contact_form["organization_contact-city"] = "NYC" + # org_contact_form["organization_contact-state_territory"] = "NY" + # org_contact_form["organization_contact-zipcode"] = "10002" + # org_contact_form["organization_contact-urbanization"] = "URB Royal Oaks" - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - purpose_result = purpose_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.purpose, "For all kinds of things.") - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(purpose_result.status_code, 302) - self.assertEqual(purpose_result["Location"], "/request/your_contact/") - num_pages_tested += 1 + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # org_contact_result = org_contact_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.organization_name, "Testorg") + # self.assertEqual(domain_request.address_line1, "address 1") + # self.assertEqual(domain_request.address_line2, "address 2") + # self.assertEqual(domain_request.city, "NYC") + # self.assertEqual(domain_request.state_territory, "NY") + # self.assertEqual(domain_request.zipcode, "10002") + # self.assertEqual(domain_request.urbanization, "URB Royal Oaks") + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(org_contact_result.status_code, 302) + # self.assertEqual(org_contact_result["Location"], "/request/authorizing_official/") + # num_pages_tested += 1 - # ---- YOUR CONTACT INFO PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - your_contact_page = purpose_result.follow() - your_contact_form = your_contact_page.forms[0] + # # ---- AUTHORIZING OFFICIAL PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # ao_page = org_contact_result.follow() + # ao_form = ao_page.forms[0] + # ao_form["authorizing_official-first_name"] = "Testy ATO" + # ao_form["authorizing_official-last_name"] = "Tester ATO" + # ao_form["authorizing_official-title"] = "Chief Tester" + # ao_form["authorizing_official-email"] = "testy@town.com" - your_contact_form["your_contact-first_name"] = "Testy you" - your_contact_form["your_contact-last_name"] = "Tester you" - your_contact_form["your_contact-title"] = "Admin Tester" - your_contact_form["your_contact-email"] = "testy-admin@town.com" - your_contact_form["your_contact-phone"] = "(201) 555 5556" + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # ao_result = ao_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.authorizing_official.first_name, "Testy ATO") + # self.assertEqual(domain_request.authorizing_official.last_name, "Tester ATO") + # self.assertEqual(domain_request.authorizing_official.title, "Chief Tester") + # self.assertEqual(domain_request.authorizing_official.email, "testy@town.com") + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(ao_result.status_code, 302) + # self.assertEqual(ao_result["Location"], "/request/current_sites/") + # num_pages_tested += 1 - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - your_contact_result = your_contact_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.submitter.first_name, "Testy you") - self.assertEqual(domain_request.submitter.last_name, "Tester you") - self.assertEqual(domain_request.submitter.title, "Admin Tester") - self.assertEqual(domain_request.submitter.email, "testy-admin@town.com") - self.assertEqual(domain_request.submitter.phone, "(201) 555 5556") - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(your_contact_result.status_code, 302) - self.assertEqual(your_contact_result["Location"], "/request/other_contacts/") - num_pages_tested += 1 + # # ---- CURRENT SITES PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # current_sites_page = ao_result.follow() + # current_sites_form = current_sites_page.forms[0] + # current_sites_form["current_sites-0-website"] = "www.city.com" - # ---- OTHER CONTACTS PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_page = your_contact_result.follow() + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # current_sites_result = current_sites_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual( + # domain_request.current_websites.filter(website="http://www.city.com").count(), + # 1, + # ) + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(current_sites_result.status_code, 302) + # self.assertEqual(current_sites_result["Location"], "/request/dotgov_domain/") + # num_pages_tested += 1 - # This page has 3 forms in 1. - # Let's set the yes/no radios to enable the other contacts fieldsets - other_contacts_form = other_contacts_page.forms[0] + # # ---- DOTGOV DOMAIN PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # dotgov_page = current_sites_result.follow() + # dotgov_form = dotgov_page.forms[0] + # dotgov_form["dotgov_domain-requested_domain"] = "city" + # dotgov_form["dotgov_domain-0-alternative_domain"] = "city1" - other_contacts_form["other_contacts-has_other_contacts"] = "True" + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # dotgov_result = dotgov_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.requested_domain.name, "city.gov") + # self.assertEqual(domain_request.alternative_domains.filter(website="city1.gov").count(), 1) + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(dotgov_result.status_code, 302) + # self.assertEqual(dotgov_result["Location"], "/request/purpose/") + # num_pages_tested += 1 - other_contacts_form["other_contacts-0-first_name"] = "Testy2" - other_contacts_form["other_contacts-0-last_name"] = "Tester2" - other_contacts_form["other_contacts-0-title"] = "Another Tester" - other_contacts_form["other_contacts-0-email"] = "testy2@town.com" - other_contacts_form["other_contacts-0-phone"] = "(201) 555 5557" + # # ---- PURPOSE PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # purpose_page = dotgov_result.follow() + # purpose_form = purpose_page.forms[0] + # purpose_form["purpose-purpose"] = "For all kinds of things." - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - other_contacts_result = other_contacts_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual( - domain_request.other_contacts.filter( - first_name="Testy2", - last_name="Tester2", - title="Another Tester", - email="testy2@town.com", - phone="(201) 555 5557", - ).count(), - 1, - ) - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(other_contacts_result.status_code, 302) - self.assertEqual(other_contacts_result["Location"], "/request/additional_details/") - num_pages_tested += 1 + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # purpose_result = purpose_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.purpose, "For all kinds of things.") + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(purpose_result.status_code, 302) + # self.assertEqual(purpose_result["Location"], "/request/your_contact/") + # num_pages_tested += 1 - # ---- ADDITIONAL DETAILS PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - additional_details_page = other_contacts_result.follow() - additional_details_form = additional_details_page.forms[0] + # # ---- YOUR CONTACT INFO PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # your_contact_page = purpose_result.follow() + # your_contact_form = your_contact_page.forms[0] - # load inputs with test data + # your_contact_form["your_contact-first_name"] = "Testy you" + # your_contact_form["your_contact-last_name"] = "Tester you" + # your_contact_form["your_contact-title"] = "Admin Tester" + # your_contact_form["your_contact-email"] = "testy-admin@town.com" + # your_contact_form["your_contact-phone"] = "(201) 555 5556" - additional_details_form["additional_details-has_cisa_representative"] = "True" - additional_details_form["additional_details-has_anything_else_text"] = "True" - additional_details_form["additional_details-cisa_representative_email"] = "FakeEmail@gmail.com" - additional_details_form["additional_details-anything_else"] = "Nothing else." + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # your_contact_result = your_contact_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.submitter.first_name, "Testy you") + # self.assertEqual(domain_request.submitter.last_name, "Tester you") + # self.assertEqual(domain_request.submitter.title, "Admin Tester") + # self.assertEqual(domain_request.submitter.email, "testy-admin@town.com") + # self.assertEqual(domain_request.submitter.phone, "(201) 555 5556") + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(your_contact_result.status_code, 302) + # self.assertEqual(your_contact_result["Location"], "/request/other_contacts/") + # num_pages_tested += 1 - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - additional_details_result = additional_details_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.cisa_representative_email, "FakeEmail@gmail.com") - self.assertEqual(domain_request.anything_else, "Nothing else.") - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(additional_details_result.status_code, 302) - self.assertEqual(additional_details_result["Location"], "/request/requirements/") - num_pages_tested += 1 + # # ---- OTHER CONTACTS PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # other_contacts_page = your_contact_result.follow() - # ---- REQUIREMENTS PAGE ---- - # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - requirements_page = additional_details_result.follow() - requirements_form = requirements_page.forms[0] + # # This page has 3 forms in 1. + # # Let's set the yes/no radios to enable the other contacts fieldsets + # other_contacts_form = other_contacts_page.forms[0] - requirements_form["requirements-is_policy_acknowledged"] = True + # other_contacts_form["other_contacts-has_other_contacts"] = "True" - # test next button - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - requirements_result = requirements_form.submit() - # validate that data from this step are being saved - domain_request = DomainRequest.objects.get() # there's only one - self.assertEqual(domain_request.is_policy_acknowledged, True) - # the post request should return a redirect to the next form in - # the domain request page - self.assertEqual(requirements_result.status_code, 302) - self.assertEqual(requirements_result["Location"], "/request/review/") - num_pages_tested += 1 + # other_contacts_form["other_contacts-0-first_name"] = "Testy2" + # other_contacts_form["other_contacts-0-last_name"] = "Tester2" + # other_contacts_form["other_contacts-0-title"] = "Another Tester" + # other_contacts_form["other_contacts-0-email"] = "testy2@town.com" + # other_contacts_form["other_contacts-0-phone"] = "(201) 555 5557" + + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # other_contacts_result = other_contacts_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual( + # domain_request.other_contacts.filter( + # first_name="Testy2", + # last_name="Tester2", + # title="Another Tester", + # email="testy2@town.com", + # phone="(201) 555 5557", + # ).count(), + # 1, + # ) + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(other_contacts_result.status_code, 302) + # self.assertEqual(other_contacts_result["Location"], "/request/additional_details/") + # num_pages_tested += 1 + + # # ---- ADDITIONAL DETAILS PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # additional_details_page = other_contacts_result.follow() + # additional_details_form = additional_details_page.forms[0] + + # # load inputs with test data + + # additional_details_form["additional_details-has_cisa_representative"] = "True" + # additional_details_form["additional_details-has_anything_else_text"] = "True" + # additional_details_form["additional_details-cisa_representative_email"] = "FakeEmail@gmail.com" + # additional_details_form["additional_details-anything_else"] = "Nothing else." + + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # additional_details_result = additional_details_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.cisa_representative_email, "FakeEmail@gmail.com") + # self.assertEqual(domain_request.anything_else, "Nothing else.") + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(additional_details_result.status_code, 302) + # self.assertEqual(additional_details_result["Location"], "/request/requirements/") + # num_pages_tested += 1 + + # # ---- REQUIREMENTS PAGE ---- + # # Follow the redirect to the next form page + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # requirements_page = additional_details_result.follow() + # requirements_form = requirements_page.forms[0] + + # requirements_form["requirements-is_policy_acknowledged"] = True + + # # test next button + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # requirements_result = requirements_form.submit() + # # validate that data from this step are being saved + # domain_request = DomainRequest.objects.get() # there's only one + # self.assertEqual(domain_request.is_policy_acknowledged, True) + # # the post request should return a redirect to the next form in + # # the domain request page + # self.assertEqual(requirements_result.status_code, 302) + # self.assertEqual(requirements_result["Location"], "/request/review/") + # num_pages_tested += 1 # ---- REVIEW AND FINSIHED PAGES ---- # Follow the redirect to the next form page - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - review_page = requirements_result.follow() - review_form = review_page.forms[0] - print("$$$$$$$$$$$$$$$$$$$$$$", review_page) + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # review_page = requirements_result.follow() + # review_form = review_page.forms[0] + # print("$$$$$$$$$$$$$$$$$$$$$$", review_page) - # Review page contains all the previously entered data - # Let's make sure the long org name is displayed - self.assertContains(review_page, "Incomplete") + # # Review page contains all the previously entered data + # # Let's make sure the long org name is displayed + # self.assertContains(review_page, "Incomplete") # In theory we just need to check that tribal is incomplete # I don't need to re-look at any of these underneath # self.assertContains(review_page, "Executive") @@ -813,22 +848,22 @@ class DomainRequestTests(TestWithUser, WebTest): # And the existence of the modal's data parked and ready for the js init. # The next assert also tests for the passed requested domain context from # the view > domain_request_form > modal - self.assertContains(review_page, "You can’t submit this request") + # self.assertContains(review_page, "You can’t submit this request") - # final submission results in a redirect to the "finished" URL - self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) - with less_console_noise(): - review_result = review_form.submit() - print("!!!!!!!!!!!!!!!!!!! review_result", review_result) + # # final submission results in a redirect to the "finished" URL + # self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id) + # with less_console_noise(): + # review_result = review_form.submit() + # print("!!!!!!!!!!!!!!!!!!! review_result", review_result) - print("!!!!!!!!!!!!!!!!!!! review_result.status_code", review_result.status_code) - print("!!!!!!!!!!!!!!!!!!! review_results location", review_result["Location"]) + # print("!!!!!!!!!!!!!!!!!!! review_result.status_code", review_result.status_code) + # print("!!!!!!!!!!!!!!!!!!! review_results location", review_result["Location"]) - self.assertEqual(review_result.status_code, 302) - self.assertEqual(review_result["Location"], "/request/finished/") + # self.assertEqual(review_result.status_code, 302) + # self.assertEqual(review_result["Location"], "/request/finished/") - # self.assertEqual(review_result["Location"], "/tribal_government/") - num_pages_tested += 1 + # # self.assertEqual(review_result["Location"], "/tribal_government/") + # num_pages_tested += 1 # following this redirect is a GET request, so include the cookie # here too. @@ -838,7 +873,7 @@ class DomainRequestTests(TestWithUser, WebTest): # self.assertContains(final_result, "Thanks for your domain request!") # check that any new pages are added to this test - self.assertEqual(num_pages, num_pages_tested) + # self.assertEqual(num_pages, num_pages_tested) # This is the start of a test to check an existing domain_request, it currently # does not work and results in errors as noted in: diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 8659fcd70..7e864987d 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -374,108 +374,109 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): } return [key for key, value in history_dict.items() if value] - def _is_federal_complete(self): - # Federal -> "Federal government branch" page can't be empty + Federal Agency selection can't be None - return not (self.domain_request.federal_type is None or self.domain_request.federal_agency is None) + # def _is_federal_complete(self): + # # Federal -> "Federal government branch" page can't be empty + Federal Agency selection can't be None + # return not (self.domain_request.federal_type is None or self.domain_request.federal_agency is None) - def _is_interstate_complete(self): - # Interstate -> "About your organization" page can't be empty - return self.domain_request.about_your_organization is not None + # def _is_interstate_complete(self): + # # Interstate -> "About your organization" page can't be empty + # return self.domain_request.about_your_organization is not None - def _is_state_or_territory_complete(self): - # State -> ""Election office" page can't be empty - return self.domain_request.is_election_board is not None + # def _is_state_or_territory_complete(self): + # # State -> ""Election office" page can't be empty + # return self.domain_request.is_election_board is not None - def _is_tribal_complete(self): - # Tribal -> "Tribal name" and "Election office" page can't be empty - return self.domain_request.tribe_name is not None and self.domain_request.is_election_board is not None + # def _is_tribal_complete(self): + # # Tribal -> "Tribal name" and "Election office" page can't be empty + # return self.domain_request.tribe_name is not None and self.domain_request.is_election_board is not None - def _is_county_complete(self): - # County -> "Election office" page can't be empty - return self.domain_request.is_election_board is not None + # def _is_county_complete(self): + # # County -> "Election office" page can't be empty + # return self.domain_request.is_election_board is not None - def _is_city_complete(self): - # City -> "Election office" page can't be empty - return self.domain_request.is_election_board is not None + # def _is_city_complete(self): + # # City -> "Election office" page can't be empty + # return self.domain_request.is_election_board is not None - def _is_special_district_complete(self): - # Special District -> "Election office" and "About your organization" page can't be empty - return ( - self.domain_request.is_election_board is not None - and self.domain_request.about_your_organization is not None - ) + # def _is_special_district_complete(self): + # # Special District -> "Election office" and "About your organization" page can't be empty + # return ( + # self.domain_request.is_election_board is not None + # and self.domain_request.about_your_organization is not None + # ) - def _is_organization_name_and_address_complete(self): - return not ( - self.domain_request.organization_name is None - or self.domain_request.address_line1 is None - or self.domain_request.city is None - or self.domain_request.state_territory is None - or self.domain_request.zipcode is None - ) + # def _is_organization_name_and_address_complete(self): + # return not ( + # self.domain_request.organization_name is None + # or self.domain_request.address_line1 is None + # or self.domain_request.city is None + # or self.domain_request.state_territory is None + # or self.domain_request.zipcode is None + # ) - def _is_authorizing_official_complete(self): - return self.domain_request.authorizing_official is not None + # def _is_authorizing_official_complete(self): + # return self.domain_request.authorizing_official is not None - def _is_requested_domain_complete(self): - return self.domain_request.requested_domain is not None + # def _is_requested_domain_complete(self): + # return self.domain_request.requested_domain is not None - def _is_purpose_complete(self): - return self.domain_request.purpose is not None + # def _is_purpose_complete(self): + # return self.domain_request.purpose is not None - def _is_submitter_complete(self): - return self.domain_request.submitter is not None + # def _is_submitter_complete(self): + # return self.domain_request.submitter is not None - def _is_other_contacts_complete(self): - return self.domain_request.other_contacts is not None + # def _is_other_contacts_complete(self): + # return self.domain_request.other_contacts is not None - def _is_additional_details_complete(self): - return not ( - self.domain_request.has_cisa_representative is None - or self.domain_request.has_anything_else_text is None - # RARE EDGE CASE: You click yes on having a cisa rep, but you dont type in email (should block in form) - or ( - self.domain_request.has_cisa_representative is True - and self.domain_request.cisa_representative_email is None - ) - or self.domain_request.is_policy_acknowledged is None - ) + # def _is_additional_details_complete(self): + # return not ( + # self.domain_request.has_cisa_representative is None + # or self.domain_request.has_anything_else_text is None + # # RARE EDGE CASE: You click yes on having a cisa rep, but you dont type in email (should block in form) + # or ( + # self.domain_request.has_cisa_representative is True + # and self.domain_request.cisa_representative_email is None + # ) + # or self.domain_request.is_policy_acknowledged is None + # ) - def _is_general_form_complete(self): - return ( - self._is_organization_name_and_address_complete() - and self._is_authorizing_official_complete() - and self._is_requested_domain_complete() - and self._is_purpose_complete() - and self._is_submitter_complete() - and self._is_other_contacts_complete() - and self._is_additional_details_complete() - ) + # def _is_general_form_complete(self): + # return ( + # self._is_organization_name_and_address_complete() + # and self._is_authorizing_official_complete() + # and self._is_requested_domain_complete() + # and self._is_purpose_complete() + # and self._is_submitter_complete() + # and self._is_other_contacts_complete() + # and self._is_additional_details_complete() + # ) - def _form_complete(self): - if self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL: - is_complete = self._is_federal_complete() - elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.INTERSTATE: - is_complete = self._is_interstate_complete() - elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.STATE_OR_TERRITORY: - is_complete = self._is_state_or_territory_complete() - elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL: - is_complete = self._is_tribal_complete() - elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.COUNTY: - is_complete = self._is_county_complete() - elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.CITY: - is_complete = self._is_city_complete() - elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.SPECIAL_DISTRICT: - is_complete = self._is_special_district_complete() - else: - is_complete = False + # def _form_complete(self): + # if self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.FEDERAL: + # is_complete = self._is_federal_complete() + # elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.INTERSTATE: + # is_complete = self._is_interstate_complete() + # elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.STATE_OR_TERRITORY: + # is_complete = self._is_state_or_territory_complete() + # elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.TRIBAL: + # is_complete = self._is_tribal_complete() + # elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.COUNTY: + # is_complete = self._is_county_complete() + # elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.CITY: + # is_complete = self._is_city_complete() + # elif self.domain_request.generic_org_type == DomainRequest.OrganizationChoices.SPECIAL_DISTRICT: + # is_complete = self._is_special_district_complete() + # else: + # # NOTE: This shouldn't happen, this is only if somehow they didn't choose an org type + # is_complete = False - if not is_complete or not self._is_general_form_complete(): - print("!!!! We are in the False if statement - form is not complete") - return False + # if not is_complete or not self._is_general_form_complete(): + # print("!!!! We are in the False if statement - form is not complete") + # return False - print("!!!! We are in the True if statement - form is complete") - return True + # print("!!!! We are in the True if statement - form is complete") + # return True def get_context_data(self): """Define context for access on all wizard pages.""" @@ -483,7 +484,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): # Concatenate the modal header that we'll pass to the modal. context_stuff = {} - if self._form_complete(): + if DomainRequest._form_complete(self.domain_request): print("!!!!!!!in form complete section") modal_button = '" context_stuff = { @@ -773,7 +774,7 @@ class Review(DomainRequestWizard): forms = [] # type: ignore def get_context_data(self): - if self._form_complete() is False: + if DomainRequest._form_complete(self.domain_request) is False: logger.warning("User arrived at review page with an incomplete form.") context = super().get_context_data() context["Step"] = Step.__members__ From 95c2a46a2c8d1d22df2003568e88172eaf2b548d Mon Sep 17 00:00:00 2001 From: Rachid Mrad Date: Thu, 23 May 2024 15:27:51 -0400 Subject: [PATCH 05/39] color class revision, solidify modal cancel button hide logic --- src/registrar/assets/sass/_theme/_forms.scss | 5 ---- .../templates/domain_request_form.html | 2 +- .../templates/domain_request_review.html | 24 +++++++++---------- src/registrar/templates/includes/modal.html | 2 +- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/registrar/assets/sass/_theme/_forms.scss b/src/registrar/assets/sass/_theme/_forms.scss index 490bf7986..9aeb54372 100644 --- a/src/registrar/assets/sass/_theme/_forms.scss +++ b/src/registrar/assets/sass/_theme/_forms.scss @@ -32,11 +32,6 @@ border-left: none; } -.incomplete { - color: #950E24; - font-weight: bold; -} - legend.float-left-tablet + button.float-right-tablet { margin-top: .5rem; @include at-media('tablet') { diff --git a/src/registrar/templates/domain_request_form.html b/src/registrar/templates/domain_request_form.html index b176866cc..11150df96 100644 --- a/src/registrar/templates/domain_request_form.html +++ b/src/registrar/templates/domain_request_form.html @@ -105,7 +105,7 @@ aria-describedby="Are you sure you want to submit a domain request?" data-force-action > - {% include 'includes/modal.html' with review_form_is_complete=review_form_is_complete modal_heading=modal_heading|safe modal_description=modal_description|safe modal_button=modal_button|safe %} + {% include 'includes/modal.html' with resets_domain_request=True review_form_is_complete=review_form_is_complete modal_heading=modal_heading|safe modal_description=modal_description|safe modal_button=modal_button|safe %} {% block after_form_content %}{% endblock %} diff --git a/src/registrar/templates/domain_request_review.html b/src/registrar/templates/domain_request_review.html index 2960e40c7..1f21683a5 100644 --- a/src/registrar/templates/domain_request_review.html +++ b/src/registrar/templates/domain_request_review.html @@ -25,11 +25,11 @@ {% if step == Step.ORGANIZATION_TYPE %} {% namespaced_url 'domain-request' step as domain_request_url %} {% if domain_request.generic_org_type is not None %} - {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.get_generic_org_type_display|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete"|safe %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -37,7 +37,7 @@ {% if step == Step.TRIBAL_GOVERNMENT %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.tribe_name|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% if domain_request.federally_recognized_tribe %}

Federally-recognized tribe

{% endif %} @@ -47,7 +47,7 @@ {% if step == Step.ORGANIZATION_FEDERAL %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.get_federal_type_display|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -66,7 +66,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url address='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete"|safe %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -74,7 +74,7 @@ {% if step == Step.ABOUT_YOUR_ORGANIZATION %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.about_your_organization|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -86,7 +86,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete"|safe %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -107,7 +107,7 @@ {% if step == Step.DOTGOV_DOMAIN %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe%} + {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe%} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} @@ -123,7 +123,7 @@ {% if step == Step.PURPOSE %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.purpose|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -135,7 +135,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value="Incomplete"|safe %} + {% with title=form_titles|get_item:step value="Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -148,7 +148,7 @@ {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url contact='true' list='true' %} {% endwith %} {% else %} - {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.no_other_contacts_rationale|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title value=value heading_level=heading_level editable=True edit_link=domain_request_url %} {% endwith %} {% endif %} @@ -157,7 +157,7 @@ {% if step == Step.ADDITIONAL_DETAILS %} {% namespaced_url 'domain-request' step as domain_request_url %} - {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe %} + {% with title=form_titles|get_item:step value=domain_request.requested_domain.name|default:"Incomplete"|safe %} {% include "includes/summary_item.html" with title=title sub_header_text='CISA regional representative' value=domain_request.cisa_representative_email heading_level=heading_level editable=True edit_link=domain_request_url custom_text_for_value_none='No' %} {% endwith %} diff --git a/src/registrar/templates/includes/modal.html b/src/registrar/templates/includes/modal.html index 24b581516..3c82aac5b 100644 --- a/src/registrar/templates/includes/modal.html +++ b/src/registrar/templates/includes/modal.html @@ -39,7 +39,7 @@ Cancel - {% elif review_form_is_complete %} + {% elif not resets_domain_request or review_form_is_complete %} - {% elif not resets_domain_request or review_form_is_complete %} + {% elif not is_domain_request_form or review_form_is_complete %} " context_stuff = { "form_titles": self.TITLES, "steps": self.steps, - # Add information about which steps should be unlocked "visited": self.storage.get("step_history", []), "is_federal": self.domain_request.is_federal(), "modal_button": modal_button, @@ -397,7 +395,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "review_form_is_complete": True, } else: # form is not complete - print("!!!!!!! form is not complete") modal_button = '" context_stuff = { "form_titles": self.TITLES, From 54c5052b2bf001fbc5cadd2f8c99cd5cedfa888d Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 12:46:41 -0700 Subject: [PATCH 14/39] Fix merge conflict --- src/registrar/views/domain_request.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index d13c88599..6659b3fab 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -22,6 +22,8 @@ from .utility import ( DomainRequestWizardPermissionView, ) +from waffle.decorators import flag_is_active + logger = logging.getLogger(__name__) @@ -376,8 +378,6 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): def get_context_data(self): """Define context for access on all wizard pages.""" - # Build the submit button that we'll pass to the modal. - # Concatenate the modal header that we'll pass to the modal. context_stuff = {} if DomainRequest._form_complete(self.domain_request): @@ -393,6 +393,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "modal_description": "Once you submit this request, you won’t be able to edit it until we review it.\ You’ll only be able to withdraw your request.", "review_form_is_complete": True, + "has_profile_feature_flag": flag_is_active(self.request, "profile_feature"), } else: # form is not complete modal_button = '" @@ -406,6 +407,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "modal_description": "You can’t submit this request because it’s incomplete.\ Click return to request and complete the sections that are missing information.", "review_form_is_complete": False, + "has_profile_feature_flag": flag_is_active(self.request, "profile_feature"), } return context_stuff From 6668a292a3558a25ddc8cc173a788cc2bf2f8633 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 12:50:38 -0700 Subject: [PATCH 15/39] Remove duplicate waffle header --- src/registrar/views/domain_request.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 5e1dc1844..a098f778a 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -24,8 +24,6 @@ from .utility import ( from waffle.decorators import flag_is_active -from waffle.decorators import flag_is_active - logger = logging.getLogger(__name__) From b6e931e5a9cd780ed868b49377f3ccc76a70a5db Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 13:02:34 -0700 Subject: [PATCH 16/39] Remove comment --- src/registrar/models/domain_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/models/domain_request.py b/src/registrar/models/domain_request.py index 869a6bcca..57a1c53d7 100644 --- a/src/registrar/models/domain_request.py +++ b/src/registrar/models/domain_request.py @@ -1032,7 +1032,7 @@ class DomainRequest(TimeStampedModel): and self._is_requested_domain_complete() and self._is_purpose_complete() and self._is_submitter_complete() - and self._is_other_contacts_complete() # -- ISSUE HERE + and self._is_other_contacts_complete() and self._is_additional_details_complete() and self._is_policy_acknowledgement_complete() ) From 1c6a565ec3508b4a262dddef9478b9d2f13656bd Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 13:08:33 -0700 Subject: [PATCH 17/39] Fix test in views with new wording --- src/registrar/tests/test_views_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/tests/test_views_request.py b/src/registrar/tests/test_views_request.py index 8816840da..f40c72114 100644 --- a/src/registrar/tests/test_views_request.py +++ b/src/registrar/tests/test_views_request.py @@ -2705,7 +2705,7 @@ class DomainRequestTests(TestWithUser, WebTest): review_page = self.app.get(reverse("domain-request:review")) self.assertContains(review_page, "toggle-submit-domain-request") - self.assertContains(review_page, "You are about to submit an incomplete request") + self.assertContains(review_page, "You can’t submit this request because it’s incomplete.") class DomainRequestTestDifferentStatuses(TestWithUser, WebTest): From 05868966c56681db29484416a1f546602b9e62b9 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 13:14:29 -0700 Subject: [PATCH 18/39] pally fix maybe --- src/registrar/templates/includes/modal.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/templates/includes/modal.html b/src/registrar/templates/includes/modal.html index cb99fa321..c745fc946 100644 --- a/src/registrar/templates/includes/modal.html +++ b/src/registrar/templates/includes/modal.html @@ -41,7 +41,7 @@ {% elif not is_domain_request_form or review_form_is_complete %} - {% elif not is_domain_request_form or review_form_is_complete %} + {% elif is_domain_request_form or review_form_is_complete %} + + {% else %} {% endif %} From a7e0ddc44358410af6571e971ba17db3498ac7f8 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 16:08:09 -0700 Subject: [PATCH 20/39] This should fix pa11y --- src/registrar/views/domain_request.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index a098f778a..7fa8d3384 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -396,7 +396,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "has_profile_feature_flag": flag_is_active(self.request, "profile_feature"), } else: # form is not complete - modal_button = '" + modal_button = '" context_stuff = { "form_titles": self.TITLES, "steps": self.steps, From a1bf9085a7bb81694158b2f090244b397f5dde10 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 16:17:30 -0700 Subject: [PATCH 21/39] Change modal logic back --- src/registrar/templates/includes/modal.html | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/registrar/templates/includes/modal.html b/src/registrar/templates/includes/modal.html index 04363c2c2..cb99fa321 100644 --- a/src/registrar/templates/includes/modal.html +++ b/src/registrar/templates/includes/modal.html @@ -39,15 +39,13 @@ Cancel - {% elif is_domain_request_form or review_form_is_complete %} - - {% else %} + {% elif not is_domain_request_form or review_form_is_complete %} {% endif %} From 3f276f1bdf6e643390e85c00f7f6fe95367b83b3 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Tue, 28 May 2024 16:32:04 -0700 Subject: [PATCH 22/39] Remove extraneous comment --- src/registrar/tests/test_models.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/registrar/tests/test_models.py b/src/registrar/tests/test_models.py index ee784af87..7b4b9fccd 100644 --- a/src/registrar/tests/test_models.py +++ b/src/registrar/tests/test_models.py @@ -1637,7 +1637,6 @@ class TestDomainRequestIncomplete(TestCase): email="testy2@town.com", phone="(555) 555 5557", ) - # domain, _ = Domain.objects.get_or_create(name="MeowardMeowardMeoward.gov") alt, _ = Website.objects.get_or_create(website="MeowardMeowardMeoward1.gov") current, _ = Website.objects.get_or_create(website="MeowardMeowardMeoward.com") self.domain_request = DomainRequest.objects.create( From 6b9cb3a2289121e39bcd46747625d1617dc36990 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Wed, 29 May 2024 15:49:35 -0700 Subject: [PATCH 23/39] See if fix for pa11y works --- src/registrar/views/domain_request.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 7f8f7dec0..a86fa500d 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -401,13 +401,10 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): "user": self.request.user, } else: # form is not complete - # modal_button = '" - # modal_button = '' - # modal_button = ( - # '' - # ) - modal_button = '" + modal_button = ( + '' + ) context_stuff = { "form_titles": self.TITLES, "steps": self.steps, From a34f55d44fe2edfd6ab7b249a17a3726fc2152c3 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 08:31:48 -0700 Subject: [PATCH 24/39] Test 3 of Pa11y fix --- src/registrar/views/domain_request.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index a86fa500d..8d780e9dc 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -402,8 +402,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): } else: # form is not complete modal_button = ( - '' + "" + '' ) context_stuff = { "form_titles": self.TITLES, From 061920f538a833bdeb74f4e8bc990fd8fac16ad6 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 08:49:48 -0700 Subject: [PATCH 25/39] Add ignore rule for pa11y --- src/.pa11yci | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 56ea40416..e20ebb179 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -21,5 +21,8 @@ "http://localhost:8080/request/requirements/", "http://localhost:8080/request/finished/", "http://localhost:8080/user-profile/" - ] -} + ], + "ignore": [ + "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" + ], +} \ No newline at end of file From 493998bbd99096e163bb37d9844cb45ee773b82c Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 08:54:54 -0700 Subject: [PATCH 26/39] Fix parameterization --- src/.pa11yci | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index e20ebb179..448817778 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -3,7 +3,8 @@ "concurrency": 1, "timeout": 30000 }, - "urls": [ + "urls": { + [ "http://localhost:8080/", "http://localhost:8080/health/", "http://localhost:8080/request/", @@ -21,8 +22,9 @@ "http://localhost:8080/request/requirements/", "http://localhost:8080/request/finished/", "http://localhost:8080/user-profile/" - ], - "ignore": [ + ], + "ignore": [ "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" - ], + ], + } } \ No newline at end of file From d6b6d98d96b9a879f20c58842b67e9ed5454283b Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 08:58:34 -0700 Subject: [PATCH 27/39] Fix parameterization pt 2 --- src/.pa11yci | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 448817778..6dac13a5c 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -3,28 +3,29 @@ "concurrency": 1, "timeout": 30000 }, - "urls": { - [ - "http://localhost:8080/", - "http://localhost:8080/health/", - "http://localhost:8080/request/", - "http://localhost:8080/request/organization/", - "http://localhost:8080/request/org_federal/", - "http://localhost:8080/request/org_election/", - "http://localhost:8080/request/org_contact/", - "http://localhost:8080/request/authorizing_official/", - "http://localhost:8080/request/current_sites/", - "http://localhost:8080/request/dotgov_domain/", - "http://localhost:8080/request/purpose/", - "http://localhost:8080/request/your_contact/", - "http://localhost:8080/request/other_contacts/", - "http://localhost:8080/request/anything_else/", - "http://localhost:8080/request/requirements/", - "http://localhost:8080/request/finished/", - "http://localhost:8080/user-profile/" - ], - "ignore": [ - "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" - ], - } + "urls": [ + { + ["http://localhost:8080/", + "http://localhost:8080/health/", + "http://localhost:8080/request/", + "http://localhost:8080/request/organization/", + "http://localhost:8080/request/org_federal/", + "http://localhost:8080/request/org_election/", + "http://localhost:8080/request/org_contact/", + "http://localhost:8080/request/authorizing_official/", + "http://localhost:8080/request/current_sites/", + "http://localhost:8080/request/dotgov_domain/", + "http://localhost:8080/request/purpose/", + "http://localhost:8080/request/your_contact/", + "http://localhost:8080/request/other_contacts/", + "http://localhost:8080/request/anything_else/", + "http://localhost:8080/request/requirements/", + "http://localhost:8080/request/finished/", + "http://localhost:8080/user-profile/" + ], + "ignore": [ + "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" + ], + } + ] } \ No newline at end of file From bc08e8e556cb142c15b3b9b971d596d38a83a6bd Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 09:53:18 -0700 Subject: [PATCH 28/39] Formatting fix --- src/.pa11yci | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 6dac13a5c..897682628 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -5,27 +5,28 @@ }, "urls": [ { - ["http://localhost:8080/", - "http://localhost:8080/health/", - "http://localhost:8080/request/", - "http://localhost:8080/request/organization/", - "http://localhost:8080/request/org_federal/", - "http://localhost:8080/request/org_election/", - "http://localhost:8080/request/org_contact/", - "http://localhost:8080/request/authorizing_official/", - "http://localhost:8080/request/current_sites/", - "http://localhost:8080/request/dotgov_domain/", - "http://localhost:8080/request/purpose/", - "http://localhost:8080/request/your_contact/", - "http://localhost:8080/request/other_contacts/", - "http://localhost:8080/request/anything_else/", - "http://localhost:8080/request/requirements/", - "http://localhost:8080/request/finished/", - "http://localhost:8080/user-profile/" + "urls": [ + "http://localhost:8080/", + "http://localhost:8080/health/", + "http://localhost:8080/request/", + "http://localhost:8080/request/organization/", + "http://localhost:8080/request/org_federal/", + "http://localhost:8080/request/org_election/", + "http://localhost:8080/request/org_contact/", + "http://localhost:8080/request/authorizing_official/", + "http://localhost:8080/request/current_sites/", + "http://localhost:8080/request/dotgov_domain/", + "http://localhost:8080/request/purpose/", + "http://localhost:8080/request/your_contact/", + "http://localhost:8080/request/other_contacts/", + "http://localhost:8080/request/anything_else/", + "http://localhost:8080/request/requirements/", + "http://localhost:8080/request/finished/", + "http://localhost:8080/user-profile/" ], "ignore": [ "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" - ], + ] } ] } \ No newline at end of file From 009d8948bc6335462cbdac4b9dab360eba496f26 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 12:00:16 -0700 Subject: [PATCH 29/39] Revert pa11y changes and add role --- src/.pa11yci | 43 +++++++++++---------------- src/registrar/views/domain_request.py | 3 +- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 897682628..56ea40416 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -4,29 +4,22 @@ "timeout": 30000 }, "urls": [ - { - "urls": [ - "http://localhost:8080/", - "http://localhost:8080/health/", - "http://localhost:8080/request/", - "http://localhost:8080/request/organization/", - "http://localhost:8080/request/org_federal/", - "http://localhost:8080/request/org_election/", - "http://localhost:8080/request/org_contact/", - "http://localhost:8080/request/authorizing_official/", - "http://localhost:8080/request/current_sites/", - "http://localhost:8080/request/dotgov_domain/", - "http://localhost:8080/request/purpose/", - "http://localhost:8080/request/your_contact/", - "http://localhost:8080/request/other_contacts/", - "http://localhost:8080/request/anything_else/", - "http://localhost:8080/request/requirements/", - "http://localhost:8080/request/finished/", - "http://localhost:8080/user-profile/" - ], - "ignore": [ - "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" - ] - } + "http://localhost:8080/", + "http://localhost:8080/health/", + "http://localhost:8080/request/", + "http://localhost:8080/request/organization/", + "http://localhost:8080/request/org_federal/", + "http://localhost:8080/request/org_election/", + "http://localhost:8080/request/org_contact/", + "http://localhost:8080/request/authorizing_official/", + "http://localhost:8080/request/current_sites/", + "http://localhost:8080/request/dotgov_domain/", + "http://localhost:8080/request/purpose/", + "http://localhost:8080/request/your_contact/", + "http://localhost:8080/request/other_contacts/", + "http://localhost:8080/request/anything_else/", + "http://localhost:8080/request/requirements/", + "http://localhost:8080/request/finished/", + "http://localhost:8080/user-profile/" ] -} \ No newline at end of file +} diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index 8d780e9dc..c0c63a47b 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -402,8 +402,7 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): } else: # form is not complete modal_button = ( - "" - '' + '' ) context_stuff = { "form_titles": self.TITLES, From ae4fb7b5e5a1eff9567aec283b02c8c96e0a953c Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 12:25:38 -0700 Subject: [PATCH 30/39] Fix ignore in pallyci --- src/.pa11yci | 47 ++++++++++++++++----------- src/registrar/views/domain_request.py | 3 +- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 56ea40416..056922545 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -3,23 +3,32 @@ "concurrency": 1, "timeout": 30000 }, - "urls": [ - "http://localhost:8080/", - "http://localhost:8080/health/", - "http://localhost:8080/request/", - "http://localhost:8080/request/organization/", - "http://localhost:8080/request/org_federal/", - "http://localhost:8080/request/org_election/", - "http://localhost:8080/request/org_contact/", - "http://localhost:8080/request/authorizing_official/", - "http://localhost:8080/request/current_sites/", - "http://localhost:8080/request/dotgov_domain/", - "http://localhost:8080/request/purpose/", - "http://localhost:8080/request/your_contact/", - "http://localhost:8080/request/other_contacts/", - "http://localhost:8080/request/anything_else/", - "http://localhost:8080/request/requirements/", - "http://localhost:8080/request/finished/", - "http://localhost:8080/user-profile/" - ] + "urls": { + [ + "http://localhost:8080/", + "http://localhost:8080/health/", + "http://localhost:8080/request/", + "http://localhost:8080/request/organization/", + "http://localhost:8080/request/org_federal/", + "http://localhost:8080/request/org_election/", + "http://localhost:8080/request/org_contact/", + "http://localhost:8080/request/authorizing_official/", + "http://localhost:8080/request/current_sites/", + "http://localhost:8080/request/dotgov_domain/", + "http://localhost:8080/request/purpose/", + "http://localhost:8080/request/your_contact/", + "http://localhost:8080/request/other_contacts/", + "http://localhost:8080/request/anything_else/", + "http://localhost:8080/request/requirements/", + "http://localhost:8080/request/finished/", + "http://localhost:8080/user-profile/" + { + "url": "http://localhost:8080/request/authorizing_official/", + "viewport": { "width": 320, "height": 480 }, + "ignore": [ + "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" + ], + } + ] + } } diff --git a/src/registrar/views/domain_request.py b/src/registrar/views/domain_request.py index c0c63a47b..8d780e9dc 100644 --- a/src/registrar/views/domain_request.py +++ b/src/registrar/views/domain_request.py @@ -402,7 +402,8 @@ class DomainRequestWizard(DomainRequestWizardPermissionView, TemplateView): } else: # form is not complete modal_button = ( - '' + "" + '' ) context_stuff = { "form_titles": self.TITLES, From 3d44bdf5e92350ae421f62f2746409422e629846 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 12:39:02 -0700 Subject: [PATCH 31/39] Try adding in ignore --- src/.pa11yci | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 056922545..49841d346 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -3,32 +3,27 @@ "concurrency": 1, "timeout": 30000 }, - "urls": { - [ - "http://localhost:8080/", - "http://localhost:8080/health/", - "http://localhost:8080/request/", - "http://localhost:8080/request/organization/", - "http://localhost:8080/request/org_federal/", - "http://localhost:8080/request/org_election/", - "http://localhost:8080/request/org_contact/", - "http://localhost:8080/request/authorizing_official/", - "http://localhost:8080/request/current_sites/", - "http://localhost:8080/request/dotgov_domain/", - "http://localhost:8080/request/purpose/", - "http://localhost:8080/request/your_contact/", - "http://localhost:8080/request/other_contacts/", - "http://localhost:8080/request/anything_else/", - "http://localhost:8080/request/requirements/", - "http://localhost:8080/request/finished/", - "http://localhost:8080/user-profile/" - { - "url": "http://localhost:8080/request/authorizing_official/", - "viewport": { "width": 320, "height": 480 }, - "ignore": [ - "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" - ], - } - ] - } + "urls": [ + "http://localhost:8080/", + "http://localhost:8080/health/", + "http://localhost:8080/request/", + "http://localhost:8080/request/organization/", + "http://localhost:8080/request/org_federal/", + "http://localhost:8080/request/org_election/", + "http://localhost:8080/request/org_contact/", + "http://localhost:8080/request/authorizing_official/", + "http://localhost:8080/request/current_sites/", + "http://localhost:8080/request/dotgov_domain/", + "http://localhost:8080/request/purpose/", + "http://localhost:8080/request/your_contact/", + "http://localhost:8080/request/other_contacts/", + "http://localhost:8080/request/anything_else/", + "http://localhost:8080/request/requirements/", + "http://localhost:8080/request/finished/", + "http://localhost:8080/user-profile/" + ], + "ignore": [ + "notice", + "warnings" + ] } From 5faf480e3e249a4ebc74b876b4256c3a0030d2b7 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 12:41:37 -0700 Subject: [PATCH 32/39] Add in specific requirement to ignore --- src/.pa11yci | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index 49841d346..ecca42a34 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -23,7 +23,6 @@ "http://localhost:8080/user-profile/" ], "ignore": [ - "notice", - "warnings" + "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" ] } From 707e5a21eacf19d606d9ff86acffeaeb5f0909e2 Mon Sep 17 00:00:00 2001 From: Rebecca Hsieh Date: Thu, 30 May 2024 12:59:40 -0700 Subject: [PATCH 33/39] Removing post form for certain situations --- src/.pa11yci | 3 --- src/registrar/templates/includes/modal.html | 14 ++++++++++---- src/registrar/views/domain_request.py | 7 +++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/.pa11yci b/src/.pa11yci index ecca42a34..56ea40416 100644 --- a/src/.pa11yci +++ b/src/.pa11yci @@ -21,8 +21,5 @@ "http://localhost:8080/request/requirements/", "http://localhost:8080/request/finished/", "http://localhost:8080/user-profile/" - ], - "ignore": [ - "WCAG2AA.Principle2.Guideline2_2.2_2_1.H91" ] } diff --git a/src/registrar/templates/includes/modal.html b/src/registrar/templates/includes/modal.html index cb99fa321..b0b316a2f 100644 --- a/src/registrar/templates/includes/modal.html +++ b/src/registrar/templates/includes/modal.html @@ -18,12 +18,18 @@