should fix remaining failing cukes from captcha and removal of client-side-validations gem

This commit is contained in:
Florian Staudacher 2014-02-22 00:37:05 +01:00
parent 061ae52e4d
commit e2adaa07a2
10 changed files with 52 additions and 30 deletions

View file

@ -3,11 +3,7 @@ Feature: invitation acceptance
Scenario: accept invitation from admin
Given I have been invited by an admin
And I am on my acceptance form page
And I fill in the following:
| user_username | ohai |
| user_email | woot@sweet.com |
| user_password | secret |
| user_password_confirmation | secret |
And I fill in the new user form
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!"
@ -21,11 +17,7 @@ Feature: invitation acceptance
Scenario: accept invitation from user
Given I have been invited by bob
And I am on my acceptance form page
And I fill in the following:
| user_username | ohai |
| user_email | woot@sweet.com |
| user_password | secret |
| user_password_confirmation | secret |
And I fill in the new user form
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!"

View file

@ -3,12 +3,7 @@ Feature: new user registration
Background:
When I go to the new user registration page
And I fill in the following:
| user_username | ohai |
| user_email | ohai@example.com |
| user_password | secret |
| user_password_confirmation | secret |
| user_captcha | 123456 |
And I fill in the new user form
And I press "Continue"
Then I should be on the getting started page
And I should see "Well, hello there!" and "Who are you?" and "What are you into?"
@ -52,16 +47,19 @@ Feature: new user registration
And I fill in the following:
| user_username | $%&(/&%$&/=)(/ |
And I press "Continue"
Then I should see a flash message containing "Email can't be blank - Password can't be blank - Username is invalid."
Then I should not be able to sign up
And I should have a validation error on "user_username, user_password, user_email"
When I fill in the following:
| user_username | valid_user |
| user_email | this is not a valid email $%&/()( |
And I press "Continue"
Then I should see a flash message containing "Email is invalid - Password can't be blank"
Then I should not be able to sign up
And I should have a validation error on "user_password, user_email"
When I fill in the following:
| user_email | valid@email.com |
| user_password | 1 |
And I press "Continue"
Then I should see a flash message containing "Password doesn't match confirmation - Password is too short (minimum is 6 characters)"
Then I should not be able to sign up
And I should have a validation error on "user_password, user_password_confirmation"

View file

@ -3,11 +3,7 @@ Feature: editing the gettig started in the mobile view
Scenario: editing gettig started fields
When I go to the new user registration page
And I fill in the following:
| user_username | amparito |
| user_email | amp@arito.com |
| user_password | secret |
| user_password_confirmation | secret |
And I fill in the new user form
And I press "Continue"
And I visit the mobile getting started page
And I should see "Well, hello there!" and "Who are you?" and "What are you into?"

View file

@ -277,3 +277,7 @@ Given /^"([^"]*)" is hidden$/ do |selector|
page.should have_selector(selector, visible: false)
page.should_not have_selector(selector)
end
Then(/^I should have a validation error on "(.*?)"$/) do |field_list|
check_fields_validation_error field_list
end

View file

@ -58,3 +58,7 @@ end
When /^I (?:log|sign) out manually$/ do
manual_logout
end
Then(/^I should not be able to sign up$/) do
confirm_not_signed_up
end

View file

@ -206,10 +206,7 @@ Given /^I visit alice's invitation code url$/ do
end
When /^I fill in the new user form$/ do
step 'I fill in "user_username" with "ohai"'
step 'I fill in "user_email" with "ohai@example.com"'
step 'I fill in "user_password" with "secret"'
step 'I fill in "user_password_confirmation" with "secret"'
fill_in_new_user_form
end
And /^I should be able to friend Alice$/ do

View file

@ -169,8 +169,7 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |
end
Then /^(?:|I )should be on (.+)$/ do |page_name|
current_path = URI.parse(current_url).path
current_path.should == path_to(page_name)
confirm_on_page(page_name)
end
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|

View file

@ -16,6 +16,18 @@ module ApplicationCukeHelpers
selector &&= "#flash_#{selector}"
find(selector || '.message', {match: :first}.merge(opts))
end
def confirm_form_validation_error(element)
is_invalid = page.evaluate_script("$('#{element}').is(':invalid')")
is_invalid.should be_true
end
def check_fields_validation_error(field_list)
field_list.split(',').each do |f|
confirm_form_validation_error('input#'+f.strip)
end
end
end
World(ApplicationCukeHelpers)

View file

@ -65,6 +65,11 @@ module NavigationHelpers
find(await_elem.delete(:selector), await_elem)
end
end
def confirm_on_page(page_name)
current_path = URI.parse(current_url).path
current_path.should == path_to(page_name)
end
end
World(NavigationHelpers)

View file

@ -59,6 +59,17 @@ module UserCukeHelpers
find("#user_menu li:last-child a").click
end
def fill_in_new_user_form
fill_in('user_username', with: 'ohai')
fill_in('user_email', with: 'ohai@example.com')
fill_in('user_password', with: 'secret')
fill_in('user_password_confirmation', with: 'secret')
# captcha needs to be filled out, because the field is required (HTML5)
# in test env, the captcha will always pass successfully
fill_in('user_captcha', with: '123456')
end
# fill change password section on the user edit page
def fill_change_password_section(cur_pass, new_pass, confirm_pass)
fill_in 'user_current_password', :with => cur_pass
@ -87,6 +98,10 @@ module UserCukeHelpers
find(".button").click
end
def confirm_not_signed_up
confirm_on_page('the new user registration page')
confirm_form_validation_error('form#new_user')
end
end
World(UserCukeHelpers)