diff --git a/.travis.yml b/.travis.yml index c2c21dae1..1ae458fcb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,13 @@ branches: - 'stable' - 'develop' -before_install: gem install bundler +before_install: + - gem install bundler + - mkdir travis-phantomjs + - wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 + - tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs + - export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH + bundler_args: "--deployment --without development production --with mysql postgresql --jobs 3 --retry 3" script: "./script/ci/build.sh" diff --git a/Changelog.md b/Changelog.md index e871f2404..1a6bfc5fc 100644 --- a/Changelog.md +++ b/Changelog.md @@ -109,6 +109,7 @@ before. * Redirect to the sign-in page instead of the stream on account deletion [#6784](https://github.com/diaspora/diaspora/pull/6784) * Removed own unicorn killer by a maintained third-party gem [#6792](https://github.com/diaspora/diaspora/pull/6792) * Removed deprecated `REDISTOGO_URL` environment variable [#6863](https://github.com/diaspora/diaspora/pull/6863) +* Use Poltergeist instead of Selenium [#6768](https://github.com/diaspora/diaspora/pull/6768) ## Bug fixes * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) diff --git a/Gemfile b/Gemfile index ce9bb79f6..6780b5931 100644 --- a/Gemfile +++ b/Gemfile @@ -281,7 +281,7 @@ group :test do gem "capybara", "2.7.1" gem "database_cleaner", "1.5.3" - gem "selenium-webdriver", "2.47.1" + gem "poltergeist", "1.9.0" gem "cucumber-api-steps", "0.13", require: false gem "json_spec", "1.1.4" diff --git a/Gemfile.lock b/Gemfile.lock index 35e8b66e6..16dfcfd2c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -116,9 +116,8 @@ GEM timers (>= 4.1.1) celluloid-supervision (0.20.5) timers (>= 4.1.1) - childprocess (0.5.9) - ffi (~> 1.0, >= 1.0.11) chunky_png (1.3.5) + cliver (0.3.2) coderay (1.1.1) coffee-rails (4.1.1) coffee-script (>= 2.2.0) @@ -579,6 +578,11 @@ GEM pg (0.18.4) phantomjs (2.1.1.0) pkg-config (1.1.7) + poltergeist (1.9.0) + capybara (~> 2.1) + cliver (~> 0.3.1) + multi_json (~> 1.0) + websocket-driver (>= 0.2.0) powerpack (0.1.1) pronto (0.6.0) gitlab (~> 3.6, >= 3.4.0) @@ -781,11 +785,6 @@ GEM rake (>= 0.9, < 12) sass (~> 3.4.15) securecompare (1.0.0) - selenium-webdriver (2.47.1) - childprocess (~> 0.5) - multi_json (~> 1.0) - rubyzip (~> 1.0) - websocket (~> 1.0) shellany (0.0.1) shoulda-matchers (3.1.1) activesupport (>= 4.0.0) @@ -902,7 +901,9 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - websocket (1.2.3) + websocket-driver (0.6.4) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) will_paginate (3.1.0) xml-simple (1.1.5) xpath (2.0.0) @@ -982,6 +983,7 @@ DEPENDENCIES open_graph_reader (= 0.6.1) openid_connect (= 0.11.2) pg (= 0.18.4) + poltergeist (= 1.9.0) pronto (= 0.6.0) pronto-eslint (= 0.6.1) pronto-haml (= 0.6.0) @@ -1029,7 +1031,6 @@ DEPENDENCIES ruby-oembed (= 0.10.1) rubyzip (= 1.2.0) sass-rails (= 5.0.4) - selenium-webdriver (= 2.47.1) shoulda-matchers (= 3.1.1) sidekiq (= 4.1.2) sidekiq-cron (= 0.4.2) diff --git a/app/assets/javascripts/app/views/single-post-viewer/single_post_comment_stream.js b/app/assets/javascripts/app/views/single-post-viewer/single_post_comment_stream.js index 9bf53e3b0..63ef065f6 100644 --- a/app/assets/javascripts/app/views/single-post-viewer/single_post_comment_stream.js +++ b/app/assets/javascripts/app/views/single-post-viewer/single_post_comment_stream.js @@ -8,13 +8,13 @@ app.views.SinglePostCommentStream = app.views.CommentStream.extend({ }, highlightPermalinkComment: function() { - if(document.location.hash){ + if (document.location.hash && $(document.location.hash).length > 0) { var element = $(document.location.hash); - var headerSize = 50; + var headerSize = 60; $(".highlighted").removeClass("highlighted"); element.addClass("highlighted"); var pos = element.offset().top - headerSize; - $("html").animate({scrollTop:pos}); + window.scroll(0, pos); } }, diff --git a/app/assets/javascripts/mobile/mobile.js b/app/assets/javascripts/mobile/mobile.js index a55d2faf1..1a7b24110 100644 --- a/app/assets/javascripts/mobile/mobile.js +++ b/app/assets/javascripts/mobile/mobile.js @@ -7,6 +7,7 @@ //= require jquery.charcount //= require js-routes //= require autosize +//= require keycodes //= require jquery.autoSuggest.custom //= require fileuploader-custom //= require rails-timeago diff --git a/app/assets/javascripts/mobile/mobile_comments.js b/app/assets/javascripts/mobile/mobile_comments.js index f4602a3c0..1690b2d9c 100644 --- a/app/assets/javascripts/mobile/mobile_comments.js +++ b/app/assets/javascripts/mobile/mobile_comments.js @@ -220,7 +220,7 @@ }, resetCommentBox: function(el){ - var commentButton = el.find("input.comment-button").first(); + var commentButton = $(el).find("input.comment-button").first(); commentButton.attr("value", commentButton.data("reset-with")); commentButton.removeAttr("disabled"); commentButton.blur(); diff --git a/app/assets/stylesheets/mobile/header.scss b/app/assets/stylesheets/mobile/header.scss index 20123442b..cc07ce808 100644 --- a/app/assets/stylesheets/mobile/header.scss +++ b/app/assets/stylesheets/mobile/header.scss @@ -74,7 +74,7 @@ $mobile-navbar-height: 46px; } .navbar-toggle { - display: unset; + display: block; margin: 6px 15px; } diff --git a/app/views/aspect_memberships/_aspect_membership_dropdown.mobile.haml b/app/views/aspect_memberships/_aspect_membership_dropdown.mobile.haml index cd595ab7e..958de0740 100644 --- a/app/views/aspect_memberships/_aspect_membership_dropdown.mobile.haml +++ b/app/views/aspect_memberships/_aspect_membership_dropdown.mobile.haml @@ -1,5 +1,5 @@ %div - %select{name: 'user_aspects', class: 'user_aspects form-control', 'data-person-id' => @person.id} + %select.aspect_dropdown.form-control.user_aspects{"name" => "user_aspects", "data-person-id" => @person.id} %option{value: 'list_cover', class: 'list_cover', disabled: 'true', selected: 'true'} = t("add_contact") - contact = current_user.contact_for(@person) diff --git a/app/views/photos/_new_profile_photo.haml b/app/views/photos/_new_profile_photo.haml index 99dd7163a..585028add 100644 --- a/app/views/photos/_new_profile_photo.haml +++ b/app/views/photos/_new_profile_photo.haml @@ -29,11 +29,12 @@ $('#file-upload').addClass("loading"); $("#profile_photo_upload").find(".avatar").addClass('loading'); $("#file-upload-spinner").removeClass("hidden"); + $("#fileInfo").show(); }, onComplete: function(id, fileName, responseJSON){ $("#file-upload-spinner").addClass("hidden"); - $('#fileInfo').text(fileName + ' completed').fadeOut(2000); + $("#fileInfo").text(Diaspora.I18n.t("photo_uploader.completed", {"file": fileName})); $('#file-upload').removeClass("loading"); /* flash message prompt */ diff --git a/config/selenium.yml b/config/selenium.yml deleted file mode 100644 index b53a7e946..000000000 --- a/config/selenium.yml +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - -common: &common - # Try to kill mongrel after suite if tmp/pids/mongrel_selenium.pid exists - # kill_mongrel_after_suite: true - -local: &local - <<: *common - test_framework: webrat - selenium_server_address: "127.0.0.1" - selenium_server_port: "4444" - selenium_browser_key: "*chrome /usr/bin/firefox" - application_address: "127.0.0.1" - application_port: "4000" - -local_jsunit: - <<: *local - application_port: "8080" - -# Possible Sauce Labs configurations as of 2009/11/19 -# From: http://saucelabs.com/products/docs/sauce-ondemand/browsers -# -# saucelabs_browser_os saucelabs_browser saucelabs_browser_version (pick one) -# -# "Windows 2003" "iexplore" "6.", "7.", "8." -# "firefox" "2.", "3.0", "3.5" -# "safari" "3.", "4." -# "opera" "9." -# "googlechrome" "" -# "Linux" "firefox" "3." -saucelabs: &saucelabs - <<: *common - test_framework: webrat - # URL of Selenium RC server: - selenium_server_address: "saucelabs.com" - selenium_server_port: "4444" - # Saucelabs credentials / Browser to drive - saucelabs_username: "YOUR-SAUCELABS-USERNAME" - saucelabs_access_key: "YOUR-SAUCELABS-ACCESS-KEY" - saucelabs_browser_os: "Linux" - saucelabs_browser: "firefox" - saucelabs_browser_version: "3." - saucelabs_max_duration_seconds: 1800 - # Selenium RC browser connects to and tests the app at this URL: - application_address: "testhost.com" # this will be ovewritten if tunnel_method == :saucetunnel - application_port: 80 - # App host can actually be a tunnel that tunnels from : to localhost: - # There are 3 kinds of tunnels: - # - # tunnel_method: :saucetunnel - # tunnel_to_localhost_port: 4000 # Warning: application_port and tunnel_to_localhost_port must be identical if you are using Webrat - # tunnel_startup_timeout: 240 - # - # tunnel_method: :sshtunnel - # application_address: proxy.mycompany.com - # application_port: 12345 # or can be a range XXXX-YYYY - # tunnel_to_localhost_port: 4000 # Warning: application_port and tunnel_to_localhost_port must be identical if you are using Webrat - # tunnel_username: fred - # tunnel_keyfile: "/Users/<%= ENV['USER'] %>/.ssh/id_rsa" # or tunnel_password: "password" - # - # tunnel_method: :othertunnel You're managing your tunnel independently - -saucelabs_jsunit: &saucelabs_jsunit - <<: *saucelabs - # We are using the Jetty server for Saucelabs JsUnit selenium testing. - localhost_app_server_port: "8080" - -saucelabs_jsunit_firefox: - <<: *saucelabs_jsunit - -saucelabs_jsunit_ie: - <<: *saucelabs_jsunit - saucelabs_browser_os: "Windows 2003" - saucelabs_browser: "iexplore" - saucelabs_browser_version: "7." - jsunit_polling_interval_seconds: 300 - -saucelabs_jsunit_safari: - <<: *saucelabs_jsunit - saucelabs_browser_os: "Windows 2003" - saucelabs_browser: "safari" - saucelabs_browser_version: "4." - -saucelabs_jsunit_chrome: - <<: *saucelabs_jsunit - saucelabs_browser_os: "Windows 2003" - saucelabs_browser: "googlechrome" - saucelabs_browser_version: "" diff --git a/features/desktop/activity_stream.feature b/features/desktop/activity_stream.feature index b9bdce270..7fb9e5277 100644 --- a/features/desktop/activity_stream.feature +++ b/features/desktop/activity_stream.feature @@ -16,8 +16,7 @@ Feature: The activity stream And I should see "is that a poodle?" When I am on "alice@alice.alice"'s page - And I click to delete the first comment - And I confirm the alert + And I confirm the alert after I click to delete the first comment And I go to the activity stream page Then I should not see "Look at this dog" diff --git a/features/desktop/blocks_user.feature b/features/desktop/blocks_user.feature index ccc0e83b2..d0beb8a8c 100644 --- a/features/desktop/blocks_user.feature +++ b/features/desktop/blocks_user.feature @@ -11,15 +11,13 @@ Feature: Blocking a user from the stream And I sign in as "bob@bob.bob" Scenario: Blocking a user - When I click on the first block button - And I confirm the alert + When I confirm the alert after I click on the first block button And I go to the home page Then I should not see any posts in my stream Scenario: Blocking a user from the profile page When I am on "alice@alice.alice"'s page - When I click on the profile block button - And I confirm the alert + And I confirm the alert after I click on the profile block button Then "All your base are belong to us!" should be post 1 When I go to the home page Then I should not see any posts in my stream diff --git a/features/desktop/closes_account.feature b/features/desktop/closes_account.feature index ece4afe58..5e08c6ca9 100644 --- a/features/desktop/closes_account.feature +++ b/features/desktop/closes_account.feature @@ -11,8 +11,7 @@ Feature: Close account Then I should see a modal And I should see "Hey, please don’t go!" within "#closeAccountModal" When I put in my password in "close_account_password" - And I press "close_account_confirm" - And I confirm the alert + And I confirm the alert after I press "Close account" in the modal Then I should be on the new user session page When I try to sign in manually diff --git a/features/desktop/comments.feature b/features/desktop/comments.feature index c4a130a88..3b9fb1aa2 100644 --- a/features/desktop/comments.feature +++ b/features/desktop/comments.feature @@ -27,8 +27,7 @@ Feature: commenting When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog" And I am on "alice@alice.alice"'s page Then I should see "is that a poodle?" - When I click to delete the first comment - And I confirm the alert + When I confirm the alert after I click to delete the first comment Then I should not see "is that a poodle?" Scenario: expand the comment form in the main stream and an individual aspect stream @@ -48,7 +47,7 @@ Feature: commenting Then I should see "Look at this dog" 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 that’s a cat" + When I make a show page comment "I think that’s a cat" Then I should see "less than a minute ago" within "#comments" When I go to "alice@alice.alice"'s page Then I should see "I think that’s a cat" @@ -60,7 +59,8 @@ Feature: commenting Then I should see "Look at this dog" And I should see "I think that’s a cat" within ".comment:last-child" When I follow "less than a minute ago" within ".comment:last-child" - Then I should see "I think that’s a cat" within ".comment .highlighted" + Then I should see "Look at this dog" within "#single-post-content" + And I should see "I think that’s a cat" within ".comment .highlighted" And I should have scrolled down Scenario: permalink to comment from a status show page diff --git a/features/desktop/edits_profile.feature b/features/desktop/edits_profile.feature index 6bb6e8213..9d07b5806 100644 --- a/features/desktop/edits_profile.feature +++ b/features/desktop/edits_profile.feature @@ -25,7 +25,7 @@ Feature: editing your profile And the "profile_gender" field should contain "Fearless" And the "profile_first_name" field should contain "Boba" And the "profile_last_name" field should contain "Fett" - And I should see "This is a bio" + And the "profile_bio" field should contain "This is a bio" And the "profile_date_year" field should be filled with "1986" And the "profile_date_month" field should be filled with "11" And the "profile_date_day" field should be filled with "30" @@ -42,7 +42,10 @@ Feature: editing your profile And I should see "#starwars" within "ul#as-selections-tags" And the "#profile_public_details" bootstrap-switch should be on - When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" - And I confirm the alert + When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + Then I should see "button.png completed" + And I should see a "img" within "#profile_photo_upload" + + When I go to my edit profile page Then I should see a "img" within "#profile_photo_upload" diff --git a/features/desktop/follows_tags.feature b/features/desktop/follows_tags.feature index 2965df10c..63448f9d4 100644 --- a/features/desktop/follows_tags.feature +++ b/features/desktop/follows_tags.feature @@ -6,21 +6,19 @@ Feature: posting Background: Given following users exist: - | 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 sign out - And I sign in as "alice@alice.alice" - And I search for "#boss" + | username | email | + | Alice Smith | alice@alice.alice | + | Bob Jones | bob@bob.bob | + And "bob@bob.bob" has a public post with text "I am da #boss" + When I sign in as "alice@alice.alice" + And I go to the tag page for "boss" And I press "Follow #boss" + Then I should see a ".tag-following-action .followed" Scenario: can post a message from the tag page Then I should see "#boss" within "#publisher" - And I click the publisher and post "#boss from the tag page" - And I search for "#boss" + When I click the publisher and post "#boss from the tag page" + And I go to the tag page for "boss" Then I should see "#boss from the tag page" Scenario: see a tag that I am following @@ -35,7 +33,7 @@ Feature: posting Then I should see "#boss from the #boss tag page" within "body" Scenario: can stop following a tag from the tag page - When I press "Stop following #boss" + When I press "Following #boss" And I go to the followed tags stream page Then I should not see "#boss" within "#tags_list" diff --git a/features/desktop/invitations.feature b/features/desktop/invitations.feature index 76ce98902..955ccdb34 100644 --- a/features/desktop/invitations.feature +++ b/features/desktop/invitations.feature @@ -15,8 +15,7 @@ Feature: Invitations And I fill in the following: | profile_first_name | O | - And I follow "awesome_button" - And I confirm the alert + And I confirm the alert after I follow "awesome_button" Then I should be on the stream page And I close the publisher @@ -31,8 +30,7 @@ Feature: Invitations And I fill in the following: | profile_first_name | O | - And I follow "awesome_button" - And I confirm the alert + And I confirm the alert after I follow "awesome_button" Then I should be on the stream page And I close the publisher And I log out diff --git a/features/desktop/keyboard_navigation.feature b/features/desktop/keyboard_navigation.feature index a5061a3e3..9e4b24cf8 100644 --- a/features/desktop/keyboard_navigation.feature +++ b/features/desktop/keyboard_navigation.feature @@ -36,8 +36,12 @@ Feature: Keyboard navigation And I should have navigated to the highlighted post Scenario: navigate upwards - When I scroll to post 3 - And I press the "K" key somewhere + When I press the "J" key somewhere + And I press the "J" key somewhere + And I press the "J" key somewhere + Then post 3 should be highlighted + + When I press the "K" key somewhere Then post 2 should be highlighted And I should have navigated to the highlighted post @@ -46,7 +50,7 @@ Feature: Keyboard navigation When I press the "J" key somewhere And I press the "C" key somewhere Then the first comment field should be open - + Scenario: navigate downwards on a profile page When I am on "alice@alice.alice"'s page And I press the "J" key somewhere diff --git a/features/desktop/likes.feature b/features/desktop/likes.feature index a961ff41b..3fff3ce56 100644 --- a/features/desktop/likes.feature +++ b/features/desktop/likes.feature @@ -15,10 +15,13 @@ Feature: Liking posts Scenario: Liking and unliking a post from the stream When I like the post "I like unicorns" in the stream - Then I should see a ".likes" within "#main_stream .stream_element" + Then I should see "Unlike" within ".stream_element .feedback" + And I should see a ".likes .media" within "#main_stream .stream_element" When I unlike the post "I like unicorns" in the stream - Then I should not see a ".likes" within "#main_stream .stream_element" + Then I should see "Like" within ".stream_element .feedback" + And I should not see a ".likes .media" within "#main_stream .stream_element" + Scenario: Liking and unliking a post from a single post page When I open the show page of the "I like unicorns" post diff --git a/features/desktop/manages_aspects.feature b/features/desktop/manages_aspects.feature index 7df4f0f2a..30770b668 100644 --- a/features/desktop/manages_aspects.feature +++ b/features/desktop/manages_aspects.feature @@ -7,7 +7,7 @@ Feature: User manages contacts Scenario: creating an aspect from contacts index Given I am signed in And I am on the contacts page - And I follow "+ Add an aspect" + And I follow "Add an aspect" And I fill in "aspect_name" with "Dorm Mates" in the aspect creation modal And I click on selector ".btn-primary" in the aspect creation modal Then I should see "Dorm Mates" within "#aspect_nav" @@ -18,15 +18,15 @@ Feature: User manages contacts When I follow "Add an aspect" And I fill in "aspect_name" with "losers" in the aspect creation modal And I click on selector ".btn-primary" in the aspect creation modal - Then I should see "losers" within "#aspect_nav" + Then I should be on the contacts page + And I should see "losers" within "#aspect_nav" Scenario: deleting an aspect from contacts index Given I am signed in And I have an aspect called "People" When I am on the contacts page And I follow "People" - And I click on selector "#delete_aspect" - And I confirm the alert + And I confirm the alert after I click on selector "#delete_aspect" Then I should be on the contacts page And I should not see "People" within "#aspect_nav" @@ -35,8 +35,7 @@ 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 click on selector "#delete_aspect" - And I confirm the alert + And I confirm the alert after I click on selector "#delete_aspect" Then I should be on the contacts page And I should not see "People" within "#aspect_nav" @@ -81,7 +80,10 @@ Feature: User manages contacts And I have an aspect called "People" And I have an aspect called "Cat People" When I am on the contacts page + And I have turned off jQuery effects And I drag "Cat People" up - And I go to the contacts page + Then I should see "Cat People" as 2. aspect + And I should see "People" as 3. aspect + When I go to the contacts page Then I should see "Cat People" as 2. aspect And I should see "People" as 3. aspect diff --git a/features/desktop/mentions.feature b/features/desktop/mentions.feature index 08e792ac7..d16a5ee77 100644 --- a/features/desktop/mentions.feature +++ b/features/desktop/mentions.feature @@ -23,8 +23,7 @@ Feature: Mentions And a user with email "bob@bob.bob" is connected with "alice@alice.alice" When I sign in as "alice@alice.alice" And I expand the publisher - When I fill in the following: - | status_message_fake_text | @Bo | + And I append "@Bob" to the publisher And I click on the first user in the mentions dropdown list And I press "Share" Then I should see "Bob Jones" within ".stream_element" diff --git a/features/desktop/mentions_from_profile_page.feature b/features/desktop/mentions_from_profile_page.feature index f18812d05..eb41c5049 100644 --- a/features/desktop/mentions_from_profile_page.feature +++ b/features/desktop/mentions_from_profile_page.feature @@ -22,7 +22,7 @@ Feature: mentioning a contact from their profile page Scenario: mentioning while posting to all aspects Given I am on "alice@alice.alice"'s page And I want to mention her from the profile - And I append "I am eating a yogurt" to the publisher + And I append "I am eating a yogurt" to the publisher in the mention modal And I press "Share" in the mention modal Then I should see a flash message indicating success When I am on the aspects page @@ -36,10 +36,10 @@ Feature: mentioning a contact from their profile page Scenario: mentioning while posting to just one aspect Given I am on "alice@alice.alice"'s page And I want to mention her from the profile + And I append "I am eating a yogurt" to the publisher in the mention modal And I press the aspect dropdown in the mention modal And I toggle the aspect "NotPostingThingsHere" in the mention modal And I press the aspect dropdown in the mention modal - And I append "I am eating a yogurt" to the publisher And I press "Share" in the mention modal Then I should see a flash message indicating success diff --git a/features/desktop/not_safe_for_work.feature b/features/desktop/not_safe_for_work.feature index 6d7f7fd7d..432d38947 100644 --- a/features/desktop/not_safe_for_work.feature +++ b/features/desktop/not_safe_for_work.feature @@ -42,8 +42,7 @@ Scenario: Resharing a 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 follow "Reshare" - And I confirm the alert + And I confirm the alert after I follow "Reshare" And I go to the home page Then I should not see "Sexy Senators Gone Wild!" And I should have 2 nsfw posts diff --git a/features/desktop/notifications.feature b/features/desktop/notifications.feature index 590092f3a..aedfe0f4e 100644 --- a/features/desktop/notifications.feature +++ b/features/desktop/notifications.feature @@ -29,8 +29,7 @@ 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 follow "Reshare" - And I confirm the alert + And I confirm the alert after I follow "Reshare" And I sign out When I sign in as "alice@alice.alice" And I follow "Notifications" in the header diff --git a/features/desktop/photo_gallery.feature b/features/desktop/photo_gallery.feature index 6ed648c33..bb86819bb 100644 --- a/features/desktop/photo_gallery.feature +++ b/features/desktop/photo_gallery.feature @@ -1,21 +1,15 @@ @javascript Feature: viewing the photo lightbox Background: - Given a user with username "bob" - And I sign in as "bob@bob.bob" - And I expand the publisher - 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" + Given a user with username "alice" + And "alice@alice.alice" has posted a status message with a photo + And I sign in as "alice@alice.alice" Scenario: viewing a photo - Then I should see an image attached to the post - And I press the attached image + When I press the attached image Then I should see the photo lightbox Scenario: closing the lightbox by clicking the close link - Then I should see an image attached to the post - And I press the attached image + When I press the attached image And I press the close lightbox link Then I should not see the photo lightbox diff --git a/features/desktop/post_preview.feature b/features/desktop/post_preview.feature index 0cafd0077..15c89c540 100644 --- a/features/desktop/post_preview.feature +++ b/features/desktop/post_preview.feature @@ -53,17 +53,15 @@ Feature: preview posts in the stream Given I expand the publisher And I mention Alice in the publisher And I press "Preview" - And I follow "Alice Smith" - And I confirm the alert + And I confirm the alert after 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" - Then I should be on the tag page for "rockstar" - And I should see "Samuel Beckett" - Given I expand the publisher - When I fill in the following: + When I go to the tag page for "rockstar" + Then I should see "Samuel Beckett" + When I expand the publisher + And I fill in the following: | status_message_fake_text | This preview rocks | And I press "Preview" Then "This preview rocks" should be post 1 diff --git a/features/desktop/posts_from_main_page.feature b/features/desktop/posts_from_main_page.feature index 6375a4b19..b81786b53 100644 --- a/features/desktop/posts_from_main_page.feature +++ b/features/desktop/posts_from_main_page.feature @@ -156,6 +156,7 @@ Feature: posting from the main page When I expand the publisher And I press the aspect dropdown And I toggle the aspect "PostingTo" + And I press the aspect dropdown And I append "I am eating a yogurt" to the publisher And I submit the publisher @@ -171,12 +172,14 @@ Feature: posting from the main page When I expand the publisher And I press the aspect dropdown And I toggle the aspect "PostingTo" + And I press the aspect dropdown And I append "I am eating a yogurt" to the publisher And I submit the publisher And I expand the publisher And I press the aspect dropdown And I toggle the aspect "Besties" + And I press the aspect dropdown And I append "And cornflakes also" to the publisher And I submit the publisher @@ -200,6 +203,5 @@ Feature: posting from the main page And I submit the publisher And I hover over the ".stream_element" - And I prepare the deletion of the first post - And I reject the alert + And I reject the alert after I prepare the deletion of the first post Then I should see "I am eating a yogurt" diff --git a/features/desktop/profile_photos.feature b/features/desktop/profile_photos.feature index eed062c08..72e45ac36 100644 --- a/features/desktop/profile_photos.feature +++ b/features/desktop/profile_photos.feature @@ -29,8 +29,8 @@ Feature: show photos Scenario: I delete a photo When I am on "robert@grimm.grimm"'s photos page - And I delete a photo - And I confirm the alert - Then I should not see a ".stream" + Then I should see a ".thumbnail" within "#main_stream" + When I confirm the alert after I delete a photo + Then I should not see a ".thumbnail" within "#main_stream" When I am on "robert@grimm.grimm"'s page Then I should not see "Photos" within "#profile-horizontal-bar" diff --git a/features/desktop/reshare.feature b/features/desktop/reshare.feature index 26c760be5..9c56da684 100644 --- a/features/desktop/reshare.feature +++ b/features/desktop/reshare.feature @@ -18,8 +18,7 @@ Feature: public repost Given I sign in as "alice@alice.alice" And I am on "bob@bob.bob"'s page And I open the show page of the "reshare this!" post - And I click on selector "a.reshare" - And I confirm the alert + And I confirm the alert after I click on selector "a.reshare" Then I should see a flash message indicating success And I should see a flash message containing "successfully" @@ -28,8 +27,7 @@ Feature: public repost And I sign in as "alice@alice.alice" And I am on "bob@bob.bob"'s page And I open the show page of the "reshare this!" post - And I click on selector "a.reshare" - And I confirm the alert + And I confirm the alert after I click on selector "a.reshare" Then I should see a flash message indicating success And I should see a flash message containing "successfully" @@ -48,8 +46,7 @@ Feature: public repost # app.stream in jasmine should be enough coverage Scenario: When I reshare, it shows up on my profile page Given I sign in as "alice@alice.alice" - And I follow "Reshare" - And I confirm the alert + And I confirm the alert after I follow "Reshare" 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" diff --git a/features/desktop/signs_up.feature b/features/desktop/signs_up.feature index 0f955a19c..2002db171 100644 --- a/features/desktop/signs_up.feature +++ b/features/desktop/signs_up.feature @@ -11,8 +11,7 @@ Feature: new user registration Scenario: new user goes through the setup wizard When I fill in the following: | profile_first_name | O | - And I follow "awesome_button" - And I confirm the alert + And I confirm the alert after I follow "awesome_button" Then I should be on the stream page And I close the publisher And I should not see "awesome_button" @@ -28,20 +27,17 @@ Feature: new user registration | profile_first_name | some name | And I focus the "follow_tags" field Then I should see a flash message containing "Hey, some name!" - When I follow "awesome_button" - And I reject the alert + When I reject the alert after I follow "awesome_button" Then I should be on the getting started page And I should see a flash message containing "All right, I’ll wait." Scenario: new user skips the setup wizard - When I follow "awesome_button" - And I confirm the alert + When I confirm the alert after I follow "awesome_button" Then I should be on the stream page And I close the publisher Scenario: new user without any tags posts first status message - When I follow "awesome_button" - And I confirm the alert + When I confirm the alert after I follow "awesome_button" Then I should be on the stream page When I submit the publisher Then "Hey everyone, I’m #newhere." should be post 1 @@ -57,8 +53,7 @@ Feature: new user registration Then "Hey everyone, I’m #newhere. I’m interested in #rockstar." should be post 1 Scenario: closing a popover clears getting started - When I follow "awesome_button" - And I confirm the alert + When I confirm the alert after I follow "awesome_button" Then I should be on the stream page And I have turned off jQuery effects And I wait for the popovers to appear diff --git a/features/desktop/single_post_view_moderation.feature b/features/desktop/single_post_view_moderation.feature index c47db4a48..af90de2c4 100644 --- a/features/desktop/single_post_view_moderation.feature +++ b/features/desktop/single_post_view_moderation.feature @@ -18,8 +18,7 @@ And I sign in as "alice@alice.alice" And I open the show page of the "Here is a post to test with" post - And I click to hide the post - And I confirm the alert + And I confirm the alert after I click to hide the post Then I should be on the stream page @@ -32,8 +31,7 @@ And I sign in as "alice@alice.alice" And I open the show page of the "Here is a post to test with" post - And I click to block the user - And I confirm the alert + And I confirm the alert after I click to block the user Then I should be on the stream page @@ -46,8 +44,7 @@ And I sign in as "alice@alice.alice" And I open the show page of the "Here is a post to test with" post - And I click to report the post - And I confirm the alert + And I confirm the alert after I click to report the post And I should see a flash message containing "The report has successfully been created" @@ -57,6 +54,5 @@ And I submit the publisher And I open the show page of the "Here is a post to test with" post - And I click to delete the post - And I confirm the alert + And I confirm the alert after I click to delete the post Then I should be on the stream page diff --git a/features/mobile/activity_stream.feature b/features/mobile/activity_stream.feature index d63961290..186f2c290 100644 --- a/features/mobile/activity_stream.feature +++ b/features/mobile/activity_stream.feature @@ -10,14 +10,12 @@ Feature: Viewing my activity on the steam mobile page And I sign in as "alice@alice.alice" on the mobile website Scenario: Show my activity empty - When I open the drawer - And I follow "My activity" - Then I should see "My activity" + When I go to the activity stream page + Then I should see "My activity" within "#main" And I should not see "Hello! I am #newhere" Scenario: Show post on my activity When I click on selector "a.like-action.inactive" - And I open the drawer - And I follow "My activity" - Then I should see "My activity" + And I go to the activity stream page + Then I should see "My activity" within "#main" And I should see "Hello! I am #newhere" within ".ltr" diff --git a/features/mobile/change_password.feature b/features/mobile/change_password.feature index 0bd6e70b4..e191ddb18 100644 --- a/features/mobile/change_password.feature +++ b/features/mobile/change_password.feature @@ -5,17 +5,17 @@ Feature: Change password Scenario: Change my password - Given I am signed in + Given I am signed in on the mobile website When I go to the users edit page And I fill out change password section with my password and "newsecret" and "newsecret" And I press "Change password" Then I should see "Password changed" And I should be on the new user session page - When I sign in with password "newsecret" + When I sign in with password "newsecret" on the mobile website Then I should be on the stream page Scenario: Attempt to change my password with invalid input - Given I am signed in + Given I am signed in on the mobile website When I go to the edit user page And I fill out change password section with my password and "too" and "short" And I press "Change password" @@ -32,7 +32,8 @@ Feature: Change password And I fill out the password reset form with "supersecret" and "supersecret" And I submit the password reset form Then I should be on the stream page - When I sign out manually on the mobile website + When I sign out + And I go to the login page And I sign in manually as "georges_abitbol" with password "supersecret" on the mobile website Then I should be on the stream page diff --git a/features/mobile/closes_account.feature b/features/mobile/closes_account.feature index ceb74fd14..3f659023f 100644 --- a/features/mobile/closes_account.feature +++ b/features/mobile/closes_account.feature @@ -5,14 +5,13 @@ Feature: Close account I want to sign in, close my account and try to log in again Scenario: user closes account - Given I am signed in + Given I am signed in on the mobile website When I go to the users edit page And I click on selector "#close_account" Then I should see a modal And I should see "Hey, please don’t go!" within "#closeAccountModal" When I put in my password in the close account modal - And I press "close_account_confirm" - And I confirm the alert + And I confirm the alert after I press "Close account" in the modal Then I should be on the mobile new user session page When I try to sign in manually diff --git a/features/mobile/conversations.feature b/features/mobile/conversations.feature index aa5901749..c64e0ba2d 100644 --- a/features/mobile/conversations.feature +++ b/features/mobile/conversations.feature @@ -21,6 +21,5 @@ Feature: private conversations mobile And I reply with "hey, how you doing?" And I press the first ".ltr" within ".conversation" Then I should see "hey, how you doing?" - When I click on selector "a.remove" - And I confirm the alert + When I confirm the alert after I click on selector "a.remove" Then I should not see "hey, how you doing" diff --git a/features/mobile/drawer.feature b/features/mobile/drawer.feature index fc1761e4d..6338406e3 100644 --- a/features/mobile/drawer.feature +++ b/features/mobile/drawer.feature @@ -9,26 +9,25 @@ Feature: Navigate between pages using the header menu and the drawer | Bob Jones | bob@bob.bob | | Alice Smith | alice@alice.alice | - And I sign in as "alice@alice.alice" And a user with email "bob@bob.bob" is connected with "alice@alice.alice" + And I sign in as "alice@alice.alice" on the mobile website Scenario: navigate to the stream page - When I open the drawer - And I follow "My activity" + When I go to the activity stream page And I click on selector "#header-title" - Then I should see "There are no posts yet." within "#main_stream" + Then I should be on the stream page Scenario: navigate to the notification page When I click on selector "#notification-badge" - Then I should see "Notifications" within "#main" + Then I should be on the notifications page Scenario: navigate to the conversation page When I click on selector "#conversations-badge" - Then I should see "Inbox" within "#main" + Then I should be on the conversations page Scenario: navigate to the publisher page When I click on selector "#compose-badge" - Then I should see "All aspects" within "#new_status_message" + Then I should be on the new status message page Scenario: search a user When I open the drawer @@ -38,57 +37,49 @@ Feature: Navigate between pages using the header menu and the drawer Scenario: search for a tag When I open the drawer And I search for "#bob" - Then I should see "#bob" within "#main > h1" + Then I should be on the tag page for "bob" Scenario: navigate to my activity page When I open the drawer - And I follow "My activity" - Then I should see "My activity" within "#main" + And I click on "My activity" in the drawer + Then I should be on the activity stream page Scenario: navigate to my mentions page - Given Alice has a post mentioning Bob - And I sign in as "bob@bob.bob" When I open the drawer - And I follow "@Mentions" - Then I should see "Bob Jones" within ".stream_element" + And I click on "@Mentions" in the drawer + Then I should be on the mentioned stream page Scenario: navigate to my aspects page Given "bob@bob.bob" has a public post with text "bob's text" When I open the drawer - And I follow "My aspects" - Then I should see "Besties" within "#all_aspects + li > ul" - And I follow "Besties" + And I click on "My aspects" in the drawer + And I click on "Besties" in the drawer Then I should see "bob's text" within "#main_stream" Scenario: navigate to the followed tags page - Given "bob@bob.bob" has a public post with text "bob is da #boss" - When I open the drawer - And I search for "#boss" - And I click on selector ".tag_following_action" - # Loading another page to refresh the drawer and make the now followed tag appears - And I click on selector "#compose-badge" + When I follow the "boss" tag + And I go to the stream page And I open the drawer - And I follow "#Followed tags" - Then I should see "#boss" within "#followed_tags + li > ul" - And I follow "#boss" - Then I should see "bob is da #boss" within "#main_stream" + And I click on "#Followed tags" in the drawer + And I click on "#boss" in the drawer + Then I should be on the tag page for "boss" + When I open the drawer - And I follow "#Followed tags" - Then I should see "Manage followed tags" within "#followed_tags + li > ul" - And I follow "Manage followed tags" - Then I should see "#boss" within "ul.followed_tags" + And I click on "#Followed tags" in the drawer + And I click on "Manage followed tags" in the drawer + Then I should be on the manage tag followings page Scenario: navigate to my profile page When I open the drawer - And I follow "Profile" - Then I should see "Alice" within "#author_info" + And I click on "Profile" in the drawer + Then I should be on my profile page - Scenario: navigate to my mentions page + Scenario: navigate to my contacts page When I open the drawer - And I follow "Contacts" - Then I should see "Contacts" within "#main" + And I click on "Contacts" in the drawer + Then I should be on the contacts page - Scenario: navigate to my mentions page + Scenario: navigate to my settings page When I open the drawer - And I follow "Settings" - Then I should see "Settings" within "#main" + And I click on "Settings" in the drawer + Then I should be on my account settings page diff --git a/features/mobile/edits_profile.feature b/features/mobile/edits_profile.feature index 583d3de6e..77a41ab7e 100644 --- a/features/mobile/edits_profile.feature +++ b/features/mobile/edits_profile.feature @@ -1,7 +1,7 @@ @javascript @mobile Feature: editing the profile in the mobile view Scenario: editing profile fields - Given I am signed in + Given I am signed in on the mobile website And I go to the edit profile page When I fill in the following: @@ -25,7 +25,7 @@ Feature: editing the profile in the mobile view And the "profile_gender" field should contain "Fearless" And the "profile_first_name" field should contain "Boba" And the "profile_last_name" field should contain "Fett" - And I should see "This is a bio" + And the "profile_bio" field should contain "This is a bio" And the "profile_date_year" field should be filled with "1986" And the "profile_date_month" field should be filled with "11" And the "profile_date_day" field should be filled with "30" @@ -39,7 +39,10 @@ Feature: editing the profile in the mobile view 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 confirm the alert + When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" + Then I should see "button.png completed" + And I should see a "img" within "#profile_photo_upload" + + When I go to my edit profile page Then I should see a "img" within "#profile_photo_upload" diff --git a/features/mobile/getting_started.feature b/features/mobile/getting_started.feature index 663ffe734..57568c1d2 100644 --- a/features/mobile/getting_started.feature +++ b/features/mobile/getting_started.feature @@ -17,8 +17,7 @@ Feature: editing the getting started in the mobile view And I should not see "awesome_button" Scenario: new user adds a profile photo and tags - When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" - And I confirm the alert + When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" 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" @@ -32,11 +31,13 @@ Feature: editing the getting started in the mobile view And I should not see "awesome_button" Scenario: new user completes getting started and signs in again later - When I sign out manually on the mobile website + When I sign out + And I go to the login page And I sign in manually as "ohai" with password "secret" on the mobile website Then I should be on the getting started page When I follow "awesome_button" Then I should be on the stream page - When I sign out manually on the mobile website + When I sign out + And I go to the login page And I sign in manually as "ohai" with password "secret" on the mobile website Then I should be on the stream page diff --git a/features/mobile/home.feature b/features/mobile/home.feature index 2b678a193..d0fea1ccd 100644 --- a/features/mobile/home.feature +++ b/features/mobile/home.feature @@ -15,5 +15,3 @@ Feature: Visit the landing page of the pod Then I should see "Welcome, friend" When I go to the mobile path Then I should see "LOG IN" - When I go to the mobile path - Then I should see "LOG IN" diff --git a/features/mobile/logged_out_browsing.feature b/features/mobile/logged_out_browsing.feature index 125fb6bbd..2609ca2f6 100644 --- a/features/mobile/logged_out_browsing.feature +++ b/features/mobile/logged_out_browsing.feature @@ -1,21 +1,21 @@ @javascript @mobile Feature: Browsing Diaspora as a logged out user mobile - In order to view public diaspora content - as a random internet user - I want to view public post and comments + In order to view public diaspora content + as a random internet user + I want to view public post and comments - Background: - Given a user named "Bob Jones" with email "bob@bob.bob" - And "bob@bob.bob" has a public post with text "public stuff" - And I sign in as "bob@bob.bob" - And I click on selector "a.comment-action.inactive" - And I fill in the following: - | text | this also | - And I press "Comment" - And I log out + Background: + Given a user named "Bob Jones" with email "bob@bob.bob" + And "bob@bob.bob" has a public post with text "public stuff" + And I sign in as "bob@bob.bob" on the mobile website + And I click on selector "a.comment-action.inactive" + And I fill in the following: + | text | this also | + And I press "Comment" + And I log out - Scenario: Visiting a profile page - When I am on "bob@bob.bob"'s page - Then I should see "public stuff" within ".ltr" - And I click on selector "a.show-comments" - And I should see "this also" within ".comment" + Scenario: Visiting a profile page + When I am on "bob@bob.bob"'s page + Then I should see "public stuff" within ".ltr" + And I click on selector "a.show-comments" + And I should see "this also" within ".comment" diff --git a/features/mobile/more-button.feature b/features/mobile/more-button.feature index a2a2816b9..b34b1c89a 100644 --- a/features/mobile/more-button.feature +++ b/features/mobile/more-button.feature @@ -1,43 +1,43 @@ @javascript @mobile Feature: using the more button on mobile stream - As a mobile user - I want to navigate the stream - And I want to test the text of the more-button in different environments + As a mobile user + I want to navigate the stream + And I want to test the text of the more-button in different environments - Background: - Given a user with username "bob" - And I sign in as "bob@bob.bob" on the mobile website + Background: + Given a user with username "bob" + And I sign in as "bob@bob.bob" on the mobile website - Scenario: There are no posts - Given I am on the home page + Scenario: There are no posts + Given I am on the home page - When I go to the stream page - Then I should see "There are no posts yet." + When I go to the stream page + Then I should see "There are no posts yet." - Scenario: There are <15 posts - Given I am on the home page - And "bob@bob.bob" has a public post with text "post 1" + Scenario: There are <15 posts + Given I am on the home page + And "bob@bob.bob" has a public post with text "post 1" - When I go to the stream page - Then I should see "You have reached the end of the stream." + When I go to the stream page + Then I should see "You have reached the end of the stream." - Scenario: There are 15 posts - Given I am on the home page - Given there are 15 public posts from "bob@bob.bob" - And "bob@bob.bob" has a public post with text "post 1" + Scenario: There are 15 posts + Given I am on the home page + Given there are 15 public posts from "bob@bob.bob" + And "bob@bob.bob" has a public post with text "post 1" - When I go to the stream page - Then I should see "More" + When I go to the stream page + Then I should see "More" - When I click on selector ".more-link" - Then I should see "You have reached the end of the stream." + When I click on selector ".more-link" + Then I should see "You have reached the end of the stream." - Scenario: There are 15 +1 posts - Given I am on the home page - Given there are 16 public posts from "bob@bob.bob" + Scenario: There are 15 +1 posts + Given I am on the home page + Given there are 16 public posts from "bob@bob.bob" - When I go to the stream page - Then I should see "More" + When I go to the stream page + Then I should see "More" - When I click on selector ".more-link" - Then I should see "You have reached the end of the stream." + When I click on selector ".more-link" + Then I should see "You have reached the end of the stream." diff --git a/features/mobile/multiphoto.feature b/features/mobile/multiphoto.feature index df8386fca..ddc79a2c1 100644 --- a/features/mobile/multiphoto.feature +++ b/features/mobile/multiphoto.feature @@ -6,23 +6,30 @@ Feature: viewing photos on the mobile main page Background: Given a user with username "bob" - When I sign in as "bob@bob.bob" on the mobile website - And I click on selector "#compose-badge" + And I sign in as "bob@bob.bob" on the mobile website Scenario: view full size image - Given I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher" + Given I visit the mobile publisher page + When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher" + Then I should see "button.png completed" + And I should see an uploaded image within the photo drop zone When I press "Share" + And I go to the stream page And I click on selector "img.stream-photo" Then I should see a "img" within "#show_content" And I should not see a "#arrow-right" within "#main" And I should not see a "#arrow-left" within "#main" Scenario: view multiphoto post - 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" + Given I visit the mobile publisher page + When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher" + Then I should see "button.png completed" + When I attach the file "spec/fixtures/button.gif" to hidden "file" within "#file-upload-publisher" + Then I should see "button.gif completed" When I press "Share" + And I go to the stream page Then I should see "+ 1" within ".additional_photo_count" When I click on selector "img.stream-photo" diff --git a/features/mobile/not_safe_for_work.feature b/features/mobile/not_safe_for_work.feature index 4a4e784b2..ea97bca1c 100644 --- a/features/mobile/not_safe_for_work.feature +++ b/features/mobile/not_safe_for_work.feature @@ -6,7 +6,7 @@ Feature: Not safe for work And a user with email "laura@office.example.com" is connected with "tommy@nsfw.example.com" Scenario: Setting not safe for work - When I sign in as "tommy@nsfw.example.com" + When I sign in as "tommy@nsfw.example.com" on the mobile website And I go to the edit profile page And I mark myself as not safe for work And I submit the form @@ -26,7 +26,7 @@ Feature: Not safe for work And "tommy@nsfw.example.com" has a public post with text "I love 0bj3ction4bl3 c0nt3nt!" and a picture #toggling nsfw state - When I sign in as "laura@office.example.com" + When I sign in as "laura@office.example.com" on the mobile website Then I should not see "I love 0bj3ction4bl3 c0nt3nt!" And I should not see "What do you think about 1 ninjas?" And I should not see "Posted from:" @@ -41,10 +41,9 @@ Feature: Not safe for work Scenario: Resharing a nsfw post with a poll Given "tommy@nsfw.example.com" has a public post with text "Sexy Senators Gone Wild!" and a poll - When I sign in as "laura@office.example.com" + When I sign in as "laura@office.example.com" on the mobile website And I toggle all nsfw posts - And I follow "Reshare" - And I confirm the alert + And I confirm the alert after I follow "Reshare" Then I should see a "a.reshare-action.active" When I go to the home page @@ -55,10 +54,9 @@ Feature: Not safe for work Scenario: Resharing a nsfw post with a location Given "tommy@nsfw.example.com" has a public post with text "Sexy Senators Gone Wild!" and a location - When I sign in as "laura@office.example.com" + When I sign in as "laura@office.example.com" on the mobile website And I toggle all nsfw posts - And I follow "Reshare" - And I confirm the alert + And I confirm the alert after I follow "Reshare" Then I should see a "a.reshare-action.active" When I go to the home page @@ -69,10 +67,9 @@ Feature: Not safe for work Scenario: Resharing a nsfw post with a picture Given "tommy@nsfw.example.com" has a public post with text "Sexy Senators Gone Wild!" and a picture - When I sign in as "laura@office.example.com" + When I sign in as "laura@office.example.com" on the mobile website And I toggle all nsfw posts - And I follow "Reshare" - And I confirm the alert + And I confirm the alert after I follow "Reshare" Then I should see a "a.reshare-action.active" When I go to the home page diff --git a/features/mobile/people_aspects.feature b/features/mobile/people_aspects.feature index c5a095ab6..8750c1526 100644 --- a/features/mobile/people_aspects.feature +++ b/features/mobile/people_aspects.feature @@ -1,42 +1,42 @@ @javascript @mobile Feature: adding and removing people from aspects - In order to add people to my contacts - As a mobile user - I want to add and remove people from my contacts + In order to add people to my contacts + As a mobile user + I want to add and remove people from my contacts - Background: - Given following users exist: - | username | - | bob | - | alice | - And I sign in as "bob@bob.bob" on the mobile website + Background: + Given following users exist: + | username | + | bob | + | alice | + And I sign in as "bob@bob.bob" on the mobile website - Scenario: verify different states of the cover button - When I am on "alice@alice.alice"'s page - Then the aspect dropdown within "#author_info" should be labeled "Add contact" + Scenario: verify different states of the cover button + When I am on "alice@alice.alice"'s page + Then the aspect dropdown within "#author_info" should be labeled "Add contact" - When I select "Unicorns" from "user_aspects" within "#author_info" - Then the aspect dropdown within "#author_info" should be labeled "Unicorns" + When I select "Unicorns" from "user_aspects" within "#author_info" + Then the aspect dropdown within "#author_info" should be labeled "Unicorns" - When I select "Besties" from "user_aspects" within "#author_info" - Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects" + When I select "Besties" from "user_aspects" within "#author_info" + Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects" - Scenario: add contact to aspect - When I am on "alice@alice.alice"'s page - And I select "Unicorns" from "user_aspects" within "#author_info" - Then the aspect dropdown within "#author_info" should be labeled "Unicorns" - Then I should have 1 contacts in "Unicorns" + Scenario: add contact to aspect + When I am on "alice@alice.alice"'s page + And I select "Unicorns" from "user_aspects" within "#author_info" + Then the aspect dropdown within "#author_info" should be labeled "Unicorns" + Then I should have 1 contacts in "Unicorns" - Scenario: remove contact to aspect - When I am on "alice@alice.alice"'s page - And I select "Unicorns" from "user_aspects" within "#author_info" - Then the aspect dropdown within "#author_info" should be labeled "Unicorns" + Scenario: remove contact to aspect + When I am on "alice@alice.alice"'s page + And I select "Unicorns" from "user_aspects" within "#author_info" + Then the aspect dropdown within "#author_info" should be labeled "Unicorns" - And I select "Besties" from "user_aspects" within "#author_info" - Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects" - Then I should have 1 contacts in "Unicorns" + And I select "Besties" from "user_aspects" within "#author_info" + Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects" + Then I should have 1 contacts in "Unicorns" - When I am on "alice@alice.alice"'s page - And I select "Unicorns" from "user_aspects" within "#author_info" - Then the aspect dropdown within "#author_info" should be labeled "Besties" - Then I should have 0 contacts in "Unicorns" + When I am on "alice@alice.alice"'s page + And I select "Unicorns" from "user_aspects" within "#author_info" + Then the aspect dropdown within "#author_info" should be labeled "Besties" + Then I should have 0 contacts in "Unicorns" diff --git a/features/mobile/posts_from_main_page.feature b/features/mobile/posts_from_main_page.feature index 74b176eef..27016314f 100644 --- a/features/mobile/posts_from_main_page.feature +++ b/features/mobile/posts_from_main_page.feature @@ -1,62 +1,60 @@ @javascript @mobile Feature: posting from the mobile main page - In order to navigate Diaspora* - As a mobile user - I want to tell the world I am eating a yogurt + In order to navigate Diaspora* + As a mobile user + I want to tell the world I am eating a yogurt - Background: - Given following users exist: - | username | - | bob | - | alice | - And I am on the home page - And I sign in as "bob@bob.bob" on the mobile website - And a user with username "bob" is connected with "alice" - Given I have following aspects: - | PostingTo | - | NotPostingThingsHere | - And I have user with username "alice" in an aspect called "PostingTo" - And I have user with username "alice" in an aspect called "NotPostingThingsHere" + Background: + Given following users exist: + | username | + | bob | + | alice | + And I am on the home page + And I sign in as "bob@bob.bob" on the mobile website + And a user with username "bob" is connected with "alice" + Given I have following aspects: + | PostingTo | + | NotPostingThingsHere | + And I have user with username "alice" in an aspect called "PostingTo" + And I have user with username "alice" in an aspect called "NotPostingThingsHere" - Scenario: post and delete some text - Given I visit the mobile publisher page - And I append "I am eating yogurt" to the mobile publisher - And I select "Unicorns" from "aspect_ids_" - And I press "Share" - When I go to the stream page - Then I should see "I am eating yogurt" - When I click on selector "a.remove" - And I confirm the alert - Then I should not see "I am eating yogurt" + Scenario: post and delete some text + Given I visit the mobile publisher page + And I append "I am eating yogurt" to the mobile publisher + And I select "Unicorns" from "aspect_ids_" + And I press "Share" + When I go to the stream page + Then I should see "I am eating yogurt" + When I confirm the alert after I click on selector "a.remove" + Then I should not see "I am eating yogurt" - Scenario: post a photo without text - Given I visit the mobile publisher page - 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" - When I go to the stream page - Then I should see a "img" within ".stream_element div.photo_attachments" - When I log out - And I sign in as "alice@alice.alice" on the mobile website - When I go to the stream page - Then I should see a "img" within ".stream_element div.photo_attachments" + Scenario: post a photo without text + Given I visit the mobile publisher page + When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher" + Then I should see "button.png completed" + And I should see an uploaded image within the photo drop zone + When I press "Share" + When I go to the stream page + Then I should see a "img" within ".stream_element div.photo_attachments" + When I log out + And I sign in as "alice@alice.alice" on the mobile website + When I go to the stream page + Then I should see a "img" within ".stream_element div.photo_attachments" - Scenario: back out of posting a photo-only post - Given I visit the mobile publisher page - When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload-publisher" - 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 "file" within "#file-upload-publisher" - And I should see "button.png completed" - And I click to delete the first uploaded photo - Then I should not see an uploaded image within the photo drop zone + Scenario: back out of posting a photo-only post + Given I visit the mobile publisher page + When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload-publisher" + Then I should not see an uploaded image within the photo drop zone + 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 + 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 visit the mobile publisher page - And I append "I am eating yogurt" to the mobile publisher - 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 - Then I should see an uploaded image within the photo drop zone - And the text area wrapper mobile should be with attachments + Scenario: back out of uploading a picture when another has been attached + Given I visit the mobile publisher page + And I append "I am eating yogurt" to the mobile publisher + 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 + Then I should see an uploaded image within the photo drop zone + And the text area wrapper mobile should be with attachments diff --git a/features/mobile/reactions.feature b/features/mobile/reactions.feature index ecaf0dd05..5f15cde82 100644 --- a/features/mobile/reactions.feature +++ b/features/mobile/reactions.feature @@ -43,6 +43,5 @@ Feature: reactions mobile post And I click on selector "a.show-comments" And I should see "1" within ".comment-count" When I click on selector "a.comment-action" - And I click on selector "a.remove" - And I confirm the alert + And I confirm the alert after I click on selector "a.remove" Then I should not see "1 reaction" within ".show-comments" diff --git a/features/mobile/reshare.feature b/features/mobile/reshare.feature index 48665aa2b..26441a78a 100644 --- a/features/mobile/reshare.feature +++ b/features/mobile/reshare.feature @@ -13,11 +13,10 @@ Feature: resharing from the mobile And a user with email "bob@bob.bob" is connected with "alice@alice.alice" And a user with email "eve@eve.eve" is connected with "bob@bob.bob" Given "bob@bob.bob" has a public post with text "reshare this!" - And I sign in as "alice@alice.alice" + And I sign in as "alice@alice.alice" on the mobile website Scenario: Resharing a post from a single post page - And I click on selector ".reshare-action.inactive" - And I confirm the alert + And I confirm the alert after I click on selector ".reshare-action.inactive" Then I should see a ".reshare-action.active" When I go to the stream page Then I should see "Reshared via" within ".reshare_via" @@ -25,8 +24,7 @@ Feature: resharing from the mobile 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" - And I click on the first selector ".reshare-action.inactive" - And I confirm the alert + And I confirm the alert after I click on the first selector ".reshare-action.inactive" Then I should see a ".reshare-action.active" When I go to the stream page Then I should see "Reshared via" within ".reshare_via" @@ -47,10 +45,9 @@ Feature: resharing from the mobile Then I should see "Original post deleted by author" within ".reshare" Scenario: Not resharing own post - Given I sign in as "bob@bob.bob" + Given I sign in as "bob@bob.bob" on the mobile website Then I should see a ".reshare-action.disabled" - When I click on selector ".reshare-action" - Then I should not see any alert + And I should not see any alert after I click on selector ".reshare-action" And I should not see a ".reshare-action.active" When I go to the stream page Then I should not see a ".reshare_via" diff --git a/features/mobile/signs_up.feature b/features/mobile/signs_up.feature index 1786bed43..5827ba900 100644 --- a/features/mobile/signs_up.feature +++ b/features/mobile/signs_up.feature @@ -12,7 +12,7 @@ Feature: New user registration When I fill in the new user form And I press "Sign up" Then I should be on the getting started page - Then I should see the 'getting started' contents + And I should see the 'getting started' contents Scenario: user fills in bogus data - client side validation When I fill in the following: diff --git a/features/mobile/tags.feature b/features/mobile/tags.feature index edca7f60c..6f6087801 100644 --- a/features/mobile/tags.feature +++ b/features/mobile/tags.feature @@ -7,9 +7,9 @@ Feature: Interacting with tags | bob | | alice | And "alice@alice.alice" has a public post with text "Hello! I am #newhere" - When I sign in as "bob@bob.bob" + When I sign in as "bob@bob.bob" on the mobile website And I visit the mobile search page - And I fill in the following: + And I fill in the following within "#main": | q | #newhere | And I press "Search" Then I should see "Follow #newhere" within ".tag_following_action" @@ -21,7 +21,7 @@ Feature: Interacting with tags Then I should see "Hello! I am #newhere" When I visit the mobile search page - And I fill in the following: + And I fill in the following within "#main": | q | #newhere | And I press "Search" Then I should see "Stop following #newhere" within ".tag_following_action" @@ -37,8 +37,7 @@ Feature: Interacting with tags When I am on the manage tag followings page Then I should see "#newhere" within "ul.followed_tags" - When I click on selector ".tag_following_action.only-delete" - And I confirm the alert + When I confirm the alert after I click on selector ".tag_following_action.only-delete" Then I should see "You aren't following any tags." When I am on the home page Then I should not see "Hello! I am #newhere" diff --git a/features/mobile/user_applications.feature b/features/mobile/user_applications.feature index 9e7ecbe2f..281d328c1 100644 --- a/features/mobile/user_applications.feature +++ b/features/mobile/user_applications.feature @@ -1,5 +1,4 @@ -@mobile -@javascript +@javascript @mobile Feature: managing authorized applications Background: Given following users exist: @@ -9,14 +8,14 @@ Feature: managing authorized applications And a client exists for user "augier@example.org" Scenario: displaying authorizations - When I sign in as "augier@example.org" + When I sign in as "augier@example.org" on the mobile website And I go to the user applications page Then I should see 2 authorized applications And I should see 1 authorized applications with no provided image And I should see 1 authorized applications with an image Scenario: revoke an authorization - When I sign in as "augier@example.org" + When I sign in as "augier@example.org" on the mobile website And I go to the user applications page And I revoke the first authorization Then I should see 1 authorized applications diff --git a/features/step_definitions/aspects_steps.rb b/features/step_definitions/aspects_steps.rb index b51284dcc..473ab2ab2 100644 --- a/features/step_definitions/aspects_steps.rb +++ b/features/step_definitions/aspects_steps.rb @@ -1,6 +1,6 @@ module AspectCukeHelpers def click_aspect_dropdown - find('.aspect_dropdown .dropdown-toggle').click + find(".aspect_dropdown .dropdown-toggle").trigger "click" end def toggle_aspect(a_name) @@ -12,19 +12,18 @@ module AspectCukeHelpers def toggle_aspect_via_ui(aspect_name) aspects_dropdown = find(".aspect_membership_dropdown .dropdown-toggle", match: :first) - aspects_dropdown.click + aspects_dropdown.trigger "click" selected_aspect_count = all(".aspect_membership_dropdown.open .dropdown-menu li.selected").length aspect = find(".aspect_membership_dropdown.open .dropdown-menu li", text: aspect_name) aspect_selected = aspect["class"].include? "selected" - aspect.click + aspect.trigger "click" aspect.parent.should have_no_css(".loading") # close dropdown page.should have_no_css('#profile.loading') unless selected_aspect_count == 0 or (selected_aspect_count == 1 and aspect_selected ) - aspects_dropdown.click + aspects_dropdown.trigger "click" end - aspects_dropdown.should have_no_xpath("..[contains(@class, 'active')]") end def aspect_dropdown_visible? @@ -89,20 +88,14 @@ When /^(.*) in the aspect creation modal$/ do |action| end When /^I drag "([^"]*)" (up|down)$/ do |aspect_name, direction| + page.execute_script("$('#aspect_nav .list-group').sortable('option', 'tolerance', 'pointer');") aspect_id = @me.aspects.where(name: aspect_name).first.id aspect = find(:xpath, "//div[@id='aspect_nav']/ul/a[@data-aspect-id='#{aspect_id}']") target = direction == "up" ? aspect.all(:xpath, "./preceding-sibling::a").last : aspect.all(:xpath, "./following-sibling::a").first - browser = aspect.base.driver.browser - mouse = browser.mouse - native_aspect = aspect.base.native - native_target = target.base.native - mouse.down native_aspect - mouse.move_to native_target - sleep 1 - mouse.up + aspect.drag_to target expect(page).to have_no_css "#aspect_nav .ui-sortable.syncing" - end +end And /^I toggle the aspect "([^"]*)"$/ do |name| toggle_aspect(name) diff --git a/features/step_definitions/auth_code_steps.rb b/features/step_definitions/auth_code_steps.rb index 8b19f7f52..33414b912 100644 --- a/features/step_definitions/auth_code_steps.rb +++ b/features/step_definitions/auth_code_steps.rb @@ -1,5 +1,5 @@ O_AUTH_QUERY_PARAMS_WITH_CODE = { - redirect_uri: "http://localhost:3000", + redirect_uri: "http://example.org/", response_type: "code", scope: "openid profile read", nonce: "hello", @@ -22,7 +22,7 @@ end When /^I parse the auth code and create a request to the token endpoint$/ do code = current_url[/(?<=code=)[^&]+/] post api_openid_connect_access_tokens_path, code: code, - redirect_uri: "http://localhost:3000", grant_type: "authorization_code", + redirect_uri: "http://example.org/", grant_type: "authorization_code", client_id: @client_id, client_secret: @client_secret end diff --git a/features/step_definitions/conversations_steps.rb b/features/step_definitions/conversations_steps.rb index 831affea0..c146902b5 100644 --- a/features/step_definitions/conversations_steps.rb +++ b/features/step_definitions/conversations_steps.rb @@ -26,7 +26,7 @@ Then /^I send a message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)" u 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}") - find("#conversation_text").native.send_keys :control, :return + find("#conversation_text").native.send_key %i(Ctrl Return) end end @@ -41,7 +41,7 @@ When /^I reply with "([^"]*)" using keyboard shortcuts$/ do |text| step %(I am on the conversations page) step %(I press the first ".conversation" within ".conversations") step %(I fill in "message_text" with "#{text}") - find("#message_text").native.send_keys :control, :return + find("#message_text").native.send_key %i(Ctrl Return) end Then /^I send a mobile message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person| diff --git a/features/step_definitions/custom_web_steps.rb b/features/step_definitions/custom_web_steps.rb index 60952f345..563ae51ec 100644 --- a/features/step_definitions/custom_web_steps.rb +++ b/features/step_definitions/custom_web_steps.rb @@ -106,13 +106,15 @@ When /^I prepare hiding the first post$/ do end When /^I click to delete the first post$/ do - step "I prepare the deletion of the first post" - step "I confirm the alert" + accept_alert do + step "I prepare the deletion of the first post" + end end When /^I click to hide the first post$/ do - step "I prepare hiding the first post" - step "I confirm the alert" + accept_alert do + step "I prepare hiding the first post" + end end When /^I click to delete the first comment$/ do @@ -123,7 +125,7 @@ end When /^I click to delete the first uploaded photo$/ do page.execute_script("$('#photodropzone .x').css('display', 'block');") - find("#photodropzone .x", match: :first).click + find("#photodropzone .x", match: :first).trigger "click" end And /^I click on selector "([^"]*)"$/ do |selector| @@ -134,16 +136,24 @@ And /^I click on the first selector "([^"]*)"$/ do |selector| find(selector, match: :first).click end -And /^I confirm the alert$/ do - page.driver.browser.switch_to.alert.accept +And /^I confirm the alert after (.*)$/ do |action| + accept_alert do + step action + end end -And /^I reject the alert$/ do - page.driver.browser.switch_to.alert.dismiss +And /^I reject the alert after (.*)$/ do |action| + dismiss_confirm do + step action + end end -And /^I should not see any alert$/ do - expect { page.driver.browser.switch_to.alert }.to raise_error(Selenium::WebDriver::Error::NoAlertPresentError) +And /^I should not see any alert after (.*)$/ do |action| + expect { + accept_alert do + step action + end + }.to raise_error(Capybara::ModalNotFound) end When /^(.*) in the mention modal$/ do |action| @@ -184,12 +194,6 @@ When /^I have turned off jQuery effects$/ do 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) - have_content(search_term) -end - Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)"$/ do |field, selector, value| with_scope(selector) do field = find_field(field) @@ -211,11 +215,11 @@ And /^I scroll down on the notifications dropdown$/ do end Then /^I should have scrolled down$/ do - page.evaluate_script("window.pageYOffset").should > 0 + expect(page.evaluate_script("window.pageYOffset")).to be > 0 end Then /^I should have scrolled down on the notification dropdown$/ do - page.evaluate_script("$('.notifications').scrollTop()").should > 0 + expect(page.evaluate_script("$('.notifications').scrollTop()")).to be > 0 end diff --git a/features/step_definitions/drawer_steps.rb b/features/step_definitions/drawer_steps.rb new file mode 100644 index 000000000..7f7359366 --- /dev/null +++ b/features/step_definitions/drawer_steps.rb @@ -0,0 +1,5 @@ +And /^I click on "([^"]*)" in the drawer$/ do |txt| + within("#drawer") do + find_link(txt).trigger "click" + end +end diff --git a/features/step_definitions/implicit_flow_steps.rb b/features/step_definitions/implicit_flow_steps.rb index f1603ec1a..892aa2e09 100644 --- a/features/step_definitions/implicit_flow_steps.rb +++ b/features/step_definitions/implicit_flow_steps.rb @@ -1,5 +1,5 @@ O_AUTH_QUERY_PARAMS = { - redirect_uri: "http://localhost:3000", + redirect_uri: "http://example.org/", response_type: "id_token token", scope: "openid profile read", nonce: "hello", @@ -8,7 +8,7 @@ O_AUTH_QUERY_PARAMS = { } O_AUTH_QUERY_PARAMS_WITH_MAX_AGE = { - redirect_uri: "http://localhost:3000", + redirect_uri: "http://example.org/", response_type: "id_token token", scope: "openid profile read", nonce: "hello", diff --git a/features/step_definitions/keyboard_navigation_steps.rb b/features/step_definitions/keyboard_navigation_steps.rb index 9c7a08d7c..2573abc0e 100644 --- a/features/step_definitions/keyboard_navigation_steps.rb +++ b/features/step_definitions/keyboard_navigation_steps.rb @@ -5,7 +5,7 @@ When /^I press the "([^\"]*)" key somewhere$/ do |key| 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").native.send_key(key) end Then /^post (\d+) should be highlighted$/ do |position| @@ -15,10 +15,3 @@ end And /^I should have navigated to the highlighted post$/ do find(".shortcut_selected")["offsetTop"].to_i.should == page.evaluate_script("window.pageYOffset + 50").to_i end - -When /^I scroll to post (\d+)$/ do |position| - page.should have_css("div.stream_element") - page.driver.browser.execute_script(" - window.scrollTo(window.pageXOffset, $('div.stream_element')[#{position}-1].offsetTop-50); - ") -end diff --git a/features/step_definitions/location_steps.rb b/features/step_definitions/location_steps.rb index 5a37904c4..cfd41f0e7 100644 --- a/features/step_definitions/location_steps.rb +++ b/features/step_definitions/location_steps.rb @@ -1,7 +1,11 @@ When /^I allow geolocation$/ do page.execute_script <<-JS - navigator.geolocation.getCurrentPosition = function(success) { - success({coords: {latitude: 42.42424242, longitude: 3.14159}}); + window.navigator = { + geolocation: { + getCurrentPosition: function(success) { + success({coords: {latitude: 42.42424242, longitude: 3.14159}}); + } + } }; JS end diff --git a/features/step_definitions/mention_steps.rb b/features/step_definitions/mention_steps.rb index a36557563..e382baba6 100644 --- a/features/step_definitions/mention_steps.rb +++ b/features/step_definitions/mention_steps.rb @@ -15,7 +15,7 @@ And /^Alice has (\d+) posts mentioning Bob$/ do |n| end And /^I mention Alice in the publisher$/ do - write_in_publisher("@alice") + step %(I append "@alice" to the publisher) step %(I click on the first user in the mentions dropdown list) end diff --git a/features/step_definitions/mobile_steps.rb b/features/step_definitions/mobile_steps.rb index 376e7dbda..ba0bfba22 100644 --- a/features/step_definitions/mobile_steps.rb +++ b/features/step_definitions/mobile_steps.rb @@ -12,6 +12,7 @@ end When /^I open the drawer$/ do find("#menu-badge").click + expect(find("#app")["class"]).to include "draw" end Then /^the aspect dropdown within "([^"]*)" should be labeled "([^"]*)"/ do |selector, label| diff --git a/features/step_definitions/modal_steps.rb b/features/step_definitions/modal_steps.rb index 36dbd9295..ad74522eb 100644 --- a/features/step_definitions/modal_steps.rb +++ b/features/step_definitions/modal_steps.rb @@ -12,3 +12,9 @@ When /^I put in my password in the close account modal$/ do execute_script("$(\"#closeAccountModal input#close_account_password\").val(\"#{@me.password}\")") expect(find("#closeAccountModal input#close_account_password").value).to eq(@me.password) end + +When /^I press "(.*)" in the modal$/ do |txt| + within(".modal.in") do + find_button(txt).trigger "click" + end +end diff --git a/features/step_definitions/oidc_common_steps.rb b/features/step_definitions/oidc_common_steps.rb index 4e28cd5f2..24f543754 100644 --- a/features/step_definitions/oidc_common_steps.rb +++ b/features/step_definitions/oidc_common_steps.rb @@ -10,7 +10,7 @@ Given /^a client exists for user "([^\"]*)"$/ do |email| end When /^I register a new client$/ do - post api_openid_connect_clients_path, redirect_uris: ["http://localhost:3000"], client_name: "diaspora client" + post api_openid_connect_clients_path, redirect_uris: ["http://example.org/"], client_name: "diaspora client" end When /^I use received valid bearer tokens to access user info$/ do diff --git a/features/step_definitions/post_with_poll_steps.rb b/features/step_definitions/post_with_poll_steps.rb index 523e60dc7..4d95ef1db 100644 --- a/features/step_definitions/post_with_poll_steps.rb +++ b/features/step_definitions/post_with_poll_steps.rb @@ -13,7 +13,7 @@ end When /^I fill in the following for the options:$/ do |table| i = 0 table.raw.flatten.each do |value| - all(".poll-answer input")[i].set(value) + all(".poll-answer input")[i].native.send_keys(value) i+=1 end end @@ -25,7 +25,7 @@ end When(/^I fill in values for the first two options$/) do all(".poll-answer input").each_with_index do |answer, i| - answer.set "answer option #{i}" + answer.native.send_keys "answer option #{i}" end end diff --git a/features/step_definitions/posts_steps.rb b/features/step_definitions/posts_steps.rb index 3b9a6a233..eacd7ac93 100644 --- a/features/step_definitions/posts_steps.rb +++ b/features/step_definitions/posts_steps.rb @@ -7,7 +7,7 @@ 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") + expect(find("#photodropzone img")["src"]).to include("uploads/images") end Then /^I should not see an uploaded image within the photo drop zone$/ do diff --git a/features/step_definitions/search_steps.rb b/features/step_definitions/search_steps.rb index 18b499989..35fd296fa 100644 --- a/features/step_definitions/search_steps.rb +++ b/features/step_definitions/search_steps.rb @@ -1,5 +1,5 @@ When /^I enter "([^"]*)" in the search input$/ do |search_term| - fill_in "q", :with => search_term + find("input#q").native.send_keys(search_term) end When /^I click on the first search result$/ do @@ -12,6 +12,13 @@ When /^I press enter in the search input$/ do find("input#q").native.send_keys :return end +When /^I search for "([^\"]*)"$/ do |search_term| + field = find_field("q") + fill_in "q", with: search_term + field.native.send_key(:enter) + expect(page).to have_content(search_term) +end + Then /^I should not see any search results$/ do expect(page).to_not have_selector(".tt-suggestion") end diff --git a/features/step_definitions/session_steps.rb b/features/step_definitions/session_steps.rb index 320c09831..56c747fad 100644 --- a/features/step_definitions/session_steps.rb +++ b/features/step_definitions/session_steps.rb @@ -1,44 +1,31 @@ -Given /^(?:I am signed in)$/ do +Given /^I am signed in( on the mobile website)?$/ do |mobile| automatic_login - confirm_login + confirm_login mobile end When /^I try to sign in manually$/ do manual_login end -When /^I (?:sign|log) in manually as "([^"]*)" with password "([^"]*)"$/ do |username, password| +When /^I (?:sign|log) in manually as "([^"]*)" with password "([^"]*)"( on the mobile website)?$/ \ +do |username, password, mobile| @me = User.find_by_username(username) @me.password ||= password manual_login - confirm_login + confirm_login mobile end -When /^I (?:sign|log) in as "([^"]*)"$/ do |email| +When /^I (?:sign|log) in as "([^"]*)"( on the mobile website)?$/ do |email, mobile| @me = User.find_by_email(email) @me.password ||= 'password' automatic_login - confirm_login + confirm_login mobile end -When /^I (?:sign|log) in as "([^"]*)" on the mobile website$/ do |email| - @me = User.find_by_email(email) - @me.password ||= 'password' - automatic_login - confirm_login_mobile -end - -When /^I (?:sign|log) in manually as "([^"]*)" with password "([^"]*)" on the mobile website$/ do |username, password| - @me = User.find_by_username(username) - @me.password ||= password - manual_login - confirm_login_mobile -end - -When /^I (?:sign|log) in with password "([^"]*)"$/ do |password| +When /^I (?:sign|log) in with password "([^"]*)"( on the mobile website)?$/ do |password, mobile| @me.password = password automatic_login - confirm_login + confirm_login mobile end When /^I put in my password in "([^"]*)"$/ do |field| diff --git a/features/step_definitions/tag_steps.rb b/features/step_definitions/tag_steps.rb index 2f4cf160d..7ea491c4e 100644 --- a/features/step_definitions/tag_steps.rb +++ b/features/step_definitions/tag_steps.rb @@ -1,8 +1,13 @@ When(/^I unfollow the "(.*?)" tag$/) do |tag| - within("#tags_list") do - li = find("li", text: tag) - li.hover - li.find(".delete-tag-following").click + accept_alert do + within("#tags_list") do + li = find("li", text: tag) + li.hover + li.find(".delete-tag-following").click + end end - step "I confirm the alert" +end + +When /^I follow the "(.*?)" tag$/ do |tag| + TagFollowing.create!(tag: FactoryGirl.create(:tag, name: tag), user: @me) end diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index e2d5ee9cb..c4b8b490f 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -206,7 +206,7 @@ end And /^I should be able to friend "([^\"]*)"$/ do |email| user = User.find_by_email(email) - step 'I should see "Add contact"' + step 'I should see a ".aspect_dropdown"' step "I should see \"#{user.name}\"" end @@ -219,5 +219,5 @@ Given /^I did request my photos$/ do end Then /^I should get a zipped file$/ do - expect(DownloadHelpers.download).to end_with("zip") + expect(page.response_headers["Content-Type"]).to eq("application/zip") end diff --git a/features/step_definitions/web_steps.rb b/features/step_definitions/web_steps.rb index e7e0ee0e0..7c8da9054 100644 --- a/features/step_definitions/web_steps.rb +++ b/features/step_definitions/web_steps.rb @@ -39,13 +39,7 @@ When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| end end -When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| - with_scope(selector) do - fill_in(field, :with => value) - end -end - -When /^(?:|I )fill in "([^"]*)" for "([^"]*)"(?: within "([^"]*)")?$/ do |value, field, selector| +When /^(?:|I )fill in "([^"]*)" (?:for|with) "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| with_scope(selector) do fill_in(field, :with => value) end @@ -156,25 +150,26 @@ end Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector| with_scope(selector) do - field_checked = find_field(label)['checked'] - field_checked.should eq('true') + expect(find_field(label)["checked"]).to be_truthy end end Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector| with_scope(selector) do - field_checked = find_field(label)['checked'] - field_checked.should be_falsey + expect(find_field(label)["checked"]).to be_falsey end end Then /^the "([^"]*)" bootstrap-switch should be (on|off)$/ do |label, state| - result = execute_script("return $('#{label}').bootstrapSwitch('state')") - result.should state == "on" ? be_truthy : be_falsey + if state == "on" + expect(page.evaluate_script("$('#{label}').bootstrapSwitch('state')")).to be_truthy + else + expect(page.evaluate_script("$('#{label}').bootstrapSwitch('state')")).to be_falsey + end end Then /^I toggle the "([^"]*)" bootstrap-switch$/ do |label| - execute_script("return $('#{label}').bootstrapSwitch('toggleState')") + page.execute_script("return $('#{label}').bootstrapSwitch('toggleState')") end Then /^(?:|I )should be on (.+)$/ do |page_name| diff --git a/features/support/application_cuke_helpers.rb b/features/support/application_cuke_helpers.rb index 0078d61fc..082c05b1a 100644 --- a/features/support/application_cuke_helpers.rb +++ b/features/support/application_cuke_helpers.rb @@ -22,8 +22,7 @@ module ApplicationCukeHelpers end def confirm_form_validation_error(element) - is_invalid = page.evaluate_script("$('#{element}').is(':invalid')") - expect(is_invalid).to be true + expect(page.evaluate_script("$('#{element}')[0].checkValidity();")).to be false end def check_fields_validation_error(field_list) @@ -31,7 +30,6 @@ module ApplicationCukeHelpers confirm_form_validation_error("input##{f.strip}") end end - end World(ApplicationCukeHelpers) diff --git a/features/support/download_helpers.rb b/features/support/download_helpers.rb deleted file mode 100644 index a3fb9fd49..000000000 --- a/features/support/download_helpers.rb +++ /dev/null @@ -1,40 +0,0 @@ -# Credits goes to Steve Richert -# http://collectiveidea.com/blog/archives/2012/01/27/testing-file-downloads-with-capybara-and-chromedriver/ -module DownloadHelpers - TIMEOUT ||= 5 - PATH ||= Rails.root.join("tmp/downloads") - - module_function - - def downloads - Dir[PATH.join("*")] - end - - def download - wait_for_download - downloads.first - end - - def download_content - wait_for_download - File.read(download) - end - - def wait_for_download - Timeout.timeout(TIMEOUT) do - sleep 0.1 until downloaded? - end - end - - def downloaded? - !downloading? && downloads.any? - end - - def downloading? - downloads.grep(/\.part$/).any? - end - - def clear_downloads - FileUtils.rm_f(downloads) - end -end diff --git a/features/support/env.rb b/features/support/env.rb index 0c5cf320d..e072ead9f 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -10,7 +10,7 @@ require "cucumber/rails" require "capybara/rails" require "capybara/cucumber" require "capybara/session" -require "selenium/webdriver" +require "capybara/poltergeist" require "cucumber/api_steps" require "json_spec/cucumber" @@ -20,30 +20,11 @@ Capybara.server_port = AppConfig.pod_uri.port Rails.application.routes.default_url_options[:host] = AppConfig.pod_uri.host Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port -# Use a version of Firefox defined by environment variable, if set -Selenium::WebDriver::Firefox::Binary.path = ENV["FIREFOX_BINARY_PATH"] || Selenium::WebDriver::Firefox::Binary.path - -Capybara.register_driver :selenium do |app| - profile = Selenium::WebDriver::Firefox::Profile.new - # Set the download directory to "tmp/downloads" - profile["browser.download.dir"] = DownloadHelpers::PATH.to_s - # Save the file instead of opening it - profile["browser.download.folderList"] = 2 - # Hide the download Manager - profile["browser.download.manager.showWhenStarting"] = false - # Suppress "open with" dialog for zipped files only - profile["browser.helperApps.neverAsk.saveToDisk"] = "application/zip" - # Start Firefox using our profile - Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile) +Capybara.register_driver :poltergeist do |app| + Capybara::Poltergeist::Driver.new(app, timeout: 60) end -Capybara.register_driver :mobile do |app| - profile = Selenium::WebDriver::Firefox::Profile.new - profile["general.useragent.override"] = "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0" - Capybara::Selenium::Driver.new(app, profile: profile) -end - -Capybara.default_driver = :selenium +Capybara.javascript_driver = :poltergeist # Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In # order to ease the transition to Capybara we set the default here. If you'd @@ -81,9 +62,11 @@ require Rails.root.join('spec', 'support', 'inlined_jobs') require Rails.root.join('spec', 'support', 'user_methods') include HelperMethods -Before do +Before do |scenario| Devise.mailer.deliveries = [] - page.driver.browser.manage.window.resize_to(1024, 500) - # Delete all files in "tmp/downloads" - DownloadHelpers.clear_downloads + page.driver.headers = if scenario.source_tag_names.include? "@mobile" + {"User-Agent" => "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0"} + else + page.driver.headers = {} + end end diff --git a/features/support/matchers.rb b/features/support/matchers.rb index 24ddc6ff8..f38e8935d 100644 --- a/features/support/matchers.rb +++ b/features/support/matchers.rb @@ -11,6 +11,18 @@ RSpec::Matchers.define :have_path do |expected| end end +RSpec::Matchers.define :have_path_in do |expected| + match do |actual| + await_condition { expected.include? actual.current_path } + end + + failure_message_for_should do |actual| + "expected #{actual.inspect} to have path in #{expected.inspect} but was #{actual.current_path.inspect}" + end + failure_message_for_should_not do |actual| + "expected #{actual.inspect} to not have path in #{expected.inspect} but it had" + end +end RSpec::Matchers.define :have_value do |expected| match do |actual| @@ -25,7 +37,6 @@ RSpec::Matchers.define :have_value do |expected| end end - def await_condition &condition start_time = Time.zone.now until condition.call diff --git a/features/support/paths.rb b/features/support/paths.rb index 223915aed..ae9f0d404 100644 --- a/features/support/paths.rb +++ b/features/support/paths.rb @@ -66,7 +66,11 @@ module NavigationHelpers end def confirm_on_page(page_name) - expect(page).to have_path(path_to(page_name)) + if page_name == "my profile page" + expect(page).to have_path_in([person_path(@me.person), user_profile_path(@me.username)]) + else + expect(page).to have_path(path_to(page_name)) + end end end diff --git a/features/support/publishing_cuke_helpers.rb b/features/support/publishing_cuke_helpers.rb index 4bea24d3b..c16735c00 100644 --- a/features/support/publishing_cuke_helpers.rb +++ b/features/support/publishing_cuke_helpers.rb @@ -5,7 +5,7 @@ module PublishingCukeHelpers def append_to_publisher(txt, input_selector='#status_message_fake_text') elem = find(input_selector) - elem.native.send_keys(' ' + txt) + elem.native.send_key(" #{txt}") # make sure the other text field got the new contents expect(find("#status_message_text", visible: false)).to have_value txt diff --git a/features/support/user_cuke_helpers.rb b/features/support/user_cuke_helpers.rb index 3a94912b7..5043d0a0a 100644 --- a/features/support/user_cuke_helpers.rb +++ b/features/support/user_cuke_helpers.rb @@ -43,19 +43,17 @@ module UserCukeHelpers end # checks the page content to see, if the login was successful - def confirm_login - page.has_content?("#{@me.first_name} #{@me.last_name}") - end - - # checks the mobile page content to see, if the login was successful - def confirm_login_mobile - page.has_css?("#notification_badge") + def confirm_login(mobile) + if mobile + expect(page).to have_css "#menu-badge" + else + expect(find("#user_menu")).to have_content "#{@me.first_name} #{@me.last_name}" + end end # delete all cookies, destroying the current session def logout - $browser.delete_cookie('_session', 'path=/') if $browser - $browser.delete_all_visible_cookies if $browser + page.driver.clear_cookies end # go to user menu, expand it, and click logout diff --git a/spec/controllers/home_controller_spec.rb b/spec/controllers/home_controller_spec.rb index 79ed02869..2fc56d646 100644 --- a/spec/controllers/home_controller_spec.rb +++ b/spec/controllers/home_controller_spec.rb @@ -41,4 +41,18 @@ describe HomeController, type: :controller do expect(session[:mobile_view]).to be true end end + + describe "#force_mobile" do + it "changes :html to :mobile" do + session[:mobile_view] = nil + get :force_mobile + expect(session[:mobile_view]).to be true + end + + it "keeps :mobile" do + session[:mobile_view] = true + get :force_mobile + expect(session[:mobile_view]).to be true + end + end end