Merge pull request #6768 from svbergerem/poltergeist

Use Poltergeist instead of Selenium
This commit is contained in:
Dennis Schubert 2016-06-19 11:43:05 +02:00
commit eb1e1e1263
78 changed files with 477 additions and 620 deletions

View file

@ -22,7 +22,13 @@ branches:
- 'stable' - 'stable'
- 'develop' - '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" bundler_args: "--deployment --without development production --with mysql postgresql --jobs 3 --retry 3"
script: "./script/ci/build.sh" script: "./script/ci/build.sh"

View file

@ -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) * 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 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) * 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 ## Bug fixes
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852) * Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)

View file

@ -281,7 +281,7 @@ group :test do
gem "capybara", "2.7.1" gem "capybara", "2.7.1"
gem "database_cleaner", "1.5.3" 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 "cucumber-api-steps", "0.13", require: false
gem "json_spec", "1.1.4" gem "json_spec", "1.1.4"

View file

@ -116,9 +116,8 @@ GEM
timers (>= 4.1.1) timers (>= 4.1.1)
celluloid-supervision (0.20.5) celluloid-supervision (0.20.5)
timers (>= 4.1.1) timers (>= 4.1.1)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
chunky_png (1.3.5) chunky_png (1.3.5)
cliver (0.3.2)
coderay (1.1.1) coderay (1.1.1)
coffee-rails (4.1.1) coffee-rails (4.1.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@ -579,6 +578,11 @@ GEM
pg (0.18.4) pg (0.18.4)
phantomjs (2.1.1.0) phantomjs (2.1.1.0)
pkg-config (1.1.7) 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) powerpack (0.1.1)
pronto (0.6.0) pronto (0.6.0)
gitlab (~> 3.6, >= 3.4.0) gitlab (~> 3.6, >= 3.4.0)
@ -781,11 +785,6 @@ GEM
rake (>= 0.9, < 12) rake (>= 0.9, < 12)
sass (~> 3.4.15) sass (~> 3.4.15)
securecompare (1.0.0) 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) shellany (0.0.1)
shoulda-matchers (3.1.1) shoulda-matchers (3.1.1)
activesupport (>= 4.0.0) activesupport (>= 4.0.0)
@ -902,7 +901,9 @@ GEM
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff 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) will_paginate (3.1.0)
xml-simple (1.1.5) xml-simple (1.1.5)
xpath (2.0.0) xpath (2.0.0)
@ -982,6 +983,7 @@ DEPENDENCIES
open_graph_reader (= 0.6.1) open_graph_reader (= 0.6.1)
openid_connect (= 0.11.2) openid_connect (= 0.11.2)
pg (= 0.18.4) pg (= 0.18.4)
poltergeist (= 1.9.0)
pronto (= 0.6.0) pronto (= 0.6.0)
pronto-eslint (= 0.6.1) pronto-eslint (= 0.6.1)
pronto-haml (= 0.6.0) pronto-haml (= 0.6.0)
@ -1029,7 +1031,6 @@ DEPENDENCIES
ruby-oembed (= 0.10.1) ruby-oembed (= 0.10.1)
rubyzip (= 1.2.0) rubyzip (= 1.2.0)
sass-rails (= 5.0.4) sass-rails (= 5.0.4)
selenium-webdriver (= 2.47.1)
shoulda-matchers (= 3.1.1) shoulda-matchers (= 3.1.1)
sidekiq (= 4.1.2) sidekiq (= 4.1.2)
sidekiq-cron (= 0.4.2) sidekiq-cron (= 0.4.2)

View file

@ -8,13 +8,13 @@ app.views.SinglePostCommentStream = app.views.CommentStream.extend({
}, },
highlightPermalinkComment: function() { highlightPermalinkComment: function() {
if(document.location.hash){ if (document.location.hash && $(document.location.hash).length > 0) {
var element = $(document.location.hash); var element = $(document.location.hash);
var headerSize = 50; var headerSize = 60;
$(".highlighted").removeClass("highlighted"); $(".highlighted").removeClass("highlighted");
element.addClass("highlighted"); element.addClass("highlighted");
var pos = element.offset().top - headerSize; var pos = element.offset().top - headerSize;
$("html").animate({scrollTop:pos}); window.scroll(0, pos);
} }
}, },

View file

@ -7,6 +7,7 @@
//= require jquery.charcount //= require jquery.charcount
//= require js-routes //= require js-routes
//= require autosize //= require autosize
//= require keycodes
//= require jquery.autoSuggest.custom //= require jquery.autoSuggest.custom
//= require fileuploader-custom //= require fileuploader-custom
//= require rails-timeago //= require rails-timeago

View file

@ -220,7 +220,7 @@
}, },
resetCommentBox: function(el){ 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.attr("value", commentButton.data("reset-with"));
commentButton.removeAttr("disabled"); commentButton.removeAttr("disabled");
commentButton.blur(); commentButton.blur();

View file

@ -74,7 +74,7 @@ $mobile-navbar-height: 46px;
} }
.navbar-toggle { .navbar-toggle {
display: unset; display: block;
margin: 6px 15px; margin: 6px 15px;
} }

View file

@ -1,5 +1,5 @@
%div %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'} %option{value: 'list_cover', class: 'list_cover', disabled: 'true', selected: 'true'}
= t("add_contact") = t("add_contact")
- contact = current_user.contact_for(@person) - contact = current_user.contact_for(@person)

View file

@ -29,11 +29,12 @@
$('#file-upload').addClass("loading"); $('#file-upload').addClass("loading");
$("#profile_photo_upload").find(".avatar").addClass('loading'); $("#profile_photo_upload").find(".avatar").addClass('loading');
$("#file-upload-spinner").removeClass("hidden"); $("#file-upload-spinner").removeClass("hidden");
$("#fileInfo").show();
}, },
onComplete: function(id, fileName, responseJSON){ onComplete: function(id, fileName, responseJSON){
$("#file-upload-spinner").addClass("hidden"); $("#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"); $('#file-upload').removeClass("loading");
/* flash message prompt */ /* flash message prompt */

View file

@ -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 <application_address>:<application_port> to localhost:<tunnel_to_localhost_port>
# 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: ""

View file

@ -16,8 +16,7 @@ Feature: The activity stream
And I should see "is that a poodle?" And I should see "is that a poodle?"
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
And I click to delete the first comment And I confirm the alert after I click to delete the first comment
And I confirm the alert
And I go to the activity stream page And I go to the activity stream page
Then I should not see "Look at this dog" Then I should not see "Look at this dog"

View file

@ -11,15 +11,13 @@ Feature: Blocking a user from the stream
And I sign in as "bob@bob.bob" And I sign in as "bob@bob.bob"
Scenario: Blocking a user Scenario: Blocking a user
When I click on the first block button When I confirm the alert after I click on the first block button
And I confirm the alert
And I go to the home page And I go to the home page
Then I should not see any posts in my stream Then I should not see any posts in my stream
Scenario: Blocking a user from the profile page Scenario: Blocking a user from the profile page
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
When I click on the profile block button And I confirm the alert after I click on the profile block button
And I confirm the alert
Then "All your base are belong to us!" should be post 1 Then "All your base are belong to us!" should be post 1
When I go to the home page When I go to the home page
Then I should not see any posts in my stream Then I should not see any posts in my stream

View file

@ -11,8 +11,7 @@ Feature: Close account
Then I should see a modal Then I should see a modal
And I should see "Hey, please dont go!" within "#closeAccountModal" And I should see "Hey, please dont go!" within "#closeAccountModal"
When I put in my password in "close_account_password" When I put in my password in "close_account_password"
And I press "close_account_confirm" And I confirm the alert after I press "Close account" in the modal
And I confirm the alert
Then I should be on the new user session page Then I should be on the new user session page
When I try to sign in manually When I try to sign in manually

View file

@ -27,8 +27,7 @@ Feature: commenting
When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog" When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog"
And I am on "alice@alice.alice"'s page And I am on "alice@alice.alice"'s page
Then I should see "is that a poodle?" Then I should see "is that a poodle?"
When I click to delete the first comment When I confirm the alert after I click to delete the first comment
And I confirm the alert
Then I should not see "is that a poodle?" Then I should not see "is that a poodle?"
Scenario: expand the comment form in the main stream and an individual aspect stream 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" Then I should see "Look at this dog"
When I follow "less than a minute ago" When I follow "less than a minute ago"
Then I should see "Look at this dog" Then I should see "Look at this dog"
And I make a show page comment "I think thats a cat" When I make a show page comment "I think thats a cat"
Then I should see "less than a minute ago" within "#comments" Then I should see "less than a minute ago" within "#comments"
When I go to "alice@alice.alice"'s page When I go to "alice@alice.alice"'s page
Then I should see "I think thats a cat" Then I should see "I think thats a cat"
@ -60,7 +59,8 @@ Feature: commenting
Then I should see "Look at this dog" Then I should see "Look at this dog"
And I should see "I think thats a cat" within ".comment:last-child" And I should see "I think thats a cat" within ".comment:last-child"
When I follow "less than a minute ago" within ".comment:last-child" When I follow "less than a minute ago" within ".comment:last-child"
Then I should see "I think thats a cat" within ".comment .highlighted" Then I should see "Look at this dog" within "#single-post-content"
And I should see "I think thats a cat" within ".comment .highlighted"
And I should have scrolled down And I should have scrolled down
Scenario: permalink to comment from a status show page Scenario: permalink to comment from a status show page

View file

@ -25,7 +25,7 @@ Feature: editing your profile
And the "profile_gender" field should contain "Fearless" And the "profile_gender" field should contain "Fearless"
And the "profile_first_name" field should contain "Boba" And the "profile_first_name" field should contain "Boba"
And the "profile_last_name" field should contain "Fett" 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_year" field should be filled with "1986"
And the "profile_date_month" field should be filled with "11" And the "profile_date_month" field should be filled with "11"
And the "profile_date_day" field should be filled with "30" 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 I should see "#starwars" within "ul#as-selections-tags"
And the "#profile_public_details" bootstrap-switch should be on 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" When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
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" Then I should see a "img" within "#profile_photo_upload"

View file

@ -6,21 +6,19 @@ Feature: posting
Background: Background:
Given following users exist: Given following users exist:
| username | | username | email |
| bob | | Alice Smith | alice@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 "bob@bob.bob" When I sign in as "alice@alice.alice"
And I post a status with the text "I am da #boss" And I go to the tag page for "boss"
When I sign out
And I sign in as "alice@alice.alice"
And I search for "#boss"
And I press "Follow #boss" And I press "Follow #boss"
Then I should see a ".tag-following-action .followed"
Scenario: can post a message from the tag page Scenario: can post a message from the tag page
Then I should see "#boss" within "#publisher" Then I should see "#boss" within "#publisher"
And I click the publisher and post "#boss from the tag page" When I click the publisher and post "#boss from the tag page"
And I search for "#boss" And I go to the tag page for "boss"
Then I should see "#boss from the tag page" Then I should see "#boss from the tag page"
Scenario: see a tag that I am following 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" Then I should see "#boss from the #boss tag page" within "body"
Scenario: can stop following a tag from the tag page 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 And I go to the followed tags stream page
Then I should not see "#boss" within "#tags_list" Then I should not see "#boss" within "#tags_list"

View file

@ -15,8 +15,7 @@ Feature: Invitations
And I fill in the following: And I fill in the following:
| profile_first_name | O | | profile_first_name | O |
And I follow "awesome_button" And I confirm the alert after I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
And I close the publisher And I close the publisher
@ -31,8 +30,7 @@ Feature: Invitations
And I fill in the following: And I fill in the following:
| profile_first_name | O | | profile_first_name | O |
And I follow "awesome_button" And I confirm the alert after I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
And I close the publisher And I close the publisher
And I log out And I log out

View file

@ -36,8 +36,12 @@ Feature: Keyboard navigation
And I should have navigated to the highlighted post And I should have navigated to the highlighted post
Scenario: navigate upwards Scenario: navigate upwards
When I scroll to post 3 When I press the "J" key somewhere
And I press the "K" 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 Then post 2 should be highlighted
And I should have navigated to the highlighted post And I should have navigated to the highlighted post
@ -46,7 +50,7 @@ Feature: Keyboard navigation
When I press the "J" key somewhere When I press the "J" key somewhere
And I press the "C" key somewhere And I press the "C" key somewhere
Then the first comment field should be open Then the first comment field should be open
Scenario: navigate downwards on a profile page Scenario: navigate downwards on a profile page
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
And I press the "J" key somewhere And I press the "J" key somewhere

View file

@ -15,10 +15,13 @@ Feature: Liking posts
Scenario: Liking and unliking a post from the stream Scenario: Liking and unliking a post from the stream
When I like the post "I like unicorns" in 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 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 Scenario: Liking and unliking a post from a single post page
When I open the show page of the "I like unicorns" post When I open the show page of the "I like unicorns" post

View file

@ -7,7 +7,7 @@ Feature: User manages contacts
Scenario: creating an aspect from contacts index Scenario: creating an aspect from contacts index
Given I am signed in Given I am signed in
And I am on the contacts page 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 fill in "aspect_name" with "Dorm Mates" in the aspect creation modal
And I click on selector ".btn-primary" 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" Then I should see "Dorm Mates" within "#aspect_nav"
@ -18,15 +18,15 @@ Feature: User manages contacts
When I follow "Add an aspect" When I follow "Add an aspect"
And I fill in "aspect_name" with "losers" in the aspect creation modal 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 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 Scenario: deleting an aspect from contacts index
Given I am signed in Given I am signed in
And I have an aspect called "People" And I have an aspect called "People"
When I am on the contacts page When I am on the contacts page
And I follow "People" And I follow "People"
And I click on selector "#delete_aspect" And I confirm the alert after I click on selector "#delete_aspect"
And I confirm the alert
Then I should be on the contacts page Then I should be on the contacts page
And I should not see "People" within "#aspect_nav" And I should not see "People" within "#aspect_nav"
@ -35,8 +35,7 @@ Feature: User manages contacts
And I have an aspect called "People" And I have an aspect called "People"
When I am on the aspects page When I am on the aspects page
And I click on "People" aspect edit icon And I click on "People" aspect edit icon
And I click on selector "#delete_aspect" And I confirm the alert after I click on selector "#delete_aspect"
And I confirm the alert
Then I should be on the contacts page Then I should be on the contacts page
And I should not see "People" within "#aspect_nav" 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 "People"
And I have an aspect called "Cat People" And I have an aspect called "Cat People"
When I am on the contacts page When I am on the contacts page
And I have turned off jQuery effects
And I drag "Cat People" up 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 Then I should see "Cat People" as 2. aspect
And I should see "People" as 3. aspect And I should see "People" as 3. aspect

View file

@ -23,8 +23,7 @@ Feature: Mentions
And a user with email "bob@bob.bob" is connected with "alice@alice.alice" And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
And I expand the publisher And I expand the publisher
When I fill in the following: And I append "@Bob" to the publisher
| status_message_fake_text | @Bo |
And I click on the first user in the mentions dropdown list And I click on the first user in the mentions dropdown list
And I press "Share" And I press "Share"
Then I should see "Bob Jones" within ".stream_element" Then I should see "Bob Jones" within ".stream_element"

View file

@ -22,7 +22,7 @@ Feature: mentioning a contact from their profile page
Scenario: mentioning while posting to all aspects Scenario: mentioning while posting to all aspects
Given I am on "alice@alice.alice"'s page Given I am on "alice@alice.alice"'s page
And I want to mention her from the profile 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 And I press "Share" in the mention modal
Then I should see a flash message indicating success Then I should see a flash message indicating success
When I am on the aspects page 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 Scenario: mentioning while posting to just one aspect
Given I am on "alice@alice.alice"'s page Given I am on "alice@alice.alice"'s page
And I want to mention her from the profile 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 press the aspect dropdown in the mention modal
And I toggle the aspect "NotPostingThingsHere" 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 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 And I press "Share" in the mention modal
Then I should see a flash message indicating success Then I should see a flash message indicating success

View file

@ -42,8 +42,7 @@ Scenario: Resharing a nsfw post
And "tommy@pr0nking.com" has a public post with text "Sexy Senators Gone Wild!" And "tommy@pr0nking.com" has a public post with text "Sexy Senators Gone Wild!"
And I sign in as "laura@officeworkers.com" And I sign in as "laura@officeworkers.com"
And I toggle nsfw posts And I toggle nsfw posts
And I follow "Reshare" And I confirm the alert after I follow "Reshare"
And I confirm the alert
And I go to the home page And I go to the home page
Then I should not see "Sexy Senators Gone Wild!" Then I should not see "Sexy Senators Gone Wild!"
And I should have 2 nsfw posts And I should have 2 nsfw posts

View file

@ -29,8 +29,7 @@ Feature: Notifications
And "alice@alice.alice" has a public post with text "check this out!" And "alice@alice.alice" has a public post with text "check this out!"
When I sign in as "bob@bob.bob" When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page And I am on "alice@alice.alice"'s page
And I follow "Reshare" And I confirm the alert after I follow "Reshare"
And I confirm the alert
And I sign out And I sign out
When I sign in as "alice@alice.alice" When I sign in as "alice@alice.alice"
And I follow "Notifications" in the header And I follow "Notifications" in the header

View file

@ -1,21 +1,15 @@
@javascript @javascript
Feature: viewing the photo lightbox Feature: viewing the photo lightbox
Background: Background:
Given a user with username "bob" Given a user with username "alice"
And I sign in as "bob@bob.bob" And "alice@alice.alice" has posted a status message with a photo
And I expand the publisher And I sign in as "alice@alice.alice"
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"
Scenario: viewing a photo Scenario: viewing a photo
Then I should see an image attached to the post When I press the attached image
And I press the attached image
Then I should see the photo lightbox Then I should see the photo lightbox
Scenario: closing the lightbox by clicking the close link Scenario: closing the lightbox by clicking the close link
Then I should see an image attached to the post When I press the attached image
And I press the attached image
And I press the close lightbox link And I press the close lightbox link
Then I should not see the photo lightbox Then I should not see the photo lightbox

View file

@ -53,17 +53,15 @@ Feature: preview posts in the stream
Given I expand the publisher Given I expand the publisher
And I mention Alice in the publisher And I mention Alice in the publisher
And I press "Preview" And I press "Preview"
And I follow "Alice Smith" And I confirm the alert after I follow "Alice Smith"
And I confirm the alert
Then I should see "Alice Smith" Then I should see "Alice Smith"
Scenario: preview a post on tag page Scenario: preview a post on tag page
Given there is a user "Samuel Beckett" who's tagged "#rockstar" Given there is a user "Samuel Beckett" who's tagged "#rockstar"
When I search for "#rockstar" When I go to the tag page for "rockstar"
Then I should be on the tag page for "rockstar" Then I should see "Samuel Beckett"
And I should see "Samuel Beckett" When I expand the publisher
Given I expand the publisher And I fill in the following:
When I fill in the following:
| status_message_fake_text | This preview rocks | | status_message_fake_text | This preview rocks |
And I press "Preview" And I press "Preview"
Then "This preview rocks" should be post 1 Then "This preview rocks" should be post 1

View file

@ -156,6 +156,7 @@ Feature: posting from the main page
When I expand the publisher When I expand the publisher
And I press the aspect dropdown And I press the aspect dropdown
And I toggle the aspect "PostingTo" 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 append "I am eating a yogurt" to the publisher
And I submit the publisher And I submit the publisher
@ -171,12 +172,14 @@ Feature: posting from the main page
When I expand the publisher When I expand the publisher
And I press the aspect dropdown And I press the aspect dropdown
And I toggle the aspect "PostingTo" 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 append "I am eating a yogurt" to the publisher
And I submit the publisher And I submit the publisher
And I expand the publisher And I expand the publisher
And I press the aspect dropdown And I press the aspect dropdown
And I toggle the aspect "Besties" And I toggle the aspect "Besties"
And I press the aspect dropdown
And I append "And cornflakes also" to the publisher And I append "And cornflakes also" to the publisher
And I submit the publisher And I submit the publisher
@ -200,6 +203,5 @@ Feature: posting from the main page
And I submit the publisher And I submit the publisher
And I hover over the ".stream_element" And I hover over the ".stream_element"
And I prepare the deletion of the first post And I reject the alert after I prepare the deletion of the first post
And I reject the alert
Then I should see "I am eating a yogurt" Then I should see "I am eating a yogurt"

View file

@ -29,8 +29,8 @@ Feature: show photos
Scenario: I delete a photo Scenario: I delete a photo
When I am on "robert@grimm.grimm"'s photos page When I am on "robert@grimm.grimm"'s photos page
And I delete a photo Then I should see a ".thumbnail" within "#main_stream"
And I confirm the alert When I confirm the alert after I delete a photo
Then I should not see a ".stream" Then I should not see a ".thumbnail" within "#main_stream"
When I am on "robert@grimm.grimm"'s page When I am on "robert@grimm.grimm"'s page
Then I should not see "Photos" within "#profile-horizontal-bar" Then I should not see "Photos" within "#profile-horizontal-bar"

View file

@ -18,8 +18,7 @@ Feature: public repost
Given I sign in as "alice@alice.alice" Given I sign in as "alice@alice.alice"
And I am on "bob@bob.bob"'s page And I am on "bob@bob.bob"'s page
And I open the show page of the "reshare this!" post And I open the show page of the "reshare this!" post
And I click on selector "a.reshare" And I confirm the alert after I click on selector "a.reshare"
And I confirm the alert
Then I should see a flash message indicating success Then I should see a flash message indicating success
And I should see a flash message containing "successfully" 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 sign in as "alice@alice.alice"
And I am on "bob@bob.bob"'s page And I am on "bob@bob.bob"'s page
And I open the show page of the "reshare this!" post And I open the show page of the "reshare this!" post
And I click on selector "a.reshare" And I confirm the alert after I click on selector "a.reshare"
And I confirm the alert
Then I should see a flash message indicating success Then I should see a flash message indicating success
And I should see a flash message containing "successfully" And I should see a flash message containing "successfully"
@ -48,8 +46,7 @@ Feature: public repost
# app.stream in jasmine should be enough coverage # app.stream in jasmine should be enough coverage
Scenario: When I reshare, it shows up on my profile page Scenario: When I reshare, it shows up on my profile page
Given I sign in as "alice@alice.alice" Given I sign in as "alice@alice.alice"
And I follow "Reshare" And I confirm the alert after I follow "Reshare"
And I confirm the alert
Then I should see a flash message indicating success Then I should see a flash message indicating success
And I should see a flash message containing "successfully" And I should see a flash message containing "successfully"
And I should not see a ".reshare" within ".feedback" And I should not see a ".reshare" within ".feedback"

View file

@ -11,8 +11,7 @@ Feature: new user registration
Scenario: new user goes through the setup wizard Scenario: new user goes through the setup wizard
When I fill in the following: When I fill in the following:
| profile_first_name | O | | profile_first_name | O |
And I follow "awesome_button" And I confirm the alert after I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
And I close the publisher And I close the publisher
And I should not see "awesome_button" And I should not see "awesome_button"
@ -28,20 +27,17 @@ Feature: new user registration
| profile_first_name | some name | | profile_first_name | some name |
And I focus the "follow_tags" field And I focus the "follow_tags" field
Then I should see a flash message containing "Hey, some name!" Then I should see a flash message containing "Hey, some name!"
When I follow "awesome_button" When I reject the alert after I follow "awesome_button"
And I reject the alert
Then I should be on the getting started page Then I should be on the getting started page
And I should see a flash message containing "All right, Ill wait." And I should see a flash message containing "All right, Ill wait."
Scenario: new user skips the setup wizard Scenario: new user skips the setup wizard
When I follow "awesome_button" When I confirm the alert after I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
And I close the publisher And I close the publisher
Scenario: new user without any tags posts first status message Scenario: new user without any tags posts first status message
When I follow "awesome_button" When I confirm the alert after I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
When I submit the publisher When I submit the publisher
Then "Hey everyone, Im #newhere." should be post 1 Then "Hey everyone, Im #newhere." should be post 1
@ -57,8 +53,7 @@ Feature: new user registration
Then "Hey everyone, Im #newhere. Im interested in #rockstar." should be post 1 Then "Hey everyone, Im #newhere. Im interested in #rockstar." should be post 1
Scenario: closing a popover clears getting started Scenario: closing a popover clears getting started
When I follow "awesome_button" When I confirm the alert after I follow "awesome_button"
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
And I have turned off jQuery effects And I have turned off jQuery effects
And I wait for the popovers to appear And I wait for the popovers to appear

View file

@ -18,8 +18,7 @@
And I sign in as "alice@alice.alice" 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 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 after I click to hide the post
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
@ -32,8 +31,7 @@
And I sign in as "alice@alice.alice" 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 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 after I click to block the user
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page
@ -46,8 +44,7 @@
And I sign in as "alice@alice.alice" 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 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 after I click to report the post
And I confirm the alert
And I should see a flash message containing "The report has successfully been created" 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 submit the publisher
And I open the show page of the "Here is a post to test with" post 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 after I click to delete the post
And I confirm the alert
Then I should be on the stream page Then I should be on the stream page

View file

@ -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 And I sign in as "alice@alice.alice" on the mobile website
Scenario: Show my activity empty Scenario: Show my activity empty
When I open the drawer When I go to the activity stream page
And I follow "My activity" Then I should see "My activity" within "#main"
Then I should see "My activity"
And I should not see "Hello! I am #newhere" And I should not see "Hello! I am #newhere"
Scenario: Show post on my activity Scenario: Show post on my activity
When I click on selector "a.like-action.inactive" When I click on selector "a.like-action.inactive"
And I open the drawer And I go to the activity stream page
And I follow "My activity" Then I should see "My activity" within "#main"
Then I should see "My activity"
And I should see "Hello! I am #newhere" within ".ltr" And I should see "Hello! I am #newhere" within ".ltr"

View file

@ -5,17 +5,17 @@ Feature: Change password
Scenario: Change my 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 When I go to the users edit page
And I fill out change password section with my password and "newsecret" and "newsecret" And I fill out change password section with my password and "newsecret" and "newsecret"
And I press "Change password" And I press "Change password"
Then I should see "Password changed" Then I should see "Password changed"
And I should be on the new user session page 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 Then I should be on the stream page
Scenario: Attempt to change my password with invalid input 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 When I go to the edit user page
And I fill out change password section with my password and "too" and "short" And I fill out change password section with my password and "too" and "short"
And I press "Change password" 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 fill out the password reset form with "supersecret" and "supersecret"
And I submit the password reset form And I submit the password reset form
Then I should be on the stream page 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 And I sign in manually as "georges_abitbol" with password "supersecret" on the mobile website
Then I should be on the stream page Then I should be on the stream page

View file

@ -5,14 +5,13 @@ Feature: Close account
I want to sign in, close my account and try to log in again I want to sign in, close my account and try to log in again
Scenario: user closes account 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 When I go to the users edit page
And I click on selector "#close_account" And I click on selector "#close_account"
Then I should see a modal Then I should see a modal
And I should see "Hey, please dont go!" within "#closeAccountModal" And I should see "Hey, please dont go!" within "#closeAccountModal"
When I put in my password in the close account modal When I put in my password in the close account modal
And I press "close_account_confirm" And I confirm the alert after I press "Close account" in the modal
And I confirm the alert
Then I should be on the mobile new user session page Then I should be on the mobile new user session page
When I try to sign in manually When I try to sign in manually

View file

@ -21,6 +21,5 @@ Feature: private conversations mobile
And I reply with "hey, how you doing?" And I reply with "hey, how you doing?"
And I press the first ".ltr" within ".conversation" And I press the first ".ltr" within ".conversation"
Then I should see "hey, how you doing?" Then I should see "hey, how you doing?"
When I click on selector "a.remove" When I confirm the alert after I click on selector "a.remove"
And I confirm the alert
Then I should not see "hey, how you doing" Then I should not see "hey, how you doing"

View file

@ -9,26 +9,25 @@ Feature: Navigate between pages using the header menu and the drawer
| Bob Jones | bob@bob.bob | | Bob Jones | bob@bob.bob |
| Alice Smith | alice@alice.alice | | 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 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 Scenario: navigate to the stream page
When I open the drawer When I go to the activity stream page
And I follow "My activity"
And I click on selector "#header-title" 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 Scenario: navigate to the notification page
When I click on selector "#notification-badge" 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 Scenario: navigate to the conversation page
When I click on selector "#conversations-badge" 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 Scenario: navigate to the publisher page
When I click on selector "#compose-badge" 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 Scenario: search a user
When I open the drawer 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 Scenario: search for a tag
When I open the drawer When I open the drawer
And I search for "#bob" 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 Scenario: navigate to my activity page
When I open the drawer When I open the drawer
And I follow "My activity" And I click on "My activity" in the drawer
Then I should see "My activity" within "#main" Then I should be on the activity stream page
Scenario: navigate to my mentions 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 When I open the drawer
And I follow "@Mentions" And I click on "@Mentions" in the drawer
Then I should see "Bob Jones" within ".stream_element" Then I should be on the mentioned stream page
Scenario: navigate to my aspects page Scenario: navigate to my aspects page
Given "bob@bob.bob" has a public post with text "bob's text" Given "bob@bob.bob" has a public post with text "bob's text"
When I open the drawer When I open the drawer
And I follow "My aspects" And I click on "My aspects" in the drawer
Then I should see "Besties" within "#all_aspects + li > ul" And I click on "Besties" in the drawer
And I follow "Besties"
Then I should see "bob's text" within "#main_stream" Then I should see "bob's text" within "#main_stream"
Scenario: navigate to the followed tags page Scenario: navigate to the followed tags page
Given "bob@bob.bob" has a public post with text "bob is da #boss" When I follow the "boss" tag
When I open the drawer And I go to the stream page
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"
And I open the drawer And I open the drawer
And I follow "#Followed tags" And I click on "#Followed tags" in the drawer
Then I should see "#boss" within "#followed_tags + li > ul" And I click on "#boss" in the drawer
And I follow "#boss" Then I should be on the tag page for "boss"
Then I should see "bob is da #boss" within "#main_stream"
When I open the drawer When I open the drawer
And I follow "#Followed tags" And I click on "#Followed tags" in the drawer
Then I should see "Manage followed tags" within "#followed_tags + li > ul" And I click on "Manage followed tags" in the drawer
And I follow "Manage followed tags" Then I should be on the manage tag followings page
Then I should see "#boss" within "ul.followed_tags"
Scenario: navigate to my profile page Scenario: navigate to my profile page
When I open the drawer When I open the drawer
And I follow "Profile" And I click on "Profile" in the drawer
Then I should see "Alice" within "#author_info" 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 When I open the drawer
And I follow "Contacts" And I click on "Contacts" in the drawer
Then I should see "Contacts" within "#main" 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 When I open the drawer
And I follow "Settings" And I click on "Settings" in the drawer
Then I should see "Settings" within "#main" Then I should be on my account settings page

View file

@ -1,7 +1,7 @@
@javascript @mobile @javascript @mobile
Feature: editing the profile in the mobile view Feature: editing the profile in the mobile view
Scenario: editing profile fields 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 And I go to the edit profile page
When I fill in the following: 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_gender" field should contain "Fearless"
And the "profile_first_name" field should contain "Boba" And the "profile_first_name" field should contain "Boba"
And the "profile_last_name" field should contain "Fett" 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_year" field should be filled with "1986"
And the "profile_date_month" field should be filled with "11" And the "profile_date_month" field should be filled with "11"
And the "profile_date_day" field should be filled with "30" 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" Then I should see "#kamino" within "ul#as-selections-tags"
And I should see "#starwars" 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" When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
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" Then I should see a "img" within "#profile_photo_upload"

View file

@ -17,8 +17,7 @@ Feature: editing the getting started in the mobile view
And I should not see "awesome_button" And I should not see "awesome_button"
Scenario: new user adds a profile photo and tags Scenario: new user adds a profile photo and tags
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload" When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I confirm the alert
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload" And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see a "img" within "#profile_photo_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" And I should not see "awesome_button"
Scenario: new user completes getting started and signs in again later 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 And I sign in manually as "ohai" with password "secret" on the mobile website
Then I should be on the getting started page Then I should be on the getting started page
When I follow "awesome_button" When I follow "awesome_button"
Then I should be on the stream page 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 And I sign in manually as "ohai" with password "secret" on the mobile website
Then I should be on the stream page Then I should be on the stream page

View file

@ -15,5 +15,3 @@ Feature: Visit the landing page of the pod
Then I should see "Welcome, friend" Then I should see "Welcome, friend"
When I go to the mobile path When I go to the mobile path
Then I should see "LOG IN" Then I should see "LOG IN"
When I go to the mobile path
Then I should see "LOG IN"

View file

@ -1,21 +1,21 @@
@javascript @mobile @javascript @mobile
Feature: Browsing Diaspora as a logged out user mobile Feature: Browsing Diaspora as a logged out user mobile
In order to view public diaspora content In order to view public diaspora content
as a random internet user as a random internet user
I want to view public post and comments I want to view public post and comments
Background: Background:
Given a user named "Bob Jones" with email "bob@bob.bob" Given a user named "Bob Jones" with email "bob@bob.bob"
And "bob@bob.bob" has a public post with text "public stuff" And "bob@bob.bob" has a public post with text "public stuff"
And I sign in as "bob@bob.bob" And I sign in as "bob@bob.bob" on the mobile website
And I click on selector "a.comment-action.inactive" And I click on selector "a.comment-action.inactive"
And I fill in the following: And I fill in the following:
| text | this also | | text | this also |
And I press "Comment" And I press "Comment"
And I log out And I log out
Scenario: Visiting a profile page Scenario: Visiting a profile page
When I am on "bob@bob.bob"'s page When I am on "bob@bob.bob"'s page
Then I should see "public stuff" within ".ltr" Then I should see "public stuff" within ".ltr"
And I click on selector "a.show-comments" And I click on selector "a.show-comments"
And I should see "this also" within ".comment" And I should see "this also" within ".comment"

View file

@ -1,43 +1,43 @@
@javascript @mobile @javascript @mobile
Feature: using the more button on mobile stream Feature: using the more button on mobile stream
As a mobile user As a mobile user
I want to navigate the stream I want to navigate the stream
And I want to test the text of the more-button in different environments And I want to test the text of the more-button in different environments
Background: Background:
Given a user with username "bob" Given a user with username "bob"
And I sign in as "bob@bob.bob" on the mobile website And I sign in as "bob@bob.bob" on the mobile website
Scenario: There are no posts Scenario: There are no posts
Given I am on the home page Given I am on the home page
When I go to the stream page When I go to the stream page
Then I should see "There are no posts yet." Then I should see "There are no posts yet."
Scenario: There are <15 posts Scenario: There are <15 posts
Given I am on the home page Given I am on the home page
And "bob@bob.bob" has a public post with text "post 1" And "bob@bob.bob" has a public post with text "post 1"
When I go to the stream page When I go to the stream page
Then I should see "You have reached the end of the stream." Then I should see "You have reached the end of the stream."
Scenario: There are 15 posts Scenario: There are 15 posts
Given I am on the home page Given I am on the home page
Given there are 15 public posts from "bob@bob.bob" Given there are 15 public posts from "bob@bob.bob"
And "bob@bob.bob" has a public post with text "post 1" And "bob@bob.bob" has a public post with text "post 1"
When I go to the stream page When I go to the stream page
Then I should see "More" Then I should see "More"
When I click on selector ".more-link" When I click on selector ".more-link"
Then I should see "You have reached the end of the stream." Then I should see "You have reached the end of the stream."
Scenario: There are 15 +1 posts Scenario: There are 15 +1 posts
Given I am on the home page Given I am on the home page
Given there are 16 public posts from "bob@bob.bob" Given there are 16 public posts from "bob@bob.bob"
When I go to the stream page When I go to the stream page
Then I should see "More" Then I should see "More"
When I click on selector ".more-link" When I click on selector ".more-link"
Then I should see "You have reached the end of the stream." Then I should see "You have reached the end of the stream."

View file

@ -6,23 +6,30 @@ Feature: viewing photos on the mobile main page
Background: Background:
Given a user with username "bob" Given a user with username "bob"
When I sign in as "bob@bob.bob" on the mobile website And I sign in as "bob@bob.bob" on the mobile website
And I click on selector "#compose-badge"
Scenario: view full size image 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" When I press "Share"
And I go to the stream page
And I click on selector "img.stream-photo" And I click on selector "img.stream-photo"
Then I should see a "img" within "#show_content" 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-right" within "#main"
And I should not see a "#arrow-left" within "#main" And I should not see a "#arrow-left" within "#main"
Scenario: view multiphoto post Scenario: view multiphoto post
Given I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher" Given I visit the mobile publisher page
And I attach the file "spec/fixtures/button.gif" to hidden "file" within "#file-upload-publisher" 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" When I press "Share"
And I go to the stream page
Then I should see "+ 1" within ".additional_photo_count" Then I should see "+ 1" within ".additional_photo_count"
When I click on selector "img.stream-photo" When I click on selector "img.stream-photo"

View file

@ -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" And a user with email "laura@office.example.com" is connected with "tommy@nsfw.example.com"
Scenario: Setting not safe for work 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 go to the edit profile page
And I mark myself as not safe for work And I mark myself as not safe for work
And I submit the form 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 And "tommy@nsfw.example.com" has a public post with text "I love 0bj3ction4bl3 c0nt3nt!" and a picture
#toggling nsfw state #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!" 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 "What do you think about 1 ninjas?"
And I should not see "Posted from:" And I should not see "Posted from:"
@ -41,10 +41,9 @@ Feature: Not safe for work
Scenario: Resharing a nsfw post with a poll 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 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 toggle all nsfw posts
And I follow "Reshare" And I confirm the alert after I follow "Reshare"
And I confirm the alert
Then I should see a "a.reshare-action.active" Then I should see a "a.reshare-action.active"
When I go to the home page When I go to the home page
@ -55,10 +54,9 @@ Feature: Not safe for work
Scenario: Resharing a nsfw post with a location 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 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 toggle all nsfw posts
And I follow "Reshare" And I confirm the alert after I follow "Reshare"
And I confirm the alert
Then I should see a "a.reshare-action.active" Then I should see a "a.reshare-action.active"
When I go to the home page When I go to the home page
@ -69,10 +67,9 @@ Feature: Not safe for work
Scenario: Resharing a nsfw post with a picture 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 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 toggle all nsfw posts
And I follow "Reshare" And I confirm the alert after I follow "Reshare"
And I confirm the alert
Then I should see a "a.reshare-action.active" Then I should see a "a.reshare-action.active"
When I go to the home page When I go to the home page

View file

@ -1,42 +1,42 @@
@javascript @mobile @javascript @mobile
Feature: adding and removing people from aspects Feature: adding and removing people from aspects
In order to add people to my contacts In order to add people to my contacts
As a mobile user As a mobile user
I want to add and remove people from my contacts I want to add and remove people from my contacts
Background: Background:
Given following users exist: Given following users exist:
| username | | username |
| bob | | bob |
| alice | | alice |
And I sign in as "bob@bob.bob" on the mobile website And I sign in as "bob@bob.bob" on the mobile website
Scenario: verify different states of the cover button Scenario: verify different states of the cover button
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
Then the aspect dropdown within "#author_info" should be labeled "Add contact" Then the aspect dropdown within "#author_info" should be labeled "Add contact"
When I select "Unicorns" from "user_aspects" within "#author_info" When I select "Unicorns" from "user_aspects" within "#author_info"
Then the aspect dropdown within "#author_info" should be labeled "Unicorns" Then the aspect dropdown within "#author_info" should be labeled "Unicorns"
When I select "Besties" from "user_aspects" within "#author_info" When I select "Besties" from "user_aspects" within "#author_info"
Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects" Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects"
Scenario: add contact to aspect Scenario: add contact to aspect
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
And I select "Unicorns" from "user_aspects" within "#author_info" And I select "Unicorns" from "user_aspects" within "#author_info"
Then the aspect dropdown within "#author_info" should be labeled "Unicorns" Then the aspect dropdown within "#author_info" should be labeled "Unicorns"
Then I should have 1 contacts in "Unicorns" Then I should have 1 contacts in "Unicorns"
Scenario: remove contact to aspect Scenario: remove contact to aspect
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
And I select "Unicorns" from "user_aspects" within "#author_info" And I select "Unicorns" from "user_aspects" within "#author_info"
Then the aspect dropdown within "#author_info" should be labeled "Unicorns" Then the aspect dropdown within "#author_info" should be labeled "Unicorns"
And I select "Besties" from "user_aspects" within "#author_info" And I select "Besties" from "user_aspects" within "#author_info"
Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects" Then the aspect dropdown within "#author_info" should be labeled "In 2 aspects"
Then I should have 1 contacts in "Unicorns" Then I should have 1 contacts in "Unicorns"
When I am on "alice@alice.alice"'s page When I am on "alice@alice.alice"'s page
And I select "Unicorns" from "user_aspects" within "#author_info" And I select "Unicorns" from "user_aspects" within "#author_info"
Then the aspect dropdown within "#author_info" should be labeled "Besties" Then the aspect dropdown within "#author_info" should be labeled "Besties"
Then I should have 0 contacts in "Unicorns" Then I should have 0 contacts in "Unicorns"

View file

@ -1,62 +1,60 @@
@javascript @mobile @javascript @mobile
Feature: posting from the mobile main page Feature: posting from the mobile main page
In order to navigate Diaspora* In order to navigate Diaspora*
As a mobile user As a mobile user
I want to tell the world I am eating a yogurt I want to tell the world I am eating a yogurt
Background: Background:
Given following users exist: Given following users exist:
| username | | username |
| bob | | bob |
| alice | | alice |
And I am on the home page And I am on the home page
And I sign in as "bob@bob.bob" on the mobile website And I sign in as "bob@bob.bob" on the mobile website
And a user with username "bob" is connected with "alice" And a user with username "bob" is connected with "alice"
Given I have following aspects: Given I have following aspects:
| PostingTo | | PostingTo |
| NotPostingThingsHere | | NotPostingThingsHere |
And I have user with username "alice" in an aspect called "PostingTo" And I have user with username "alice" in an aspect called "PostingTo"
And I have user with username "alice" in an aspect called "NotPostingThingsHere" And I have user with username "alice" in an aspect called "NotPostingThingsHere"
Scenario: post and delete some text Scenario: post and delete some text
Given I visit the mobile publisher page Given I visit the mobile publisher page
And I append "I am eating yogurt" to the mobile publisher And I append "I am eating yogurt" to the mobile publisher
And I select "Unicorns" from "aspect_ids_" And I select "Unicorns" from "aspect_ids_"
And I press "Share" And I press "Share"
When I go to the stream page When I go to the stream page
Then I should see "I am eating yogurt" Then I should see "I am eating yogurt"
When I click on selector "a.remove" When I confirm the alert after I click on selector "a.remove"
And I confirm the alert Then I should not see "I am eating yogurt"
Then I should not see "I am eating yogurt"
Scenario: post a photo without text Scenario: post a photo without text
Given I visit the mobile publisher page Given I visit the mobile publisher page
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher" 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 Then I should see "button.png completed"
And I should see "button.png completed" And I should see an uploaded image within the photo drop zone
When I press "Share" When I press "Share"
When I go to the stream page When I go to the stream page
Then I should see a "img" within ".stream_element div.photo_attachments" Then I should see a "img" within ".stream_element div.photo_attachments"
When I log out When I log out
And I sign in as "alice@alice.alice" on the mobile website And I sign in as "alice@alice.alice" on the mobile website
When I go to the stream page When I go to the stream page
Then I should see a "img" within ".stream_element div.photo_attachments" Then I should see a "img" within ".stream_element div.photo_attachments"
Scenario: back out of posting a photo-only post Scenario: back out of posting a photo-only post
Given I visit the mobile publisher page Given I visit the mobile publisher page
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload-publisher" When I confirm the alert after 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
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"
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 should see "button.png completed" And I click to delete the first uploaded photo
And I click to delete the first uploaded photo Then I should not see an uploaded image within the photo drop zone
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 Scenario: back out of uploading a picture when another has been attached
Given I visit the mobile publisher page Given I visit the mobile publisher page
And I append "I am eating yogurt" to the mobile publisher 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.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 attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
And I click to delete the first uploaded photo And I click to delete the first uploaded photo
Then I should see an uploaded image within the photo drop zone Then I should see an uploaded image within the photo drop zone
And the text area wrapper mobile should be with attachments And the text area wrapper mobile should be with attachments

View file

@ -43,6 +43,5 @@ Feature: reactions mobile post
And I click on selector "a.show-comments" And I click on selector "a.show-comments"
And I should see "1" within ".comment-count" And I should see "1" within ".comment-count"
When I click on selector "a.comment-action" When I click on selector "a.comment-action"
And I click on selector "a.remove" And I confirm the alert after I click on selector "a.remove"
And I confirm the alert
Then I should not see "1 reaction" within ".show-comments" Then I should not see "1 reaction" within ".show-comments"

View file

@ -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 "bob@bob.bob" is connected with "alice@alice.alice"
And a user with email "eve@eve.eve" is connected with "bob@bob.bob" 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!" 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 Scenario: Resharing a post from a single post page
And I click on selector ".reshare-action.inactive" And I confirm the alert after I click on selector ".reshare-action.inactive"
And I confirm the alert
Then I should see a ".reshare-action.active" Then I should see a ".reshare-action.active"
When I go to the stream page When I go to the stream page
Then I should see "Reshared via" within ".reshare_via" 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 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" 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 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 after I click on the first selector ".reshare-action.inactive"
And I confirm the alert
Then I should see a ".reshare-action.active" Then I should see a ".reshare-action.active"
When I go to the stream page When I go to the stream page
Then I should see "Reshared via" within ".reshare_via" 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" Then I should see "Original post deleted by author" within ".reshare"
Scenario: Not resharing own post 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" Then I should see a ".reshare-action.disabled"
When I click on selector ".reshare-action" And I should not see any alert after I click on selector ".reshare-action"
Then I should not see any alert
And I should not see a ".reshare-action.active" And I should not see a ".reshare-action.active"
When I go to the stream page When I go to the stream page
Then I should not see a ".reshare_via" Then I should not see a ".reshare_via"

View file

@ -12,7 +12,7 @@ Feature: New user registration
When I fill in the new user form When I fill in the new user form
And I press "Sign up" And I press "Sign up"
Then I should be on the getting started page 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 Scenario: user fills in bogus data - client side validation
When I fill in the following: When I fill in the following:

View file

@ -7,9 +7,9 @@ Feature: Interacting with tags
| bob | | bob |
| alice | | alice |
And "alice@alice.alice" has a public post with text "Hello! I am #newhere" 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 visit the mobile search page
And I fill in the following: And I fill in the following within "#main":
| q | #newhere | | q | #newhere |
And I press "Search" And I press "Search"
Then I should see "Follow #newhere" within ".tag_following_action" 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" Then I should see "Hello! I am #newhere"
When I visit the mobile search page When I visit the mobile search page
And I fill in the following: And I fill in the following within "#main":
| q | #newhere | | q | #newhere |
And I press "Search" And I press "Search"
Then I should see "Stop following #newhere" within ".tag_following_action" 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 When I am on the manage tag followings page
Then I should see "#newhere" within "ul.followed_tags" Then I should see "#newhere" within "ul.followed_tags"
When I click on selector ".tag_following_action.only-delete" When I confirm the alert after I click on selector ".tag_following_action.only-delete"
And I confirm the alert
Then I should see "You aren't following any tags." Then I should see "You aren't following any tags."
When I am on the home page When I am on the home page
Then I should not see "Hello! I am #newhere" Then I should not see "Hello! I am #newhere"

View file

@ -1,5 +1,4 @@
@mobile @javascript @mobile
@javascript
Feature: managing authorized applications Feature: managing authorized applications
Background: Background:
Given following users exist: Given following users exist:
@ -9,14 +8,14 @@ Feature: managing authorized applications
And a client exists for user "augier@example.org" And a client exists for user "augier@example.org"
Scenario: displaying authorizations 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 And I go to the user applications page
Then I should see 2 authorized applications 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 no provided image
And I should see 1 authorized applications with an image And I should see 1 authorized applications with an image
Scenario: revoke an authorization 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 go to the user applications page
And I revoke the first authorization And I revoke the first authorization
Then I should see 1 authorized applications Then I should see 1 authorized applications

View file

@ -1,6 +1,6 @@
module AspectCukeHelpers module AspectCukeHelpers
def click_aspect_dropdown def click_aspect_dropdown
find('.aspect_dropdown .dropdown-toggle').click find(".aspect_dropdown .dropdown-toggle").trigger "click"
end end
def toggle_aspect(a_name) def toggle_aspect(a_name)
@ -12,19 +12,18 @@ module AspectCukeHelpers
def toggle_aspect_via_ui(aspect_name) def toggle_aspect_via_ui(aspect_name)
aspects_dropdown = find(".aspect_membership_dropdown .dropdown-toggle", match: :first) 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 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 = find(".aspect_membership_dropdown.open .dropdown-menu li", text: aspect_name)
aspect_selected = aspect["class"].include? "selected" aspect_selected = aspect["class"].include? "selected"
aspect.click aspect.trigger "click"
aspect.parent.should have_no_css(".loading") aspect.parent.should have_no_css(".loading")
# close dropdown # close dropdown
page.should have_no_css('#profile.loading') page.should have_no_css('#profile.loading')
unless selected_aspect_count == 0 or (selected_aspect_count == 1 and aspect_selected ) unless selected_aspect_count == 0 or (selected_aspect_count == 1 and aspect_selected )
aspects_dropdown.click aspects_dropdown.trigger "click"
end end
aspects_dropdown.should have_no_xpath("..[contains(@class, 'active')]")
end end
def aspect_dropdown_visible? def aspect_dropdown_visible?
@ -89,20 +88,14 @@ When /^(.*) in the aspect creation modal$/ do |action|
end end
When /^I drag "([^"]*)" (up|down)$/ do |aspect_name, direction| 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_id = @me.aspects.where(name: aspect_name).first.id
aspect = find(:xpath, "//div[@id='aspect_nav']/ul/a[@data-aspect-id='#{aspect_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 : target = direction == "up" ? aspect.all(:xpath, "./preceding-sibling::a").last :
aspect.all(:xpath, "./following-sibling::a").first aspect.all(:xpath, "./following-sibling::a").first
browser = aspect.base.driver.browser aspect.drag_to target
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
expect(page).to have_no_css "#aspect_nav .ui-sortable.syncing" expect(page).to have_no_css "#aspect_nav .ui-sortable.syncing"
end end
And /^I toggle the aspect "([^"]*)"$/ do |name| And /^I toggle the aspect "([^"]*)"$/ do |name|
toggle_aspect(name) toggle_aspect(name)

View file

@ -1,5 +1,5 @@
O_AUTH_QUERY_PARAMS_WITH_CODE = { O_AUTH_QUERY_PARAMS_WITH_CODE = {
redirect_uri: "http://localhost:3000", redirect_uri: "http://example.org/",
response_type: "code", response_type: "code",
scope: "openid profile read", scope: "openid profile read",
nonce: "hello", nonce: "hello",
@ -22,7 +22,7 @@ end
When /^I parse the auth code and create a request to the token endpoint$/ do When /^I parse the auth code and create a request to the token endpoint$/ do
code = current_url[/(?<=code=)[^&]+/] code = current_url[/(?<=code=)[^&]+/]
post api_openid_connect_access_tokens_path, code: 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 client_id: @client_id, client_secret: @client_secret
end end

View file

@ -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 press the first ".as-result-item" within ".as-results")
step %(I fill in "conversation_subject" with "#{subject}") step %(I fill in "conversation_subject" with "#{subject}")
step %(I fill in "conversation_text" with "#{text}") 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
end end
@ -41,7 +41,7 @@ When /^I reply with "([^"]*)" using keyboard shortcuts$/ do |text|
step %(I am on the conversations page) step %(I am on the conversations page)
step %(I press the first ".conversation" within ".conversations") step %(I press the first ".conversation" within ".conversations")
step %(I fill in "message_text" with "#{text}") 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 end
Then /^I send a mobile message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person| Then /^I send a mobile message with subject "([^"]*)" and text "([^"]*)" to "([^"]*)"$/ do |subject, text, person|

View file

@ -106,13 +106,15 @@ When /^I prepare hiding the first post$/ do
end end
When /^I click to delete the first post$/ do When /^I click to delete the first post$/ do
step "I prepare the deletion of the first post" accept_alert do
step "I confirm the alert" step "I prepare the deletion of the first post"
end
end end
When /^I click to hide the first post$/ do When /^I click to hide the first post$/ do
step "I prepare hiding the first post" accept_alert do
step "I confirm the alert" step "I prepare hiding the first post"
end
end end
When /^I click to delete the first comment$/ do When /^I click to delete the first comment$/ do
@ -123,7 +125,7 @@ end
When /^I click to delete the first uploaded photo$/ do When /^I click to delete the first uploaded photo$/ do
page.execute_script("$('#photodropzone .x').css('display', 'block');") page.execute_script("$('#photodropzone .x').css('display', 'block');")
find("#photodropzone .x", match: :first).click find("#photodropzone .x", match: :first).trigger "click"
end end
And /^I click on selector "([^"]*)"$/ do |selector| 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 find(selector, match: :first).click
end end
And /^I confirm the alert$/ do And /^I confirm the alert after (.*)$/ do |action|
page.driver.browser.switch_to.alert.accept accept_alert do
step action
end
end end
And /^I reject the alert$/ do And /^I reject the alert after (.*)$/ do |action|
page.driver.browser.switch_to.alert.dismiss dismiss_confirm do
step action
end
end end
And /^I should not see any alert$/ do And /^I should not see any alert after (.*)$/ do |action|
expect { page.driver.browser.switch_to.alert }.to raise_error(Selenium::WebDriver::Error::NoAlertPresentError) expect {
accept_alert do
step action
end
}.to raise_error(Capybara::ModalNotFound)
end end
When /^(.*) in the mention modal$/ do |action| 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") page.execute_script("$.fx.off = true")
end 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| Then /^the "([^"]*)" field(?: within "([^"]*)")? should be filled with "([^"]*)"$/ do |field, selector, value|
with_scope(selector) do with_scope(selector) do
field = find_field(field) field = find_field(field)
@ -211,11 +215,11 @@ And /^I scroll down on the notifications dropdown$/ do
end end
Then /^I should have scrolled down$/ do Then /^I should have scrolled down$/ do
page.evaluate_script("window.pageYOffset").should > 0 expect(page.evaluate_script("window.pageYOffset")).to be > 0
end end
Then /^I should have scrolled down on the notification dropdown$/ do 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 end

View file

@ -0,0 +1,5 @@
And /^I click on "([^"]*)" in the drawer$/ do |txt|
within("#drawer") do
find_link(txt).trigger "click"
end
end

View file

@ -1,5 +1,5 @@
O_AUTH_QUERY_PARAMS = { O_AUTH_QUERY_PARAMS = {
redirect_uri: "http://localhost:3000", redirect_uri: "http://example.org/",
response_type: "id_token token", response_type: "id_token token",
scope: "openid profile read", scope: "openid profile read",
nonce: "hello", nonce: "hello",
@ -8,7 +8,7 @@ O_AUTH_QUERY_PARAMS = {
} }
O_AUTH_QUERY_PARAMS_WITH_MAX_AGE = { O_AUTH_QUERY_PARAMS_WITH_MAX_AGE = {
redirect_uri: "http://localhost:3000", redirect_uri: "http://example.org/",
response_type: "id_token token", response_type: "id_token token",
scope: "openid profile read", scope: "openid profile read",
nonce: "hello", nonce: "hello",

View file

@ -5,7 +5,7 @@ When /^I press the "([^\"]*)" key somewhere$/ do |key|
end end
When /^I press the "([^\"]*)" key in the publisher$/ do |key| 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 end
Then /^post (\d+) should be highlighted$/ do |position| Then /^post (\d+) should be highlighted$/ do |position|
@ -15,10 +15,3 @@ end
And /^I should have navigated to the highlighted post$/ do 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 find(".shortcut_selected")["offsetTop"].to_i.should == page.evaluate_script("window.pageYOffset + 50").to_i
end 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

View file

@ -1,7 +1,11 @@
When /^I allow geolocation$/ do When /^I allow geolocation$/ do
page.execute_script <<-JS page.execute_script <<-JS
navigator.geolocation.getCurrentPosition = function(success) { window.navigator = {
success({coords: {latitude: 42.42424242, longitude: 3.14159}}); geolocation: {
getCurrentPosition: function(success) {
success({coords: {latitude: 42.42424242, longitude: 3.14159}});
}
}
}; };
JS JS
end end

View file

@ -15,7 +15,7 @@ And /^Alice has (\d+) posts mentioning Bob$/ do |n|
end end
And /^I mention Alice in the publisher$/ do 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) step %(I click on the first user in the mentions dropdown list)
end end

View file

@ -12,6 +12,7 @@ end
When /^I open the drawer$/ do When /^I open the drawer$/ do
find("#menu-badge").click find("#menu-badge").click
expect(find("#app")["class"]).to include "draw"
end end
Then /^the aspect dropdown within "([^"]*)" should be labeled "([^"]*)"/ do |selector, label| Then /^the aspect dropdown within "([^"]*)" should be labeled "([^"]*)"/ do |selector, label|

View file

@ -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}\")") execute_script("$(\"#closeAccountModal input#close_account_password\").val(\"#{@me.password}\")")
expect(find("#closeAccountModal input#close_account_password").value).to eq(@me.password) expect(find("#closeAccountModal input#close_account_password").value).to eq(@me.password)
end end
When /^I press "(.*)" in the modal$/ do |txt|
within(".modal.in") do
find_button(txt).trigger "click"
end
end

View file

@ -10,7 +10,7 @@ Given /^a client exists for user "([^\"]*)"$/ do |email|
end end
When /^I register a new client$/ do 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 end
When /^I use received valid bearer tokens to access user info$/ do When /^I use received valid bearer tokens to access user info$/ do

View file

@ -13,7 +13,7 @@ end
When /^I fill in the following for the options:$/ do |table| When /^I fill in the following for the options:$/ do |table|
i = 0 i = 0
table.raw.flatten.each do |value| table.raw.flatten.each do |value|
all(".poll-answer input")[i].set(value) all(".poll-answer input")[i].native.send_keys(value)
i+=1 i+=1
end end
end end
@ -25,7 +25,7 @@ end
When(/^I fill in values for the first two options$/) do When(/^I fill in values for the first two options$/) do
all(".poll-answer input").each_with_index do |answer, i| all(".poll-answer input").each_with_index do |answer, i|
answer.set "answer option #{i}" answer.native.send_keys "answer option #{i}"
end end
end end

View file

@ -7,7 +7,7 @@ Then /^the post should be expanded$/ do
end end
Then /^I should see an uploaded image within the photo drop zone$/ do 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 end
Then /^I should not see an uploaded image within the photo drop zone$/ do Then /^I should not see an uploaded image within the photo drop zone$/ do

View file

@ -1,5 +1,5 @@
When /^I enter "([^"]*)" in the search input$/ do |search_term| 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 end
When /^I click on the first search result$/ do 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 find("input#q").native.send_keys :return
end 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 Then /^I should not see any search results$/ do
expect(page).to_not have_selector(".tt-suggestion") expect(page).to_not have_selector(".tt-suggestion")
end end

View file

@ -1,44 +1,31 @@
Given /^(?:I am signed in)$/ do Given /^I am signed in( on the mobile website)?$/ do |mobile|
automatic_login automatic_login
confirm_login confirm_login mobile
end end
When /^I try to sign in manually$/ do When /^I try to sign in manually$/ do
manual_login manual_login
end 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 = User.find_by_username(username)
@me.password ||= password @me.password ||= password
manual_login manual_login
confirm_login confirm_login mobile
end 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 = User.find_by_email(email)
@me.password ||= 'password' @me.password ||= 'password'
automatic_login automatic_login
confirm_login confirm_login mobile
end end
When /^I (?:sign|log) in as "([^"]*)" on the mobile website$/ do |email| When /^I (?:sign|log) in with password "([^"]*)"( on the mobile website)?$/ do |password, mobile|
@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|
@me.password = password @me.password = password
automatic_login automatic_login
confirm_login confirm_login mobile
end end
When /^I put in my password in "([^"]*)"$/ do |field| When /^I put in my password in "([^"]*)"$/ do |field|

View file

@ -1,8 +1,13 @@
When(/^I unfollow the "(.*?)" tag$/) do |tag| When(/^I unfollow the "(.*?)" tag$/) do |tag|
within("#tags_list") do accept_alert do
li = find("li", text: tag) within("#tags_list") do
li.hover li = find("li", text: tag)
li.find(".delete-tag-following").click li.hover
li.find(".delete-tag-following").click
end
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 end

View file

@ -206,7 +206,7 @@ end
And /^I should be able to friend "([^\"]*)"$/ do |email| And /^I should be able to friend "([^\"]*)"$/ do |email|
user = User.find_by_email(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}\"" step "I should see \"#{user.name}\""
end end
@ -219,5 +219,5 @@ Given /^I did request my photos$/ do
end end
Then /^I should get a zipped file$/ do 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 end

View file

@ -39,13 +39,7 @@ When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
end end
end end
When /^(?:|I )fill in "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector| When /^(?:|I )fill in "([^"]*)" (?:for|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|
with_scope(selector) do with_scope(selector) do
fill_in(field, :with => value) fill_in(field, :with => value)
end end
@ -156,25 +150,26 @@ end
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector| Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should be checked$/ do |label, selector|
with_scope(selector) do with_scope(selector) do
field_checked = find_field(label)['checked'] expect(find_field(label)["checked"]).to be_truthy
field_checked.should eq('true')
end end
end end
Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector| Then /^the "([^"]*)" checkbox(?: within "([^"]*)")? should not be checked$/ do |label, selector|
with_scope(selector) do with_scope(selector) do
field_checked = find_field(label)['checked'] expect(find_field(label)["checked"]).to be_falsey
field_checked.should be_falsey
end end
end end
Then /^the "([^"]*)" bootstrap-switch should be (on|off)$/ do |label, state| Then /^the "([^"]*)" bootstrap-switch should be (on|off)$/ do |label, state|
result = execute_script("return $('#{label}').bootstrapSwitch('state')") if state == "on"
result.should state == "on" ? be_truthy : be_falsey expect(page.evaluate_script("$('#{label}').bootstrapSwitch('state')")).to be_truthy
else
expect(page.evaluate_script("$('#{label}').bootstrapSwitch('state')")).to be_falsey
end
end end
Then /^I toggle the "([^"]*)" bootstrap-switch$/ do |label| Then /^I toggle the "([^"]*)" bootstrap-switch$/ do |label|
execute_script("return $('#{label}').bootstrapSwitch('toggleState')") page.execute_script("return $('#{label}').bootstrapSwitch('toggleState')")
end end
Then /^(?:|I )should be on (.+)$/ do |page_name| Then /^(?:|I )should be on (.+)$/ do |page_name|

View file

@ -22,8 +22,7 @@ module ApplicationCukeHelpers
end end
def confirm_form_validation_error(element) def confirm_form_validation_error(element)
is_invalid = page.evaluate_script("$('#{element}').is(':invalid')") expect(page.evaluate_script("$('#{element}')[0].checkValidity();")).to be false
expect(is_invalid).to be true
end end
def check_fields_validation_error(field_list) def check_fields_validation_error(field_list)
@ -31,7 +30,6 @@ module ApplicationCukeHelpers
confirm_form_validation_error("input##{f.strip}") confirm_form_validation_error("input##{f.strip}")
end end
end end
end end
World(ApplicationCukeHelpers) World(ApplicationCukeHelpers)

View file

@ -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

View file

@ -10,7 +10,7 @@ require "cucumber/rails"
require "capybara/rails" require "capybara/rails"
require "capybara/cucumber" require "capybara/cucumber"
require "capybara/session" require "capybara/session"
require "selenium/webdriver" require "capybara/poltergeist"
require "cucumber/api_steps" require "cucumber/api_steps"
require "json_spec/cucumber" 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[:host] = AppConfig.pod_uri.host
Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port
# Use a version of Firefox defined by environment variable, if set Capybara.register_driver :poltergeist do |app|
Selenium::WebDriver::Firefox::Binary.path = ENV["FIREFOX_BINARY_PATH"] || Selenium::WebDriver::Firefox::Binary.path Capybara::Poltergeist::Driver.new(app, timeout: 60)
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)
end end
Capybara.register_driver :mobile do |app| Capybara.javascript_driver = :poltergeist
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 defaults to XPath selectors rather than Webrat's default of CSS3. In # 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 # 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') require Rails.root.join('spec', 'support', 'user_methods')
include HelperMethods include HelperMethods
Before do Before do |scenario|
Devise.mailer.deliveries = [] Devise.mailer.deliveries = []
page.driver.browser.manage.window.resize_to(1024, 500) page.driver.headers = if scenario.source_tag_names.include? "@mobile"
# Delete all files in "tmp/downloads" {"User-Agent" => "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0"}
DownloadHelpers.clear_downloads else
page.driver.headers = {}
end
end end

View file

@ -11,6 +11,18 @@ RSpec::Matchers.define :have_path do |expected|
end end
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| RSpec::Matchers.define :have_value do |expected|
match do |actual| match do |actual|
@ -25,7 +37,6 @@ RSpec::Matchers.define :have_value do |expected|
end end
end end
def await_condition &condition def await_condition &condition
start_time = Time.zone.now start_time = Time.zone.now
until condition.call until condition.call

View file

@ -66,7 +66,11 @@ module NavigationHelpers
end end
def confirm_on_page(page_name) 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
end end

View file

@ -5,7 +5,7 @@ module PublishingCukeHelpers
def append_to_publisher(txt, input_selector='#status_message_fake_text') def append_to_publisher(txt, input_selector='#status_message_fake_text')
elem = find(input_selector) elem = find(input_selector)
elem.native.send_keys(' ' + txt) elem.native.send_key(" #{txt}")
# make sure the other text field got the new contents # make sure the other text field got the new contents
expect(find("#status_message_text", visible: false)).to have_value txt expect(find("#status_message_text", visible: false)).to have_value txt

View file

@ -43,19 +43,17 @@ module UserCukeHelpers
end end
# checks the page content to see, if the login was successful # checks the page content to see, if the login was successful
def confirm_login def confirm_login(mobile)
page.has_content?("#{@me.first_name} #{@me.last_name}") if mobile
end expect(page).to have_css "#menu-badge"
else
# checks the mobile page content to see, if the login was successful expect(find("#user_menu")).to have_content "#{@me.first_name} #{@me.last_name}"
def confirm_login_mobile end
page.has_css?("#notification_badge")
end end
# delete all cookies, destroying the current session # delete all cookies, destroying the current session
def logout def logout
$browser.delete_cookie('_session', 'path=/') if $browser page.driver.clear_cookies
$browser.delete_all_visible_cookies if $browser
end end
# go to user menu, expand it, and click logout # go to user menu, expand it, and click logout

View file

@ -41,4 +41,18 @@ describe HomeController, type: :controller do
expect(session[:mobile_view]).to be true expect(session[:mobile_view]).to be true
end end
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 end