jam-cloud/web/spec/features/feed_spec.rb

199 lines
5.2 KiB
Ruby
Raw Normal View History

2014-04-03 04:19:39 +00:00
require 'spec_helper'
describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
2014-04-04 04:47:07 +00:00
let (:user) { FactoryGirl.create(:user) }
before(:all) do
MusicSessionHistory.delete_all
Recording.delete_all
end
2014-04-03 04:19:39 +00:00
describe "sessions" do
before(:each) do
2014-04-29 07:33:37 +00:00
MusicSessionHistory.delete_all
create_session(creator: user)
2014-04-03 14:38:58 +00:00
formal_leave_by(user)
2014-04-03 04:19:39 +00:00
end
# it "should render avatar" do
2014-04-29 07:33:37 +00:00
# it " and link to profile" do
# end
# it " and render artist hover bubble" do
# end
2014-04-03 04:19:39 +00:00
# end
# it "should render description" do
2014-04-29 07:33:37 +00:00
# it " and link to session landing" do
# end
# it " and render session hover bubble" do
# end
2014-04-03 04:19:39 +00:00
# end
2014-04-29 07:33:37 +00:00
# it "should render artist name" do
# it " and link to profile" do
# end
# it " and render artist hover bubble"
2014-04-03 04:19:39 +00:00
# end
2014-04-29 07:33:37 +00:00
it "should render stats" do
visit "/client#/feed"
# initial stats
find('span.plays').should have_content('0')
find('span.comments').should have_content('0')
find('span.likes').should have_content('0')
# Comments
find('a.btn-comment').trigger(:click)
comment = 'this sounds great'
fill_in "txtComment", with: comment
find('#btn-add-comment').trigger(:click)
find('div.comment-text', text: comment)
find('#dialog-close-button', '[layout-id="comment-dialog"]').trigger(:click)
find('#btn-refresh-feed').trigger(:click)
find('span.comments').should have_content('1')
# Likes
find('a.btn-like').trigger(:click)
find('span.likes').should have_content('1')
end
2014-04-03 04:19:39 +00:00
it "should render details" do
visit "/client#/feed"
2014-04-04 04:47:07 +00:00
find('.feed-details a.details').trigger(:click)
2014-04-03 04:19:39 +00:00
# confirm user avatar exists
2014-04-19 19:24:30 +00:00
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"] img")
2014-04-03 04:19:39 +00:00
# confirm user name exists
2014-04-19 19:24:30 +00:00
find("a.musician-name[user-id=\"#{user.id}\"][hoveraction=\"musician\"]", text: user.name)
2014-04-03 04:19:39 +00:00
# confirm instrument icons exist
find("img[instrument-id=\"electric guitar\"]")
2014-04-19 19:24:30 +00:00
# confirm hover bubbles show
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").hover_intent
# confirm navigate to user profile page
find(".avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").trigger(:click)
find("#user-profile h2[id=profile-username]", text: user.name)
2014-04-03 04:19:39 +00:00
end
# it "should render play widget" do
# end
end
describe "recordings" do
before(:each) do
2014-04-04 04:47:07 +00:00
MusicSessionHistory.delete_all
2014-04-29 07:33:37 +00:00
Recording.delete_all
2014-04-03 14:38:58 +00:00
start_recording_with(user)
2014-04-03 04:19:39 +00:00
stop_recording
2014-04-03 14:38:58 +00:00
formal_leave_by(user)
2014-04-03 04:19:39 +00:00
end
# it "should render avatar" do
2014-04-29 07:33:37 +00:00
# it " and link to profile" do
# end
# it " and render artist hover bubble" do
# end
2014-04-03 04:19:39 +00:00
# end
# it "should render description" do
2014-04-29 07:33:37 +00:00
# it " and link to recording landing" do
# end
# it " and render recording hover bubble" do
# end
2014-04-03 04:19:39 +00:00
# end
2014-04-29 07:33:37 +00:00
# it "should render artist name" do
# it " and link to profile" do
# end
# it " and render artist hover bubble"
2014-04-03 04:19:39 +00:00
# end
2014-04-29 07:33:37 +00:00
it "should render stats" do
visit "/client#/feed"
# close recording finished dialog
claim_recording("my recording", "my recording description")
MusicSessionHistory.delete_all
find('#btn-refresh-feed').trigger(:click)
# initial stats
find('span.plays').should have_content('0')
find('span.comments').should have_content('0')
find('span.likes').should have_content('0')
# ensure Share icon exists
find('a.btn-share')
# Comments
find('a.btn-comment').trigger(:click)
comment = 'this sounds great'
fill_in "txtComment", with: comment
find('#btn-add-comment').trigger(:click)
find('div.comment-text', text: comment)
find('#dialog-close-button', '[layout-id="comment-dialog"]').trigger(:click)
find('#btn-refresh-feed').trigger(:click)
find('span.comments').should have_content('1')
# Likes
find('a.btn-like').trigger(:click)
find('span.likes').should have_content('1')
end
2014-04-03 04:19:39 +00:00
it "should render details" do
visit "/client#/feed"
2014-04-19 19:24:30 +00:00
# close recording finished dialog
2014-04-29 07:33:37 +00:00
claim_recording("my recording", "my recording description")
MusicSessionHistory.delete_all
find('#btn-refresh-feed').trigger(:click)
2014-04-19 19:24:30 +00:00
2014-04-04 04:47:07 +00:00
find('.feed-details a.details').trigger(:click)
2014-04-03 04:19:39 +00:00
# confirm user avatar exists
2014-04-19 19:24:30 +00:00
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"] img")
2014-04-03 04:19:39 +00:00
# confirm user name exists
2014-04-19 19:24:30 +00:00
find("a.musician-name[user-id=\"#{user.id}\"][hoveraction=\"musician\"]", text: user.name)
2014-04-03 04:19:39 +00:00
# confirm instrument icons exist
find("img[instrument-id=\"electric guitar\"]")
2014-04-19 19:24:30 +00:00
# confirm hover bubbles show
find("a.avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").hover_intent
# confirm navigate to user profile page
find(".avatar-tiny[user-id=\"#{user.id}\"][hoveraction=\"musician\"]").trigger(:click)
2014-04-29 07:33:37 +00:00
find("#user-profile h2[id=profile-username]", text: user.name)
2014-04-03 04:19:39 +00:00
end
# it "should render play widget" do
# it " and allow recording playback" do
# end
# end
end
end