Skip to content

Commit 37538cd

Browse files
jamiefalcusThemitchell
authored andcommitted
Fix and add to ui tests
1 parent 756c830 commit 37538cd

4 files changed

Lines changed: 44 additions & 2 deletions

File tree

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"cSpell.language": "en-GB",
1010
"cSpell.words": [
1111
"dateutil",
12+
"Dproject",
13+
"Dsonar",
1214
"endcall",
1315
"endfor",
1416
"endset",
@@ -20,8 +22,10 @@
2022
"novalidate",
2123
"psycopg",
2224
"pyjwt",
25+
"qualitygate",
2326
"relativedelta",
2427
"responseset",
28+
"sonarsource",
2529
"stylesheet",
2630
"toplevel",
2731
"unsubmitted",

tests/features/questionnaire.feature

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ Feature: Questionnaire
4444
When I fill in and submit my cancer diagnosis with "No"
4545
Then I am on "/family-history-lung-cancer"
4646
And I see a back link to "/cancer-diagnosis"
47-
When I fill in and submit my family history lung cancer with "No"
48-
Then I am on "/responses"
47+
When I fill in and submit my family history lung cancer with "Yes"
48+
Then I am on "/relatives-age-when-diagnosed"
4949
And I see a back link to "/family-history-lung-cancer"
50+
When I fill in and submit my relatives age when diagnosed with "Yes, they were younger than 60"
51+
Then I am on "/responses"
52+
And I see a back link to "/relatives-age-when-diagnosed"
5053
And I see responses "Have you ever smoked? Yes, I used to smoke"
5154
And I see responses "What is your date of birth?" with a date 55 years ago
5255
And I see responses "What is your height? 5 feet 7 inches"
@@ -56,3 +59,6 @@ Feature: Questionnaire
5659
And I see responses "What is your ethnic background? White"
5760
And I see responses "Have you ever worked in a job where you might have been exposed to asbestos? No"
5861
And I see responses "Have you ever been diagnosed with any of the following respiratory conditions? Pneumonia and Emphysema"
62+
And I see responses "Have you ever been diagnosed with cancer? No"
63+
And I see responses "Have any of your parents, siblings or children ever been diagnosed with lung cancer Yes"
64+
And I see responses "Were any of your relatives younger than 60 years old when they were diagnosed with lung cancer? Yes, they were younger than 60"

tests/features/steps/form_steps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ def when_i_fill_in_and_submit_my_cancer_diagnosis(context, family_history_lung_c
8484
context.page.get_by_label(family_history_lung_cancer, exact=True).check()
8585
when_i_submit_the_form(context)
8686

87+
@when(u'I fill in and submit my relatives age when diagnosed with "{relatives_age_when_diagnosed}"')
88+
def when_i_fill_in_and_submit_my_cancer_diagnosis(context, relatives_age_when_diagnosed):
89+
context.page.get_by_label(relatives_age_when_diagnosed, exact=True).check()
90+
when_i_submit_the_form(context)
91+
8792
@when('I submit the form')
8893
def when_i_submit_the_form(context):
8994
context.page.click("text=Continue")

tests/features/validation_errors.feature

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,30 @@ Feature: Validation errors
123123
When I fill in and submit my respiratory conditions with "Bronchitis" and "No, I have not had any of these respiratory conditions"
124124
Then I am on "/respiratory-conditions"
125125
And I see a form error "Select if you have had any respiratory conditions, or select 'No, I have not had any of these respiratory conditions'"
126+
127+
Scenario: Respiratory conditions form errors
128+
Given I am logged in
129+
And I have started the questionnaire
130+
When I go to "/cancer-diagnosis"
131+
And I submit the form
132+
Then I am on "/cancer-diagnosis"
133+
And I see a form error "Select if you have been diagnosed with cancer"
134+
135+
Scenario: Respiratory conditions form errors
136+
Given I am logged in
137+
And I have started the questionnaire
138+
When I go to "/family-history-lung-cancer"
139+
And I submit the form
140+
Then I am on "/family-history-lung-cancer"
141+
And I see a form error "Select if any of your parents, siblings or children have had a diagnosis of lung cancer"
142+
143+
Scenario: Respiratory conditions form errors
144+
Given I am logged in
145+
And I have started the questionnaire
146+
When I go to "/relatives-age-when-diagnosed"
147+
Then I am on "/family-history-lung-cancer"
148+
When I fill in and submit my family history lung cancer with "Yes"
149+
Then I am on "/relatives-age-when-diagnosed"
150+
When I submit the form
151+
Then I am on "/relatives-age-when-diagnosed"
152+
And I see a form error "Select if your relatives were younger than 60 when they were diagnosed with lung cancer"

0 commit comments

Comments
 (0)