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'
- 'develop'
before_install: gem install bundler
before_install:
- gem install bundler
- mkdir travis-phantomjs
- wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 -O $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
- tar -xvf $PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 -C $PWD/travis-phantomjs
- export PATH=$PWD/travis-phantomjs/phantomjs-2.1.1-linux-x86_64/bin:$PATH
bundler_args: "--deployment --without development production --with mysql postgresql --jobs 3 --retry 3"
script: "./script/ci/build.sh"

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)
* Removed own unicorn killer by a maintained third-party gem [#6792](https://github.com/diaspora/diaspora/pull/6792)
* Removed deprecated `REDISTOGO_URL` environment variable [#6863](https://github.com/diaspora/diaspora/pull/6863)
* Use Poltergeist instead of Selenium [#6768](https://github.com/diaspora/diaspora/pull/6768)
## Bug fixes
* Destroy Participation when removing interactions with a post [#5852](https://github.com/diaspora/diaspora/pull/5852)

View file

@ -281,7 +281,7 @@ group :test do
gem "capybara", "2.7.1"
gem "database_cleaner", "1.5.3"
gem "selenium-webdriver", "2.47.1"
gem "poltergeist", "1.9.0"
gem "cucumber-api-steps", "0.13", require: false
gem "json_spec", "1.1.4"

View file

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

View file

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

View file

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

View file

@ -220,7 +220,7 @@
},
resetCommentBox: function(el){
var commentButton = el.find("input.comment-button").first();
var commentButton = $(el).find("input.comment-button").first();
commentButton.attr("value", commentButton.data("reset-with"));
commentButton.removeAttr("disabled");
commentButton.blur();

View file

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

View file

@ -1,5 +1,5 @@
%div
%select{name: 'user_aspects', class: 'user_aspects form-control', 'data-person-id' => @person.id}
%select.aspect_dropdown.form-control.user_aspects{"name" => "user_aspects", "data-person-id" => @person.id}
%option{value: 'list_cover', class: 'list_cover', disabled: 'true', selected: 'true'}
= t("add_contact")
- contact = current_user.contact_for(@person)

View file

@ -29,11 +29,12 @@
$('#file-upload').addClass("loading");
$("#profile_photo_upload").find(".avatar").addClass('loading');
$("#file-upload-spinner").removeClass("hidden");
$("#fileInfo").show();
},
onComplete: function(id, fileName, responseJSON){
$("#file-upload-spinner").addClass("hidden");
$('#fileInfo').text(fileName + ' completed').fadeOut(2000);
$("#fileInfo").text(Diaspora.I18n.t("photo_uploader.completed", {"file": fileName}));
$('#file-upload').removeClass("loading");
/* flash message prompt */

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?"
When I am on "alice@alice.alice"'s page
And I click to delete the first comment
And I confirm the alert
And I confirm the alert after I click to delete the first comment
And I go to the activity stream page
Then I should not see "Look at this dog"

View file

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

View file

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

View file

@ -27,8 +27,7 @@ Feature: commenting
When "bob@bob.bob" has commented "is that a poodle?" on "Look at this dog"
And I am on "alice@alice.alice"'s page
Then I should see "is that a poodle?"
When I click to delete the first comment
And I confirm the alert
When I confirm the alert after I click to delete the first comment
Then I should not see "is that a poodle?"
Scenario: expand the comment form in the main stream and an individual aspect stream
@ -48,7 +47,7 @@ Feature: commenting
Then I should see "Look at this dog"
When I follow "less than a minute ago"
Then I should see "Look at this dog"
And I make a show page comment "I think 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"
When I go to "alice@alice.alice"'s page
Then I should see "I think thats a cat"
@ -60,7 +59,8 @@ Feature: commenting
Then I should see "Look at this dog"
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"
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
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_first_name" field should contain "Boba"
And the "profile_last_name" field should contain "Fett"
And I should see "This is a bio"
And the "profile_bio" field should contain "This is a bio"
And the "profile_date_year" field should be filled with "1986"
And the "profile_date_month" field should be filled with "11"
And the "profile_date_day" field should be filled with "30"
@ -42,7 +42,10 @@ Feature: editing your profile
And I should see "#starwars" within "ul#as-selections-tags"
And the "#profile_public_details" bootstrap-switch should be on
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I confirm the alert
When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see "button.png completed"
And I should see a "img" within "#profile_photo_upload"
When I go to my edit profile page
Then I should see a "img" within "#profile_photo_upload"

View file

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

View file

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

View file

@ -36,8 +36,12 @@ Feature: Keyboard navigation
And I should have navigated to the highlighted post
Scenario: navigate upwards
When I scroll to post 3
And I press the "K" key somewhere
When I press the "J" key somewhere
And I press the "J" key somewhere
And I press the "J" key somewhere
Then post 3 should be highlighted
When I press the "K" key somewhere
Then post 2 should be highlighted
And I should have navigated to the highlighted post

View file

@ -15,10 +15,13 @@ Feature: Liking posts
Scenario: Liking and unliking a post from the stream
When I like the post "I like unicorns" in the stream
Then I should see a ".likes" within "#main_stream .stream_element"
Then I should see "Unlike" within ".stream_element .feedback"
And I should see a ".likes .media" within "#main_stream .stream_element"
When I unlike the post "I like unicorns" in the stream
Then I should not see a ".likes" within "#main_stream .stream_element"
Then I should see "Like" within ".stream_element .feedback"
And I should not see a ".likes .media" within "#main_stream .stream_element"
Scenario: Liking and unliking a post from a single post page
When I open the show page of the "I like unicorns" post

View file

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

View file

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

View file

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

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 I sign in as "laura@officeworkers.com"
And I toggle nsfw posts
And I follow "Reshare"
And I confirm the alert
And I confirm the alert after I follow "Reshare"
And I go to the home page
Then I should not see "Sexy Senators Gone Wild!"
And I should have 2 nsfw posts

View file

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

View file

@ -1,21 +1,15 @@
@javascript
Feature: viewing the photo lightbox
Background:
Given a user with username "bob"
And I sign in as "bob@bob.bob"
And I expand the publisher
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
And I fill in the following:
| status_message_fake_text | Look at this dog |
And I press "Share"
Given a user with username "alice"
And "alice@alice.alice" has posted a status message with a photo
And I sign in as "alice@alice.alice"
Scenario: viewing a photo
Then I should see an image attached to the post
And I press the attached image
When I press the attached image
Then I should see the photo lightbox
Scenario: closing the lightbox by clicking the close link
Then I should see an image attached to the post
And I press the attached image
When I press the attached image
And I press the close lightbox link
Then I should not see the photo lightbox

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

View file

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

View file

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

View file

@ -9,26 +9,25 @@ Feature: Navigate between pages using the header menu and the drawer
| Bob Jones | bob@bob.bob |
| Alice Smith | alice@alice.alice |
And I sign in as "alice@alice.alice"
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
And I sign in as "alice@alice.alice" on the mobile website
Scenario: navigate to the stream page
When I open the drawer
And I follow "My activity"
When I go to the activity stream page
And I click on selector "#header-title"
Then I should see "There are no posts yet." within "#main_stream"
Then I should be on the stream page
Scenario: navigate to the notification page
When I click on selector "#notification-badge"
Then I should see "Notifications" within "#main"
Then I should be on the notifications page
Scenario: navigate to the conversation page
When I click on selector "#conversations-badge"
Then I should see "Inbox" within "#main"
Then I should be on the conversations page
Scenario: navigate to the publisher page
When I click on selector "#compose-badge"
Then I should see "All aspects" within "#new_status_message"
Then I should be on the new status message page
Scenario: search a user
When I open the drawer
@ -38,57 +37,49 @@ Feature: Navigate between pages using the header menu and the drawer
Scenario: search for a tag
When I open the drawer
And I search for "#bob"
Then I should see "#bob" within "#main > h1"
Then I should be on the tag page for "bob"
Scenario: navigate to my activity page
When I open the drawer
And I follow "My activity"
Then I should see "My activity" within "#main"
And I click on "My activity" in the drawer
Then I should be on the activity stream page
Scenario: navigate to my mentions page
Given Alice has a post mentioning Bob
And I sign in as "bob@bob.bob"
When I open the drawer
And I follow "@Mentions"
Then I should see "Bob Jones" within ".stream_element"
And I click on "@Mentions" in the drawer
Then I should be on the mentioned stream page
Scenario: navigate to my aspects page
Given "bob@bob.bob" has a public post with text "bob's text"
When I open the drawer
And I follow "My aspects"
Then I should see "Besties" within "#all_aspects + li > ul"
And I follow "Besties"
And I click on "My aspects" in the drawer
And I click on "Besties" in the drawer
Then I should see "bob's text" within "#main_stream"
Scenario: navigate to the followed tags page
Given "bob@bob.bob" has a public post with text "bob is da #boss"
When I open the drawer
And I search for "#boss"
And I click on selector ".tag_following_action"
# Loading another page to refresh the drawer and make the now followed tag appears
And I click on selector "#compose-badge"
When I follow the "boss" tag
And I go to the stream page
And I open the drawer
And I follow "#Followed tags"
Then I should see "#boss" within "#followed_tags + li > ul"
And I follow "#boss"
Then I should see "bob is da #boss" within "#main_stream"
And I click on "#Followed tags" in the drawer
And I click on "#boss" in the drawer
Then I should be on the tag page for "boss"
When I open the drawer
And I follow "#Followed tags"
Then I should see "Manage followed tags" within "#followed_tags + li > ul"
And I follow "Manage followed tags"
Then I should see "#boss" within "ul.followed_tags"
And I click on "#Followed tags" in the drawer
And I click on "Manage followed tags" in the drawer
Then I should be on the manage tag followings page
Scenario: navigate to my profile page
When I open the drawer
And I follow "Profile"
Then I should see "Alice" within "#author_info"
And I click on "Profile" in the drawer
Then I should be on my profile page
Scenario: navigate to my mentions page
Scenario: navigate to my contacts page
When I open the drawer
And I follow "Contacts"
Then I should see "Contacts" within "#main"
And I click on "Contacts" in the drawer
Then I should be on the contacts page
Scenario: navigate to my mentions page
Scenario: navigate to my settings page
When I open the drawer
And I follow "Settings"
Then I should see "Settings" within "#main"
And I click on "Settings" in the drawer
Then I should be on my account settings page

View file

@ -1,7 +1,7 @@
@javascript @mobile
Feature: editing the profile in the mobile view
Scenario: editing profile fields
Given I am signed in
Given I am signed in on the mobile website
And I go to the edit profile page
When I fill in the following:
@ -25,7 +25,7 @@ Feature: editing the profile in the mobile view
And the "profile_gender" field should contain "Fearless"
And the "profile_first_name" field should contain "Boba"
And the "profile_last_name" field should contain "Fett"
And I should see "This is a bio"
And the "profile_bio" field should contain "This is a bio"
And the "profile_date_year" field should be filled with "1986"
And the "profile_date_month" field should be filled with "11"
And the "profile_date_day" field should be filled with "30"
@ -39,7 +39,10 @@ Feature: editing the profile in the mobile view
Then I should see "#kamino" within "ul#as-selections-tags"
And I should see "#starwars" within "ul#as-selections-tags"
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I confirm the alert
When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload"
And I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload"
Then I should see "button.png completed"
And I should see a "img" within "#profile_photo_upload"
When I go to my edit profile page
Then I should see a "img" within "#profile_photo_upload"

View file

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

View file

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

View file

@ -7,7 +7,7 @@ Feature: Browsing Diaspora as a logged out user mobile
Background:
Given a user named "Bob Jones" with email "bob@bob.bob"
And "bob@bob.bob" has a public post with text "public stuff"
And I sign in as "bob@bob.bob"
And I sign in as "bob@bob.bob" on the mobile website
And I click on selector "a.comment-action.inactive"
And I fill in the following:
| text | this also |

View file

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

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

View file

@ -25,15 +25,14 @@ Feature: posting from the mobile main page
And I press "Share"
When I go to the stream page
Then I should see "I am eating yogurt"
When I click on selector "a.remove"
And I confirm the alert
When I confirm the alert after I click on selector "a.remove"
Then I should not see "I am eating yogurt"
Scenario: post a photo without text
Given I visit the mobile publisher page
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
Then I should see an uploaded image within the photo drop zone
And I should see "button.png completed"
Then I should see "button.png completed"
And I should see an uploaded image within the photo drop zone
When I press "Share"
When I go to the stream page
Then I should see a "img" within ".stream_element div.photo_attachments"
@ -44,8 +43,7 @@ Feature: posting from the mobile main page
Scenario: back out of posting a photo-only post
Given I visit the mobile publisher page
When I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload-publisher"
And I confirm the alert
When I confirm the alert after I attach the file "spec/fixtures/bad_urls.txt" to "file" within "#file-upload-publisher"
Then I should not see an uploaded image within the photo drop zone
When I attach the file "spec/fixtures/button.png" to hidden "file" within "#file-upload-publisher"
And I should see "button.png completed"

View file

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

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 "eve@eve.eve" is connected with "bob@bob.bob"
Given "bob@bob.bob" has a public post with text "reshare this!"
And I sign in as "alice@alice.alice"
And I sign in as "alice@alice.alice" on the mobile website
Scenario: Resharing a post from a single post page
And I click on selector ".reshare-action.inactive"
And I confirm the alert
And I confirm the alert after I click on selector ".reshare-action.inactive"
Then I should see a ".reshare-action.active"
When I go to the stream page
Then I should see "Reshared via" within ".reshare_via"
@ -25,8 +24,7 @@ Feature: resharing from the mobile
Scenario: Resharing a post from a single post page that is reshared
Given the post with text "reshare this!" is reshared by "eve@eve.eve"
And a user with email "alice@alice.alice" is connected with "eve@eve.eve"
And I click on the first selector ".reshare-action.inactive"
And I confirm the alert
And I confirm the alert after I click on the first selector ".reshare-action.inactive"
Then I should see a ".reshare-action.active"
When I go to the stream page
Then I should see "Reshared via" within ".reshare_via"
@ -47,10 +45,9 @@ Feature: resharing from the mobile
Then I should see "Original post deleted by author" within ".reshare"
Scenario: Not resharing own post
Given I sign in as "bob@bob.bob"
Given I sign in as "bob@bob.bob" on the mobile website
Then I should see a ".reshare-action.disabled"
When I click on selector ".reshare-action"
Then I should not see any alert
And I should not see any alert after I click on selector ".reshare-action"
And I should not see a ".reshare-action.active"
When I go to the stream page
Then I should not see a ".reshare_via"

View file

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

View file

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

View file

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

View file

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

View file

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

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

View file

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

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 = {
redirect_uri: "http://localhost:3000",
redirect_uri: "http://example.org/",
response_type: "id_token token",
scope: "openid profile read",
nonce: "hello",
@ -8,7 +8,7 @@ O_AUTH_QUERY_PARAMS = {
}
O_AUTH_QUERY_PARAMS_WITH_MAX_AGE = {
redirect_uri: "http://localhost:3000",
redirect_uri: "http://example.org/",
response_type: "id_token token",
scope: "openid profile read",
nonce: "hello",

View file

@ -5,7 +5,7 @@ When /^I press the "([^\"]*)" key somewhere$/ do |key|
end
When /^I press the "([^\"]*)" key in the publisher$/ do |key|
find("#status_message_fake_text").native.send_keys(key)
find("#status_message_fake_text").native.send_key(key)
end
Then /^post (\d+) should be highlighted$/ do |position|
@ -15,10 +15,3 @@ end
And /^I should have navigated to the highlighted post$/ do
find(".shortcut_selected")["offsetTop"].to_i.should == page.evaluate_script("window.pageYOffset + 50").to_i
end
When /^I scroll to post (\d+)$/ do |position|
page.should have_css("div.stream_element")
page.driver.browser.execute_script("
window.scrollTo(window.pageXOffset, $('div.stream_element')[#{position}-1].offsetTop-50);
")
end

View file

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

View file

@ -15,7 +15,7 @@ And /^Alice has (\d+) posts mentioning Bob$/ do |n|
end
And /^I mention Alice in the publisher$/ do
write_in_publisher("@alice")
step %(I append "@alice" to the publisher)
step %(I click on the first user in the mentions dropdown list)
end

View file

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

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

View file

@ -10,7 +10,7 @@ Given /^a client exists for user "([^\"]*)"$/ do |email|
end
When /^I register a new client$/ do
post api_openid_connect_clients_path, redirect_uris: ["http://localhost:3000"], client_name: "diaspora client"
post api_openid_connect_clients_path, redirect_uris: ["http://example.org/"], client_name: "diaspora client"
end
When /^I use received valid bearer tokens to access user info$/ do

View file

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

View file

@ -7,7 +7,7 @@ Then /^the post should be expanded$/ do
end
Then /^I should see an uploaded image within the photo drop zone$/ do
find("#photodropzone img")["src"].should include("uploads/images")
expect(find("#photodropzone img")["src"]).to include("uploads/images")
end
Then /^I should not see an uploaded image within the photo drop zone$/ do

View file

@ -1,5 +1,5 @@
When /^I enter "([^"]*)" in the search input$/ do |search_term|
fill_in "q", :with => search_term
find("input#q").native.send_keys(search_term)
end
When /^I click on the first search result$/ do
@ -12,6 +12,13 @@ When /^I press enter in the search input$/ do
find("input#q").native.send_keys :return
end
When /^I search for "([^\"]*)"$/ do |search_term|
field = find_field("q")
fill_in "q", with: search_term
field.native.send_key(:enter)
expect(page).to have_content(search_term)
end
Then /^I should not see any search results$/ do
expect(page).to_not have_selector(".tt-suggestion")
end

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

View file

@ -1,8 +1,13 @@
When(/^I unfollow the "(.*?)" tag$/) do |tag|
accept_alert do
within("#tags_list") do
li = find("li", text: tag)
li.hover
li.find(".delete-tag-following").click
end
step "I confirm the alert"
end
end
When /^I follow the "(.*?)" tag$/ do |tag|
TagFollowing.create!(tag: FactoryGirl.create(:tag, name: tag), user: @me)
end

View file

@ -206,7 +206,7 @@ end
And /^I should be able to friend "([^\"]*)"$/ do |email|
user = User.find_by_email(email)
step 'I should see "Add contact"'
step 'I should see a ".aspect_dropdown"'
step "I should see \"#{user.name}\""
end
@ -219,5 +219,5 @@ Given /^I did request my photos$/ do
end
Then /^I should get a zipped file$/ do
expect(DownloadHelpers.download).to end_with("zip")
expect(page.response_headers["Content-Type"]).to eq("application/zip")
end

View file

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

View file

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

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/cucumber"
require "capybara/session"
require "selenium/webdriver"
require "capybara/poltergeist"
require "cucumber/api_steps"
require "json_spec/cucumber"
@ -20,30 +20,11 @@ Capybara.server_port = AppConfig.pod_uri.port
Rails.application.routes.default_url_options[:host] = AppConfig.pod_uri.host
Rails.application.routes.default_url_options[:port] = AppConfig.pod_uri.port
# Use a version of Firefox defined by environment variable, if set
Selenium::WebDriver::Firefox::Binary.path = ENV["FIREFOX_BINARY_PATH"] || Selenium::WebDriver::Firefox::Binary.path
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
# Set the download directory to "tmp/downloads"
profile["browser.download.dir"] = DownloadHelpers::PATH.to_s
# Save the file instead of opening it
profile["browser.download.folderList"] = 2
# Hide the download Manager
profile["browser.download.manager.showWhenStarting"] = false
# Suppress "open with" dialog for zipped files only
profile["browser.helperApps.neverAsk.saveToDisk"] = "application/zip"
# Start Firefox using our profile
Capybara::Selenium::Driver.new(app, browser: :firefox, profile: profile)
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, timeout: 60)
end
Capybara.register_driver :mobile do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile["general.useragent.override"] = "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0"
Capybara::Selenium::Driver.new(app, profile: profile)
end
Capybara.default_driver = :selenium
Capybara.javascript_driver = :poltergeist
# Capybara defaults to XPath selectors rather than Webrat's default of CSS3. In
# order to ease the transition to Capybara we set the default here. If you'd
@ -81,9 +62,11 @@ require Rails.root.join('spec', 'support', 'inlined_jobs')
require Rails.root.join('spec', 'support', 'user_methods')
include HelperMethods
Before do
Before do |scenario|
Devise.mailer.deliveries = []
page.driver.browser.manage.window.resize_to(1024, 500)
# Delete all files in "tmp/downloads"
DownloadHelpers.clear_downloads
page.driver.headers = if scenario.source_tag_names.include? "@mobile"
{"User-Agent" => "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0"}
else
page.driver.headers = {}
end
end

View file

@ -11,6 +11,18 @@ RSpec::Matchers.define :have_path do |expected|
end
end
RSpec::Matchers.define :have_path_in do |expected|
match do |actual|
await_condition { expected.include? actual.current_path }
end
failure_message_for_should do |actual|
"expected #{actual.inspect} to have path in #{expected.inspect} but was #{actual.current_path.inspect}"
end
failure_message_for_should_not do |actual|
"expected #{actual.inspect} to not have path in #{expected.inspect} but it had"
end
end
RSpec::Matchers.define :have_value do |expected|
match do |actual|
@ -25,7 +37,6 @@ RSpec::Matchers.define :have_value do |expected|
end
end
def await_condition &condition
start_time = Time.zone.now
until condition.call

View file

@ -66,8 +66,12 @@ module NavigationHelpers
end
def confirm_on_page(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
World(NavigationHelpers)

View file

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

View file

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

View file

@ -41,4 +41,18 @@ describe HomeController, type: :controller do
expect(session[:mobile_view]).to be true
end
end
describe "#force_mobile" do
it "changes :html to :mobile" do
session[:mobile_view] = nil
get :force_mobile
expect(session[:mobile_view]).to be true
end
it "keeps :mobile" do
session[:mobile_view] = true
get :force_mobile
expect(session[:mobile_view]).to be true
end
end
end