File tree Expand file tree Collapse file tree 6 files changed +39
-2
lines changed
app/controllers/teacher_interface
support/autoload/page_objects/teacher_interface Expand file tree Collapse file tree 6 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,8 @@ def edit_contact
242
242
contact_job : work_history . contact_job ,
243
243
contact_email : work_history . contact_email ,
244
244
)
245
+
246
+ @form . validate if @work_history . invalid_email_domain_for_contact?
245
247
end
246
248
247
249
def update_contact
Original file line number Diff line number Diff line change @@ -211,6 +211,8 @@ def edit_contact
211
211
contact_job : work_history . contact_job ,
212
212
contact_email : work_history . contact_email ,
213
213
)
214
+
215
+ @form . validate if @work_history . invalid_email_domain_for_contact?
214
216
end
215
217
216
218
def update_contact
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ class EditOtherEnglandWorkHistoryContact < SitePrism::Page
12
12
"#teacher-interface-work-history-contact-form-contact-job-field"
13
13
element :email_input ,
14
14
"#teacher-interface-work-history-contact-form-contact-email-field"
15
+ element :email_input_with_error ,
16
+ "#teacher-interface-work-history-contact-form-contact-email-field-error"
15
17
16
18
element :continue_button , ".govuk-button:not(.govuk-button--secondary)"
17
19
element :save_and_come_back_later_button ,
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ class EditWorkHistoryContact < SitePrism::Page
12
12
"#teacher-interface-work-history-contact-form-contact-job-field"
13
13
element :email_input ,
14
14
"#teacher-interface-work-history-contact-form-contact-email-field"
15
+ element :email_input_with_error ,
16
+ "#teacher-interface-work-history-contact-form-contact-email-field-error"
15
17
16
18
element :continue_button , ".govuk-button:not(.govuk-button--secondary)"
17
19
element :save_and_come_back_later_button ,
Original file line number Diff line number Diff line change 118
118
119
119
when_i_click_the_other_england_work_history_task
120
120
then_i_see_the ( :teacher_edit_other_england_work_history_contact_page )
121
+ and_i_see_error_message_for_email_address_using_public_domain
121
122
122
- when_i_fill_in_the_contact_information
123
+ when_i_update_the_contact_email_with_error
123
124
then_i_see_the ( :teacher_check_other_england_work_history_page )
124
125
125
126
when_i_click_continue
@@ -256,6 +257,15 @@ def when_i_fill_in_the_contact_information
256
257
. click
257
258
end
258
259
260
+ def when_i_update_the_contact_email_with_error
261
+ teacher_edit_other_england_work_history_contact_page . form . email_input_with_error . fill_in with :
262
+ "contact@example.com"
263
+ teacher_edit_other_england_work_history_contact_page
264
+ . form
265
+ . continue_button
266
+ . click
267
+ end
268
+
259
269
def and_i_see_the_other_england_work_history_information ( name :)
260
270
summary_list_rows = teacher_check_work_history_page . summary_list . rows
261
271
@@ -355,6 +365,12 @@ def when_i_delete_work_history
355
365
teacher_delete_other_england_work_history_page . form . continue_button . click
356
366
end
357
367
368
+ def and_i_see_error_message_for_email_address_using_public_domain
369
+ expect ( teacher_edit_work_history_contact_page ) . to have_content (
370
+ "Enter an official email address that uses the institution’s domain" ,
371
+ )
372
+ end
373
+
358
374
def teacher
359
375
@teacher ||= create ( :teacher )
360
376
end
Original file line number Diff line number Diff line change 139
139
140
140
when_i_click_the_work_history_task
141
141
then_i_see_the ( :teacher_edit_work_history_contact_page )
142
+ and_i_see_error_message_for_email_address_using_public_domain
142
143
143
- when_i_fill_in_the_contact_information
144
+ when_i_update_the_contact_email_with_error
144
145
then_i_see_the ( :teacher_check_work_history_page )
145
146
146
147
when_i_click_continue
@@ -347,6 +348,12 @@ def when_i_fill_in_the_contact_information
347
348
teacher_edit_work_history_contact_page . form . continue_button . click
348
349
end
349
350
351
+ def when_i_update_the_contact_email_with_error
352
+ teacher_edit_work_history_contact_page . form . email_input_with_error . fill_in with :
353
+ "contact@example.com"
354
+ teacher_edit_work_history_contact_page . form . continue_button . click
355
+ end
356
+
350
357
def and_i_see_the_work_history_information
351
358
summary_list_rows = teacher_check_work_history_page . summary_list . rows
352
359
@@ -583,6 +590,12 @@ def and_i_see_one_work_history
583
590
expect ( teacher_check_work_histories_page . summary_cards . count ) . to eq ( 1 )
584
591
end
585
592
593
+ def and_i_see_error_message_for_email_address_using_public_domain
594
+ expect ( teacher_edit_work_history_contact_page ) . to have_content (
595
+ "Enter an official email address that uses the institution’s domain" ,
596
+ )
597
+ end
598
+
586
599
def teacher
587
600
@teacher ||= create ( :teacher )
588
601
end
You can’t perform that action at this time.
0 commit comments