mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-20 03:19:24 +02:00
Update unit tests to look for the dynamic header passed in context to the modal
This commit is contained in:
parent
6912b03cc0
commit
8718635b94
2 changed files with 22 additions and 10 deletions
|
@ -164,6 +164,9 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
this test work.
|
this test work.
|
||||||
|
|
||||||
This test also looks for the long organization name on the summary page.
|
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
|
num_pages_tested = 0
|
||||||
# elections, type_of_work, tribal_government, no_other_contacts
|
# elections, type_of_work, tribal_government, no_other_contacts
|
||||||
|
@ -472,6 +475,14 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
self.assertContains(review_page, "(201) 555-5557")
|
self.assertContains(review_page, "(201) 555-5557")
|
||||||
self.assertContains(review_page, "Nothing else.")
|
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 > application_form > modal
|
||||||
|
self.assertContains(review_page, "You are about to submit a domain request for city.gov")
|
||||||
|
|
||||||
# final submission results in a redirect to the "finished" URL
|
# final submission results in a redirect to the "finished" URL
|
||||||
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
self.app.set_cookie(settings.SESSION_COOKIE_NAME, session_id)
|
||||||
with less_console_noise():
|
with less_console_noise():
|
||||||
|
@ -1086,16 +1097,17 @@ class DomainApplicationTests(TestWithUser, WebTest):
|
||||||
detail_page = home_page.click("Manage", index=0)
|
detail_page = home_page.click("Manage", index=0)
|
||||||
self.assertContains(detail_page, "Federal: an agency of the U.S. government")
|
self.assertContains(detail_page, "Federal: an agency of the U.S. government")
|
||||||
|
|
||||||
def test_submit_modal(self):
|
def test_submit_modal_no_domain_text_fallback(self):
|
||||||
"""When user clicks on submit your domain request, a modal pops up."""
|
"""When user clicks on submit your domain request and the requested domain
|
||||||
# completed_application(name="cats.gov")
|
is null (possible through url direct access to the review page), present
|
||||||
|
fallback copy in the modal's header.
|
||||||
|
|
||||||
|
NOTE: This may be a moot point if we implement a more solid pattern in the
|
||||||
|
future, like not a submit action at all on the review page."""
|
||||||
|
|
||||||
review_page = self.app.get(reverse("application:review"))
|
review_page = self.app.get(reverse("application:review"))
|
||||||
# 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")
|
self.assertContains(review_page, "toggle-submit-domain-request")
|
||||||
# And the existence of the modal's data parked and ready for the js init:
|
self.assertContains(review_page, "You are about to submit an incomplete request")
|
||||||
print(review_page)
|
|
||||||
self.assertContains(review_page, "You are about to submit")
|
|
||||||
|
|
||||||
|
|
||||||
class TestWithDomainPermissions(TestWithUser):
|
class TestWithDomainPermissions(TestWithUser):
|
||||||
|
|
|
@ -331,9 +331,9 @@ class ApplicationWizard(ApplicationWizardPermissionView, TemplateView):
|
||||||
# by tyoing in review in the URL. The submit button still shows, hence
|
# by tyoing in review in the URL. The submit button still shows, hence
|
||||||
# the if/else.
|
# the if/else.
|
||||||
if self.application.requested_domain:
|
if self.application.requested_domain:
|
||||||
modal_heading = 'You are about to submit a domain request for ' + str(self.application.requested_domain)
|
modal_heading = "You are about to submit a domain request for " + str(self.application.requested_domain)
|
||||||
else:
|
else:
|
||||||
modal_heading = 'You are about to submit an incomplete request'
|
modal_heading = "You are about to submit an incomplete request"
|
||||||
return {
|
return {
|
||||||
"form_titles": self.TITLES,
|
"form_titles": self.TITLES,
|
||||||
"steps": self.steps,
|
"steps": self.steps,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue