diff --git a/app/views/users/registrations/edit.html.erb b/app/views/users/registrations/edit.html.erb index 1ac19f557..c27d23e93 100644 --- a/app/views/users/registrations/edit.html.erb +++ b/app/views/users/registrations/edit.html.erb @@ -18,8 +18,10 @@ <%= devise_error_messages! %> <% end %> - - <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, "data-for" => "avatar" }) do |f| %> + <%= form_for(resource, + as: resource_name, + url: registration_path(resource_name), + html: { method: :put, "data-for" => "avatar", id: 'user-avatar-field' }) do |f| %> <%= hidden_field_tag "user[change_avatar]", "true" %>
@@ -54,12 +56,11 @@
<% end %> - <%= form_for(resource, as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "full_name", class: 'settings-page-full-name' }) do |f| %> + html: { method: :put, "data-for" => "full_name", class: 'settings-page-full-name', id: 'user-full_name-field' }) do |f| %>
<%= f.label t("users.registrations.edit.name_label") %> @@ -90,7 +91,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "initials", class: 'settings-page-initials' }) do |f| %> + html: { method: :put, "data-for" => "initials", class: 'settings-page-initials', id: 'user-initials-field' }) do |f| %>
<%= f.label t("users.registrations.edit.initials_label") %> @@ -121,7 +122,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "email", class: 'settings-page-email' }) do |f| %> + html: { method: :put, "data-for" => "email", class: 'settings-page-email', id: 'user-email-field' }) do |f| %>
<%= f.label t("users.registrations.edit.email_label") %> @@ -148,7 +149,7 @@
<%= f.label :current_password, t("users.registrations.edit.current_password_label") %> <%=t "users.registrations.edit.password_explanation" %> - <%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear" %> + <%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear", id: 'edit-email-current-password' %>
<%=t "general.cancel" %> @@ -162,7 +163,7 @@ as: resource_name, url: registration_path(resource_name, format: :json), remote: true, - html: { method: :put, "data-for" => "password", class: 'settings-page-change-password' }) do |f| %> + html: { method: :put, "data-for" => "password", class: 'settings-page-change-password', id: 'user-password-field' }) do |f| %> <%= hidden_field_tag "user[change_password]", "true" %>
@@ -180,7 +181,7 @@

<%=t "users.registrations.edit.password_title" %>

<%= f.label :current_password, t("users.registrations.edit.current_password_label") %> <%=t "users.registrations.edit.password_explanation" %> - <%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear" %> + <%= f.password_field :current_password, autocomplete: "off", class: "form-control", "data-role" => "clear", id: 'edit-password-current-password' %>
diff --git a/features/settings_page/profile.feature b/features/settings_page/profile.feature index 0e76e5cb1..92b491112 100644 --- a/features/settings_page/profile.feature +++ b/features/settings_page/profile.feature @@ -71,7 +71,7 @@ Scenario: Successfully changes user email Given I'm on the profile page Then I click on Edit on ".settings-page-email" input field And I change "nonadmin@myorg.com" with "user@myorg.com" email - And I fill in "mypassword1234" in "Current password" field of ".settings-page-email" form + And I fill in "mypassword1234" in "#edit-email-current-password" field of ".settings-page-email" form Then I click "Update" button And I should see "user@myorg.com" in ".settings-page-email" input field @@ -79,9 +79,9 @@ Scenario: Successfully changes user email Scenario: Unsuccessful Password Change, password is too short Given I'm on the profile page Then I click on Edit on ".settings-page-change-password" input field - And I fill in "mypassword1234" in "Current password" field of ".settings-page-change-password" form - And I fill in "mypass" in "New password" field of ".settings-page-change-password" form - And I fill in "mypass" in "New password confirmation" field of ".settings-page-change-password" form + And I fill in "mypassword1234" in "#edit-password-current-password" field of ".settings-page-change-password" form + And I fill in "mypass" in "#user_password" field of ".settings-page-change-password" form + And I fill in "mypass" in "#user_password_confirmation" field of ".settings-page-change-password" form Then I click "Update" button And I should see "is too short (minimum is 8 characters)" @@ -89,9 +89,9 @@ Scenario: Unsuccessful Password Change, password is too short Scenario: Unsuccessful Password Change, passwords does not match Given I'm on the profile page Then I click on Edit on ".settings-page-change-password" input field - And I fill in "mypassword1234" in "Current password" field of ".settings-page-change-password" form - And I fill in "mypassword5678" in "New password" field of ".settings-page-change-password" form - And I fill in "mypassword56788" in "New password confirmation" field of ".settings-page-change-password" form + And I fill in "mypassword1234" in "#edit-password-current-password" field of ".settings-page-change-password" form + And I fill in "mypassword5678" in "#user_password" field of ".settings-page-change-password" form + And I fill in "mypassword56788" in "#user_password_confirmation" field of ".settings-page-change-password" form Then I click "Update" button And I should see "doesn't match" @@ -99,9 +99,9 @@ Scenario: Unsuccessful Password Change, passwords does not match Scenario: Unsuccessful Password Change, current password is invalid Given I'm on the profile page Then I click on Edit on ".settings-page-change-password" input field - And I fill in "mypassword123" in "Current password" field of ".settings-page-change-password" form - And I fill in "mypassword5678" in "New password" field of ".settings-page-change-password" form - And I fill in "mypassword5678" in "New password confirmation" field of ".settings-page-change-password" form + And I fill in "mypassword123" in "#edit-password-current-password" field of ".settings-page-change-password" form + And I fill in "mypassword5678" in "#user_password" field of ".settings-page-change-password" form + And I fill in "mypassword5678" in "#user_password_confirmation" field of ".settings-page-change-password" form Then I click "Update" button And I should see "is invalid" @@ -109,8 +109,8 @@ Scenario: Unsuccessful Password Change, current password is invalid Scenario: Successful Password Change Given I'm on the profile page Then I click on Edit on ".settings-page-change-password" input field - And I fill in "mypassword1234" in "Current password" field of ".settings-page-change-password" form - And I fill in "mypassword5678" in "New password" field of ".settings-page-change-password" form - And I fill in "mypassword5678" in "New password confirmation" field of ".settings-page-change-password" form + And I fill in "mypassword1234" in "#edit-password-current-password" field of ".settings-page-change-password" form + And I fill in "mypassword5678" in "#user_password" field of ".settings-page-change-password" form + And I fill in "mypassword5678" in "#user_password_confirmation" field of ".settings-page-change-password" form Then I click "Update" button And I should see "Password successfully updated." flash message diff --git a/features/step_definitions/profile_steps.rb b/features/step_definitions/profile_steps.rb index 61808280f..e8173a64d 100644 --- a/features/step_definitions/profile_steps.rb +++ b/features/step_definitions/profile_steps.rb @@ -17,6 +17,6 @@ end Then(/^I fill in "([^"]*)" in "([^"]*)" field of "([^"]*)" form$/) do |password, field, form_id| within form_id do - fill_in field, with: password + find(field).set(password) end end