Skip to content

Commit

Permalink
update style in line with review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dp-daly authored and Kizr committed Jan 17, 2025
1 parent 02cddff commit 0d36b34
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ def and_i_am_signed_in_using_two_tabs
def when_i_am_on_the_mentors_index_page_in_the_first_tab
within_window @windows.first do
visit placements_school_mentors_path(@school)
expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(page).to have_h1("Mentors at your school")
expect(page).to have_element(:p, text: "Add mentors to be able to assign them to your placements.", class: "govuk-body")
expect(page).to have_link("Add mentor", href: "/schools/#{@school.id}/mentors/new")
Expand All @@ -72,9 +72,9 @@ def when_i_am_on_the_mentors_index_page_in_the_first_tab
def when_i_am_on_the_mentors_index_page_in_the_second_tab
within_window @windows.second do
visit placements_school_mentors_path(@school)
expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(page).to have_h1("Mentors at your school")
expect(page).to have_element(:p, text: "Add mentors to be able to assign them to your placements.", class: "govuk-body")
expect(page).to have_link("Add mentor", href: "/schools/#{@school.id}/mentors/new")
Expand All @@ -95,19 +95,19 @@ def and_i_click_on_add_mentor_in_the_second_tab

def then_i_see_the_tab_one_find_mentor_page
within_window @windows.first do
expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(page).to have_element(:span, text: "Mentor details", class: "govuk-caption-l")
expect(page).to have_h1("Find teacher")
end
end

def then_i_see_the_tab_two_find_mentor_page
within_window @windows.second do
expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(page).to have_element(:span, text: "Mentor details", class: "govuk-caption-l")
expect(page).to have_h1("Find teacher")
end
Expand Down Expand Up @@ -152,18 +152,18 @@ def and_i_click_on_continue_in_the_second_tab

def then_i_see_the_tab_one_confirm_mentor_details_page
within_window @windows.first do
expect(page).to have_title("Confirm mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Confirm mentor details - Manage school placements - GOV.UK")
expect(page).to have_h1("Confirm mentor details")
end
end

def then_i_see_the_tab_two_confirm_mentor_details_page
within_window @windows.second do
expect(page).to have_title("Confirm mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Confirm mentor details - Manage school placements - GOV.UK")
expect(page).to have_h1("Confirm mentor details")
end
end
Expand All @@ -176,11 +176,11 @@ def when_i_click_on_change_in_the_first_tab

def then_i_see_the_find_mentor_form_with_the_trn_and_date_of_birth_prefilled_for_mister_bergstrom
within_window @windows.first do
find_field "TRN", with: "1111111"
expect(page).to have_field("TRN", with: "1111111")

find_field "Day", with: "7"
find_field "Month", with: "2"
find_field "Year", with: "1949"
expect(page).to have_field("Day", with: "7")
expect(page).to have_field("Month", with: "2")
expect(page).to have_field("Year", with: "1949")
end
end

Expand Down Expand Up @@ -210,15 +210,19 @@ def then_i_see_a_success_message_for_otto_mann

def and_i_see_the_mentors_index_page_with_mister_bergstrom_listed
within_window @windows.first do
expect(page).to have_element(:a, text: "Mister Bergstrom", class: "govuk-link")
expect(page).to have_element(:td, text: "1111111", class: "govuk-table__cell")
expect(page).to have_table_row({
"Name" => "Mister Bergstrom",
"Teacher reference number (TRN)" => "1111111",
})
end
end

def and_i_see_the_mentors_index_page_with_otto_mann_listed
within_window @windows.second do
expect(page).to have_element(:a, text: "Otto Mann", class: "govuk-link")
expect(page).to have_element(:td, text: "3333333", class: "govuk-table__cell")
expect(page).to have_table_row({
"Name" => "Otto Mann",
"Teacher reference number (TRN)" => "3333333",
})
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
and_i_am_signed_in

when_i_am_on_the_mentors_index_page
and_i_click_on_add_mentor
then_i_see_the_mentor_details

when_i_click_on_add_mentor
then_i_see_the_find_mentor_page

when_i_enter_the_trn_and_date_of_birth_for_an_existing_claims_mentor
Expand Down Expand Up @@ -41,23 +43,28 @@ def and_i_am_signed_in
end

def when_i_am_on_the_mentors_index_page
page.find(".app-primary-navigation__nav").click_on("Mentors")
expect(primary_navigation).to have_current_item("Mentors")
within ".app-primary-navigation__nav" do
click_on "Mentors"
end
end

def then_i_see_the_mentor_details
expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_h1("Mentors at your school")
expect(page).to have_element(:p, text: "Add mentors to be able to assign them to your placements.", class: "govuk-body")
expect(page).to have_link("Add mentor", href: "/schools/#{@school.id}/mentors/new")
end

def and_i_click_on_add_mentor
def when_i_click_on_add_mentor
click_on "Add mentor"
end

def then_i_see_the_find_mentor_page
expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(page).to have_element(:span, text: "Mentor details", class: "govuk-caption-l")
expect(page).to have_h1("Find teacher")
end
Expand Down Expand Up @@ -94,9 +101,9 @@ def teaching_record_valid_response
end

def then_i_see_the_confirm_mentor_details_page
expect(page).to have_title("Confirm mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Confirm mentor details - Manage school placements - GOV.UK")
expect(page).to have_h1("Confirm mentor details")
expect(page).to have_element(:p, text: "Once added, you will be able to assign them to placements.", class: "govuk-body")
expect(page).to have_h2("Mentor")
Expand All @@ -110,11 +117,11 @@ def when_i_click_on_change
end

def then_i_see_the_find_mentor_form_with_the_trn_and_date_of_birth_prefilled_for_edna_krabappel
find_field "TRN", with: "6666666"
expect(page).to have_field("TRN", with: "6666666")

find_field "Day", with: "14"
find_field "Month", with: "9"
find_field "Year", with: "1991"
expect(page).to have_field("Day", with: "14")
expect(page).to have_field("Month", with: "9")
expect(page).to have_field("Year", with: "1991")
end

def when_i_click_on_confirm_and_add_mentor
Expand All @@ -126,7 +133,9 @@ def then_i_see_a_success_message_for_edna_krapabbel
end

def and_i_see_the_mentors_index_page_with_edna_krabappel_listed
expect(page).to have_element(:a, text: "Edna Krabappel", class: "govuk-link")
expect(page).to have_element(:td, text: "6666666", class: "govuk-table__cell")
expect(page).to have_table_row({
"Name" => "Edna Krabappel",
"Teacher reference number (TRN)" => "6666666",
})
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
private

def given_the_mentor_and_school_exist
@school = create(:school, :placements, name: "Springfield Elementary")
@placements_mentor = create(:placements_mentor, trn: "7777777", first_name: "Elizabeth", last_name: "Hoover")
@school = build(:school, :placements, name: "Springfield Elementary")
@placements_mentor = build(:placements_mentor, trn: "7777777", first_name: "Elizabeth", last_name: "Hoover")
create(:placements_mentor_membership, school: @school, mentor: @placements_mentor)
end

Expand All @@ -32,9 +32,9 @@ def and_i_am_signed_in

def when_i_am_on_the_mentors_index_page
page.find(".app-primary-navigation__nav").click_on("Mentors")
expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(page).to have_h1("Mentors at your school")
expect(page).to have_element(:p, text: "Add mentors to be able to assign them to your placements.", class: "govuk-body")
expect(page).to have_link("Add mentor", href: "/schools/#{@school.id}/mentors/new")
Expand All @@ -45,9 +45,9 @@ def and_i_click_on_add_mentor
end

def then_i_see_the_find_mentor_page
expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(page).to have_element(:span, text: "Mentor details", class: "govuk-caption-l")
expect(page).to have_h1("Find teacher")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
and_i_am_signed_in

when_i_am_on_the_mentors_index_page
and_i_click_on_add_mentor
then_i_see_the_mentor_details

when_i_click_on_add_mentor
then_i_see_the_find_mentor_page

when_i_click_on_help_with_the_trn
Expand Down Expand Up @@ -46,32 +48,36 @@
private

def given_mentor_and_school_exists
@school = build(:school, :placements, name: "Springfield Elementary")
@new_mentor = build(:placements_mentor, first_name: "Mister", last_name: "Bergstrom")
@school = create(:school, :placements, name: "Springfield Elementary")
end

def and_i_am_signed_in
given_i_am_signed_in_as_a_placements_user(organisations: [@school])
end

def when_i_am_on_the_mentors_index_page
page.find(".app-primary-navigation__nav").click_on("Mentors")
expect(primary_navigation).to have_current_item("Mentors")
within ".app-primary-navigation__nav" do
click_on "Mentors"
end
end

def then_i_see_the_mentor_details
expect(page).to have_title("Mentors at your school - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_h1("Mentors at your school")
expect(page).to have_element(:p, text: "Add mentors to be able to assign them to your placements.", class: "govuk-body")
expect(page).to have_link("Add mentor", href: "/schools/#{@school.id}/mentors/new")
end

def and_i_click_on_add_mentor
def when_i_click_on_add_mentor
click_on "Add mentor"
end

def then_i_see_the_find_mentor_page
expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_title("Find teacher - Mentor details - Manage school placements - GOV.UK")
expect(page).to have_element(:span, text: "Mentor details", class: "govuk-caption-l")
expect(page).to have_h1("Find teacher")
expect(page).to have_element(:label, text: "Teacher reference number (TRN)", class: "govuk-label")
Expand Down Expand Up @@ -127,7 +133,7 @@ def when_i_clear_the_date_of_birth
end

def and_i_enter_a_trn
fill_in "TRN", with: @new_mentor.trn
fill_in "TRN", with: "8888888"
end

def then_i_see_a_validation_error_for_not_entering_a_date_of_birth
Expand All @@ -154,8 +160,8 @@ def when_i_enter_valid_data_that_does_not_exist_in_the_teaching_record_service
end

def then_i_see_the_no_results_page
expect(primary_navigation).to have_current_item("Mentors")
expect(page).to have_title("No results found for ‘8888888’ - Mentor not found - Manage school placements - GOV.UK")
expect(primary_navigation).to have_current_item("Mentors")

expect(page).to have_element(:span, text: "Mentor not found", class: "govuk-caption-l")
expect(page).to have_h1("No results found for ‘8888888’")
Expand All @@ -167,11 +173,11 @@ def when_i_click_on_change_your_search
end

def then_i_see_the_find_mentor_form_with_the_trn_and_date_of_birth_prefilled
find_field "TRN", with: "8888888"
expect(page).to have_field("TRN", with: "8888888")

find_field "Day", with: "14"
find_field "Month", with: "9"
find_field "Year", with: "1991"
expect(page).to have_field("Day", with: "14")
expect(page).to have_field("Month", with: "9")
expect(page).to have_field("Year", with: "1991")
end

def stub_no_results_teaching_record_response
Expand Down

0 comments on commit 0d36b34

Please sign in to comment.