2014-06-19 18:43:21 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
2014-07-29 02:14:09 +00:00
|
|
|
describe "Create Session UI", :js => true, :type => :feature, :capybara_feature => true do
|
2014-06-20 16:52:36 +00:00
|
|
|
let(:user1) { FactoryGirl.create(:user) }
|
|
|
|
|
let(:user2) { FactoryGirl.create(:user) }
|
2014-06-19 18:43:21 +00:00
|
|
|
|
2014-06-20 16:52:36 +00:00
|
|
|
context "create session flow ui" do
|
2014-06-19 18:43:21 +00:00
|
|
|
before(:each) do
|
|
|
|
|
MusicSession.delete_all
|
|
|
|
|
ActiveMusicSession.delete_all
|
|
|
|
|
|
|
|
|
|
in_client(user1) do
|
2014-06-20 16:52:36 +00:00
|
|
|
page.driver.resize(1500, 800) # makes sure all the elements are visible
|
|
|
|
|
emulate_client
|
|
|
|
|
sign_in_poltergeist user1
|
2014-07-29 02:14:09 +00:00
|
|
|
page.find('.createsession').trigger(:click)
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-07-29 22:52:20 +00:00
|
|
|
# VRFS-1976
|
|
|
|
|
it "create two sessions; select the second one" do
|
|
|
|
|
|
|
|
|
|
# this is tricky because of iCheck and it's custom way of dealing with 'checked' state
|
|
|
|
|
start1 = 15.minutes.ago
|
|
|
|
|
session1 = FactoryGirl.create(:music_session, description: 'My Session 1', creator: user1, scheduled_start: start1)
|
|
|
|
|
session2 = FactoryGirl.create(:music_session, description: 'My Session 2', creator: user1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
# should reload the session page, so that we see new sessions
|
|
|
|
|
visit '/client#/createSession'
|
|
|
|
|
|
|
|
|
|
# pick the second session
|
|
|
|
|
page.find("#scheduled-session-list input[data-session-id='#{session2.id}'] + ins").trigger(:click)
|
|
|
|
|
page.find('.btn-next').trigger(:click)
|
|
|
|
|
|
|
|
|
|
# check if future dialog is showing; if so, accept
|
|
|
|
|
accept = first('#btn-confirm-ok', text: "START SESSION NOW")
|
|
|
|
|
accept.trigger(:click) if accept
|
|
|
|
|
|
|
|
|
|
page.find('#session-description-disp', text: 'My Session 2')
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-06-19 18:43:21 +00:00
|
|
|
describe "step 1" do
|
|
|
|
|
it "initial status" do
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
find('.session-step-title', text: 'When Is Your Session?')
|
|
|
|
|
find('#session-when-start-scheduled[checked="checked"]')
|
|
|
|
|
find('div#scheduled-session-not-found')
|
|
|
|
|
find('div[info-id="start-scheduled"]')
|
|
|
|
|
page.should have_css(".session-stepnumber", :count => 2)
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
|
|
|
page.should_not have_css(".btn-back")
|
2014-06-30 21:34:00 +00:00
|
|
|
page.should have_css(".btn-next.disabled")
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".btn-help")
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "select option for scheduling a session" do
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
2014-06-20 16:52:36 +00:00
|
|
|
find('div[info-id="schedule-future"]')
|
2014-06-19 18:43:21 +00:00
|
|
|
page.should have_css(".session-stepnumber", :count => 5)
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
2014-06-19 18:43:21 +00:00
|
|
|
find('div#schedule-future-wrapper')
|
|
|
|
|
find('h3', text: 'When will the session happen?')
|
|
|
|
|
find('input#session-start-date')
|
2014-06-24 03:26:27 +00:00
|
|
|
find('.start-time-list-holder .easydropdown')
|
|
|
|
|
find('.end-time-list-holder .easydropdown')
|
|
|
|
|
find('.start-time-list-holder .easydropdown')
|
|
|
|
|
find('.timezone-list-holder .easydropdown')
|
|
|
|
|
find('.recurring-mode-list-holder .easydropdown')
|
2014-06-30 22:12:00 +00:00
|
|
|
|
|
|
|
|
# by selecting this time, the end-time-list should auto-select to 6:30PM
|
2014-07-01 01:28:35 +00:00
|
|
|
# Out for the time being; because the contents of the dropdown is based on the current time
|
2014-06-30 23:54:16 +00:00
|
|
|
#jk_select('05:30 PM', '#start-time-list')
|
|
|
|
|
#find('.end-time-list-holder .selected', text: '06:30 PM')
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "select option for scheduling session after others RSVP" do
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="rsvp"] ins').trigger(:click)
|
|
|
|
|
find('div[info-id="rsvp"]')
|
|
|
|
|
page.should have_css(".session-stepnumber", :count => 5)
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2014-06-20 16:52:36 +00:00
|
|
|
it "select option for starting session right now" do
|
2014-06-19 18:43:21 +00:00
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="immediately"] ins').trigger(:click)
|
|
|
|
|
find('div[info-id="immediately"]')
|
|
|
|
|
page.should have_css(".session-stepnumber", :count => 5)
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "select option for starting quick session" do
|
2014-06-20 16:52:36 +00:00
|
|
|
in_client(user1) do
|
2014-06-19 18:43:21 +00:00
|
|
|
find('li[create-type="quick-start"] ins').trigger(:click)
|
|
|
|
|
find('div[info-id="quick-start"]')
|
|
|
|
|
page.should have_css(".session-stepnumber", :count => 2)
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "step 2" do
|
|
|
|
|
before(:each) do
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "initial status" do
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
find('.session-step-title', text: 'What Are You Playing?')
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".btn-back")
|
|
|
|
|
page.should have_css(".btn-next")
|
|
|
|
|
page.should have_css(".btn-help")
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "validates genre, name and description" do
|
|
|
|
|
in_client(user1) do
|
|
|
|
|
find('.btn-next').trigger(:click)
|
2014-06-20 16:52:36 +00:00
|
|
|
find('ul.error-text li', text: 'You must select a genre.')
|
|
|
|
|
find('ul.error-text li', text: 'Name is required')
|
|
|
|
|
find('ul.error-text li', text: 'Description is required')
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "step 3" do
|
|
|
|
|
before(:each) do
|
2014-06-20 16:52:36 +00:00
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
2014-09-10 16:27:55 +00:00
|
|
|
jk_select("Alternative Rock", '#create-session-form select[name="genres"]')
|
2014-06-20 16:52:36 +00:00
|
|
|
fill_in('session-name', :with => "Test Name")
|
|
|
|
|
fill_in('session-description', :with => "Test Description")
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
end
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "initial status" do
|
2014-06-20 16:52:36 +00:00
|
|
|
find('.session-step-title', text: 'Who Is Playing With You?')
|
|
|
|
|
find('input#session-plus-musicians[type="checkbox"][checked="checked"]')
|
2014-06-19 18:43:21 +00:00
|
|
|
|
2014-06-24 03:26:27 +00:00
|
|
|
expect( find(:css, 'select#session-language-list', :visible => false).value ).to eq('eng')
|
2014-06-20 16:52:36 +00:00
|
|
|
page.should have_css(".session-stepnumber", :count => 5)
|
|
|
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
|
|
|
|
|
|
|
|
page.should have_css(".btn-back")
|
|
|
|
|
page.should have_css(".btn-next")
|
|
|
|
|
page.should have_css(".btn-help")
|
|
|
|
|
end
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "step 4" do
|
|
|
|
|
before(:each) do
|
2014-06-20 16:52:36 +00:00
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
2014-09-10 16:27:55 +00:00
|
|
|
jk_select("Alternative Rock", '#create-session-form select[name="genres"]')
|
2014-06-20 16:52:36 +00:00
|
|
|
fill_in('session-name', :with => "Test Name")
|
|
|
|
|
fill_in('session-description', :with => "Test Description")
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "initial status" do
|
|
|
|
|
find('.session-step-title', text: 'What Are Your Policies?')
|
|
|
|
|
find('input#session-policy-standard[type="radio"][checked="checked"]')
|
|
|
|
|
find('input#session-policy-confirm[type="checkbox"]')
|
|
|
|
|
|
2014-10-11 15:39:52 +00:00
|
|
|
expect( find(:css, 'select#session-musician-access', :visible => false).value ).to eq('musicians')
|
2014-06-24 03:26:27 +00:00
|
|
|
expect( find(:css, 'select#session-fans-access', :visible => false).value ).to eq('listen-chat-each')
|
2014-10-11 15:39:52 +00:00
|
|
|
page.should have_css('span.selected', text: "Musicians may join at will")
|
2014-06-22 23:43:17 +00:00
|
|
|
page.should have_css('span.selected', text: "Fans may listen, chat with each other")
|
2014-06-20 16:52:36 +00:00
|
|
|
|
|
|
|
|
page.should have_css(".btn-back")
|
|
|
|
|
page.should have_css(".btn-next")
|
|
|
|
|
page.should have_css(".btn-help")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
it "validates terms of service checkbox" do
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
|
|
|
|
find('ul.error-text li', text: 'You must accept the Session Policy.')
|
2014-06-19 18:43:21 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "step 5" do
|
|
|
|
|
before(:each) do
|
2014-06-20 16:52:36 +00:00
|
|
|
in_client(user1) do
|
|
|
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
2014-09-10 16:27:55 +00:00
|
|
|
jk_select("Alternative Rock", '#create-session-form select[name="genres"]')
|
2014-06-20 16:52:36 +00:00
|
|
|
fill_in('session-name', :with => "Test Name")
|
|
|
|
|
fill_in('session-description', :with => "Test Description")
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
|
|
|
|
|
find('div#divSessionPolicy ins').trigger(:click)
|
|
|
|
|
find('.btn-next').trigger(:click)
|
|
|
|
|
end
|
2014-07-08 21:52:25 +00:00
|
|
|
end
|
2014-06-20 16:52:36 +00:00
|
|
|
|
|
|
|
|
|
2014-07-08 21:52:25 +00:00
|
|
|
it "initial status" do
|
|
|
|
|
find('.session-step-title', text: 'Review & Confirm')
|
2014-09-10 16:27:55 +00:00
|
|
|
find('em#session-name-disp', text: 'Test Name (Alternative Rock)')
|
2014-07-08 21:52:25 +00:00
|
|
|
find('div#session-description-disp', text: 'Test Description')
|
|
|
|
|
find('div#session-language-disp', text: 'English')
|
2014-10-11 15:39:52 +00:00
|
|
|
find('div#session-invited-disp', text: 'Any interested JamKazam musicians who want to join us')
|
2014-07-08 21:52:25 +00:00
|
|
|
find('div#session-instruments-me-disp', text: 'Other')
|
|
|
|
|
find('div#session-instruments-rsvp-disp', text: 'Any Instrument Allowed')
|
2014-10-11 15:39:52 +00:00
|
|
|
find('div#session-musician-access-disp', text: 'Musicians: Musicians may join at will')
|
2014-07-08 21:52:25 +00:00
|
|
|
find('div#session-fans-access-disp', text: 'Fans: Fans may listen, chat with each other')
|
|
|
|
|
find('div#session-policy-disp', text: 'Standard')
|
|
|
|
|
|
|
|
|
|
page.should have_css(".btn-back")
|
|
|
|
|
page.should have_css(".btn-next")
|
|
|
|
|
page.should have_css(".btn-help")
|
2014-06-20 16:52:36 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2014-10-11 15:39:52 +00:00
|
|
|
end
|