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

98 lines
2.9 KiB
Ruby
Raw Normal View History

require 'spec_helper'
# these test will verify all of the user progression cases that rely on a javascript event (not bothering with instrumented models)
2015-07-18 12:49:45 +00:00
describe "Download", :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_max_wait_time = 10
end
let(:user) { FactoryGirl.create(:user) }
2021-03-17 09:14:58 +00:00
#let(:platforms) {[ 'Win32', 'MacOSX']}
let(:platforms) {{ 'Win32' => 'Windows', 'MacOSX' => 'Mac' }}
describe "downloaded client" do
before(:each) do
FactoryGirl.create(:artifact_update, :product => 'JamClient/Win32')
FactoryGirl.create(:artifact_update, :product => 'JamClient/MacOSX')
end
shared_examples :dowload_client do
# there is also a generic download pages
before(:each) do
#sign_in_poltergeist user
visit path
# put the user on Windows to start
detected_os = find("a.current-os-download")['data-platform']
end
it "toggle active download" do
2015-07-18 12:49:45 +00:00
other_download = find(".download-others a")
other_download_platform = other_download['data-platform']
2021-03-17 09:14:58 +00:00
platforms.keys.include?(other_download_platform).should be true
platforms.keys.delete(other_download_platform)
2015-07-18 12:49:45 +00:00
2021-03-17 09:14:58 +00:00
remaining_platform = platforms.keys[0]
2015-07-18 12:49:45 +00:00
#other_download.trigger(:click)
other_download.click
2015-07-18 12:49:45 +00:00
find("a.current-os-download")['data-platform'].should == other_download_platform
#find(".download-others a[data-platform='#{remaining_platform}']").trigger(:click)
find(".download-others a[data-platform='#{remaining_platform}']").click
2015-07-18 12:49:45 +00:00
find("a.current-os-download")['data-platform'].should == remaining_platform
2021-03-17 09:14:58 +00:00
find("a.current-os-download").click
if path =~ /landing/
should have_content("The application is downloading...") #download instruction modal
should have_content("how to install the JamKazam app for #{platforms[remaining_platform]}")
end
end
end
describe "goto downloads-page without signin" do
describe :default_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/downloads" }
end
end
describe :landing_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/landing/general/downloads" }
end
end
end
2021-03-16 13:10:46 +00:00
describe "signin and goto downloads-page" do
before(:each) do
sign_in_poltergeist user
end
describe :default_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/downloads" }
end
end
2021-03-16 13:10:46 +00:00
describe :landing_downloads_page do
it_behaves_like :dowload_client do
let(:path){ "/landing/general/downloads" }
end
end
end
end
end