11from behave import given
2- from datetime import datetime
3- from dateutil .relativedelta import relativedelta
2+
3+ from features .steps .form_steps import (
4+ when_i_fill_in_and_submit_my_date_of_birth_as_x_years_ago ,
5+ when_i_submit_the_form ,
6+ when_i_check_label ,
7+ when_i_fill_in_label_with_value
8+ )
9+
410from lung_cancer_screening .questions .tests .factories .have_you_ever_smoked_response_factory import (
511 ResponseSetFactory ,
612)
@@ -23,6 +29,7 @@ def get_or_create_response_set(context):
2329 )
2430 )
2531
32+
2633@given ('I have answered have you ever smoked with an eligible response' )
2734def given_i_have_answered_have_your_ever_smoked_with_an_eligible_response (context ):
2835 response_set = get_or_create_response_set (context )
@@ -57,3 +64,16 @@ def given_i_have_answered_questions_showing_i_have_smoked_for_years_years(contex
5764 response_set = response_set ,
5865 value = response_set .date_of_birth_response .age_in_years () - int (years ),
5966 )
67+
68+ @given ('I have answered questions showing I am aged "{years}" years old' )
69+ def given_i_have_answered_questions_showing_i_am_aged_60_years_old (context , years ):
70+ context .page .goto (f"{ context .live_server_url } /date-of-birth" )
71+ when_i_fill_in_and_submit_my_date_of_birth_as_x_years_ago (context , years )
72+
73+
74+ @given ('I have answered questions showing I stopped smoking for "{years}" years' )
75+ def given_i_have_answered_questions_showing_i_stopped_smoking_for_years_years (context , years ):
76+ context .page .goto (f"{ context .live_server_url } /periods-when-you-stopped-smoking" )
77+ when_i_check_label (context , "Yes" )
78+ when_i_fill_in_label_with_value (context , "Enter the total number of years you stopped smoking for" , years )
79+ when_i_submit_the_form (context )
0 commit comments