Cleaned up/sped up two-session test
This commit is contained in:
parent
9341b077e3
commit
09e046e033
|
|
@ -7,25 +7,25 @@ describe "Find Session", :js => true, :type => :feature, :capybara_feature => tr
|
|||
before(:all) do
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
Capybara.current_driver = Capybara.javascript_driver
|
||||
Capybara.default_wait_time = 10
|
||||
Capybara.default_wait_time = 20 # these tests are SLOOOOOW
|
||||
end
|
||||
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
||||
before(:each) do
|
||||
UserMailer.deliveries.clear
|
||||
|
||||
page.driver.resize(1400, 600) # crude hack
|
||||
end
|
||||
|
||||
# when the find session page loads, it should show that there are no sessions
|
||||
# when no sessions have been created:
|
||||
it "shows there are no sessions" do
|
||||
|
||||
sign_in_poltergeist user
|
||||
visit "/#/findSession"
|
||||
find('#find-session-form') # using Capybara to avoid a 'sleep 5'
|
||||
|
||||
find('#find-session-form')
|
||||
|
||||
page.should have_selector('#sessions-none-found')
|
||||
|
||||
# verify no sessions are found
|
||||
expect(page).to have_selector('#sessions-none-found')
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -33,38 +33,33 @@ describe "Find Session", :js => true, :type => :feature, :capybara_feature => tr
|
|||
|
||||
@unique_session_desc = 'Description found easily'
|
||||
|
||||
# create session in one client
|
||||
in_client(:one) do
|
||||
|
||||
sign_in_poltergeist user
|
||||
visit "/#/createSession"
|
||||
|
||||
sleep 5 # this was in the cucumber steps file and it breaks when i remove it here
|
||||
within('#create-session-form') do
|
||||
fill_in('description', :with => @unique_session_desc)
|
||||
select('Rock', :from => 'genres')
|
||||
check('intellectual-property')
|
||||
click_link('btn-create-session') # fails if page width is low
|
||||
end
|
||||
|
||||
# pick a genre
|
||||
page.select("Rock", :from => "genres")
|
||||
|
||||
# fill in description
|
||||
page.fill_in 'description', :with => @unique_session_desc
|
||||
|
||||
# check box for legal terms
|
||||
page.check('intellectual-property')
|
||||
|
||||
# create the session
|
||||
page.find('#btn-create-session').click
|
||||
# sleep 5
|
||||
find('#session-controls') # using Capybara to avoid a 'sleep 5'
|
||||
|
||||
# verify that the in-session page is showing
|
||||
expect(page).to have_selector('h2', text: 'my tracks')
|
||||
|
||||
# with our description showing
|
||||
# click into session description
|
||||
# page.find("#session-info").should have_content @unique_session_desc
|
||||
end
|
||||
|
||||
# find session in second client
|
||||
in_client(:two) do
|
||||
sign_in_poltergeist user
|
||||
sign_in_poltergeist user # (currently uses SAME user login as client one)
|
||||
visit "/#/findSession"
|
||||
find('#find-session-form')
|
||||
sleep 5 # not happy with this
|
||||
find('#find-session-form') # again, using Capybara to avoid a 'sleep'
|
||||
|
||||
# verify the ßsession description is seen by second client
|
||||
expect(page).to have_text(@unique_session_desc)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue