Cucumber/spec cleanup. Removed some stray aspect.firsts, which should improve reliability across databases. Removed some cucumber steps we don't use & consolidated duplicate steps.
This commit is contained in:
parent
58161b006a
commit
2d6c2f0b60
9 changed files with 51 additions and 128 deletions
|
|
@ -8,7 +8,7 @@ Feature: Close Account
|
|||
Given I am signed in
|
||||
When I click on my name in the header
|
||||
And I follow "settings"
|
||||
And I click ok in the confirm dialog to appear next
|
||||
And I preemptively confirm the alert
|
||||
And I follow "Close Account"
|
||||
Then I should be on the home page
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ Feature: Close Account
|
|||
Then I sign in as "bob@bob.bob"
|
||||
When I click on my name in the header
|
||||
And I follow "settings"
|
||||
And I click ok in the confirm dialog to appear next
|
||||
And I preemptively confirm the alert
|
||||
And I follow "Close Account"
|
||||
Then I sign in as "alice@alice.alice"
|
||||
And I am on the home page
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ Feature: User manages contacts
|
|||
And I follow "People"
|
||||
And I follow "Edit People"
|
||||
And I wait for the ajax to finish
|
||||
And I click ok in the confirm dialog to appear next
|
||||
And I preemptively confirm the alert
|
||||
And I press "Delete" in the modal window
|
||||
Then I should be on the contacts page
|
||||
And I should not see "People" within "#aspect_nav"
|
||||
|
|
@ -37,7 +37,7 @@ Feature: User manages contacts
|
|||
When I am on the home page
|
||||
And I click on "People" aspect edit icon
|
||||
And I wait for the ajax to finish
|
||||
And I click ok in the confirm dialog to appear next
|
||||
And I preemptively confirm the alert
|
||||
And I press "Delete" in the modal window
|
||||
Then I should be on the aspects page
|
||||
And I should not see "People" within "#aspect_nav"
|
||||
|
|
@ -58,8 +58,9 @@ Feature: User manages contacts
|
|||
And I wait for the ajax to finish
|
||||
Then I should have 0 contacts in "Cat People"
|
||||
|
||||
Scenario: scrolling through contacts index
|
||||
Scenario: infinite scroll on contacts index
|
||||
Given I am signed in
|
||||
And I resize my window to 800x600
|
||||
And I have 60 contacts
|
||||
And I am on the contacts page
|
||||
Then I should see 25 contacts
|
||||
|
|
@ -70,7 +71,6 @@ Feature: User manages contacts
|
|||
When I scroll down
|
||||
Then I should see 60 contacts
|
||||
|
||||
|
||||
Scenario: clicking on the contacts link in the header with zero contacts directs a user to the featured users page
|
||||
Given I am signed in
|
||||
And I have 0 contacts
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@ Feature: posting
|
|||
Scenario: post to all aspects
|
||||
Given I expand the publisher
|
||||
When I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
And I press "Share"
|
||||
And I follow "Your Aspects"
|
||||
And I press "Share"
|
||||
And I follow "Your Aspects"
|
||||
Then I should see "I am eating a yogurt" within ".stream_element"
|
||||
|
||||
Scenario: post a photo without text
|
||||
|
|
@ -90,43 +90,43 @@ Feature: posting
|
|||
Scenario: hide a post
|
||||
Given I expand the publisher
|
||||
When I fill in "status_message_fake_text" with "Here is a post for you to hide"
|
||||
And I press "Share"
|
||||
And I wait for the ajax to finish
|
||||
And I press "Share"
|
||||
And I wait for the ajax to finish
|
||||
|
||||
And I log out
|
||||
And I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
And I log out
|
||||
And I sign in as "alice@alice.alice"
|
||||
And I am on "bob@bob.bob"'s page
|
||||
|
||||
And I hover over the ".stream_element"
|
||||
And I preemptively confirm the alert
|
||||
And I click to delete the first post
|
||||
And I wait for the ajax to finish
|
||||
And I go to "bob@bob.bob"'s page
|
||||
Then I should not see "Here is a post for you to hide"
|
||||
And I am on the aspects page
|
||||
Then I should not see "Here is a post for you to hide"
|
||||
And I hover over the ".stream_element"
|
||||
And I preemptively confirm the alert
|
||||
And I click to delete the first post
|
||||
And I wait for the ajax to finish
|
||||
And I go to "bob@bob.bob"'s page
|
||||
Then I should not see "Here is a post for you to hide"
|
||||
And I am on the aspects page
|
||||
Then I should not see "Here is a post for you to hide"
|
||||
|
||||
Scenario: delete a post
|
||||
Given I expand the publisher
|
||||
When I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
And I press "Share"
|
||||
And I wait for the ajax to finish
|
||||
And I follow "Your Aspects"
|
||||
And I hover over the ".stream_element"
|
||||
And I preemptively confirm the alert
|
||||
And I click to delete the first post
|
||||
And I wait for the ajax to finish
|
||||
And I follow "Your Aspects"
|
||||
Then I should not see "I am eating a yogurt"
|
||||
And I press "Share"
|
||||
And I wait for the ajax to finish
|
||||
And I follow "Your Aspects"
|
||||
And I hover over the ".stream_element"
|
||||
And I preemptively confirm the alert
|
||||
And I click to delete the first post
|
||||
And I wait for the ajax to finish
|
||||
And I follow "Your Aspects"
|
||||
Then I should not see "I am eating a yogurt"
|
||||
|
||||
Scenario Outline: post to one aspect
|
||||
When I follow "PostTo"
|
||||
And I wait for the ajax to finish
|
||||
And I expand the publisher
|
||||
And I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
And I press "Share"
|
||||
And I am on the aspects page
|
||||
And I follow "<aspect>" within "#aspect_nav"
|
||||
And I wait for the ajax to finish
|
||||
And I expand the publisher
|
||||
And I fill in "status_message_fake_text" with "I am eating a yogurt"
|
||||
And I press "Share"
|
||||
And I am on the aspects page
|
||||
And I follow "<aspect>" within "#aspect_nav"
|
||||
Then I should <see> "I am eating a yogurt"
|
||||
|
||||
Examples:
|
||||
|
|
|
|||
|
|
@ -61,10 +61,6 @@ When /^I click to delete the first post$/ do
|
|||
page.execute_script('$(".stream_element").first().find(".stream_element_delete").first().click()')
|
||||
end
|
||||
|
||||
When /^I click to delete the ([\d])(nd|rd|st|th) post$/ do |number, stuff|
|
||||
page.execute_script('$(".stream_element:nth-child('+ number +'").first().find(".stream_element_delete").first().click()')
|
||||
end
|
||||
|
||||
When /^I click to delete the first comment$/ do
|
||||
page.execute_script('$(".comment.posted").first().find(".comment_delete").click()')
|
||||
end
|
||||
|
|
@ -91,12 +87,6 @@ When /^(.*) in the modal window$/ do |action|
|
|||
end
|
||||
end
|
||||
|
||||
When /^(.*) in the aspect list$/ do |action|
|
||||
within('#aspect_list') do
|
||||
When action
|
||||
end
|
||||
end
|
||||
|
||||
When /^I press the first "([^"]*)"(?: within "([^"]*)")?$/ do |link_selector, within_selector|
|
||||
with_scope(within_selector) do
|
||||
find(:css, link_selector).click
|
||||
|
|
@ -121,12 +111,6 @@ Then /^(?:|I )should not see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector,
|
|||
end
|
||||
end
|
||||
|
||||
Then /^I should see "([^\"]*)" in the main content area$/ do |stuff|
|
||||
within("#main_stream") do
|
||||
Then "I should see #{stuff}"
|
||||
end
|
||||
end
|
||||
|
||||
When /^I wait for the ajax to finish$/ do
|
||||
wait_until(10) { evaluate_script("$.active") == 0 }
|
||||
end
|
||||
|
|
@ -151,12 +135,6 @@ When /^I attach the file "([^\"]*)" to hidden element "([^\"]*)"(?: within "([^\
|
|||
JS
|
||||
end
|
||||
|
||||
When /^I click ok in the confirm dialog to appear next$/ do
|
||||
evaluate_script <<-JS
|
||||
window.confirm = function() { return true; };
|
||||
JS
|
||||
end
|
||||
|
||||
Then /^I should get download alert$/ do
|
||||
page.evaluate_script("window.alert = function() { return true; }")
|
||||
end
|
||||
|
|
@ -170,15 +148,6 @@ When /^I search for "([^\"]*)"$/ do |search_term|
|
|||
JS
|
||||
end
|
||||
|
||||
Then /^I should( not)? see an add contact button$/ do |not_see|
|
||||
expected_length = not_see ? 0 : 1
|
||||
evaluate_script("$('.add_contact a').length == #{expected_length};")
|
||||
end
|
||||
|
||||
When /^I click on the add contact button$/ do
|
||||
page.execute_script("$('.add_contact a').click();")
|
||||
end
|
||||
|
||||
Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)"$/ do |field, selector, value|
|
||||
with_scope(selector) do
|
||||
field = find_field(field)
|
||||
|
|
@ -206,14 +175,6 @@ And /^I scroll down$/ do
|
|||
wait_until(10) { evaluate_script('$("#infscr-loading:visible").length') == 0 }
|
||||
end
|
||||
|
||||
When /^I wait for (\d+) seconds?$/ do |seconds|
|
||||
sleep seconds.to_i
|
||||
end
|
||||
|
||||
When /^I click the notification badge$/ do
|
||||
find(:css, "#notification_badge a").click
|
||||
end
|
||||
|
||||
Then /^the notification dropdown should be visible$/ do
|
||||
find(:css, "#notification_dropdown").should be_visible
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,3 +2,7 @@ When 'I debug' do
|
|||
debugger
|
||||
true
|
||||
end
|
||||
|
||||
When /^I wait for (\d+) seconds?$/ do |seconds|
|
||||
sleep seconds.to_i
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,11 +1,6 @@
|
|||
And /^Alice has a post mentioning Bob$/ do
|
||||
alice = User.find_by_email 'alice@alice.alice'
|
||||
bob = User.find_by_email 'bob@bob.bob'
|
||||
aspect = alice.aspects.first
|
||||
alice.post(:status_message, :text => "@{Bob Jones; #{bob.person.diaspora_handle}}", :to => alice.aspects.first)
|
||||
end
|
||||
|
||||
When /^I fill in a mention for bob into the publisher$/ do
|
||||
bob = User.find_by_email 'bob@bob.bob'
|
||||
And 'I fill in "status_message_fake_text" with "Hi, @{Bob Jones; #{bob.person.diaspora_handle}} long time no see'
|
||||
end
|
||||
aspect = alice.aspects.where(:name => "Besties").first
|
||||
alice.post(:status_message, :text => "@{Bob Jones; #{bob.person.diaspora_handle}}", :to => aspect)
|
||||
end
|
||||
|
|
@ -1,14 +1,3 @@
|
|||
Given /^I am signed in as the following (\w+):$/ do |role, table|
|
||||
Given %(the following #{role}:), table
|
||||
@me = @it
|
||||
Given 'I am signed in'
|
||||
end
|
||||
|
||||
Given /^I (?:am signed|sign) in as an? (\w+)$/ do |role|
|
||||
@me = Factory(role.to_sym)
|
||||
Given 'I am signed in'
|
||||
end
|
||||
|
||||
Given /^(?:I am signed in|I sign in)$/ do
|
||||
When %(I try to sign in)
|
||||
wait_until { page.has_content?("#{@me.first_name} #{@me.last_name}") }
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ Given /^a user with username "([^\"]*)" and password "([^\"]*)"$/ do |username,
|
|||
@me.reload
|
||||
end
|
||||
|
||||
Given /^that I am a rock star$/ do
|
||||
Given('a user with username "awesome" and password "totallyawesome"')
|
||||
end
|
||||
|
||||
Given /^a user with email "([^\"]*)"$/ do |email|
|
||||
user = Factory(:user, :email => email, :password => 'password',
|
||||
:password_confirmation => 'password', :getting_started => false)
|
||||
|
|
@ -62,17 +58,6 @@ When /^I have user with username "([^"]*)" in an aspect called "([^"]*)"$/ do |u
|
|||
contact.aspects << @me.aspects.find_by_name(aspect)
|
||||
end
|
||||
|
||||
|
||||
Given /^I have one follower$/ do
|
||||
other_user = Factory(:user)
|
||||
other_aspect = other_user.aspects.create!(:name => "meh")
|
||||
other_user.share_with(@me.person, other_aspect)
|
||||
|
||||
other_user.reload
|
||||
other_aspect.reload
|
||||
@me.reload
|
||||
end
|
||||
|
||||
Given /^a user with email "([^"]*)" is connected with "([^"]*)"$/ do |arg1, arg2|
|
||||
user1 = User.where(:email => arg1).first
|
||||
user2 = User.where(:email => arg2).first
|
||||
|
|
@ -82,7 +67,7 @@ end
|
|||
Given /^a user with username "([^"]*)" is connected with "([^"]*)"$/ do |arg1, arg2|
|
||||
user1 = User.where(:username => arg1).first
|
||||
user2 = User.where(:username => arg2).first
|
||||
connect_users(user1, user1.aspects.first, user2, user2.aspects.first)
|
||||
connect_users(user1, user1.aspects.where(:name => "Besties").first, user2, user2.aspects.where(:name => "Besties").first)
|
||||
end
|
||||
|
||||
Given /^there is a user "([^\"]*)" who's tagged "([^\"]*)"$/ do |full_name, tag|
|
||||
|
|
@ -101,7 +86,7 @@ Given /^many posts from alice for bob$/ do
|
|||
time_fulcrum = Time.now - 40000
|
||||
time_interval = 1000
|
||||
(1..40).each do |n|
|
||||
post = alice.post :status_message, :text => "#{alice.username} - #{n} - #seeded", :to => alice.aspects.first.id
|
||||
post = alice.post :status_message, :text => "#{alice.username} - #{n} - #seeded", :to => alice.aspects.where(:name => "generic").first.id
|
||||
post.created_at = time_fulcrum - time_interval
|
||||
post.updated_at = time_fulcrum + time_interval
|
||||
post.save
|
||||
|
|
@ -122,19 +107,6 @@ When /^I (add|remove|toggle) the person (to|from) my ([\d])(nd|rd|st|th) aspect$
|
|||
}
|
||||
end
|
||||
|
||||
When /^I add the person to a new aspect called "([^\"]*)"$/ do |aspect_name|
|
||||
steps %Q{
|
||||
And I press the first ".toggle.button"
|
||||
|
||||
And I press click ".new_aspect" within ".dropdown.active"
|
||||
And I fill in "#aspect_name" with "#{aspect_name}"
|
||||
And I submit the form
|
||||
|
||||
And I wait for the ajax to finish
|
||||
And I press the first ".toggle.button"
|
||||
}
|
||||
end
|
||||
|
||||
When /^I post a status with the text "([^\"]*)"$/ do |text|
|
||||
@me.post(:status_message, :text => text, :public => true, :to => 'all')
|
||||
end
|
||||
|
|
@ -191,9 +163,9 @@ Given /^I have (\d+) contacts$/ do |n|
|
|||
Contact.import(contacts)
|
||||
contacts = @me.contacts.limit(n.to_i)
|
||||
|
||||
aspect_id = @me.aspects.first.id
|
||||
aspect_id = @me.aspects.length == 1 ? @me.aspects.first.id : @me.aspects.where(:name => "Besties").first.id
|
||||
contacts.each do |contact|
|
||||
aspect_memberships << AspectMembership.new(:contact_id => contact.id, :aspect_id => @me.aspects.first.id)
|
||||
aspect_memberships << AspectMembership.new(:contact_id => contact.id, :aspect_id => aspect_id)
|
||||
end
|
||||
AspectMembership.import(aspect_memberships)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module HelperMethods
|
||||
def connect_users_with_aspects(u1,u2)
|
||||
connect_users(u1, u1.aspects.first, u2, u2.aspects.first)
|
||||
def connect_users_with_aspects(u1, u2)
|
||||
aspect1 = u1.aspects.length == 1 ? u1.aspects.first : u1.aspects.where(:name => "Besties").first
|
||||
aspect2 = u2.aspects.length == 1 ? u2.aspects.first : u2.aspects.where(:name => "Besties").first
|
||||
connect_users(u1, aspect1, u2, aspect2)
|
||||
end
|
||||
def connect_users(user1, aspect1, user2, aspect2)
|
||||
user1.contacts.create!(:person => user2.person,
|
||||
|
|
|
|||
Loading…
Reference in a new issue