Commit b6bc2eac authored by Florian Staudacher's avatar Florian Staudacher
Browse files

Merge pull request #3401 from Raven24/fix-registration-form-validations

fix client-side validations in registration form
parents f3d98315 994bfd4a
......@@ -19,7 +19,7 @@
<%= t('.sign_up') %>
</h4>
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => "form-horizontal block-form", :autocomplete => "off"}, :validate => true) do |f| %>
<%= form_for(resource, :validate => true, :url => registration_path(resource_name), :html => {:class => "form-horizontal block-form", :autocomplete => "off"}) do |f| %>
<fieldset>
<div class="control-group">
<label class="control-label" for="user_email">
......
......@@ -36,3 +36,26 @@ Feature: new user registration
And I wait for 3 seconds
And I go to the home page
Then I should not see "Welcome to Diaspora"
Scenario: user fills in bogus data - client side validation
When I log out manually
And I go to the new user registration page
And I fill in "user_username" with "§$%&(/&%$&/=)(/"
And I press "Continue"
Then the "user_username" field should have a validation error
And the "user_email" field should have a validation error
And the "user_password" field should have a validation error
When I fill in "user_username" with "valid_user"
And I fill in "user_email" with "this is not a valid email $%&/()("
And I press "Continue"
Then the "user_email" field should have a validation error
And the "user_password" field should have a validation error
When I fill in "user_email" with "valid@email.com"
And I fill in "user_password" with "1"
And I press "Continue"
Then the "user_password" field should have a validation error
\ No newline at end of file
......@@ -8,6 +8,10 @@ And /^I submit the form$/ do
click_button :submit
end
Then /^the "([^"]*)" field should have a validation error$/ do |field|
find_field(field).has_xpath?(".//ancestor::div[contains(@class, 'control-group')]/div[contains(@class, 'field_with_errors')]")
end
And /^I expand the publisher$/ do
click_publisher
end
......
......@@ -39,3 +39,7 @@ end
When /^I (?:log|sign) out$/ do
logout
end
When /^I (?:log|sign) out manually$/ do
manual_logout
end
\ No newline at end of file
......@@ -42,6 +42,7 @@ module UserCukeHelpers
login_as @me.username, @me.password
end
# checks the page content to see, if the login was successful
def confirm_login
wait_until { page.has_content?("#{@me.first_name} #{@me.last_name}") }
end
......@@ -51,6 +52,11 @@ module UserCukeHelpers
$browser.delete_cookie('_session', 'path=/') if $browser
$browser.delete_all_visible_cookies if $browser
end
def manual_logout
find("#user_menu li:first-child a").click
find("#user_menu li:last-child a").click
end
end
World(UserCukeHelpers)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment