bump capybara

* removed wait_until where possible
* replaced wait_until with DOM obersavtions
* added match: :first to all finders that assumed getting the first element
* replaced evaluate_script with execute_script where possible
* replaced a few execute_script with DOM observations through Capybara
* removed sleep where possible
* replaced sleep with DOM obersvations
* replaced "wait for ajax" with DOM obersavations
* replaced alert confirmation with new selenium API
* bump selenium webdriver
* made any other fixes to get green again
This commit is contained in:
Jonne Haß 2013-07-21 22:40:04 +02:00
parent cdc29e449d
commit 300752fc87
50 changed files with 226 additions and 375 deletions

View file

@ -160,7 +160,7 @@ group :development do
gem 'guard-rspec', '3.0.1'
gem 'rb-fsevent', '0.9.3', :require => false
gem 'rb-inotify', '0.9.0', :require => false
# Preloading environment
gem 'guard-spork', '1.5.0'
@ -176,9 +176,9 @@ group :test do
# Cucumber (integration tests)
gem 'capybara', '1.1.3'
gem 'capybara', '2.1.0'
gem 'database_cleaner', '1.0.1'
gem 'selenium-webdriver', '2.32.1'
gem 'selenium-webdriver', '2.33.0'
# General helpers

View file

@ -45,13 +45,12 @@ GEM
bootstrap-sass (2.2.2.0)
sass (~> 3.2)
builder (3.0.4)
capybara (1.1.3)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
xpath (~> 2.0)
carrierwave (0.8.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
@ -214,7 +213,7 @@ GEM
mobile-fu (1.2.1)
rack-mobile-detect
rails
multi_json (1.7.6)
multi_json (1.7.7)
multipart-post (1.2.0)
mysql2 (0.3.11)
nested_form (0.3.2)
@ -348,7 +347,7 @@ GEM
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
selenium-webdriver (2.32.1)
selenium-webdriver (2.33.0)
childprocess (>= 0.2.5)
multi_json (~> 1.0)
rubyzip
@ -406,7 +405,7 @@ GEM
crack (>= 0.3.2)
websocket (1.0.7)
will_paginate (3.0.4)
xpath (0.1.4)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
@ -419,7 +418,7 @@ DEPENDENCIES
addressable (= 2.3.4)
asset_sync (= 0.5.4)
bootstrap-sass (= 2.2.2.0)
capybara (= 1.1.3)
capybara (= 2.1.0)
carrierwave (= 0.8.0)
client_side_validations (= 3.2.5)
compass-rails (= 1.0.3)
@ -476,7 +475,7 @@ DEPENDENCIES
rspec-rails (= 2.13.2)
ruby-oembed (= 0.8.8)
sass-rails (= 3.2.6)
selenium-webdriver (= 2.32.1)
selenium-webdriver (= 2.33.0)
sidekiq (= 2.11.1)
sinatra (= 1.3.3)
sinon-rails (= 1.4.2.1)

View file

@ -17,9 +17,9 @@ app.views.Aspect = app.views.Base.extend({
toggleAspect: function(evt){
if (evt) { evt.preventDefault(); };
this.model.toggleSelected();
this.$el.toggleClass('active');
this.$el.find('.icons-check_yes_ok').toggleClass('invisible')
this.model.toggleSelected();
app.router.aspects_stream();
},

View file

@ -14,8 +14,8 @@ Feature: invitation acceptance
And I fill in the following:
| profile_first_name | O |
And I preemptively confirm the alert
And I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page
Scenario: accept invitation from user
@ -32,8 +32,8 @@ Feature: invitation acceptance
And I fill in the following:
| profile_first_name | O |
And I preemptively confirm the alert
And I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page
And I log out
And I sign in as "bob@bob.bob"

View file

@ -5,11 +5,8 @@ Feature: The activity stream
When I sign in as "bob@bob.bob"
And I post "A- I like turtles"
And I wait for 1 second
And I post "B- barack obama is your new bicycle"
And I wait for 1 second
And I post "C- barack obama is a square"
And I wait for 1 second
When I go to the activity stream page
Then "C- barack obama is a square" should be post 1
@ -17,11 +14,8 @@ Feature: The activity stream
And "A- I like turtles" should be post 3
When I like the post "A- I like turtles"
And I wait for 1 second
And I comment "Sassy sawfish" on "C- barack obama is a square"
And I wait for 1 second
And I like the post "B- barack obama is your new bicycle"
And I wait for 1 second
When I go to the activity stream page
Then "B- barack obama is your new bicycle" should be post 1

View file

@ -17,7 +17,6 @@ Feature: Viewing my activity on the steam mobile page
Scenario: Show post on my activity
When I click on selector "a.image_link.like_action.inactive"
And I wait for the ajax to finish
And I click on selector "img.my_activity"
Then I should see "My Activity"
And I should see "Hello! i am #newhere" within ".ltr"

View file

@ -12,20 +12,15 @@ Feature: Blocking a user from the stream
Scenario: Blocking a user
When I am on the home page
And I preemptively confirm the alert
And I wait for the ajax to finish
When I click on the first block button
And I confirm the alert
And I am on the home page
And I wait for the ajax to finish
Then I should not see any posts in my stream
Scenario: Blocking a user from the profile page
When I am on the home page
And I follow "Alice Smith"
And I wait for the ajax to finish
And I preemptively confirm the alert
And I wait for the ajax to finish
When I click on the first block button
And I confirm the alert
And I am on the home page
And I wait for the ajax to finish
Then I should not see any posts in my stream

View file

@ -9,8 +9,8 @@ Feature: Close Account
When I go to the users edit page
And I follow "Close Account"
And I put in my password in "close_account_password" in the modal window
And I preemptively confirm the alert
And I press "Close Account" in the modal window
And I confirm the alert
Then I should be on the new user session page
When I try to sign in manually
@ -29,8 +29,8 @@ Feature: Close Account
When I go to the users edit page
And I follow "Close Account"
And I put in my password in "close_account_password" in the modal window
And I preemptively confirm the alert
And I press "Close Account" in the modal window
And I confirm the alert
Then I sign in as "alice@alice.alice"
And I am on the home page
Then I should see "Bob Jones"

View file

@ -20,7 +20,6 @@ Feature: commenting
And I fill in the following:
| text | is that a poodle? |
And I press "Comment"
And I wait for the ajax to finish
Then I should see "is that a poodle?" within ".comment"
And I should see "less than a minute ago" within ".comment time"
@ -32,11 +31,8 @@ Feature: commenting
And I fill in the following:
| text | is that a poodle? |
And I press "Comment"
And I wait for the ajax to finish
When I hover over the ".comment"
And I preemptively confirm the alert
And I click to delete the first comment
And I wait for the ajax to finish
And I confirm the alert
Then I should not see "is that a poodle?"
Scenario: expand the comment form in the main stream and an individual aspect stream
@ -59,5 +55,6 @@ Feature: commenting
When I follow "less than a minute ago"
Then I should see "Look at this dog"
And I make a show page comment "I think thats a cat"
Then I should see "less than a minute ago" within "#post-comments"
When I go to "alice@alice.alice"'s page
Then I should see "I think thats a cat"

View file

@ -6,7 +6,7 @@ Feature: following and being followed
| email |
| bob@bob.bob |
| alice@alice.alice |
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I add the person to my "Besties" aspect
@ -16,7 +16,7 @@ Feature: following and being followed
And I fill in the following:
| status_message_fake_text | I am following you |
And I press "Share"
Then I go to the destroy user session page
Then I sign out
Scenario: seeing a follower's posts on their profile page, but not in your stream
When I sign in as "alice@alice.alice"
@ -35,7 +35,7 @@ Feature: following and being followed
And I press the first ".toggle" within "#publisher"
And I press the first ".public" within "#publisher"
And I press "Share"
And I go to the destroy user session page
And I sign out
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
@ -49,7 +49,6 @@ Feature: following and being followed
And I am on "bob@bob.bob"'s page
And I add the person to my "Besties" aspect
And I wait for the ajax to finish
And I add the person to my "Unicorns" aspect
When I go to the home page
@ -59,7 +58,7 @@ Feature: following and being followed
When I am on the home page
And I post "I am following you back"
Then I go to the destroy user session page
Then I sign out
When I sign in as "bob@bob.bob"
Then I should have 1 contacts in "Besties"
@ -73,15 +72,13 @@ Feature: following and being followed
And I press the first ".toggle.button"
And I press the first "a" within ".add_aspect"
And I wait for the ajax to finish
And I fill in "Name" with "Super People" in the modal window
And I press "Create" in the modal window
And I wait for the ajax to finish
When I go to the home page
Then I should have 1 contact in "Super People"
Then I go to the destroy user session page
Then I sign out
When I sign in as "bob@bob.bob"
Then I should have 1 contact in "Besties"
@ -90,7 +87,7 @@ Feature: following and being followed
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
Then I should see "Besties" and "Mention"
Then I should see "Besties" and "Mention"
Then I should not see "Message" within "#profile"
Scenario: interacting with the profile page of someone who follows you but who you do not follow
@ -105,9 +102,7 @@ Feature: following and being followed
And I am on "bob@bob.bob"'s page
When I add the person to my "Besties" aspect
And I wait for the ajax to finish
And I add the person to my "Unicorns" aspect
And I wait for the ajax to finish
When I go to "bob@bob.bob"'s page
Then I should see "All Aspects" and "Mention" and "Message"

View file

@ -8,4 +8,4 @@ Feature: Download Photos
And I follow "settings"
Then I should be on my account settings page
And I follow "download my photos"
Then I should get download alert
Then I confirm the alert

View file

@ -40,9 +40,8 @@ Feature: editing your profile
And I should see "#starwars" within "ul#as-selections-tags"
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I preemptively confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see a "img" within "#profile_photo_upload"
When I go to my new profile page

View file

@ -11,7 +11,7 @@ Feature: editing the profile in the mobile view
| profile_last_name | Fett |
| profile_bio | This is a bio |
| profile_location | Kamino |
And I select "1986" from "profile_date_year"
And I select "30" from "profile_date_day"
And I select "November" from "profile_date_month"
@ -35,16 +35,15 @@ Feature: editing the profile in the mobile view
When I fill in "profile[tag_string]" with "#kamino"
And I press the first ".as-result-item" within ".as-results"
And I press "Update Profile"
Then I should see "#kamino" within "ul#as-selections-tags"
And I should see "#starwars" within "ul#as-selections-tags"
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I preemptively confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see a "img" within "#profile_photo_upload"
When I go to my new profile page
And I should see "Boba Fett"

View file

@ -6,17 +6,16 @@ Feature: posting
Background:
Given following users exist:
| username |
| username |
| bob |
| alice |
When I sign in as "bob@bob.bob"
And I post a status with the text "I am da #boss"
When I go to the destroy user session page
When I sign out
And I sign in as "alice@alice.alice"
And I search for "#boss"
And I press "Follow #boss"
And I wait for the ajax to finish
Scenario: can post a message from the tag page
Then I should see "#boss" within "#publisher"
@ -42,8 +41,7 @@ Feature: posting
Scenario: can stop following a tag from the homepage
When I go to the followed tags stream page
And I preemptively confirm the alert
And I hover over the "li.unfollow#tag-following-boss"
And I follow "unfollow_boss"
And I wait for the ajax to finish
And I confirm the alert
Then I should not see "#tag-following-boss" within ".left_nav"

View file

@ -14,9 +14,8 @@ Feature: editing the gettig started in the mobile view
And I should see "amparito"
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I preemptively confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see a "img" within "#profile_photo_upload"
When I fill in "follow_tags" with "#men"

View file

@ -10,7 +10,6 @@ Feature: Keyboard navigation
Scenario: navigate downwards
When I am on the home page
When I wait for the ajax to finish
And I press the "J" key somewhere
Then post 1 should be highlighted
And I should have navigated to the highlighted post
@ -18,22 +17,20 @@ Feature: Keyboard navigation
When I press the "J" key somewhere
Then post 2 should be highlighted
And I should have navigated to the highlighted post
Given I expand the publisher
When I press the "J" key in the publisher
Then post 2 should be highlighted
Scenario: navigate upwards
When I am on the home page
When I wait for the ajax to finish
And I scroll to post 3
When I press the "K" key somewhere
Then post 2 should be highlighted
And I should have navigated to the highlighted post
Scenario: expand the comment form in the main stream
When I am on the home page
When I wait for the ajax to finish
Then the first comment field should be closed
When I press the "J" key somewhere
And I press the "C" key somewhere

View file

@ -26,9 +26,8 @@ Feature: User manages contacts
When I am on the contacts page
And I follow "People"
And I follow "add contacts to People"
And I wait for the ajax to finish
And I preemptively confirm the alert
And I press "Delete" in the modal window
And I confirm the alert
Then I should be on the contacts page
And I should not see "People" within "#aspect_nav"
@ -37,9 +36,8 @@ Feature: User manages contacts
And I have an aspect called "People"
When I am on the aspects page
And I click on "People" aspect edit icon
And I wait for the ajax to finish
And I preemptively confirm the alert
And I press "Delete" in the modal window
And I confirm the alert
Then I should be on the aspects page
And I should not see "People" within "#aspect_nav"
@ -50,13 +48,10 @@ Feature: User manages contacts
When I am on the contacts page
And I follow "Cat People"
And I follow "add contacts to Cat People"
And I wait for the ajax to finish
And I press the first ".contact_list .button"
And I wait for the ajax to finish
And I check the first contact list button
Then I should have 1 contact in "Cat People"
When I press the first ".contact_list .button"
And I wait for the ajax to finish
When I uncheck the first contact list button
Then I should have 0 contacts in "Cat People"
Scenario: infinite scroll on contacts index

View file

@ -29,7 +29,6 @@ Feature: Mentions
| status_message_fake_text | @Bo |
And I click on the first user in the mentions dropdown list
And I press "Share"
And I wait for the ajax to finish
And I follow "Bob Jones"
Then I should see "Bob Jones"

View file

@ -27,15 +27,12 @@ Feature: mentioning a contact from their profile page
And I want to mention her from the profile
And I append "I am eating a yogurt" to the publisher
And I press "Share" in the modal window
And I wait for the ajax to finish
When I am on the aspects page
And I follow "PostingTo" within "#aspect_nav"
And I wait for the ajax to finish
Then I should see "I am eating a yogurt"
When I am on the aspects page
And I follow "NotPostingThingsHere" within "#aspect_nav"
And I wait for the ajax to finish
Then I should see "I am eating a yogurt"
Scenario: mentioning while posting to just one aspect
@ -45,7 +42,6 @@ Feature: mentioning a contact from their profile page
And I append "I am eating a yogurt" to the publisher
And I press the aspect dropdown in the modal window
And I toggle the aspect "NotPostingThingsHere" in the modal window
And I wait for the ajax to finish
And I press "Share" in the modal window
When I am on the aspects page

View file

@ -11,21 +11,16 @@ Feature: viewing photos on the mobile main page
And I click on selector "img.compose_icon"
Scenario: view full size image
Given I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload-publisher"
And I wait for the ajax to finish
Given I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
When I press "Share"
And I wait for the ajax to finish
And I click on selector "img.stream-photo"
Then I should see a "img" within "#show_content"
And I should not see a "#right" within ".row"
Scenario: view multiphoto post
Given I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload-publisher"
And I wait for the ajax to finish
And I attach the file "spec/fixtures/button.gif" to hidden element "file" within "#file-upload-publisher"
And I wait for the ajax to finish
Given I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
And I attach the file "spec/fixtures/button.gif" to hidden "file" within "#file-upload-publisher"
When I press "Share"
And I wait for the ajax to finish
And I should see "+ 1" within ".additional_photo_count"
And I click on selector "img.stream-photo"
Then I should see a "#right" within "tbody"

View file

@ -3,7 +3,7 @@ Feature: Not safe for work
Scenario: Setting not safe for work
Given following users exist:
| username | email |
| username | email |
| pr0n king | tommy@pr0n.xxx |
And I sign in as "tommy@pr0n.xxx"
When I go to the edit profile page
@ -49,12 +49,8 @@ Scenario: Resharing an nsfw post
And "tommy@pr0nking.com" has a public post with text "Sexy Senators Gone Wild!"
And I sign in as "laura@officeworkers.com"
And I toggle nsfw posts
And I preemptively confirm the alert
And I follow "Reshare"
And I wait for 2 seconds
And I wait for the ajax to finish
And I confirm the alert
And I go to the home page
#if this is failing on travis throw a random wait in here :/
And I wait for the ajax to finish
Then I should not see "Sexy Senators Gone Wild!"
And I should have 2 nsfw posts

View file

@ -9,15 +9,14 @@ Feature: Notifications
| email |
| bob@bob.bob |
| alice@alice.alice |
Scenario: someone shares with me
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I add the person to my "Besties" aspect
And I go to the destroy user session page
And I sign out
When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header
And I wait for the ajax to finish
Then the notification dropdown should be visible
Then I should see "started sharing with you"
And I go to the notifications page
@ -29,15 +28,12 @@ Feature: Notifications
And "alice@alice.alice" has a public post with text "check this out!"
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I preemptively confirm the alert
And I follow "Reshare"
And I wait for the ajax to finish
And I go to the destroy user session page
And I confirm the alert
And I sign out
When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header
#And I wait for the ajax to finish
Then the notification dropdown should be visible
#And I wait for the ajax to finish
Then I should see "reshared your post"
And I should have 1 email delivery
@ -46,15 +42,11 @@ Feature: Notifications
And "alice@alice.alice" has a public post with text "check this out!"
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I preemptively confirm the alert
And I follow "Like"
And I wait for the ajax to finish
And I go to the destroy user session page
And I sign out
When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header
And I wait for the ajax to finish
Then the notification dropdown should be visible
And I wait for the ajax to finish
Then I should see "liked your post"
And I should have 1 email delivery
@ -67,8 +59,8 @@ Feature: Notifications
And I fill in the following:
| text | great post! |
And I press "Comment"
And I wait for the ajax to finish
And I go to the destroy user session page
Then I should see "less than a minute ago" within ".comment"
And I sign out
When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header
Then the notification dropdown should be visible
@ -80,8 +72,6 @@ Feature: Notifications
And Alice has a post mentioning Bob
When I sign in as "bob@bob.bob"
And I follow "Notifications" in the header
And I wait for the ajax to finish
Then the notification dropdown should be visible
And I wait for the ajax to finish
Then I should see "mentioned you in a post"
And I should have 1 email delivery

View file

@ -6,7 +6,7 @@ Feature: oembed
Background:
Given following user exists:
| username | email |
| username | email |
| Alice Smith | alice@alice.alice |
And I have several oEmbed data in cache
When I sign in as "alice@alice.alice"
@ -17,18 +17,13 @@ Feature: oembed
When I fill in the following:
| status_message_fake_text | http://youtube.com/watch?v=M3r2XDceM6A&format=json |
And I press "Share"
And I wait for the ajax to finish
And I follow "My Aspects"
Then I should see a video player
And I should see a ".oembed" within ".post-content"
And I should see a "img" within ".oembed"
Scenario: Post an unsecure video link
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | http://mytube.com/watch?v=M3r2XDceM6A&format=json |
And I press "Share"
And I wait for the ajax to finish
And I follow "My Aspects"
Then I should not see a video player
And I should see "http://mytube.com/watch?v=M3r2XDceM6A&format=json"

View file

@ -8,11 +8,10 @@ Feature: viewing the photo lightbox
And I am on the home page
Given I expand the publisher
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I fill in the following:
| status_message_fake_text | Look at this dog |
And I press "Share"
And I wait for the ajax to finish
Scenario: viewing a photo
Then I should see an image attached to the post

View file

@ -21,36 +21,35 @@ Feature: preview posts in the stream
And I press "Preview"
Then "I am eating yogurt" should be post 1
And the first post should be a preview
When I fill in the following:
| status_message_fake_text | This preview rocks |
And I press "Preview"
Then "This preview rocks" should be post 1
And I should not see "I am eating a yogurt"
When I fill in the following:
| status_message_fake_text | I like rocks |
And I press "Share"
And I wait for the ajax to finish
Then "I like rocks" should be post 1
And I should not see "This preview rocks"
Scenario: preview a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
When I fill in the following:
| status_message_fake_text | Look at this dog |
And I press "Preview"
Then I should see a "img" within ".stream_element div.photo_attachments"
And I should see "Look at this dog" within ".stream_element"
Scenario: preview a post with mentions
Given I expand the publisher
And I mention Alice in the publisher
And I press "Preview"
And I follow "Alice Smith"
Then I should see "Alice Smith"
Scenario: preview a post on tag page
Given there is a user "Samuel Beckett" who's tagged "#rockstar"
When I search for "#rockstar"

View file

@ -23,7 +23,6 @@ Feature: posting from the main page
When I fill in the following:
| status_message_fake_text | I am eating yogurt |
And I press "Share"
And I wait for the ajax to finish
And I go to the aspects page
Then "I am eating yogurt" should be post 1
@ -33,13 +32,11 @@ Feature: posting from the main page
When I fill in the following:
| status_message_fake_text | The World needs more Cats. |
And I press "Share"
And I wait for the ajax to finish
Given I expand the publisher
When I fill in the following:
| status_message_fake_text | The World needs more Cats. |
And I press "Share"
And I wait for the ajax to finish
And I go to the aspects page
Then "The World needs more Cats." should be post 1
@ -47,7 +44,6 @@ Feature: posting from the main page
Scenario: posting a message appends it to the top of the stream
When I click the publisher and post "sup dog"
And I wait for 1 second
And I click the publisher and post "hello there"
Then I should see "hello there" as the first post in my stream
@ -56,9 +52,8 @@ Feature: posting from the main page
And I expand the publisher
And I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I press "Share"
And I wait for the ajax to finish
When I am on the aspects page
And I select only "PostingTo" aspect
@ -70,11 +65,10 @@ Feature: posting from the main page
Scenario: post a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
When I fill in the following:
| status_message_fake_text | Look at this dog |
And I press "Share"
And I wait for the ajax to finish
And I go to the aspects page
Then I should see a "img" within ".stream_element div.photo_attachments"
And I should see "Look at this dog" within ".stream_element"
@ -86,11 +80,9 @@ Feature: posting from the main page
Scenario: post a photo without text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see an uploaded image within the photo drop zone
When I press "Share"
And I wait for the ajax to finish
And I go to the aspects page
Then I should see a "img" within ".stream_element div.photo_attachments"
When I log out
@ -102,12 +94,10 @@ Feature: posting from the main page
Given I expand the publisher
And I have turned off jQuery effects
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I preemptively confirm the alert
And I confirm the alert
Then I should not see an uploaded image within the photo drop zone
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I click to delete the first uploaded photo
And I wait for the ajax to finish
Then I should not see an uploaded image within the photo drop zone
Scenario: back out of uploading a picture to a post with text
@ -115,10 +105,8 @@ Feature: posting from the main page
And I have turned off jQuery effects
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I click to delete the first uploaded photo
And I wait for the ajax to finish
Then I should not see an uploaded image within the photo drop zone
And the publisher should be expanded
@ -127,11 +115,9 @@ Feature: posting from the main page
And I have turned off jQuery effects
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I click to delete the first uploaded photo
And I wait for the ajax to finish
Then I should see an uploaded image within the photo drop zone
And the publisher should be expanded
@ -141,21 +127,17 @@ Feature: posting from the main page
When I fill in the following:
| status_message_fake_text | Here is a post for you to hide |
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 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 confirm the alert
And I go to "bob@bob.bob"'s page
And I wait for the ajax to finish
Then I should not see "Here is a post for you to hide"
When I am on the aspects page
And I wait for the ajax to finish
Then I should not see "Here is a post for you to hide"
Scenario: delete one of my posts
@ -163,12 +145,9 @@ Feature: posting from the main page
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I press "Share"
And I wait for the ajax to finish
And I go to the aspects 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 the aspects page
Then I should not see "I am eating a yogurt"
@ -178,7 +157,6 @@ Feature: posting from the main page
And I toggle the aspect "PostingTo"
And I append "I am eating a yogurt" to the publisher
And I press "Share"
And I wait for the ajax to finish
And I am on the aspects page
And I select only "PostingTo" aspect
@ -193,14 +171,12 @@ Feature: posting from the main page
And I toggle the aspect "PostingTo"
And I append "I am eating a yogurt" to the publisher
And I press "Share"
And I wait for the ajax to finish
And I expand the publisher
And I press the aspect dropdown
And I toggle the aspect "Besties"
And I append "And cornflakes also" to the publisher
And I press "Share"
And I wait for the ajax to finish
And I am on the aspects page
And I select only "PostingTo" aspect
@ -219,9 +195,8 @@ Feature: posting from the main page
When I fill in the following:
| status_message_fake_text | I am eating a yogurt |
And I press "Share"
And I wait for the ajax to finish
And I hover over the ".stream_element"
And I preemptively reject the alert
And I click to delete the first post
And I prepare the deletion of the first post
And I reject the alert
Then I should see "I am eating a yogurt"

View file

@ -9,7 +9,7 @@ Feature: posting from the mobile main page
| username |
| bob |
| alice |
And I visit the mobile home page
And I visit the mobile home page
And I sign in as "bob@bob.bob"
And a user with username "bob" is connected with "alice"
Given I have following aspects:
@ -28,12 +28,10 @@ Feature: posting from the mobile main page
Scenario: post a photo without text
Given I publisher mobile page
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload-publisher"
And I wait for the ajax to finish
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
Then I should see an uploaded image within the photo drop zone
And I should see "button.png completed"
When I press "Share"
And I wait for the ajax to finish
When I visit the mobile stream page
Then I should see a "img" within ".stream_element div.photo_attachments"
When I log out
@ -44,22 +42,18 @@ Feature: posting from the mobile main page
Scenario: back out of posting a photo-only post
Given I publisher mobile page
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload-publisher"
And I preemptively confirm the alert
And I confirm the alert
Then I should not see an uploaded image within the photo drop zone
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload-publisher"
And I wait for the ajax to finish
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
And I should see "button.png completed"
And I click to delete the first uploaded photo
And I wait for the ajax to finish
Then I should not see an uploaded image within the photo drop zone
Scenario: back out of uploading a picture when another has been attached
Given I publisher mobile page
And I append "I am eating yogurt" to the publisher mobile
And I attach the file "spec/fixtures/button.gif" to hidden element "file" within "#file-upload-publisher"
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload-publisher"
And I wait for the ajax to finish
And I attach the file "spec/fixtures/button.gif" to hidden "file" within "#file-upload-publisher"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
And I click to delete the first uploaded photo
And I wait for the ajax to finish
Then I should see an uploaded image within the photo drop zone
And the text area wrapper mobile should be with attachments

View file

@ -19,7 +19,6 @@ Feature: posting from own profile page
And I select "Family" on the aspect dropdown
And I press "Share"
And I wait for the ajax to finish
Then I should see "I want to understand people"
@ -29,19 +28,18 @@ Feature: posting from own profile page
When I am on the aspects page
And I select only "Family" aspect
Then I should see "I want to understand people"
When I select only "Work" aspect
Then I should not see "I want to understand people"
Scenario: post a photo with text
Given I expand the publisher
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
When I fill in the following:
| status_message_fake_text | who am I? |
And I press "Share"
And I wait for the ajax to finish
When I am on the home page
Then I should see a "img" within ".stream_element div.photo_attachments"
And I should see "who am I?" within ".stream_element"
@ -49,8 +47,6 @@ Feature: posting from own profile page
Scenario: back out of posting a photo-only post
Given I expand the publisher
And I have turned off jQuery effects
When I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
And I wait for the ajax to finish
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I click to delete the first uploaded photo
And I wait for the ajax to finish
Then I should not see an uploaded image within the photo drop zone

View file

@ -17,23 +17,17 @@ Feature: reactions mobile post
Scenario: like on a mobile post
When I should see "0 reactions" within ".show_comments"
And I click on selector "span.show_comments"
And I wait for the ajax to finish
And I preemptively confirm the alert
And I click on selector "a.image_link.like_action.inactive"
And I wait for the ajax to finish
Then I go to the stream page
And I should see "1 reaction" within ".show_comments"
And I click on selector "a.show_comments"
And I should see "1" within ".like_count"
Scenario: comment a mobile post
When I preemptively confirm the alert
And I click on selector "a.image_link.comment_action.inactive"
And I wait for the ajax to finish
When I click on selector "a.image_link.comment_action.inactive"
And I fill in the following:
| text | is that a poodle? |
And I press "Comment"
And I wait for the ajax to finish
Then I go to the stream page
And I should see "1 reaction" within ".show_comments"
And I click on selector "a.show_comments"

View file

@ -18,9 +18,8 @@ Feature: public repost
And I am on "bob@bob.bob"'s page
And I follow "Last Post"
And I preemptively confirm the alert
And I click on selector "a.reshare"
And I wait for the ajax to finish
And I confirm the alert
Then I should see a flash message indicating success
And I should see a flash message containing "successfully"
@ -31,9 +30,8 @@ Feature: public repost
And I am on "bob@bob.bob"'s page
And I follow "Last Post"
And I preemptively confirm the alert
And I click on selector "a.reshare"
And I wait for the ajax to finish
And I confirm the alert
Then I should see a flash message indicating success
And I should see a flash message containing "successfully"
@ -43,9 +41,8 @@ Feature: public repost
Given "bob@bob.bob" has a public post with text "reshare this!"
And I sign in as "alice@alice.alice"
And I preemptively confirm the alert
And I follow "Reshare"
And I wait for the ajax to finish
And I confirm the alert
Then I should see a flash message indicating success
And I should see a flash message containing "successfully"
And I should not see a ".reshare" within ".feedback"

View file

@ -16,29 +16,27 @@ Feature: resharing from the mobile
Scenario: Resharing a post from a single post page
When I toggle the mobile view
And I preemptively confirm the alert
And I click on selector "a.image_link.reshare_action.inactive"
And I wait for the ajax to finish
Then I go to the stream page
And I should see "reshared via" within ".reshare_via"
And I confirm the alert
Then I should see a "a.image_link.reshare_action.active"
When I go to the stream page
Then I should see "reshared via" within ".reshare_via"
Scenario: Resharing a post from a single post page that is reshared
Given the post with text "reshare this!" is reshared by "eve@eve.eve"
And a user with email "alice@alice.alice" is connected with "eve@eve.eve"
When I toggle the mobile view
And I preemptively confirm the alert
And I click on the first selector "a.image_link.reshare_action.inactive"
And I wait for the ajax to finish
Then I go to the stream page
And I should see "reshared via" within ".reshare_via"
And I confirm the alert
Then I should see "reshared via"
When I go to the stream page
Then I should see "reshared via" within ".reshare_via"
Scenario: Delete original reshared post
Given "alice@alice.alice" has a public post with text "Don't reshare this!"
And the post with text "Don't reshare this!" is reshared by "bob@bob.bob"
And I am on "alice@alice.alice"'s page
And I preemptively confirm the alert
When I click to delete the first post
And I wait for the ajax to finish
And I log out
And I sign in as "bob@bob.bob"
And I toggle the mobile view

View file

@ -15,32 +15,31 @@ Feature: new user registration
Scenario: new user goes through the setup wizard
When I fill in the following:
| profile_first_name | O |
And I preemptively confirm the alert
And I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page
And I should not see "awesome_button"
Scenario: new user does not add any tags in setup wizard and cancel the alert
When I fill in the following:
| profile_first_name | some name |
And I preemptively reject the alert
And I follow "awesome_button"
And I reject the alert
Then I should be on the getting started page
And I should see a flash message containing "Alright, I'll wait."
Scenario: new user skips the setup wizard
When I preemptively confirm the alert
And I follow "awesome_button"
When I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page
Scenario: closing a popover clears getting started
When I preemptively confirm the alert
And I follow "awesome_button"
When I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page
And I have turned off jQuery effects
And I wait for the popovers to appear
And I click close on all the popovers
And I wait for 3 seconds
And I go to the home page
Then I should not see "Welcome to Diaspora"

View file

@ -9,32 +9,19 @@ When /^I select only "([^"]*)" aspect$/ do |aspect_name|
within('#aspect_nav') do
click_link 'Aspects'
click_link 'Select all' if has_link? 'Select all'
click_link 'Deselect all'
end
step %{I wait for the ajax to finish}
within('#aspect_nav') do
click_link 'Deselect all' if has_link? 'Deselect all'
end
step %{I wait for the ajax to finish}
within('#aspect_nav') do
click_link aspect_name
end
step %{I wait for the ajax to finish}
step %Q(I select "#{aspect_name}" aspect as well)
end
When /^I select "([^"]*)" aspect as well$/ do |aspect_name|
within('#aspect_nav') do
click_link aspect_name
end
step %{I wait for the ajax to finish}
step %Q(I should see "#{aspect_name}" aspect selected)
end
When /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
Then /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspect_nav") do
page.has_css?("li.active[data-aspect_id='#{aspect.id}']").should be_true
@ -42,9 +29,24 @@ When /^I should see "([^"]*)" aspect selected$/ do |aspect_name|
end
end
When /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
Then /^I should see "([^"]*)" aspect unselected$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
within("#aspect_nav") do
page.has_css?("li[data-aspect_id='#{aspect.id}']:not(.active) .invisible").should be_true
page.has_css?("li[data-aspect_id='#{aspect.id}']:not(.active) .invisible", visible: false).should be_true
end
end
When /^I check the first contact list button$/ do
find(".contact_list .button", match: :first).tap do |button|
button.click
button.parent.should have_css ".added"
end
end
When /^I uncheck the first contact list button$/ do
find(".contact_list .button", match: :first).tap do |button|
button.click
button.parent.should have_css ".add"
sleep 1 # The expectation above should wait for the request to finsh, but that doesn't work for some reason
end
end

View file

@ -7,7 +7,8 @@ Then /^the first comment field should be open/ do
end
Then /^the first comment field should be closed$/ do
find("#main_stream .stream_element .new_comment").should_not be_visible
page.should have_css(".stream_element")
find("#main_stream .stream_element .new_comment", match: :first, visible: false).should_not be_visible
end
When /^I comment "([^"]*)" on "([^"]*)"$/ do |comment_text, post_text|

View file

@ -7,45 +7,40 @@ end
Then /^I send a message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person|
step %(I am on the conversations page)
step %(I follow "New Message")
step %(I wait for the ajax to finish)
step %(I fill in "contact_autocomplete" with "#{person}" in the modal window)
step %(I press the first ".as-result-item" within ".as-results" in the modal window)
step %(I fill in "conversation_subject" with "#{subject}" in the modal window)
step %(I fill in "conversation_text" with "#{text}" in the modal window)
step %(I press "Send" in the modal window)
step %(I wait for the ajax to finish)
end
When /^I reply with "([^"]*)"$/ do |text|
step %(I am on the conversations page)
step %(I press the first ".conversation" within ".conversations")
step %(I wait for the ajax to finish)
step %(I fill in "message_text" with "#{text}")
step %(I press "Reply")
step %(I wait for the ajax to finish)
end
Then /^I send a mobile message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person|
step %(I am on the conversations page)
step %(I follow "New Message")
step %(I wait for the ajax to finish)
step %(I fill in "contact_autocomplete" with "#{person}")
step %(I press the first ".as-result-item" within ".as-results")
step %(I fill in "conversation_subject" with "#{subject}")
step %(I fill in "conversation_text" with "#{text}")
step %(I press "Send")
step %(I wait for the ajax to finish)
end
Then /^I should see the participants popover$/ do
step %(I should see "Participants" within ".popover-title")
page.execute_script("$('.popover').css('position', 'static')")
page.should have_css ".popover"
end
Then /^I should see "([^"]*)" as part of the participants popover$/ do |name|
find(".conversation_participants_popover img.avatar[title^='#{name}']").should_not be_nil
find(".conversation_participants_popover img.avatar[data-original-title^='#{name}']").should_not be_nil
end
Then /^I close the participants popover$/ do
find('.popover-title .close').click
find('.popover-title .close', visible: false).click
end

View file

@ -57,7 +57,7 @@ When /^(.*) in the header$/ do |action|
end
And /^I submit the form$/ do
click_button :submit
find("input[type='submit']").click
end
Then /^the "([^"]*)" field should have a validation error$/ do |field|
@ -104,23 +104,18 @@ When /^I append "([^"]*)" to the publisher$/ do |stuff|
elem = find('#status_message_fake_text')
elem.native.send_keys(' ' + stuff)
wait_until do
find('#status_message_text').value.include?(stuff)
end
find('#status_message_text', visible: false).value.should include(stuff)
end
When /^I append "([^"]*)" to the publisher mobile$/ do |stuff|
elem = find('#status_message_text')
elem.native.send_keys(' ' + stuff)
wait_until do
find('#status_message_text').value.include?(stuff)
end
find('#status_message_text').value.should include(stuff)
end
And /^I want to mention (?:him|her) from the profile$/ do
click_link("Mention")
wait_for_ajax_to_finish
within('#facebox') do
click_publisher
end
@ -130,16 +125,26 @@ And /^I hover over the "([^"]+)"$/ do |element|
page.execute_script("$(\"#{element}\").first().addClass('hover')")
end
When /^I prepare the deletion of the first post$/ do
within('.stream_element', match: :first) do
find('.remove_post', visible: false).click
end
end
When /^I click to delete the first post$/ do
page.execute_script('$(".stream_element").first().find(".remove_post").first().click()')
step "I prepare the deletion of the first post"
step "I confirm the alert"
end
When /^I click to delete the first comment$/ do
find(".comment").find(".comment_delete").click()
within("div.comment", match: :first) do
find(".comment_delete", visible: false).click
end
end
When /^I click to delete the first uploaded photo$/ do
page.execute_script('$("#photodropzone").find(".x").first().click()')
page.execute_script("$('#photodropzone .x').css('display', 'block');")
find("#photodropzone .x", match: :first).click
end
And /^I click "([^"]*)" button$/ do |arg1|
@ -147,19 +152,19 @@ And /^I click "([^"]*)" button$/ do |arg1|
end
And /^I click on selector "([^"]*)"$/ do |selector|
page.execute_script("$('#{selector}').click();")
find(selector).click
end
And /^I click on the first selector "([^"]*)"$/ do |selector|
page.execute_script("$('#{selector}').first().click();")
find(selector, match: :first).click
end
And /^I preemptively confirm the alert$/ do
page.evaluate_script("window.confirm = function() { return true; }")
And /^I confirm the alert$/ do
page.driver.browser.switch_to.alert.accept
end
And /^I preemptively reject the alert$/ do
page.evaluate_script("window.confirm = function() { return false; }")
And /^I reject the alert$/ do
page.driver.browser.switch_to.alert.dismiss
end
When /^(.*) in the modal window$/ do |action|
@ -170,25 +175,25 @@ end
When /^I press the first "([^"]*)"(?: within "([^"]*)")?$/ do |link_selector, within_selector|
with_scope(within_selector) do
find(:css, link_selector).click
current_scope.find(link_selector, match: :first).click
end
end
When /^I press the ([\d])(?:nd|rd|st|th) "([^\"]*)"(?: within "([^\"]*)")?$/ do |number, link_selector, within_selector|
with_scope(within_selector) do
find(:css, link_selector+":nth-child(#{number})").click
current_scope.find(:css, link_selector+":nth-child(#{number})").click
end
end
Then /^(?:|I )should see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector, scope_selector|
with_scope(scope_selector) do
page.has_css?(selector).should be_true
current_scope.should have_css selector
end
end
Then /^(?:|I )should not see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector, scope_selector|
with_scope(scope_selector) do
page.has_css?(selector, :visible => true).should be_false
current_scope.has_css?(selector, :visible => true).should be_false
end
end
@ -196,38 +201,14 @@ Then /^page should (not )?have "([^\"]*)"$/ do |negate, selector|
page.has_css?(selector).should ( negate ? be_false : be_true )
end
When /^I wait for the ajax to finish$/ do
wait_for_ajax_to_finish
end
When /^I have turned off jQuery effects$/ do
evaluate_script("$.fx.off = true")
end
When /^I attach the file "([^\"]*)" to hidden element "([^\"]*)"(?: within "([^\"]*)")?$/ do |path, field, selector|
page.execute_script <<-JS
$("#{selector || 'body'}").find("input[name=#{field}]").css({opacity: 1});
JS
if selector
step "I attach the file \"#{Rails.root.join(path).to_s}\" to \"#{field}\" within \"#{selector}\""
else
step "I attach the file \"#{Rails.root.join(path).to_s}\" to \"#{field}\""
end
page.execute_script <<-JS
$("#{selector || 'body'}").find("input[name=#{field}]").css({opacity: 0});
JS
end
Then /^I should get download alert$/ do
page.evaluate_script("window.alert = function() { return true; }")
page.execute_script("$.fx.off = true")
end
When /^I search for "([^\"]*)"$/ do |search_term|
fill_in "q", :with => search_term
find_field("q").native.send_key(:enter)
sleep(2)
find(".tags_people")
end
Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)"$/ do |field, selector, value|
@ -252,8 +233,7 @@ Then /^I should see (\d+) contacts$/ do |n_posts|
end
And /^I scroll down$/ do
evaluate_script("window.scrollBy(0,3000000)")
step "I wait for the ajax to finish"
page.execute_script("window.scrollBy(0,3000000)")
end
Then /^the notification dropdown should be visible$/ do
@ -281,22 +261,19 @@ Then 'I press the attached image' do
end
And "I wait for the popovers to appear" do
wait_until(30) { evaluate_script('$(".popover").length') == 3 }
page.should have_selector(".popover", count: 3)
end
And /^I click close on all the popovers$/ do
page.execute_script("var time = 400; $('.popover .close').each(
function(index, element){ setTimeout(function(){ $(element).click()},time);
time += 800;
});")
all(".popover .close", visible: false).each(&:click)
end
Then /^I should see first post deletion link$/ do
page.evaluate_script("$('.stream_element .delete').first().css('display')").should == "inline"
page.should have_selector '.stream_element .delete', match: :first
end
Then /^I should not see ajax loader on deletion link place$/ do
page.evaluate_script("$('.hide_loader').first().css('display')").should == "none"
page.should_not have_selector '.hide_loader'
end
Then /^I should see a flash message indicating success$/ do

View file

@ -1,7 +1,7 @@
module DebuggingCukeHelpers
def start_debugging
require 'debug'
debugger
require 'pry'
binding.pry
true
end
end

View file

@ -1,9 +1,11 @@
When /^I press the "([^\"]*)" key somewhere$/ do |key|
find("div.stream_element").native.send_keys(key)
within("#main_stream") do
find("div.stream_element", match: :first).native.send_keys(key)
end
end
When /^I press the "([^\"]*)" key in the publisher$/ do |key|
find("#status_message_fake_text").native.send_keys(key)
find("#status_message_fake_text", visible: false).native.send_keys(key)
end
Then /^post (\d+) should be highlighted$/ do |position|
@ -15,6 +17,8 @@ And /^I should have navigated to the highlighted post$/ do
end
When /^I scroll to post (\d+)$/ do |position|
page.driver.browser.execute_script("var element = $('div.stream_element')[" + position + " - 1];
window.scrollTo(window.pageXOffset, element.offsetTop-50);")
page.should have_css("div.stream_element")
page.driver.browser.execute_script("
window.scrollTo(window.pageXOffset, $('div.stream_element')[#{position}-1].offsetTop-50);
")
end

View file

@ -5,7 +5,7 @@ Then 'I should see the photo lightbox' do
end
Then 'I should not see the photo lightbox' do
step %{I should not see a "img" within "#lightbox-imageset"}
step %{I should not see a "#lightbox-imageset" within "body"}
step %{I should not see a "#lightbox-backdrop" within "body"}
step %{I should not see a "#lightbox-image" within "body"}
end

View file

@ -11,5 +11,5 @@ And /^I mention Alice in the publisher$/ do
end
And /^I click on the first user in the mentions dropdown list$/ do
find('.mentions-autocomplete-list li:first').click
find('.mentions-autocomplete-list li', match: :first).click
end

View file

@ -123,10 +123,12 @@ Given /^I have several oEmbed data in cache$/ do
end
Then /^I should see a video player$/ do
page.has_css?('object')
visit aspects_path
find('.post-content .oembed')
find('.stream_container').should have_css('.post-content .oembed img')
end
Then /^I should not see a video player$/ do
page.has_no_css?('object')
find('.stream_container').should_not have_css('.post-content .oembed img')
end

View file

@ -11,11 +11,11 @@ Then /^the post should be expanded$/ do
end
Then /^I should see an uploaded image within the photo drop zone$/ do
find("#photodropzone img")["src"].should include("uploads/images")
find("#photodropzone img", visible: false)["src"].should include("uploads/images")
end
Then /^I should not see an uploaded image within the photo drop zone$/ do
all("#photodropzone img").should be_empty
page.should_not have_css "#photodropzone img"
end
Then /^I should not see any posts in my stream$/ do
@ -43,7 +43,7 @@ When /^The user deletes their first post$/ do
end
When /^I click on the first block button/ do
find(".block_user").click
find(".block_user", visible: false).click
end
When /^I expand the post$/ do

View file

@ -11,11 +11,11 @@ Then /^"([^"]*)" should be post (\d+)$/ do |post_text, position|
end
When /^I toggle nsfw posts$/ do
find(".toggle_nsfw_state").click
find(".toggle_nsfw_state", match: :first).click
end
Then /^I should have (\d+) nsfw posts$/ do |num_posts|
all(".nsfw-shield").size.should == num_posts.to_i
page.should have_css(".nsfw-shield", count: num_posts.to_i)
end
When /^I click the show page link for "([^"]*)"$/ do |post_text|

View file

@ -31,7 +31,7 @@ Given /^(?:|[tT]hat )?following user[s]?(?: exist[s]?)?:$/ do |table|
if hash.has_key? "username" and hash.has_key? "email"
step %{a user named "#{hash['username']}" with email "#{hash['email']}"}
elsif hash.has_key? "username"
step %{a user with username "#{hash['username']}"}
step %{a user with username "#{hash['username']}"}
elsif hash.has_key? "email"
step %{a user with email "#{hash['email']}"}
end
@ -119,9 +119,9 @@ Then /^I should have (\d) contacts? in "([^"]*)"$/ do |n_contacts, aspect_name|
end
When /^I (?:add|remove) the person (?:to|from) my "([^\"]*)" aspect$/ do |aspect_name|
aspects_dropdown = find(".aspect_membership .toggle.button:first")
aspects_dropdown = find(".aspect_membership .toggle.button", match: :first)
aspects_dropdown.click
find(".dropdown.active .dropdown_list li:contains('#{aspect_name}')").click
find(".dropdown.active .dropdown_list li", text: aspect_name).click
aspects_dropdown.click
end

View file

@ -8,7 +8,13 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "pat
module WithinHelpers
def with_scope(locator)
locator ? within(locator) { yield } : yield
if locator
within(locator, match: :first) do
yield
end
else
yield
end
end
end
World(WithinHelpers)
@ -23,9 +29,7 @@ end
When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
with_scope(selector) do
silence_warnings {
sleep 1 if button == "Share"
click_button(button) } # ruby 1.9 produces a warning about UTF8 from rack-util
click_button(button)
end
end
@ -90,9 +94,10 @@ When /^(?:|I )choose "([^"]*)"(?: within "([^"]*)")?$/ do |field, selector|
end
end
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
When /^(?:|I )attach the file "([^"]*)" to (?:hidden )?"([^"]*)"(?: within "([^"]*)")?$/ do |path, field, selector|
with_scope(selector) do
attach_file(field, path)
page.execute_script("$(\"input[name='#{field}']\").css('opacity', '1');")
attach_file(field, Rails.root.join(path).to_s)
end
end
@ -103,14 +108,10 @@ Then /^(?:|I )should see JSON:$/ do |expected_json|
expected.should == actual
end
Then /^(?:|I )should see (\".+?\"[\s]*)(?:[\s]+within[\s]* "([^"]*)")?$/ do |vars,selector|
Then /^(?:|I )should see (\".+?\"[\s]*)(?:[\s]+within[\s]* "([^"]*)")?$/ do |vars, selector|
vars.scan(/"([^"]+?)"/).flatten.each do |text|
with_scope(selector) do
if page.respond_to? :should
page.should have_content(text)
else
assert page.has_content?(text)
end
current_scope.should have_content(text)
end
end
end
@ -196,16 +197,8 @@ Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |
end
Then /^(?:|I )should be on (.+)$/ do |page_name|
wait_until(3) do
current_path = URI.parse(current_url).path
current_path == path_to(page_name)
end
if current_path.respond_to? :should
current_path.should == path_to(page_name)
else
assert_equal path_to(page_name), current_path
end
current_path = URI.parse(current_url).path
current_path.should == path_to(page_name)
end
Then /^(?:|I )should have the following query string:$/ do |expected_pairs|

View file

@ -21,7 +21,7 @@ Feature: Unfollowing
Then I should have 0 contacts in "Besties"
Then I go to the destroy user session page
Then I sign out
When I sign in as "alice@alice.alice"
And I am on "bob@bob.bob"'s page
@ -33,16 +33,13 @@ Feature: Unfollowing
And I follow "Besties"
And I follow "add contacts to Besties"
And I wait for the ajax to finish
And I preemptively confirm the alert
And I press the first ".added" within "#facebox .contact_list ul > li:first-child"
And I wait for the ajax to finish
When I follow "My Contacts"
Then I should have 0 contacts in "Besties"
When I go to the destroy user session page
When I sign out
And I sign in as "alice@alice.alice"
And I am on "bob@bob.bob"'s page
Then I should not see "is sharing with you."

View file

@ -13,7 +13,7 @@ module ApplicationCukeHelpers
def flash_message(selector=".message")
selector = "#flash_#{selector}" unless selector == ".message"
find(selector)
find(selector, match: :first)
end
end

View file

@ -2,7 +2,7 @@ module PublishingCukeHelpers
def make_post(text)
fill_in 'status_message_fake_text', :with => text
find(".creation").click
wait_for_ajax_to_finish
page.should have_content text unless page.has_css? '.nsfw-shield'
end
def click_and_post(text)
@ -12,29 +12,31 @@ module PublishingCukeHelpers
def click_publisher
page.execute_script('
$("#publisher").removeClass("closed");
$("#publisher").find("#status_message_fake_text").focus();
$("#publisher").removeClass("closed");
$("#publisher").find("#status_message_fake_text").focus();
')
end
def expand_first_post
find(".stream_element:first .expander").click
wait_until{ !find(".expander").visible? }
within(".stream_element", match: :first) do
find(".expander").click
find(".expander", visible: false).should_not be_visible
end
end
def first_post_collapsed?
find(".stream_element:first .collapsible").should have_css(".expander")
find(".stream_element:first .collapsible").has_selector?(".collapsed")
find(".stream_element .collapsible", match: :first).should have_css(".expander")
find(".stream_element .collapsible", match: :first).has_selector?(".collapsed")
end
def first_post_expanded?
find(".stream_element:first .expander").should_not be_visible
find(".stream_element:first .collapsible").has_no_selector?(".collapsed")
find(".stream_element:first .collapsible").has_selector?(".opened")
find(".stream_element .expander", match: :first, visible: false).should_not be_visible
find(".stream_element .collapsible", match: :first).has_no_selector?(".collapsed")
find(".stream_element .collapsible", match: :first).has_selector?(".opened")
end
def first_post_text
stream_element_numbers_content(1).text()
find(".stream_element .post-content", match: :first).text
end
def frame_numbers_content(position)
@ -50,14 +52,13 @@ module PublishingCukeHelpers
end
def find_post_by_text(text)
find(".stream_element:contains('#{text}')")
find(".stream_element", text: text)
end
def like_post(post_text)
within_post(post_text) do
click_link 'Like'
end
wait_for_ajax_to_finish
end
def within_post(post_text)
@ -75,7 +76,7 @@ module PublishingCukeHelpers
focus_comment_box
make_comment(comment_text)
end
wait_for_ajax_to_finish
step %Q(I should see "#{comment_text}" within ".comment")
end
def comment_on_show_page(comment_text)
@ -83,24 +84,17 @@ module PublishingCukeHelpers
focus_comment_box(".label.comment")
make_comment(comment_text, "new-comment-text")
end
wait_for_ajax_to_finish
end
def make_comment(text, elem="text")
fill_in elem, :with => text
click_button :submit
click_button "Comment"
end
def focus_comment_box(elem="a.focus_comment_textarea")
find(elem).click
end
def wait_for_ajax_to_finish(wait_time=30)
wait_until(wait_time) do
evaluate_script("$.active") == 0
end
end
def assert_nsfw(text)
post = find_post_by_text(text)
post.find(".nsfw-shield").should be_present

View file

@ -25,14 +25,14 @@ module UserCukeHelpers
def login_as(user, pass)
fill_in 'user_username', :with=>user
fill_in 'user_password', :with=>pass
click_button :submit
click_button "Sign in"
end
# create a new @me user, if not present, and log in using the
# integration_sessions controller (automatic)
def automatic_login
@me ||= FactoryGirl.create(:user_with_aspect, :getting_started => false)
page.driver.visit(new_integration_sessions_path(:user_id => @me.id))
visit(new_integration_sessions_path(:user_id => @me.id))
click_button "Login"
end
@ -44,7 +44,7 @@ module UserCukeHelpers
# 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}") }
page.has_content?("#{@me.first_name} #{@me.last_name}")
end
# delete all cookies, destroying the current session

View file

@ -5,7 +5,6 @@ Feature: Issue #3382 The comments under postings are missing when using the #tag
Given a user named "Bob Jones" with email "bob@bob.bob"
And I sign in as "bob@bob.bob"
When I post "This is a post with a #tag"
And I wait for 1 second
And I am on the homepage
Scenario:
@ -15,7 +14,6 @@ Feature: Issue #3382 The comments under postings are missing when using the #tag
Scenario:
When I comment "this is a comment on my post" on "This is a post with a #tag"
And I wait for the ajax to finish
And I search for "#tag"
Then I should be on the tag page for "tag"
And I should see "this is a comment on my post"