Skip to content

Commit

Permalink
Change Add buttons to Save buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
CatalinVoineag committed May 7, 2024
1 parent eba3116 commit eca248f
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 62 deletions.
2 changes: 1 addition & 1 deletion app/views/claims/schools/users/check.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<strong class="govuk-warning-text__text"><%= t(".warning", user_name: "#{@user_form.first_name} #{@user_form.last_name}", school_name: @school.name) %></strong>
</div>

<%= f.govuk_submit t(".add_user") %>
<%= f.govuk_submit t(".submit") %>

<p class="govuk-body">
<%= govuk_link_to(t(".cancel"), claims_school_users_path(@school), no_visited_state: true) %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/claims/support/schools/check.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<% end %>
<% end %>
<%= f.govuk_submit t(".add_organisation") %>
<%= f.govuk_submit t(".save_organisation") %>
<p class="govuk-body">
<%= govuk_link_to(t(".cancel"), claims_support_schools_path, no_visited_state: true) %>
</p>
Expand Down
2 changes: 1 addition & 1 deletion app/views/claims/support/schools/users/check.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<strong class="govuk-warning-text__text"><%= t(".warning", user_name: "#{@user_form.first_name} #{@user_form.last_name}", school_name: @school.name) %></strong>
</div>

<%= f.govuk_submit t(".add_user") %>
<%= f.govuk_submit t(".submit") %>

<p class="govuk-body">
<%= govuk_link_to(t(".cancel"), claims_support_school_users_path(@school), no_visited_state: true) %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/claims/schools/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ en:
page_title: Check your answers
title: Check your answers
caption: Add user
add_user: Add user
submit: Save user
cancel: Cancel
warning: "%{user_name} will be sent an email to tell them you’ve added them to %{school_name}."
change: Change
Expand Down
1 change: 1 addition & 0 deletions config/locales/en/claims/support/schools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ en:
title_with_error: "Error: Enter a school name, URN or postcode"
check:
add_organisation: Add organisation
save_organisation: Save organisation
address: Address
cancel: Cancel
contact_details: Contact details
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/claims/support/schools/claims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ en:
view_claims: View claims
check:
page_title: Check your answers
submit: Add claim
submit: Save claim
update: Update claim
grant_funding: Grant funding
add_claim: Add claim - %{school}
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/claims/support/schools/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ en:
check:
title: Check your answers
caption: Add user - %{school_name}
add_user: Add user
submit: Save user
cancel: Cancel
first_name: First name
last_name: Last name
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/claims/support/support_users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ en:
page_title: Check your answers - Add user
caption: Add user
title: Check your answers
submit: Add user
submit: Save user
cancel: Cancel
change: Change
warning: "%{user_name} will be sent an email to tell them you’ve added them to Claim funding for mentor training."
Expand Down
2 changes: 1 addition & 1 deletion config/locales/en/claims/support/users.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ en:
check:
title: Check your answers
caption: Add user
add_user: Add user
submit: Save user
cancel: Cancel
first_name: First name
last_name: Last name
Expand Down
20 changes: 10 additions & 10 deletions spec/system/claims/schools/users/invite_a_user_to_a_school_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
scenario "I sign in as a lead mentor user and invite a user to a school" do
sign_in_as_lead_mentor_user
visit_claims_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_on_add_user
when_i_click("Save user")
verify_user_added
end

scenario "I sign in as a lead mentor user and enter invalid user details" do
sign_in_as_lead_mentor_user
visit_claims_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_invalid_user_details
then_see_error_message
end
Expand All @@ -43,12 +43,12 @@
scenario "I try to add a user who already exists" do
sign_in_as_lead_mentor_user
visit_claims_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_on_add_user
when_i_click("Save user")
and_user_is_added
click_on_add_user
when_i_click("Add user")
fill_in_user_details
then_see_error_message_for_existing_user
end
Expand All @@ -61,14 +61,14 @@
scenario "I use back or change to edit my answers" do
sign_in_as_lead_mentor_user
visit_claims_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_back
check_form_is_populated
edit_first_name
check_user_details_updated
click_on_add_user
when_i_click("Save user")
verify_edited_user_added
end

Expand Down Expand Up @@ -166,8 +166,8 @@ def check_user_details
expect(page).to have_content("[email protected]")
end

def click_on_add_user
click_on "Add user"
def when_i_click(button)
click_on button
end

def click_back
Expand Down
8 changes: 4 additions & 4 deletions spec/system/claims/schools/users/view_users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
scenario "I sign in as a lead mentor user and invite a user to a school and view that users details" do
sign_in_as_lead_mentor_user
visit_claims_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
click_on_add_user
when_i_click("Save user")
show_user_details
end

Expand Down Expand Up @@ -49,7 +49,7 @@ def show_user_details
expect(page).to have_content("\nEmail [email protected]")
end

def click_on_add_user
click_on "Add user"
def when_i_click(button)
click_on button
end
end
6 changes: 3 additions & 3 deletions spec/system/claims/support/schools/add_a_school_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
when_i_click_the_dropdown_item_for("School 1")
and_i_click_continue
then_i_see_the_check_details_page_for_school("School 1")
when_i_click_add_organisation
when_i_click_save_organisation
then_i_return_to_support_organisations_index
and_a_school_is_listed(school_name: "School 1")
and_i_see_success_message
Expand Down Expand Up @@ -91,8 +91,8 @@ def then_i_see_the_check_details_page_for_school(school_name)
expect(org_name_row).to have_content(school_name)
end

def when_i_click_add_organisation
click_on "Add organisation"
def when_i_click_save_organisation
click_on "Save organisation"
end

def then_i_return_to_support_organisations_index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
then_i_choose("Manchester 1")
and_i_click_continue
then_i_see_the_check_details_page_for_school("Manchester 1")
when_i_click_add_organisation
when_i_click_save_organisation
then_i_return_to_support_organisations_index
and_a_school_is_listed(school_name: "Manchester 1")
end
Expand Down Expand Up @@ -105,8 +105,8 @@ def then_i_see_the_check_details_page_for_school(school_name)
expect(org_name_row).to have_content(school_name)
end

def when_i_click_add_organisation
click_on "Add organisation"
def when_i_click_save_organisation
click_on "Save organisation"
end

def then_i_return_to_support_organisations_index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
then_i_expect_the_provider_to_be_checked(provider2)
when_i_click("Continue")
then_i_check_my_answers(provider2, [mentor1, mentor2], [20, 12])
when_i_click("Add claim")
when_i_click("Save claim")
then_i_am_redirected_to_index_page(claim)
end

Expand All @@ -56,7 +56,7 @@
when_i_check_the_mentor(mentor2)
when_i_click("Continue")
then_i_check_my_answers(provider1, [mentor2], [12])
when_i_click("Add claim")
when_i_click("Save claim")
then_i_am_redirected_to_index_page(claim)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
when_i_choose_other_amount_and_input_hours(12)
when_i_click("Continue")
then_i_check_my_answers
when_i_click("Add claim")
when_i_click("Save claim")
then_i_am_redirectd_to_index_page(Claims::Claim.draft.first)
end

Expand Down Expand Up @@ -81,7 +81,7 @@
when_i_click("Continue")
then_i_check_my_answers
when_another_claim_with_same_mentors_has_been_created([mentor1, mentor2])
when_i_click("Add claim")
when_i_click("Save claim")
then_i_get_the_reject_page
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,62 +13,62 @@
scenario "I sign in as a support user and invite a user to a school" do
sign_in_as_support_user
visit_claims_support_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_on_add_user
when_i_click("Save user")
verify_user_added
end

scenario "I sign in as a support user and enter invalid user details" do
sign_in_as_support_user
visit_claims_support_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_invalid_user_details
then_see_error_message
end

scenario "I try to add a user who already exists" do
sign_in_as_support_user
visit_claims_support_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_on_add_user
when_i_click("Save user")
and_user_is_added
click_on_add_user
when_i_click("Add user")
fill_in_user_details
then_see_error_message_for_existing_user
end

scenario "I add a user to different schools" do
sign_in_as_support_user
visit_claims_support_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_on_add_user
when_i_click("Save user")
verify_user_added

visit_another_claims_support_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_on_add_user
when_i_click("Save user")
verify_user_added_to_another_school
end

scenario "I use back or change to edit my answers" do
sign_in_as_support_user
visit_claims_support_school_users_page
click_on_add_user
when_i_click("Add user")
fill_in_user_details
check_user_details
click_back
check_form_is_populated
edit_first_name
check_user_details_updated
click_on_add_user
when_i_click("Save user")
verify_edited_user_added
end

Expand Down Expand Up @@ -143,8 +143,8 @@ def check_user_details
expect(page).to have_content("[email protected]")
end

def click_on_add_user
click_on "Add user"
def when_i_click(button)
click_on button
end

def click_back
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@
scenario "Add a support user" do
given_i_sign_in_as(support_user)
and_i_visit_the_support_users_page
and_i_click_on_add_a_support_user
when_i_click("Add user")
and_i_fill_in_the_support_user_form(email_address: "[email protected]")
then_i_am_redirected_to_check_the_support_user_details
when_i_click_on_add_user
when_i_click("Save user")
then_i_see_the_support_user_has_been_added(email_address: "[email protected]")
and_an_email_is_sent_to_the_support_user(email_address: "[email protected]")
end

scenario "Attempt to add a support user without an @education.gov.uk email address" do
given_i_sign_in_as(support_user)
and_i_visit_the_support_users_page
and_i_click_on_add_a_support_user
when_i_click("Add user")
and_i_fill_in_the_support_user_form(email_address: "[email protected]")
then_i_see_an_error("Enter a Department for Education email address in the correct format, like [email protected]")
and_the_page_title_is("Error: Personal details - Add user - Claim funding for mentor training")
Expand All @@ -33,7 +33,7 @@
given_there_is_a_support_user_with(email_address: "[email protected]")
given_i_sign_in_as(support_user)
and_i_visit_the_support_users_page
and_i_click_on_add_a_support_user
when_i_click("Add user")
and_i_fill_in_the_support_user_form(email_address: "[email protected]")
then_i_see_an_error("Email address already in use")
and_the_page_title_is("Error: Personal details - Add user - Claim funding for mentor training")
Expand All @@ -42,12 +42,12 @@
scenario "Make changes while adding a support user" do
given_i_sign_in_as(support_user)
and_i_visit_the_support_users_page
and_i_click_on_add_a_support_user
when_i_click("Add user")
and_i_fill_in_the_support_user_form(email_address: "[email protected]")
and_i_click_on_a_change_link
then_i_should_see_the_support_user_form_with(email_address: "[email protected]")
when_i_fill_in_the_support_user_form(email_address: "[email protected]")
and_i_click_on_add_user
when_i_click("Save user")
then_i_see_the_support_user_has_been_added(email_address: "[email protected]")
and_an_email_is_sent_to_the_support_user(email_address: "[email protected]")
end
Expand Down Expand Up @@ -85,10 +85,9 @@ def then_i_am_redirected_to_check_the_support_user_details
expect(page).to have_content "[email protected]"
end

def when_i_click_on_add_user
click_on "Add user"
def when_i_click(button)
click_on button
end
alias_method :and_i_click_on_add_user, :when_i_click_on_add_user

def then_i_see_the_support_user_has_been_added(email_address:)
expect(page).to have_content "User added"
Expand Down
Loading

0 comments on commit eca248f

Please sign in to comment.