Skip to content

Commit 022db13

Browse files
ThemitchelljamiefalcusCopilot
authored
PPHA-589: multiple types of smoking history (#317)
* PPHA-589: Add cigarillos journey * PPHA-589: Add cigar smoking journey * PPHA-589: Rename RolledCigarettes to RollingTobacco * PPHA-589: Stop using TobacoSmokingTypes everywhere Use methods or scopes insted where possible * PPHA-589: Add pipe smoking history * PPHA-589: Remove wips and fix spelling errors * Corrections for pipe smoking text * Change cigar types to small, medium and large * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andy Mitchell <326561+Themitchell@users.noreply.github.com> * PPHA-589: Provide rollback for RollingTobacco to RolledCigarrettes * PPHA-589: Add migration for updated TobaccoSmokingHistoryTypes * PPHA-589: Check normal smoking history status using model not query string * PPHA-589: Fix RollingTobacco and Pipe changed over time validation message * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Andy Mitchell <326561+Themitchell@users.noreply.github.com> * PPHA-589: Use model.url_type() in TobaccoSmokingHistory change tests * PPHA-589: Remove shisha from have you ever smoked page --------- Signed-off-by: Andy Mitchell <326561+Themitchell@users.noreply.github.com> Co-authored-by: Jamie Falcus <50366804+jamiefalcus@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 2ba733f commit 022db13

45 files changed

Lines changed: 1097 additions & 209 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"gunicorn",
1919
"jinja",
2020
"kebabize",
21+
"kwargs",
2122
"makemigrations",
2223
"nhsuk",
2324
"novalidate",
@@ -31,5 +32,5 @@
3132
"toplevel",
3233
"unsubmitted",
3334
"whitenoise"
34-
]
35+
],
3536
}

features/smoking_history.feature

Lines changed: 304 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@SmokingHistory
12
Feature: Smoking history pages
23
Scenario: Singular smoking histories
34
Given I am logged in
@@ -97,3 +98,306 @@ Feature: Smoking history pages
9798
And I see "25 cigarettes a month" as a response to "Current cigarette smoking" under "Cigarette smoking history"
9899

99100
And I see "40 cigarettes a day for 5 years" as a response to "When you smoked more than 25 cigarettes a month" under "Cigarette smoking history"
101+
102+
Scenario: Multiple smoking histories
103+
Given I am logged in
104+
And I have answered questions showing I am eligible
105+
And I have answered questions showing I have smoked for "30" years
106+
When I go to "/types-tobacco-smoking"
107+
And I check "Cigarettes"
108+
And I check "Rolling tobacco"
109+
And I check "Pipe"
110+
And I check "Cigarillos"
111+
And I check "Medium cigars"
112+
And I submit the form
113+
114+
# Cigarettes with increased and decreased
115+
Then I am on "/cigarettes-smoking-current"
116+
And I see a page title "Do you currently smoke cigarettes?"
117+
When I check "Yes"
118+
And I submit the form
119+
120+
Then I am on "/cigarettes-smoked-total-years"
121+
When I fill in "Roughly how many years have you smoked cigarettes?" with "15"
122+
And I submit the form
123+
124+
Then I am on "/cigarettes-smoking-frequency"
125+
And I see a page title "How often do you smoke cigarettes?"
126+
When I check "Daily"
127+
And I submit the form
128+
129+
Then I am on "/cigarettes-smoked-amount"
130+
When I fill in "Roughly how many cigarettes do you currently smoke in a normal day?" with "10"
131+
And I submit the form
132+
133+
Then I am on "/cigarettes-smoking-change"
134+
And I see a page title "Has the number of cigarettes you normally smoke changed over time?"
135+
When I check "Yes, I used to smoke more than 10 cigarettes a day"
136+
And I check "Yes, I used to smoke fewer than 10 cigarettes a day"
137+
And I submit the form
138+
139+
Then I am on "/cigarettes-smoking-increased-frequency"
140+
And I see a page title "When you smoked more than 10 cigarettes a day, how often did you smoke cigarettes?"
141+
When I check "Weekly"
142+
And I submit the form
143+
144+
Then I am on "/cigarettes-smoked-increased-amount"
145+
When I fill in "When you smoked more than 10 cigarettes a day, roughly how many cigarettes did you normally smoke a week?" with "200"
146+
And I submit the form
147+
148+
Then I am on "/cigarettes-smoked-increased-years"
149+
When I fill in "Roughly how many years did you smoke 200 cigarettes a week?" with "5"
150+
And I submit the form
151+
152+
Then I am on "/cigarettes-smoking-decreased-frequency"
153+
And I see a page title "When you smoked fewer than 10 cigarettes a day, how often did you smoke cigarettes?"
154+
When I check "Monthly"
155+
And I submit the form
156+
157+
Then I am on "/cigarettes-smoked-decreased-amount"
158+
When I fill in "When you smoked fewer than 10 cigarettes a day, roughly how many cigarettes did you normally smoke a month?" with "1"
159+
And I submit the form
160+
161+
Then I am on "/cigarettes-smoked-decreased-years"
162+
When I fill in "Roughly how many years did you smoke 1 cigarettes a month?" with "2"
163+
And I submit the form
164+
165+
# Rolling tobacco with increased and decreased
166+
Then I am on "/rolling-tobacco-smoking-current"
167+
And I see a page title "Do you currently smoke rolling tobacco?"
168+
When I check "Yes"
169+
And I submit the form
170+
171+
Then I am on "/rolling-tobacco-smoked-total-years"
172+
When I fill in "Roughly how many years have you smoked rolling tobacco?" with "26"
173+
And I submit the form
174+
175+
Then I am on "/rolling-tobacco-smoking-frequency"
176+
And I see a page title "How often do you smoke rolling tobacco?"
177+
When I check "Weekly"
178+
And I submit the form
179+
180+
Then I am on "/rolling-tobacco-smoked-amount"
181+
When I fill in "Roughly how many grams of rolling tobacco do you currently smoke in a normal week?" with "25"
182+
And I submit the form
183+
184+
Then I am on "/rolling-tobacco-smoking-change"
185+
When I check "Yes, I used to smoke more than 25 grams of rolling tobacco a week"
186+
And I check "Yes, I used to smoke fewer than 25 grams of rolling tobacco a week"
187+
And I submit the form
188+
189+
Then I am on "/rolling-tobacco-smoking-increased-frequency"
190+
And I see a page title "When you smoked more than 25 grams of rolling tobacco a week, how often did you smoke rolling tobacco?"
191+
When I check "Daily"
192+
And I submit the form
193+
194+
Then I am on "/rolling-tobacco-smoked-increased-amount"
195+
When I fill in "When you smoked more than 25 grams of rolling tobacco a week, roughly how many grams of rolling tobacco did you normally smoke a day?" with "12"
196+
And I submit the form
197+
198+
Then I am on "/rolling-tobacco-smoked-increased-years"
199+
When I fill in "Roughly how many years did you smoke 12 grams of rolling tobacco a day?" with "10"
200+
And I submit the form
201+
202+
Then I am on "/rolling-tobacco-smoking-decreased-frequency"
203+
When I check "Monthly"
204+
And I submit the form
205+
206+
Then I am on "/rolling-tobacco-smoked-decreased-amount"
207+
When I fill in "When you smoked fewer than 25 grams of rolling tobacco a week, roughly how many grams of rolling tobacco did you normally smoke a month?" with "5"
208+
And I submit the form
209+
210+
Then I am on "/rolling-tobacco-smoked-decreased-years"
211+
When I fill in "Roughly how many years did you smoke 5 grams of rolling tobacco a month?" with "4"
212+
And I submit the form
213+
214+
# Pipe with increased and decreased
215+
Then I am on "/pipe-smoking-current"
216+
And I see a page title "Do you currently smoke a pipe?"
217+
When I check "Yes"
218+
And I submit the form
219+
220+
Then I am on "/pipe-smoked-total-years"
221+
When I fill in "Roughly how many years have you smoked a pipe?" with "26"
222+
And I submit the form
223+
224+
Then I am on "/pipe-smoking-frequency"
225+
And I see a page title "How often do you smoke a pipe?"
226+
When I check "Weekly"
227+
And I submit the form
228+
229+
Then I am on "/pipe-smoked-amount"
230+
When I fill in "Roughly how many full pipe loads do you currently smoke in a normal week?" with "25"
231+
And I submit the form
232+
233+
Then I am on "/pipe-smoking-change"
234+
And I see a page title "Has the number of full pipe loads you normally smoke changed over time?"
235+
When I check "Yes, I used to smoke more than 25 full pipe loads a week"
236+
And I check "Yes, I used to smoke fewer than 25 full pipe loads a week"
237+
And I submit the form
238+
239+
Then I am on "/pipe-smoking-increased-frequency"
240+
And I see a page title "When you smoked more than 25 full pipe loads a week, how often did you smoke a pipe?"
241+
When I check "Daily"
242+
And I submit the form
243+
244+
Then I am on "/pipe-smoked-increased-amount"
245+
When I fill in "When you smoked more than 25 full pipe loads a week, roughly how many full pipe loads did you normally smoke a day?" with "12"
246+
And I submit the form
247+
248+
Then I am on "/pipe-smoked-increased-years"
249+
When I fill in "Roughly how many years did you smoke 12 full pipe loads a day?" with "10"
250+
And I submit the form
251+
252+
Then I am on "/pipe-smoking-decreased-frequency"
253+
When I check "Monthly"
254+
And I submit the form
255+
256+
Then I am on "/pipe-smoked-decreased-amount"
257+
When I fill in "When you smoked fewer than 25 full pipe loads a week, roughly how many full pipe loads did you normally smoke a month?" with "5"
258+
And I submit the form
259+
260+
Then I am on "/pipe-smoked-decreased-years"
261+
When I fill in "Roughly how many years did you smoke 5 full pipe loads a month?" with "4"
262+
And I submit the form
263+
264+
265+
# Medium cigars with only decreased
266+
Then I am on "/medium-cigars-smoking-current"
267+
And I see a page title "Do you currently smoke medium cigars?"
268+
When I check "Yes"
269+
And I submit the form
270+
271+
Then I am on "/medium-cigars-smoked-total-years"
272+
When I fill in "Roughly how many years have you smoked medium cigars?" with "8"
273+
And I submit the form
274+
275+
Then I am on "/medium-cigars-smoking-frequency"
276+
And I see a page title "How often do you smoke medium cigars?"
277+
When I check "Monthly"
278+
And I submit the form
279+
280+
Then I am on "/medium-cigars-smoked-amount"
281+
When I fill in "Roughly how many medium cigars do you currently smoke in a normal month?" with "9"
282+
And I submit the form
283+
284+
Then I am on "/medium-cigars-smoking-change"
285+
And I see a page title "Has the number of medium cigars you normally smoke changed over time?"
286+
When I check "Yes, I used to smoke fewer than 9 medium cigars a month"
287+
And I submit the form
288+
289+
Then I am on "/medium-cigars-smoking-decreased-frequency"
290+
And I see a page title "When you smoked fewer than 9 medium cigars a month, how often did you smoke medium cigars?"
291+
When I check "Weekly"
292+
And I submit the form
293+
294+
Then I am on "/medium-cigars-smoked-decreased-amount"
295+
When I fill in "When you smoked fewer than 9 medium cigars a month, roughly how many medium cigars did you normally smoke a week?" with "7"
296+
And I submit the form
297+
298+
Then I am on "/medium-cigars-smoked-decreased-years"
299+
When I fill in "Roughly how many years did you smoke 7 medium cigars a week?" with "3"
300+
And I submit the form
301+
302+
# Cigarillos with only increased
303+
Then I am on "/cigarillos-smoking-current"
304+
And I see a page title "Do you currently smoke cigarillos?"
305+
When I check "Yes"
306+
And I submit the form
307+
308+
Then I am on "/cigarillos-smoked-total-years"
309+
When I fill in "Roughly how many years have you smoked cigarillos?" with "4"
310+
And I submit the form
311+
312+
Then I am on "/cigarillos-smoking-frequency"
313+
And I see a page title "How often do you smoke cigarillos?"
314+
When I check "Monthly"
315+
And I submit the form
316+
317+
Then I am on "/cigarillos-smoked-amount"
318+
When I fill in "Roughly how many cigarillos do you currently smoke in a normal month?" with "2"
319+
And I submit the form
320+
321+
Then I am on "/cigarillos-smoking-change"
322+
And I see a page title "Has the number of cigarillos you normally smoke changed over time?"
323+
When I check "Yes, I used to smoke more than 2 cigarillos a month"
324+
And I submit the form
325+
326+
Then I am on "/cigarillos-smoking-increased-frequency"
327+
And I see a page title "When you smoked more than 2 cigarillos a month, how often did you smoke cigarillos?"
328+
When I check "Weekly"
329+
And I submit the form
330+
331+
Then I am on "/cigarillos-smoked-increased-amount"
332+
When I fill in "When you smoked more than 2 cigarillos a month, roughly how many cigarillos did you normally smoke a week?" with "4"
333+
And I submit the form
334+
335+
Then I am on "/cigarillos-smoked-increased-years"
336+
When I fill in "Roughly how many years did you smoke 4 cigarillos a week?" with "3"
337+
And I submit the form
338+
339+
# Check your answers
340+
Then I am on "/check-your-answers"
341+
342+
Then I see "15 years" as a response to "Total number of years you smoked cigarettes" under "Cigarette smoking history"
343+
And I see "10 cigarettes a day" as a response to "Current cigarette smoking" under "Cigarette smoking history"
344+
And I see "200 cigarettes a week for 5 years" as a response to "When you smoked more than 10 cigarettes a day" under "Cigarette smoking history"
345+
And I see "1 cigarettes a month for 2 years" as a response to "When you smoked fewer than 10 cigarettes a day" under "Cigarette smoking history"
346+
347+
Then I see "26 years" as a response to "Total number of years you smoked rolling tobacco" under "Rolling tobacco smoking history"
348+
And I see "25 grams of rolling tobacco a week" as a response to "Current rolling tobacco smoking" under "Rolling tobacco smoking history"
349+
And I see "12 grams of rolling tobacco a day for 10 years" as a response to "When you smoked more than 25 grams of rolling tobacco a week" under "Rolling tobacco smoking history"
350+
And I see "5 grams of rolling tobacco a month for 4 years" as a response to "When you smoked fewer than 25 grams of rolling tobacco a week" under "Rolling tobacco smoking history"
351+
352+
Then I see "26 years" as a response to "Total number of years you smoked a pipe" under "Pipe smoking history"
353+
And I see "25 full pipe loads a week" as a response to "Current pipe smoking" under "Pipe smoking history"
354+
And I see "12 full pipe loads a day for 10 years" as a response to "When you smoked more than 25 full pipe loads a week" under "Pipe smoking history"
355+
And I see "5 full pipe loads a month for 4 years" as a response to "When you smoked fewer than 25 full pipe loads a week" under "Pipe smoking history"
356+
357+
Then I see "8 years" as a response to "Total number of years you smoked medium cigars" under "Medium cigar smoking history"
358+
And I see "9 medium cigars a month" as a response to "Current medium cigar smoking" under "Medium cigar smoking history"
359+
And I see "7 medium cigars a week for 3 years" as a response to "When you smoked fewer than 9 medium cigars a month" under "Medium cigar smoking history"
360+
361+
Then I see "4 years" as a response to "Total number of years you smoked cigarillos" under "Cigarillo smoking history"
362+
And I see "2 cigarillos a month" as a response to "Current cigarillo smoking" under "Cigarillo smoking history"
363+
And I see "4 cigarillos a week for 3 years" as a response to "When you smoked more than 2 cigarillos a month" under "Cigarillo smoking history"
364+
365+
# Change cigarette smoking history
366+
When I click the link to change "Cigarette" smoking history
367+
368+
Then I am on "/cigarettes-smoking-current?change=True"
369+
When I check "Yes"
370+
And I submit the form
371+
372+
Then I am on "/cigarettes-smoked-total-years?change=True"
373+
When I fill in "Roughly how many years have you smoked cigarettes?" with "17"
374+
And I submit the form
375+
376+
Then I am on "/cigarettes-smoking-frequency?change=True"
377+
When I check "Monthly"
378+
And I submit the form
379+
380+
Then I am on "/cigarettes-smoked-amount?change=True"
381+
When I fill in "Roughly how many cigarettes do you currently smoke in a normal month?" with "25"
382+
And I submit the form
383+
384+
Then I am on "/cigarettes-smoking-change?change=True"
385+
When I check "Yes, I used to smoke more than 25 cigarettes a month"
386+
And I check "Yes, I used to smoke fewer than 25 cigarettes a month"
387+
And I submit the form
388+
389+
Then I am on "/cigarettes-smoking-increased-frequency?change=True"
390+
When I check "Daily"
391+
And I submit the form
392+
393+
Then I am on "/cigarettes-smoked-increased-amount?change=True"
394+
When I fill in "When you smoked more than 25 cigarettes a month, roughly how many cigarettes did you normally smoke a day?" with "40"
395+
And I submit the form
396+
397+
Then I am on "/cigarettes-smoked-increased-years?change=True"
398+
399+
When I go to "/check-your-answers"
400+
Then I see "17 years" as a response to "Total number of years you smoked cigarettes" under "Cigarette smoking history"
401+
And I see "25 cigarettes a month" as a response to "Current cigarette smoking" under "Cigarette smoking history"
402+
403+
And I see "40 cigarettes a day for 5 years" as a response to "When you smoked more than 25 cigarettes a month" under "Cigarette smoking history"

features/steps/debug_steps.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,11 @@ def screenshot(context, value=""):
1111
@step("I print eligibility")
1212
def print_eligibility(context):
1313
print("Is user eligible?: ", context.current_user.responseset_set.last().is_eligible())
14+
15+
16+
@step("I print smoking history")
17+
def print_smoking_history(context):
18+
histories = context.current_user.responseset_set.last().tobacco_smoking_history.all()
19+
print("Smoking history: ", histories.count())
20+
for history in histories:
21+
print("\nHistory: ", history.type, history.level)

features/steps/page_assertion_steps.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@ def then_i_see_a_back_link_to(context, url):
1010
back_link = context.page.locator(".nhsuk-back-link")
1111
expect(back_link).to_have_count(1)
1212
expect(back_link).to_have_attribute("href", url)
13+
14+
@then(u'I see a page title "{title}"')
15+
def then_i_see_a_page_title(context, title):
16+
expect(context.page.locator('h1')).to_have_text(title)

features/types_tobacco_smoking.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ Feature: Types tobacco smoking page
3434
And I have answered questions showing I have smoked for "10" years
3535
When I go to "/types-tobacco-smoking"
3636
And I check "Cigarettes"
37-
And I check "Cigars"
37+
And I check "Medium cigars"
3838
And I submit the form
3939
When I go to "/check-your-answers"
40-
Then I see "Cigarettes and Cigars" as a response to "Types of tobacco smoked" under "Smoking history"
40+
Then I see "Cigarettes and Medium cigars" as a response to "Types of tobacco smoked" under "Smoking history"
4141
And I see "/types-tobacco-smoking?change=True" as a link to change "Types of tobacco smoked" under "Smoking history"
4242
When I click the link to change "Types of tobacco smoked" under "Smoking history"
4343
Then I am on "/types-tobacco-smoking?change=True"
4444
And I see "Cigarettes" selected
45-
And I see "Cigars" selected
45+
And I see "Medium cigars" selected
4646
When I check "Pipe"
4747
And I click "Continue"
4848
Then I am on "/cigarettes-smoking-current"
4949
When I go to "/check-your-answers"
50-
Then I see "Cigarettes, Pipe, and Cigars" as a response to "Types of tobacco smoked" under "Smoking history"
50+
Then I see "Cigarettes, Pipe, and Medium cigars" as a response to "Types of tobacco smoked" under "Smoking history"

0 commit comments

Comments
 (0)