Skip to content

Commit b33955a

Browse files
committed
Use a common method for continuing the form in behave
1 parent 57ad291 commit b33955a

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

tests/features/steps/form_steps.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,73 +13,73 @@ def when_i_submit_my_participant_id(context):
1313
@when('I fill in and submit my smoking status with "{smoking_status}"')
1414
def when_i_fill_in_and_submit_my_smoking_status(context, smoking_status):
1515
context.page.get_by_label(smoking_status).check()
16-
context.page.click("text=Continue")
16+
when_i_submit_the_form(context)
1717

1818
@when('I fill in and submit my date of birth with "{date_of_birth}"')
1919
def when_i_fill_in_and_submit_my_date_of_birth(context, date_of_birth):
2020
day, month, year = date_of_birth.split('-')
2121
context.page.get_by_label('Day').fill(day)
2222
context.page.get_by_label('Month').fill(month)
2323
context.page.get_by_label('Year').fill(year)
24-
context.page.click("text=Continue")
24+
when_i_submit_the_form(context)
2525

2626
@when(u'I fill in and submit my date of birth as {years} years ago')
2727
def when_i_fill_in_and_submit_my_date_of_birth_as_x_years_ago(context, years):
2828
date_of_birth = datetime.now() - relativedelta(years=int(years))
2929
context.page.get_by_label('Day').fill(str(date_of_birth.day))
3030
context.page.get_by_label('Month').fill(str(date_of_birth.month))
3131
context.page.get_by_label('Year').fill(str(date_of_birth.year))
32-
context.page.click("text=Continue")
32+
when_i_submit_the_form(context)
3333

3434
@when(u'I fill in and submit my height with "{height}"')
3535
def when_i_fill_in_and_submit_my_height(context, height):
3636
context.page.get_by_label('Centimetre').fill(height)
37-
context.page.click("text=Continue")
37+
when_i_submit_the_form(context)
3838

3939
@when(u'I fill in and submit my height with "{feet}" feet and "{inches}" inch')
4040
@when(u'I fill in and submit my height with "{feet}" feet and "{inches}" inches')
4141
def when_i_fill_in_and_submit_my_height_with_feet_and_inches(context, feet, inches):
4242
context.page.get_by_label('Feet').fill(feet)
4343
context.page.get_by_label('Inches').fill(inches)
44-
context.page.click("text=Continue")
44+
when_i_submit_the_form(context)
4545

4646
@when(u'I fill in and submit my weight with "{weight}"')
4747
def when_i_fill_in_and_submit_my_weight(context, weight):
4848
context.page.get_by_label('Kilograms').fill(weight)
49-
context.page.click("text=Continue")
49+
when_i_submit_the_form(context)
5050

5151
@when(u'I fill in and submit my weight with "{stone}" stone and "{pounds}" pound')
5252
@when(u'I fill in and submit my weight with "{stone}" stone and "{pounds}" pounds')
5353
def stone_and_pounds(context, stone, pounds):
5454
context.page.get_by_label('Stone').fill(stone)
5555
context.page.get_by_label('Pounds').fill(pounds)
56-
context.page.click("text=Continue")
56+
when_i_submit_the_form(context)
5757

5858
@when(u'I fill in and submit my sex at birth with "{sex_at_birth}"')
5959
def when_i_fill_in_and_submit_my_sex_at_birth(context, sex_at_birth):
6060
context.page.get_by_label(sex_at_birth, exact=True).check()
61-
context.page.click("text=Continue")
61+
when_i_submit_the_form(context)
6262

6363
@when(u'I fill in and submit my gender with "{gender}"')
6464
def when_i_fill_in_and_submit_my_gender(context, gender):
6565
context.page.get_by_label(gender, exact=True).check()
66-
context.page.click("text=Continue")
66+
when_i_submit_the_form(context)
6767

6868
@when(u'I fill in and submit my ethnicity with "{ethnicity}"')
6969
def when_i_fill_in_and_submit_my_ethnicity(context, ethnicity):
7070
context.page.get_by_label(ethnicity, exact=True).check()
71-
context.page.click("text=Continue")
71+
when_i_submit_the_form(context)
7272

7373
@when(u'I fill in and submit my respiratory conditions with "{condition_a}" and "{condition_b}"')
7474
def when_i_fill_in_and_submit_my_respiratory_conditions(context, condition_a, condition_b):
7575
context.page.get_by_label(condition_a).check()
7676
context.page.get_by_label(condition_b).check()
77-
context.page.click("text=Continue")
77+
when_i_submit_the_form(context)
7878

7979
@when(u'I fill in and submit my asbestos exposure with "{asbestos_exposure}"')
8080
def when_i_fill_in_and_submit_my_asbestos_exposure(context, asbestos_exposure):
8181
context.page.get_by_label(asbestos_exposure, exact=True).check()
82-
context.page.click("text=Continue")
82+
when_i_submit_the_form(context)
8383

8484
@when('I submit the form')
8585
def when_i_submit_the_form(context):

0 commit comments

Comments
 (0)