2013-10-19 19:46:06 +00:00
|
|
|
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
|
2013-10-19 19:46:06 +00:00
|
|
|
|
|
|
|
|
subject { page }
|
|
|
|
|
|
|
|
|
|
before(:all) do
|
2021-03-13 06:10:47 +00:00
|
|
|
#Capybara.javascript_driver = :poltergeist
|
|
|
|
|
#Capybara.current_driver = Capybara.javascript_driver
|
|
|
|
|
#Capybara.default_max_wait_time = 10
|
2013-10-19 19:46:06 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
let(:user) { FactoryGirl.create(:user) }
|
2021-03-17 09:14:58 +00:00
|
|
|
#let(:platforms) {[ 'Win32', 'MacOSX']}
|
|
|
|
|
let(:platforms) {{ 'Win32' => 'Windows', 'MacOSX' => 'Mac' }}
|
2013-10-19 19:46:06 +00:00
|
|
|
|
|
|
|
|
describe "downloaded client" do
|
|
|
|
|
|
|
|
|
|
before(:each) do
|
|
|
|
|
FactoryGirl.create(:artifact_update, :product => 'JamClient/Win32')
|
|
|
|
|
FactoryGirl.create(:artifact_update, :product => 'JamClient/MacOSX')
|
|
|
|
|
end
|
|
|
|
|
|
2021-03-16 11:40:21 +00:00
|
|
|
shared_examples :dowload_client do
|
2013-10-19 19:46:06 +00:00
|
|
|
# there is also a generic download pages
|
|
|
|
|
before(:each) do
|
2021-03-16 11:40:21 +00:00
|
|
|
#sign_in_poltergeist user
|
|
|
|
|
visit path
|
2013-10-19 19:46:06 +00:00
|
|
|
# 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
|
|
|
|
2021-03-13 06:10:47 +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
|
2013-10-19 19:46:06 +00:00
|
|
|
|
2021-03-13 06:10:47 +00:00
|
|
|
#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
|
2013-10-19 19:46:06 +00:00
|
|
|
end
|
2021-03-16 11:40:21 +00:00
|
|
|
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
|
2013-10-19 19:46:06 +00:00
|
|
|
|
|
|
|
|
end
|
2021-03-16 11:40:21 +00:00
|
|
|
|
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 11:40:21 +00:00
|
|
|
|
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
|
2021-03-16 11:40:21 +00:00
|
|
|
|
2013-10-19 19:46:06 +00:00
|
|
|
end
|
2021-03-16 11:40:21 +00:00
|
|
|
|
2013-10-19 19:46:06 +00:00
|
|
|
end
|
|
|
|
|
end
|