Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prevent submission if password is not included #5250

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<p class='form__field__instructions'>
<%= t('.enter_password') %>
</p>
<%= form.password_field :password, autocomplete: 'current-password', class: 'form__input' %>
<%= form.password_field :password, autocomplete: 'current-password', class: 'form__input', required: true %>
</div>


Expand Down
13 changes: 13 additions & 0 deletions test/integration/profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,19 @@ def sign_out
assert page.has_link?("@nick1", href: "https://twitter.com/nick1")
end

test "adding X(formerly Twitter) username without filling in your password" do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: I need to write the test in the system folder

fullscreen_headless_chrome_driver

sign_in
visit profile_path("nick1")

click_link "Edit Profile"
fill_in "user_twitter_username", with: "nick1twitter"
click_button "Update"
puts page.html


assert_content("please fill in your password")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not be readable by capybara because it's browser generated.

What if you click submit, comment about what's happening (browser halted submit because password is required), then filled the password and submitted again and check that the new value is saved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! I had to write this as a system test rather than an integration test since the system test runs the test on actual chrome.

end

test "deleting profile" do
sign_in
visit profile_path("nick1")
Expand Down
Loading