Skip to content

Commit

Permalink
FS-4954 - Confirmation page for completed applications
Browse files Browse the repository at this point in the history
  • Loading branch information
wjrm500 committed Mar 6, 2025
1 parent c3ede02 commit e195e67
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 3 deletions.
12 changes: 11 additions & 1 deletion app/blueprints/application/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,17 @@ def mark_application_complete(round_id):
round_ = get_round_by_id(round_id)
round_.status = "Complete"
update_round(round_)
return redirect(url_for("application_bp.build_application", round_id=round_id))
return redirect(url_for("application_bp.application_complete", round_id=round_id))


@application_bp.route("/<round_id>/complete", methods=["GET"])
def application_complete(round_id):
"""
Shows the confirmation page after marking an application as complete
"""
round_ = get_round_by_id(round_id)
fund = get_fund_by_id(round_.fund_id)
return render_template("application_complete.html", round=round_, fund=fund)


@application_bp.route("/<round_id>/mark-in-progress", methods=["GET"])
Expand Down
32 changes: 32 additions & 0 deletions app/blueprints/application/templates/application_complete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{% extends "base.html" %}

{% block content %}
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-panel govuk-panel--confirmation">
<h1 class="govuk-panel__title">
Application marked as complete
</h1>
</div>

<p class="govuk-body">The status of this application has been changed to 'complete'.</p>

<h3 class="govuk-heading-m">What happens next</h3>

<ul class="govuk-list govuk-list--bullet">
<li><a href="{{ url_for('application_bp.create_export_files', round_id=round.round_id) }}" class="govuk-link">Download the application ZIP file</a> and send it to the Live Services team</li>
<li>The application can be edited at any time. Editing a complete application will automatically change its status to 'In progress'.</li>
</ul>

<p class="govuk-body">
<a href="{{ url_for('application_bp.build_application', round_id=round.round_id) }}" class="govuk-link">Back to application</a>
</p>

<div class="govuk-button-group">
<a href="{{ url_for('index_bp.dashboard') }}" class="govuk-button govuk-button--secondary">
Back to home
</a>
</div>
</div>
</div>
{% endblock %}
60 changes: 58 additions & 2 deletions tests/unit/blueprints/application/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,14 @@ def test_mark_application_complete(flask_test_client, seed_dynamic_data):
# Ensure the round starts with "In progress" status
assert test_round.status == "In progress"

# Call the endpoint to mark application as complete
# Call the endpoint to mark application as complete (don't follow redirects)
url = f"/rounds/{test_round.round_id}/mark-complete"
response = flask_test_client.get(url, follow_redirects=True)
response = flask_test_client.get(url, follow_redirects=False)
assert response.status_code == 302 # Should be a redirect

# Now manually go to the build_application page to check the status
app_url = f"/rounds/{test_round.round_id}/sections"
response = flask_test_client.get(app_url)
assert response.status_code == 200

# Check the page content reflects the completed status
Expand Down Expand Up @@ -204,6 +209,57 @@ def test_mark_application_complete(flask_test_client, seed_dynamic_data):
assert len(down_links) == 0


@pytest.mark.usefixtures("set_auth_cookie", "patch_validate_token_rs256_internal_user")
def test_application_complete_page(flask_test_client, seed_dynamic_data):
"""Test the application complete confirmation page"""
test_round = seed_dynamic_data["rounds"][0]

# Call the endpoint to mark application as complete and follow redirects
url = f"/rounds/{test_round.round_id}/mark-complete"
response = flask_test_client.get(url, follow_redirects=True)
assert response.status_code == 200

# Check the confirmation page content
soup = BeautifulSoup(response.data, "html.parser")

# Check for the confirmation panel
panel = soup.find("div", class_="govuk-panel--confirmation")
assert panel is not None

# Check panel title
panel_title = panel.find("h1", class_="govuk-panel__title")
assert panel_title is not None
assert panel_title.text.strip() == "Application marked as complete"

# Check for the status change text
status_text = soup.find(
"p",
class_="govuk-body",
string=lambda text: "status of this application has been changed" in text if text else False,
)
assert status_text is not None

# Check for the "What happens next" heading
next_heading = soup.find("h3", class_="govuk-heading-m", string="What happens next")
assert next_heading is not None

# Check for the bullet points
bullet_list = soup.find("ul", class_="govuk-list--bullet")
assert bullet_list is not None
bullet_points = bullet_list.find_all("li")
assert len(bullet_points) == 2

# Check for the back to application link
back_link = soup.find("a", string="Back to application")
assert back_link is not None

# Check for the back to home button
home_button = soup.find(
"a", class_="govuk-button--secondary", string=lambda text: "Back to home" in text if text else False
)
assert home_button is not None


@pytest.mark.usefixtures("set_auth_cookie", "patch_validate_token_rs256_internal_user")
def test_mark_application_in_progress(flask_test_client, seed_dynamic_data):
"""Test marking a complete application as in progress"""
Expand Down

0 comments on commit e195e67

Please sign in to comment.