Skip to content
Extraits de code Groupes Projets
Valider e7cf5fc8 rédigé par Sarah Mei's avatar Sarah Mei
Parcourir les fichiers

Fix/expand cucumber feature for new user signup.

Replace "wait for aspects page"-type steps with general wait for step.
parent 7bfaf462
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -49,7 +49,7 @@
%h4
= t('.aspect_name')
= form_for Aspect.new do |aspect|
= aspect.text_field :name, :style => "display:inline;"
= aspect.text_field :name, :id => "step-2-aspect-name", :style => "display:inline;"
%p.checkbox_select
= aspect.label :contacts_visible, t('aspects.edit.make_aspect_list_visible')
= aspect.check_box :contacts_visible, :default => true
......
......@@ -17,7 +17,7 @@ Feature: managing contact requests
When I am on the aspects manage page
Then I should see "1" within "#notification_badge"
When I click on the contact request
And I wait for the requestors profile page to load
And I wait for "the requestors profile" to load
Then I should be on the requestors profile
And I should see "wants to share with you"
......
......@@ -16,21 +16,22 @@ Feature: new user registration
And I fill in "profile_last_name" with "Hai"
And I fill in "profile_gender" with "guess!"
And I press "Save and continue"
And I wait for "step 2" to load
Then I should see "Profile updated"
And I should see "Your aspects"
When I fill in "step-2-aspect-name" with "cheez friends"
And I press "Add"
Then I should see "cheez friends"
# Not working with selenium - it thinks the aspect name field is hidden
# When I fill in "Aspect name" with "cheez friends"
# And I press "Add"
# And show me the page
# Then I should see "cheez friends"
When I follow "Save and continue"
And I wait for "step 3" to load
Then I should see "Your services"
When I follow "Save and continue"
And I wait for "step 4" to load
Then I should see "You're all set up, O!"
And I should not see "skip getting started"
But I should not see "skip getting started"
When I follow "Continue on to your Home page, an overview of all of your aspects."
Then I should be on the aspects page
......@@ -43,6 +44,6 @@ Feature: new user registration
Scenario: new user skips the setup wizard
When I follow "skip getting started"
And I wait for the aspects page to load
And I wait for "the aspects page" to load
Then I should be on the aspects page
And I should see "Bring the people that matter in your life to Diaspora!"
......@@ -47,14 +47,6 @@ Then /^I should see "([^\"]*)" in the main content area$/ do |stuff|
end
end
When /^I wait for the aspects page to load$/ do
wait_until { current_path == aspects_path }
end
When /^I wait for the requestors profile page to load$/ do
wait_until { current_path == person_path(Request.where(:recipient_id => @me.person.id).first.sender) }
end
When /^I wait for the ajax to finish$/ do
wait_until(10) { evaluate_script("$.active") == 0 }
end
......@@ -68,3 +60,12 @@ When /^I click ok in the confirm dialog to appear next$/ do
window.confirm = function() { return true; };
JS
end
When /^I wait for "([^\"]*)" to load$/ do |page_name|
wait_until(10) do
uri = URI.parse(current_url)
current_location = uri.path
current_location << "?#{uri.query}" unless uri.query.blank?
current_location == path_to(page_name)
end
end
\ No newline at end of file
module NavigationHelpers
def path_to(page_name)
case page_name
when /^the home page$/
root_path
when /^its ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path", @it)
when /^the ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path")
when /^my edit profile page$/
edit_person_path(@me.person)
when /^my acceptance form page$/
accept_user_invitation_path(:invitation_token => @me.invitation_token)
when /^the requestors profile$/
person_path(Request.where(:recipient_id => @me.person.id).first.sender)
when /^"([^\"]*)"'s page$/
person_path(User.find_by_email($1).person)
when /^my account settings page$/
edit_user_path(@me)
when /^"(\/.*)"/
$1
else
raise "Can't find mapping from \"#{page_name}\" to a path."
when /^the home page$/
root_path
when /^step (\d)$/
if $1.to_i == 1
getting_started_path
else
getting_started_path(:step => $1)
end
when /^its ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path", @it)
when /^the ([\w ]+) page$/
send("#{$1.gsub(/\W+/, '_')}_path")
when /^my edit profile page$/
edit_person_path(@me.person)
when /^my acceptance form page$/
accept_user_invitation_path(:invitation_token => @me.invitation_token)
when /^the requestors profile$/
person_path(Request.where(:recipient_id => @me.person.id).first.sender)
when /^"([^\"]*)"'s page$/
person_path(User.find_by_email($1).person)
when /^my account settings page$/
edit_user_path(@me)
when /^"(\/.*)"/
$1
else
raise "Can't find mapping from \"#{page_name}\" to a path."
end
end
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter