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

76 lines
2.0 KiB
Ruby

require 'spec_helper'
describe "Home Screen", :js => true, :type => :feature, :capybara_feature => true do
subject { page }
before(:all) do
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
Capybara.default_wait_time = 10
end
before(:each) do
sign_in_poltergeist user
emulate_client
visit "/client"
end
let(:user) { FactoryGirl.create(:user, :show_whats_next => true) }
describe "new user in the native view should see the whats next dialog" do
it {
should have_selector('h1', text: 'what\'s next?')
}
describe "open invitation dialog for email" do
before(:each) do
find('#whatsnext-dialog .email-invite').trigger(:click)
end
it {should have_selector('label', text: 'Enter email address(es). If multiple addresses, separate with commas.')}
end
describe "launches youtube tutorial site" do
it {
find("#whatsnext-dialog a.orange[purpose='youtube-tutorials']").trigger(:click)
page.driver.window_handles.last
page.within_window page.driver.window_handles.last do
should have_title('JamKazam - YouTube')
end
}
end
describe "close hides the screen" do
it {
find('#whatsnext-dialog a[layout-action="close"]').trigger(:click)
should have_no_selector('h1', text: 'what\'s next?')
}
end
describe "user can make prompt go away forever" do
it {
find('#whatsnext-dialog ins.iCheck-helper').trigger(:click)
find('#whatsnext-dialog a[layout-action="close"]').trigger(:click)
# needed because we poke the server with an updateUser call, but their is no indication in the UI that it's done
wait_for_ajax
emulate_client
sleep 1
visit "/client"
wait_until_curtain_gone
should_not have_selector('h1', text: 'what\'s next?')
}
end
end
end