Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions features/age_when_started_smoking.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Feature: Age when started smoking
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/age-when-started-smoking"
Then I see a page title tag "How old were you when you started smoking? – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
3 changes: 2 additions & 1 deletion features/agree_terms_of_use.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
@TermsOfUse
Feature: Check if you need an appointment page
Feature: Agree terms of use page
Scenario: The page is accessible
Given I am logged in
When I go to "/agree-terms-of-use"
Then I see a page title tag "Accept terms of use for NHS check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/asbestos_exposure.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Asbestos exposure page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/asbestos-exposure"
Then I see a page title tag "Asbestos exposure at work – Check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/cancer_diagnosis.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Cancer diagnosis page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/cancer-diagnosis"
Then I see a page title tag "Have you ever been diagnosed with cancer? - NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
2 changes: 2 additions & 0 deletions features/check_need_appointment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Feature: Check if you need an appointment page
Given I am logged in
And I have answered have you ever smoked with an eligible response
And I have answered date of birth with an eligible date of birth
And I have answered questions showing I have accepted the terms of use
When I go to "/check-if-you-need-an-appointment"
Then I see a page title tag "Check if you need to ask for a face-to-face appointment – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
2 changes: 2 additions & 0 deletions features/date_of_birth_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
Feature: Date of birth page
Scenario: The page is accessible
Given I am logged in
And I have answered questions showing I have accepted the terms of use
And I have answered have you ever smoked with an eligible response
When I go to "/date-of-birth"
Then I see a page title tag "What is your date of birth? – Check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/education.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Education page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/education"
Then I see a page title tag "Your education – Check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/ethnicity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Ethnicity page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/ethnicity"
Then I see a page title tag "Your ethnic background – Check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/family_history_lung_cancer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Family history of lung cancer page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/family-history-lung-cancer"
Then I see a page title tag "Family history of lung cancer - Check if you need a lung scan - NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
2 changes: 2 additions & 0 deletions features/have_you_ever_smoked_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
Feature: Have you ever smoked page
Scenario: The page is accessible
Given I am logged in
And I have answered questions showing I have accepted the terms of use
When I go to "/have-you-ever-smoked"
Then I see a page title tag "Have you ever smoked? – Check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/height.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Height page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/height"
Then I see a page title tag "What is your height? – Check if you need a lung scan – NHS"
Then there are no accessibility violations
When I click "Switch to feet and inches"
Then there are no accessibility violations
Expand Down
1 change: 1 addition & 0 deletions features/periods_when_you_stopped_smoking.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Periods when you stopped smoking page
And I have answered questions showing I am eligible
And I have answered questions showing I have smoked for "10" years
When I go to "/periods-when-you-stopped-smoking"
Then I see a page title tag "Have you ever stopped smoking for periods of 1 year or longer? - NHS"
# TODO: problem with aria expanded from nhsuk frontend
# Then there are no accessibility violations

Expand Down
1 change: 1 addition & 0 deletions features/relatives_age_when_diagnosed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Relatives age when diagnosed page
When I go to "/family-history-lung-cancer"
And I fill in and submit my family history lung cancer with "Yes"
Then I am on "/relatives-age-when-diagnosed"
Then I see a page title tag "If your relatives were under 60 when diagnosed - NHS"
And there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/sex_at_birth.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Sex at birth page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/sex-at-birth"
Then I see a page title tag "Your sex at birth – Check if you need a lung scan – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
2 changes: 2 additions & 0 deletions features/smoked_amount.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Feature: Smoked amount page
And I have answered questions showing I currently smoke "Cigarettes"
And I have answered questions showing I have smoked "Cigarettes" daily
When I go to "/cigarettes-smoked-amount"
Then I see a page title tag "Number of cigarettes you normally smoke - NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down Expand Up @@ -41,6 +42,7 @@ Feature: Smoked amount page
And I have answered questions showing I have "increased" my frequency of "Cigarettes" smoking to "Weekly"
When I go to "/cigarettes-smoked-increased-amount"
Then I see a back link to "/cigarettes-smoking-increased-frequency"
Then I see a page title tag "Number of cigarettes you smoked when your smoking increased - NHS"
When I fill in "When you smoked more than 10 cigarettes a day, roughly how many cigarettes did you normally smoke a week?" with "10"
And I submit the form
Then I am on "/cigarettes-smoked-increased-years"
1 change: 1 addition & 0 deletions features/smoking_current.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Smoking current page
And I have answered questions showing I am eligible
And I have answered questions showing I have smoked "Cigarettes"
When I go to "/cigarettes-smoking-current"
Then I see a page title tag "Do you currently smoke cigarettes? – NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
13 changes: 13 additions & 0 deletions features/static.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,38 @@ Feature: Static Pages
Then I see a phase header "Pilot"
And I see a link named "feedback"
And I see a page title "NHS check if you need a lung scan cookies policy"
And I see a page title tag "NHS check if you need a lung scan cookies - NHS"
When I go to "/privacy-policy"
Then I see a phase header "Pilot"
And I see a link named "feedback"
And I see a page title "NHS check if you need a lung scan privacy policy"
And I see a page title tag "NHS check if you need a lung scan privacy policy - NHS"
When I go to "/contact-us"
Then I see a page title tag "Contact us - NHS check if you need a lung scan - NHS"
Then I see a page title "Contact us"
when I go to "/terms-of-use"
Then I see a page title "NHS check if you need a lung scan terms of use"
Then I see a page title tag "NHS check if you need a lung scan terms of use - NHS"

Scenario: The static pages are available when logged in and accessible
Given I am logged in
When I go to "/cookies"
Then I see a phase header "Pilot"
And I see a link named "feedback"
And I see a page title tag "NHS check if you need a lung scan cookies - NHS"
And there are no accessibility violations
And I see a page title "NHS check if you need a lung scan cookies policy"
When I go to "/privacy-policy"
Then I see a phase header "Pilot"
And I see a link named "feedback"
And there are no accessibility violations
And I see a page title "NHS check if you need a lung scan privacy policy"
And I see a page title tag "NHS check if you need a lung scan privacy policy - NHS"
When I go to "/contact-us"
Then there are no accessibility violations
Then I see a page title tag "Contact us - NHS check if you need a lung scan - NHS"
And I see a page title "Contact us"
And there are no accessibility violations
When I go to "/terms-of-use"
Then I see a page title "NHS check if you need a lung scan terms of use"
Then I see a page title tag "NHS check if you need a lung scan terms of use - NHS"
4 changes: 4 additions & 0 deletions features/steps/page_assertion_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ def then_i_see_a_phase_header(context, phase):
def then_i_see_a_link_named(context, link_text):
link = context.page.locator(f'a:has-text("{link_text}")')
expect(link).to_have_count(1)

@then(u'I see a page title tag "{title}"')
def then_i_see_a_page_title_tag(context, title):
expect(context.page).to_have_title(title)
1 change: 1 addition & 0 deletions features/types_tobacco_smoking.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Feature: Types tobacco smoking page
And I have answered questions showing I am eligible
And I have answered questions showing I have smoked for "10" years
When I go to "/types-tobacco-smoking"
Then I see a page title tag "What do you or have you smoked? - Check if you need a lung scan - NHS"
Then there are no accessibility violations

Scenario: Form errors
Expand Down
1 change: 1 addition & 0 deletions features/weight.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Feature: Weight page
Given I am logged in
And I have answered questions showing I am eligible
When I go to "/weight"
Then I see a page title tag "What is your weight? – Check if you need a lung scan – NHS"
Then there are no accessibility violations
When I click "Switch to stone and pounds"
Then there are no accessibility violations
Expand Down
2 changes: 1 addition & 1 deletion lung_cancer_screening/core/jinja2/layout.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script type="module" src="{{ static('js/bundle.js' )}}"></script>
{% endblock %}

{% block pageTitle %}Check if you need a lung scan{% endblock %}
{% block pageTitle %}{{ page_title|default("Check if you need a lung scan – NHS") }}{% endblock %}

{% block header %}
{{ header({
Expand Down
8 changes: 8 additions & 0 deletions lung_cancer_screening/questions/forms/smoked_amount_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ def min_value_error_message(self):
"must be at least 1"
)

def page_title(self) -> str:
if self.presenter.increased_or_decreased():
return(f"Number of {self.presenter.unit()} you smoked when your smoking {self.presenter.increased_or_decreased()}")
else:
return (f"Number of {self.presenter.unit()} you normally {self.presenter.smoke_or_smoked()}")



class Meta:
model = SmokedAmountResponse
fields = ['value']
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def greater_than_years_smoked_error_message(self):
else:
return self.changed_greater_than_years_smoked_error_message()

def page_title(self):
return self.label()

class Meta:
model = SmokedTotalYearsResponse
Expand Down
3 changes: 3 additions & 0 deletions lung_cancer_screening/questions/forms/smoking_change_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def is_valid(self):
return False
return True

def page_title(self):
return f"Did the number of {self.tobacco_smoking_history.unit()} you smoke change over time?"


def _delete_levels_not_selected(self):
for level in self._existing_levels():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@
return self.normal_required_error_message()
else:
return self.changed_required_error_message()

def page_title(self):
if self.presenter.increased_or_decreased(): #TODO: What's the best condition to use here?

Check warning on line 90 in lung_cancer_screening/questions/forms/smoking_frequency_form.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Complete the task associated to this "TODO" comment.

See more on https://sonarcloud.io/project/issues?id=NHSDigital_lung_cancer_screening&issues=AZ0FuDgfIxbDRB7lIiUI&open=AZ0FuDgfIxbDRB7lIiUI&pullRequest=374
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the best condition to use here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd guess looking at label() you're best of doing self.tobacco_smoking_history.is_normal() and flipping the two versions around so normal is first?

return f"How often you {self.presenter.smoke_or_smoked()} {self.presenter.human_type().lower()} when your smoking {self.presenter.increased_or_decreased()}"
else:
return(f"How often {self.presenter.do_or_did()} you smoke {self.presenter.human_type().lower()}?")
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends 'layout.jinja' %}
{% from 'nhsuk/components/back-link/macro.jinja' import backLink %}

{% block pageTitle %}You are not in the age range for NHS lung cancer screening – NHS{% endblock %}
{% block beforeContent %}
<nav>
{{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'question_form.jinja' %}

{% block pageTitle %}Accept terms of use for NHS check if you need a lung scan – NHS{% endblock %}
{% block prelude %}
<h1 class="nhsuk-heading-l">Accept terms of use</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends 'question_form.jinja' %}
{% from 'nhsuk/components/details/macro.jinja' import details %}

{% block pageTitle %}Asbestos exposure at work – Check if you need a lung scan – NHS{% endblock %}

{% block prelude %}
<h1 class="nhsuk-heading-l">Tell us if you might have been exposed to asbestos at work</h1>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends 'layout.jinja' %}
{% from 'nhsuk/components/back-link/macro.jinja' import backLink %}

{% block pageTitle %}Call us to book an appointment – NHS{% endblock %}

{% block beforeContent %}
<nav>
{{
Expand Down
2 changes: 2 additions & 0 deletions lung_cancer_screening/questions/jinja2/cancer_diagnosis.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends 'question_form.jinja' %}

{% block pageTitle %}Have you ever been diagnosed with cancer? - NHS{% endblock %}

{% block prelude %}

<h1 class="nhsuk-heading-l">If you have ever been diagnosed with cancer</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends 'question_form.jinja' %}
{% block pageTitle %}Check if you need to ask for a face-to-face appointment – NHS{% endblock %}

{% block prelude %}

Expand Down
2 changes: 2 additions & 0 deletions lung_cancer_screening/questions/jinja2/confirmation.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{% extends 'layout.jinja' %}
{% from "nhsuk/components/panel/macro.jinja" import panel %}

{% block pageTitle %}Thank you for testing the online service - NHS{% endblock %}

{% block content %}
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
Expand Down
2 changes: 2 additions & 0 deletions lung_cancer_screening/questions/jinja2/contact_us.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends 'layout.jinja' %}

{% block pageTitle %}Contact us - NHS check if you need a lung scan - NHS{% endblock %}

{% block content %}
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">
Expand Down
1 change: 1 addition & 0 deletions lung_cancer_screening/questions/jinja2/cookies.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends 'layout.jinja' %}
{% block pageTitle %}NHS check if you need a lung scan cookies - NHS{% endblock %}

{% block content %}
<div class="nhsuk-grid-row">
Expand Down
1 change: 1 addition & 0 deletions lung_cancer_screening/questions/jinja2/education.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% extends 'question_form.jinja' %}
{% block pageTitle %}Your education – Check if you need a lung scan – NHS{% endblock %}

{% block prelude %}

Expand Down
4 changes: 4 additions & 0 deletions lung_cancer_screening/questions/jinja2/ethnicity.jinja
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{% extends 'question_form.jinja' %}
{% block pageTitle %}Your ethnic background – Check if you need a lung scan – NHS{% endblock %}

{% from 'nhsuk/components/back-link/macro.jinja' import backLink %}
{% from 'nhsuk/components/fieldset/macro.jinja' import fieldset %}
Comment on lines +4 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't need these here do you?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, I must have picked up too much in the copy and past


{% block prelude %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{% extends 'question_form.jinja' %}

{% block pageTitle %}Family history of lung cancer - Check if you need a lung scan - NHS{% endblock %}

{% block prelude %}

<h1 class="nhsuk-heading-l">If your parents, siblings or children have ever been diagnosed with lung cancer</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% extends 'question_form.jinja' %}

{% block pageTitle %}Have you ever smoked? – Check if you need a lung scan – NHS{% endblock %}


{% block prelude %}

<h1 class="nhsuk-heading-l">Tobacco smoking</h1>
Expand Down
3 changes: 3 additions & 0 deletions lung_cancer_screening/questions/jinja2/height.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
{% from 'nhsuk/components/back-link/macro.jinja' import backLink %}
{% from 'nhsuk/components/fieldset/macro.jinja' import fieldset %}

{% block pageTitle %}What is your height? – Check if you need a lung scan – NHS{% endblock %}

{% set HEIGHT_UNIT = {
'imperial': 'feet and inches',
'metric': 'centimetres'
} %}


{% block beforeContent %}
<nav>
{{
Expand Down
3 changes: 3 additions & 0 deletions lung_cancer_screening/questions/jinja2/non_smoker_exit.jinja
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% extends 'layout.jinja' %}
{% from 'nhsuk/components/back-link/macro.jinja' import backLink %}

{% block pageTitle %}You are not eligible for lung cancer screening – NHS{% endblock %}


{% block beforeContent %}
<nav>
{{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

{% from 'nhsuk/components/button/macro.jinja' import button %}

{% block pageTitle %}Have you ever stopped smoking for periods of 1 year or longer? - NHS{% endblock %}


{% if error %}
{% set error_message = { "text": error } %}
{% endif %}
Expand Down
Loading
Loading