248 lines
8.9 KiB
Ruby
248 lines
8.9 KiB
Ruby
require 'spec_helper'
|
|
|
|
describe "Create Session Flow", :js => true, :type => :feature, :capybara_feature => true do
|
|
let(:user1) { FactoryGirl.create(:user) }
|
|
let(:user2) { FactoryGirl.create(:user) }
|
|
|
|
context "create session flow ui" do
|
|
before(:each) do
|
|
MusicSession.delete_all
|
|
ActiveMusicSession.delete_all
|
|
|
|
in_client(user1) do
|
|
page.driver.resize(1500, 800) # makes sure all the elements are visible
|
|
emulate_client
|
|
sign_in_poltergeist user1
|
|
wait_until_curtain_gone
|
|
visit "/client#/createSession"
|
|
end
|
|
end
|
|
|
|
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)
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
page.should_not have_css(".btn-back")
|
|
page.should have_css(".btn-next")
|
|
page.should have_css(".btn-help")
|
|
end
|
|
end
|
|
|
|
it "select option for scheduling a session" do
|
|
in_client(user1) do
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
find('div[info-id="schedule-future"]')
|
|
page.should have_css(".session-stepnumber", :count => 5)
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
find('div#schedule-future-wrapper')
|
|
find('h3', text: 'When will the session happen?')
|
|
find('input#session-start-date')
|
|
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')
|
|
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)
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
end
|
|
end
|
|
|
|
it "select option for starting session right now" do
|
|
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)
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
end
|
|
end
|
|
|
|
it "select option for starting quick session" do
|
|
in_client(user1) do
|
|
find('li[create-type="quick-start"] ins').trigger(:click)
|
|
find('div[info-id="quick-start"]')
|
|
page.should have_css(".session-stepnumber", :count => 2)
|
|
page.should have_css(".session-stepnumber.session-stepactive", :count => 1)
|
|
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?')
|
|
page.should have_css(".btn-back")
|
|
page.should have_css(".btn-next")
|
|
page.should have_css(".btn-help")
|
|
end
|
|
end
|
|
|
|
it "validates genre, name and description" do
|
|
in_client(user1) do
|
|
find('.btn-next').trigger(:click)
|
|
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')
|
|
end
|
|
end
|
|
end
|
|
|
|
describe "step 3" do
|
|
before(:each) do
|
|
in_client(user1) do
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
find('.btn-next').trigger(:click)
|
|
|
|
jk_select("Rock", '#create-session-form select[name="genres"]')
|
|
fill_in('session-name', :with => "Test Name")
|
|
fill_in('session-description', :with => "Test Description")
|
|
find('.btn-next').trigger(:click)
|
|
end
|
|
end
|
|
|
|
it "initial status" do
|
|
find('.session-step-title', text: 'Who Is Playing With You?')
|
|
find('input#session-plus-musicians[type="checkbox"][checked="checked"]')
|
|
|
|
expect( find(:css, 'select#session-language-list', :visible => false).value ).to eq('eng')
|
|
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
|
|
end
|
|
|
|
describe "step 4" do
|
|
before(:each) do
|
|
in_client(user1) do
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
find('.btn-next').trigger(:click)
|
|
|
|
jk_select("Rock", '#create-session-form select[name="genres"]')
|
|
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"]')
|
|
|
|
expect( find(:css, 'select#session-musician-access', :visible => false).value ).to eq('musicians-approval')
|
|
expect( find(:css, 'select#session-fans-access', :visible => false).value ).to eq('listen-chat-each')
|
|
|
|
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.')
|
|
end
|
|
end
|
|
|
|
describe "step 5" do
|
|
before(:each) do
|
|
in_client(user1) do
|
|
find('li[create-type="schedule-future"] ins').trigger(:click)
|
|
find('.btn-next').trigger(:click)
|
|
|
|
jk_select("Rock", '#create-session-form select[name="genres"]')
|
|
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
|
|
|
|
it "initial status" do
|
|
find('.session-step-title', text: 'Review & Confirm?')
|
|
find('em#session-name-disp', text: 'Test (Rock)')
|
|
find('div#session-description-disp', text: 'Test Description')
|
|
find('div#session-language-disp', text: 'English')
|
|
find('div#session-invited-disp', text: 'Any interested JamKazam musicians that I approve')
|
|
find('div#session-instruments-me-disp', text: 'Electric Guitar')
|
|
find('div#session-musician-access-disp', text: 'Musicians: Musicians may join by approval')
|
|
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")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
context "create session flow backend" do
|
|
describe "schedule a session" do
|
|
it "schedule a session" do
|
|
schedule_session({creator: user1})
|
|
end
|
|
|
|
it "start a session after scheduling" do
|
|
pending "Waiting Brian to fix rsvp bug..."
|
|
MusicSession.delete_all
|
|
|
|
schedule_session({creator: user1})
|
|
|
|
in_client(user1) do
|
|
visit "/client#/createSession"
|
|
|
|
find('.btn-next').trigger(:click)
|
|
find('.btn-next').trigger(:click)
|
|
|
|
expect(page).to have_selector('h2', text: 'my tracks')
|
|
find('#session-screen .session-mytracks .session-track')
|
|
end
|
|
end
|
|
end
|
|
|
|
it "start quick session" do
|
|
page.driver.resize(1500, 800) # makes sure all the elements are visible
|
|
emulate_client
|
|
sign_in_poltergeist user1
|
|
wait_until_curtain_gone
|
|
visit "/client#/createSession"
|
|
expect(page).to have_selector('h1', text: 'create session')
|
|
|
|
find('li[create-type="quick-start"] ins').trigger(:click)
|
|
find('div[info-id="quick-start"]')
|
|
|
|
find('.btn-next').trigger(:click)
|
|
find('.btn-next', text: 'START SESSION').trigger(:click)
|
|
|
|
expect(page).to have_selector('h2', text: 'my tracks')
|
|
find('#session-screen .session-mytracks .session-track')
|
|
end
|
|
end
|
|
end |