diff --git a/features/age_when_started_smoking.feature b/features/age_when_started_smoking.feature index b3473365..f5648808 100644 --- a/features/age_when_started_smoking.feature +++ b/features/age_when_started_smoking.feature @@ -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 diff --git a/features/agree_terms_of_use.feature b/features/agree_terms_of_use.feature index 77ef896a..7ebdd25a 100644 --- a/features/agree_terms_of_use.feature +++ b/features/agree_terms_of_use.feature @@ -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 diff --git a/features/asbestos_exposure.feature b/features/asbestos_exposure.feature index 23f5ea45..13cee5ff 100644 --- a/features/asbestos_exposure.feature +++ b/features/asbestos_exposure.feature @@ -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 diff --git a/features/cancer_diagnosis.feature b/features/cancer_diagnosis.feature index c8a10803..02a6309e 100644 --- a/features/cancer_diagnosis.feature +++ b/features/cancer_diagnosis.feature @@ -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 diff --git a/features/check_need_appointment.feature b/features/check_need_appointment.feature index 6b520b21..bc853699 100644 --- a/features/check_need_appointment.feature +++ b/features/check_need_appointment.feature @@ -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 diff --git a/features/date_of_birth_page.feature b/features/date_of_birth_page.feature index 463b3720..8363541b 100644 --- a/features/date_of_birth_page.feature +++ b/features/date_of_birth_page.feature @@ -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 diff --git a/features/education.feature b/features/education.feature index aaf45bc9..e571ec39 100644 --- a/features/education.feature +++ b/features/education.feature @@ -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 diff --git a/features/ethnicity.feature b/features/ethnicity.feature index 264acb04..2c4b7581 100644 --- a/features/ethnicity.feature +++ b/features/ethnicity.feature @@ -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 diff --git a/features/family_history_lung_cancer.feature b/features/family_history_lung_cancer.feature index da24612b..5033a32f 100644 --- a/features/family_history_lung_cancer.feature +++ b/features/family_history_lung_cancer.feature @@ -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 diff --git a/features/have_you_ever_smoked_page.feature b/features/have_you_ever_smoked_page.feature index c567608d..0f07ddbb 100644 --- a/features/have_you_ever_smoked_page.feature +++ b/features/have_you_ever_smoked_page.feature @@ -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 diff --git a/features/height.feature b/features/height.feature index 3d6db41d..133f68e9 100644 --- a/features/height.feature +++ b/features/height.feature @@ -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 diff --git a/features/periods_when_you_stopped_smoking.feature b/features/periods_when_you_stopped_smoking.feature index eeba1ce5..336975a2 100644 --- a/features/periods_when_you_stopped_smoking.feature +++ b/features/periods_when_you_stopped_smoking.feature @@ -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 diff --git a/features/relatives_age_when_diagnosed.feature b/features/relatives_age_when_diagnosed.feature index b692c7e1..6d7e06a4 100644 --- a/features/relatives_age_when_diagnosed.feature +++ b/features/relatives_age_when_diagnosed.feature @@ -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 diff --git a/features/sex_at_birth.feature b/features/sex_at_birth.feature index 70ff10fa..b2677dcf 100644 --- a/features/sex_at_birth.feature +++ b/features/sex_at_birth.feature @@ -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 diff --git a/features/smoked_amount.feature b/features/smoked_amount.feature index 2a3937ef..7e0aefbb 100644 --- a/features/smoked_amount.feature +++ b/features/smoked_amount.feature @@ -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 @@ -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" diff --git a/features/smoking_current.feature b/features/smoking_current.feature index 746008b1..77c94e69 100644 --- a/features/smoking_current.feature +++ b/features/smoking_current.feature @@ -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 diff --git a/features/static.feature b/features/static.feature index 96e969d2..28f78c4f 100644 --- a/features/static.feature +++ b/features/static.feature @@ -5,18 +5,25 @@ 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" @@ -24,6 +31,12 @@ Feature: Static Pages 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" diff --git a/features/steps/page_assertion_steps.py b/features/steps/page_assertion_steps.py index 7e15a9a2..1501a237 100644 --- a/features/steps/page_assertion_steps.py +++ b/features/steps/page_assertion_steps.py @@ -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) diff --git a/features/types_tobacco_smoking.feature b/features/types_tobacco_smoking.feature index dd444afc..f7577805 100644 --- a/features/types_tobacco_smoking.feature +++ b/features/types_tobacco_smoking.feature @@ -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 diff --git a/features/weight.feature b/features/weight.feature index c826f588..ce1c273c 100644 --- a/features/weight.feature +++ b/features/weight.feature @@ -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 diff --git a/lung_cancer_screening/core/jinja2/layout.jinja b/lung_cancer_screening/core/jinja2/layout.jinja index 5375a9ca..3a087950 100644 --- a/lung_cancer_screening/core/jinja2/layout.jinja +++ b/lung_cancer_screening/core/jinja2/layout.jinja @@ -9,7 +9,7 @@ {% 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({ diff --git a/lung_cancer_screening/questions/forms/smoked_amount_form.py b/lung_cancer_screening/questions/forms/smoked_amount_form.py index 384f9d19..0ea10dd4 100644 --- a/lung_cancer_screening/questions/forms/smoked_amount_form.py +++ b/lung_cancer_screening/questions/forms/smoked_amount_form.py @@ -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'] diff --git a/lung_cancer_screening/questions/forms/smoked_total_years_form.py b/lung_cancer_screening/questions/forms/smoked_total_years_form.py index c3423825..a9967261 100644 --- a/lung_cancer_screening/questions/forms/smoked_total_years_form.py +++ b/lung_cancer_screening/questions/forms/smoked_total_years_form.py @@ -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 diff --git a/lung_cancer_screening/questions/forms/smoking_change_form.py b/lung_cancer_screening/questions/forms/smoking_change_form.py index 8d9a471e..0e1f3fc4 100644 --- a/lung_cancer_screening/questions/forms/smoking_change_form.py +++ b/lung_cancer_screening/questions/forms/smoking_change_form.py @@ -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(): diff --git a/lung_cancer_screening/questions/forms/smoking_frequency_form.py b/lung_cancer_screening/questions/forms/smoking_frequency_form.py index f2b498de..fc87c2c1 100644 --- a/lung_cancer_screening/questions/forms/smoking_frequency_form.py +++ b/lung_cancer_screening/questions/forms/smoking_frequency_form.py @@ -85,3 +85,9 @@ def required_error_message(self): 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? + 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()}?") diff --git a/lung_cancer_screening/questions/jinja2/age_range_exit.jinja b/lung_cancer_screening/questions/jinja2/age_range_exit.jinja index 66a5595c..e31e120a 100644 --- a/lung_cancer_screening/questions/jinja2/age_range_exit.jinja +++ b/lung_cancer_screening/questions/jinja2/age_range_exit.jinja @@ -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 %}