Merged in VRFS-5011-fix_landing_signup_error (pull request #9)

VRFS-5011 fix landing signup error

Approved-by: Seth Call
This commit is contained in:
Nuwan Chaturanga 2021-03-19 15:29:18 +00:00 committed by Seth Call
commit b1484f0a71
14 changed files with 620 additions and 247 deletions

View File

@ -1,13 +1,100 @@
//= require ./jquery-3.5.1.min
//= require bluebird
//= require babel/polyfill
//= require bugsnag
//= require bind-polyfill
//= require jquery
//= require jquery.monkeypatch
//= require jquery_ujs
//= require ./bootstrap.min
//= require ./bootstrap.bundle.min
//= require AAC_underscore
//= require utils
//= require jam_rest
//= require jquery.ui.draggable
//= require jquery.queryparams
//= require jquery.hoverIntent
//= require jquery.cookie
//= require clipboard
//= require jquery.easydropdown
//= require jquery.carousel-1.1
//= require jquery.mousewheel-3.1.9
//= require jquery.timeago
//= require jquery.dotdotdot
//= require jquery.listenbroadcast
//= require jquery.listenRecording
//= require jquery.browser
//= require jquery.custom-protocol
//= require jquery.ba-bbq
//= require jquery.icheck
//= require jquery.bt
//= require jquery.exists
//= require jquery.visible
//= require jquery.lessonSessionActions
//= require jquery.jamblasterOptions
//= require jquery.manageVsts
//= require jquery.scrollTo
//= require jquery.pulse
//= require howler.core.js
//= require jstz
//= require ResizeSensor
//= require AAA_Log
//= require AAC_underscore
//= require alert
//= require globals
//= require AAB_message_factory
//= require facebook_helper
//= require twitter_helper
//= require google_helper
//= require ../web/signup_helper
//= require ../web/signin_helper
//= require extras
//= require tickDuration
//= require feed_item_recording
//= require feed_item_session
//= require hoverMusician
//= require hoverFan
//= require hoverBand
//= require hoverSession
//= require hoverRecording
//= require layout
//= require user_dropdown
//= require jamkazam
//= require utils
//= require subscription_utils
//= require ui_helper
//= require custom_controls
//= require jam_rest
//= require ga
//= require session_utils
//= require recording_utils
//= require helpBubbleHelper
//= require facebook_rest
//= require jam_track_preview
//= require ../landing/init
//= require ../landing/signup
//= require ../recordingModel
//= require ../web/downloads2021
//= require ../web/congratulations
//= require ../web/sessions
//= require ../web/session_info
//= require ../web/recordings
//= require ../web/home
//= require ../web/tracking
//= require ../web/individual_jamtrack
//= require ../web/individual_jamtrack_v1
//= require ../web/individual_jamtrack_band_v1
//= require ../web/affiliate_program
//= require ../web/affiliate_links
//= require fakeJamClient
//= require fakeJamClientMessages
//= require fakeJamClientRecordings
//= require JamServer
//= require_directory ../dialog
//= require everywhere/everywhere
//= require classnames
//= require reflux
//= require react
//= require react_ujs
//= require react-init
//= require react-components
//= require ../landing/signup
//= require ../web/downloads

View File

@ -10,6 +10,7 @@
var rest = context.JK.Rest();
function selectPlatform(selectedPlatform) {
//console.log("selectedPlatform", selectedPlatform);
var platformName; // mac, windows, linux
var platformDisplay; // Mac, Windows, Linux
var platform = selectedPlatform; //MacOSX, Win32, Unix
@ -83,6 +84,7 @@
});
$('a', blurb).click(function() {
//console.log("download clicked");
var clicked = $(this);
var href = clicked.attr('href');
if(href != "#") {
@ -127,6 +129,7 @@
}
}
function listClients(congratulations, friend) {
isCongratulations = congratulations;
@ -143,6 +146,7 @@
rest.getClientDownloads()
.done(function(data) {
//console.log('getClientDownloads', data);
removeSpinner();
$.each(data, function(key, item) {
@ -158,6 +162,8 @@
.always(function() {
selectPlatform(currentOS == null ? 'Win32' : currentOS);
});
//console.log('downloadUris', downloadUris);
}
downloads.listClients = listClients;

View File

@ -0,0 +1,195 @@
(function(context,$) {
"use strict";
context.JK = context.JK || {};
var downloads = {};
var isCongratulations;
var downloadUris = {}; // map of platform > uri
var rest = context.JK.Rest();
function selectPlatform(selectedPlatform) {
//console.log("selectedPlatform", selectedPlatform);
var platformName; // mac, windows, linux
var platformDisplay; // Mac, Windows, Linux
var platform = selectedPlatform; //MacOSX, Win32, Unix
var platformName1, platformName2, platform1, platform2, platformDisplay1, platformDisplay2;
var uri = downloadUris[selectedPlatform];
// prepare template varaibles
if (selectedPlatform == "Unix") {
platformName = "linux";
platformDisplay = "Linux"
platformName1 = "mac";
platformDisplay1 = "Mac";
platformName2 = "windows";
platformDisplay2 = "Windows";
platform1 = "MacOSX";
platform2 = "Win32"
} else if(selectedPlatform == "Win32") {
platformName = "windows";
platformDisplay = "Windows";
platformName1 = "mac";
platformDisplay1 = "Mac";
platformName2 = "linux"
platformDisplay2 = "Linux";
platform1 = "MacOSX";
platform2 = "Unix";
} else if(selectedPlatform == "MacOSX") {
platformName = "mac";
platformDisplay = "Mac";
platformName1 = "windows";
platformDisplay1 = "Windows";
platformName2 = "linux";
platformDisplay2 = "Linux";
platform1 = "Win32";
platform2 = "Unix";
}
else {
alert("unknown platform: " + selectedPlatform);
}
var options = {
platform : platform,
platformName : platformName,
platformDisplay : platformDisplay,
platformName1 : platformName1,
platformDisplay1 : platformDisplay1,
platformName2 : platformName2,
platformDisplay2 : platformDisplay2,
platform1: platform1,
platform2: platform2,
uri : uri ? uri : '#',
isCongratulations : isCongratulations
};
var blurb = $(context._.template($('#client-download-blurb-contents').html(), options, { variable: 'data' }));
// isolate active image for blurb
$('div.hidden-images img[data-purpose=' + platformName + ']', blurb).remove().appendTo($('a.current-os-download', blurb));
var selectOthers = $(context._.template($('#client-download-select-others').html(), options, { variable: 'data' }));
// isolate active images for selectOthers
$('div.hidden-images img[data-purpose=' + platformName1 + ']', selectOthers).remove().appendTo($('a[data-order=1]', selectOthers));
$('div.hidden-images img[data-purpose=' + platformName2 + ']', selectOthers).remove().appendTo($('a[data-order=2]', selectOthers));
// install click handler for change selection
$('a', selectOthers).click(function() {
var platform = $(this).attr('data-platform');
selectPlatform(platform);
return false;
});
$('a', blurb).click(function() {
//console.log("download clicked");
var clicked = $(this);
var href = clicked.attr('href');
// if(platform == "MacOSX" || platform == "Win32"){
// openModal();
// }
if(href != "#") {
context.JK.GA.trackDownload(clicked.attr('data-platform'));
rest.userDownloadedClient().always(function() {
$('body').append('<iframe class="downloading" src="' + clicked.attr('href') + '" style="display:none"/>')
});
//open download instructions modal
if(platform == "MacOSX" || platform == "Win32"){
openModal();
}
}
else {
// if there is no download available, apologize to the user
alert("Sorry, this download is not currently available.");
return false;
}
return false;
});
// update blurb
$('body.web .downloads-blurb').empty().append(blurb);
// update the 'download other platforms' buttons
$('body.web .downloads-container').empty().append(selectOthers);
// update system requirements
if($('#client-download-system-requirements').length){
var systemRequirements = $(context._.template($('#client-download-system-requirements').html(), options, { variable: 'data' }));
$('body.web .system-requirements').empty().append(systemRequirements);
}
$('body.web .system-requirements ul').hide();
$('body.web .system-requirements ul.' + platformName + '-requirements').show();
$('body.web .system-requirements').show();
var downloadInstructions = $(context._.template($('#client-download-instructions').html(), options, { variable: 'data' }));
$('body.web .download-instructions').empty().append(downloadInstructions);
//close download instructions modal
$('.jk-modal .btn-close').on('click', closeModal);
}
function openModal() {
$('#overlay').fadeIn(300);
}
function closeModal() {
$('#overlay').fadeOut(300);
}
function removeSpinner() {
$('body.web .spinner-large').remove();
}
function flashCongratulations(friend) {
if(friend) {
context.JK.flash('Congratulations!<br>Soon you can play with ' + friend + '!', {hide:20})
}
else {
context.JK.flash('Congratulations!<br>Your account is ready.', {hide:20})
}
}
function listClients(congratulations, friend) {
isCongratulations = congratulations;
if(isCongratulations) {
flashCongratulations(friend);
}
else {
//flashCongratulations();
}
var rest = context.JK.Rest();
var currentOS = context.JK.detectOS();
var downloads = $('.downloads');
rest.getClientDownloads()
.done(function(data) {
//console.log('getClientDownloads', data);
removeSpinner();
$.each(data, function(key, item) {
var platform = key.substring('JamClient/'.length);
downloadUris[platform] = item.uri;
});
})
.fail(function(jqXHR) {
removeSpinner();
context.JK.app.notify({text: "Currently unable to list client software downloads due to error."});
})
.always(function() {
selectPlatform(currentOS == null ? 'Win32' : currentOS);
});
//console.log('downloadUris', downloadUris);
}
downloads.listClients = listClients;
context.JK.Downloads = downloads;
})(window, jQuery)

View File

@ -1,6 +1,7 @@
/**
*= require ./bootstrap.min
*= require ../client/flash
*= require ./landing
*/

View File

@ -10,6 +10,9 @@
font-family: "Zilla Slab";
font-weight: 600;
}
h3.larger {
font-size:2rem;
}
body, div, p {
font-family: "Open Sans";
font-weight: 500;
@ -18,6 +21,9 @@
.main {
background-image: linear-gradient(180deg,#007582 0%,#22a39c 100%);
}
.mt-3 {
}
.container {
padding: 40px 15px;

View File

@ -112,9 +112,8 @@ class UsersController < ApplicationController
@user.last_name = @fb_signup.last_name
@user.gender = @fb_signup.gender
end
#render :layout => 'jk2021'
_render('new')
rend = _render('new')
render rend[:template], :layout => rend[:layout]
end
def create
@ -191,7 +190,8 @@ class UsersController < ApplicationController
timezone: current_timezone,
origin: origin_cookie,
desired_plan_code: desired_plan_code )
rend = _render('new')
# check for errors
if @user.errors.any?
# render any @user.errors on error
@ -199,14 +199,15 @@ class UsersController < ApplicationController
gon.signup_errors = true
gon.musician_instruments = instruments
gon.plan_code = desired_plan_code
#render "new", :layout => 'jk2021'
_render('new')
render rend[:template], :layout => rend[:layout]
else
sign_in @user
new_user(@user, signup_hint) # sets a cookie used for GA analytics (one-time new user stuff in JavaScript)
destination = @user.musician ? :congratulations_musician : :congratulations_fan
redirect_url = handle_signup_hint(@user, signup_hint, {:action => destination, friend: @invited_user.nil? ? nil : @invited_user.sender.name})
#destination = @user.musician ? :congratulations_musician : :congratulations_fan
redirect_params = { friend: @invited_user.nil? ? nil : @invited_user.sender.name }
destination = rend[:template] == 'new2021' ? landing_client_downloads_path(redirect_params) : congratulations_musician_path(redirect_params)
redirect_url = handle_signup_hint(@user, signup_hint, destination)
redirect_to redirect_url
end
end
@ -224,8 +225,12 @@ class UsersController < ApplicationController
def downloads
@no_user_dropdown = true
@page_context = 'standalone'
#render :layout => "jk2021"
_render('downloads')
rend = _render('downloads')
render rend[:template], :layout => rend[:layout]
end
def downloads2021
render :downloads2021, layout: 'jk2021'
end
# DO NOT USE CURRENT_USER IN THIS ROUTINE UNLESS REDIRECTING. IT'S CACHED FOR THE WHOLE SITE
@ -440,13 +445,12 @@ JS
private
def _render(action)
layout_template = case action
case action
when 'new'
request.path == '/landing/general/signup' ? ['jk2021', 'new2021'] : ['web', 'new']
request.path == '/landing/general/signup' ? { layout: 'jk2021', template: 'new2021' } : { layout: 'web', template: 'new' }
when 'downloads'
request.path == '/landing/general/downloads' ? ['jk2021', 'downloads2021'] : ['web', 'downloads']
request.path == '/landing/general/downloads' ? { layout: 'jk2021', template: 'downloads2021' } : { layout: 'web', template: 'downloads' }
end
render layout_template[1], :layout => layout_template[0]
end
def is_native_client

View File

@ -32,13 +32,13 @@
<div class="container text-white">
<div class="row">
<div class="col-12">
<h3><%= yield :hero_title %> </h3>
<h3 class="<%= yield :hero_extra_class %>"><%= yield :hero_title %> </h3>
</div>
</div>
</div>
</div>
<% end %>
<div class="container">
<div class="container" style="padding-bottom:60px">
<%= yield %>
</div>
</div>
@ -55,9 +55,16 @@
</div>
</footer>
<%= javascript_include_tag "jk2021/jk2021" %>
<% if content_for?(:scripts) %>
<%= yield :scripts %>
<!--<%= render "clients/flash" %>-->
<% if content_for?(:extra_js) %>
<%= yield(:extra_js) %>
<% end %>
<%= render "shared/ga" %>
<%= render "shared/olark" %>
<!-- version: <%= version %> -->
</body>
</html>

View File

@ -23,22 +23,72 @@ script type="text/template" id="client-download-system-requirements"
| {% if(data.platform == "Win32") { %}
ul.windows-requirements
li Windows 7, 8, or 10 - 64-bit (32-bit not supported)
li Dual core processor or higher
li 75MB hard disk space for app
li External audio interface recommended (but you can start with built-in mic and & headphone jack)
li USB 2.0, USB 3.0, Thunderbolt, or Firewire (not USB 1.1) for external audio interfaces
li Ethernet port for real-time online sessions (WiFi not recommended)
li Broadband Internet service with 1Mbps uplink bandwidth for real-time online sessions
li
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122514-audio-interfaces-for-windows-computers" target="_blank"
| External audio interface&nbsp;
| recommended (or you can use a USB microphone)
li Broadband Internet service
li
| Ethernet port or&nbsp;
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123542" target="_blank" adapter
| &nbsp;and Ethernet cable to connect computer to home router (WiFi not recommended)
| {% } else if(data.platform == "MacOSX") { %}
ul.mac-requirements
li Mac OS X 10.8 or higher, 64-bit
li Dual-core processor or higher
li Mac OS X 10.8 or higher
li 75MB hard disk space for app
li External audio interface recommended (but you can start with built-in mic and & headphone jack)
li USB 2.0, USB 3.0, Thunderbolt, or Firewire (not USB 1.1) for external audio interfaces
li Ethernet port for real-time online sessions (WiFi not recommended)
li Broadband Internet service with 1Mbps uplink bandwidth for real-time online sessions
li
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122513" target="_blank"
| External audio interface&nbsp;
| recommended (or you can use a USB microphone)
li Broadband Internet service
li
| Ethernet port or&nbsp;
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000123542" target="_blank" adapter
| &nbsp;and Ethernet cable to connect computer to home router (WiFi not recommended)
| {% } else { %}
ul.linux-requirements
li Linux is not yet supported
| {% } %}
| {% } %}
script type="text/template" id="client-download-instructions"
#overlay.jk-overlay
.jk-modal
h2 The application is downloading...
p If you don't want to set up the app right now, don't worry &mdash; we're sending you an email with instructions you can follow a little later.
br/
h4 SETUP INSTRUCTIONS &mdash; PLEASE READ/FOLLOW!
p
strong 1. Install JamKazam App for {{data.platformDisplay}}
br/
| To get started, learn
| {% if(data.platform == "MacOSX") { %}
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000479050-installing-the-jamkazam-app-on-mac" target="_blank" how to install the JamKazam app for Mac.
| {% } else if(data.platform == "Win32") { %}
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000478446-installing-the-jamkazam-app-on-windows" target="_blank" how to install the JamKazam app for Windows.
| {% } %}
p
strong 2. Get Your Gear Together
br/
| Next, you need to understand
a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122533" target="_blank" what gear you need
| to use JamKazam properly. And once you have these basics in mind,
a href="https://jamkazam.freshdesk.com/support/solutions/66000073843" target="_blank" review this set of help articles
| packed with valuable information on different setups and gear recommendations.
p
strong 3. Set Up Your Audio Gear in the JamKazam App
br/
| And finally, carefully read and
| {% if(data.platform == "MacOSX") { %}
a href="https://jamkazam.freshdesk.com/support/solutions/folders/66000108387" target="_blank" follow these step-by-step instructions
| {% } else if(data.platform == "Win32") { %}
a href="https://jamkazam.freshdesk.com/support/solutions/folders/66000108430" target="_blank" follow these step-by-step instructions
| {% } %}
| that will guide you through our wizard to configure our app to work with your audio gear in online sessions.
p
| Once you&rsquo;ve completed these three steps, you&rsquo;re ready to play online! Here are some articles that cover our
a href="https://jamkazam.freshdesk.com/support/solutions/66000073845" target="_blank" core features around playing with others in online JamKazam sessions.
| Have fun playing!
p.text-center
button.btn-close CLOSE

View File

@ -1,6 +1,7 @@
// used by congrats_musician, and downloads
- provide(:page_name, "downloads #{@page_context}")
- provide(:hero_title, 'Signup successful! Now download the JamKazam application.')
- provide(:hero_extra_class, 'larger')
.row
.col-md-7.col-sm-12
@ -17,3 +18,4 @@
= render "users/download_templates2021"
.download-instructions

View File

@ -3,8 +3,12 @@
<%= render "users/downloads2021" %>
<%= content_for :scripts do %>
<%= content_for :extra_js do %>
<script type="text/javascript">
$(function() { window.JK.Downloads.listClients(false) } );
</script>
<script type="text/javascript">
$(function() { window.congratulations.initialize(true, jQuery.QueryString["friend"]) })
</script>
<% end %>

View File

@ -24,12 +24,12 @@
<div class="col-md-4 col-sm-12">
<p>Sign up for a free account now and get <a href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122535-what-are-jamkazam-s-free-vs-premium-features-">Gold premium subscription</a> features FREE for 30 days! After 30 days you can continue playing on our free plan or select a premium plan whatever is right for you. When you sign up, well send you an email with instructions on how to set up and play on the platform.</p>
<p>Sign up for a free account now and get <a target="_blank" href="https://jamkazam.freshdesk.com/support/solutions/articles/66000122535-what-are-jamkazam-s-free-vs-premium-features-">Gold premium subscription</a> features FREE for 30 days! After 30 days you can continue playing on our free plan or select a premium plan whatever is right for you. When you sign up, well send you an email with instructions on how to set up and play on the platform.</p>
<%= errors_for @user %>
<%= form_for(@user, :url => @signup_postback, :method => :post, html: { id: 'signup' }) do |f| %>
<div class="row mb-2">
<div class="row">
<div class="col-md-6 col-sm-12">
<%= f.label :first_name, "First Name:" %>
<%= f.text_field :first_name %>
@ -39,40 +39,32 @@
<%= f.text_field :last_name %>
</div>
</div>
<div class="row mb-2">
<div class="row">
<div class="col-12">
<%= f.label :email, "Email Address:" %>
<%= f.text_field :email %>
</div>
</div>
<div class="row mb-2">
<div class="row">
<div class="col-md-12">
<%= f.label :password, "Choose a Password:" %>
<%= f.password_field :password %>
</div>
</div>
<div class="row mb-2">
<div class="row d-none">
<div class="col-md-12">
<%= f.label :password_confirmation, "Verify Password:" %>
<%= f.password_field :password_confirmation %>
</div>
</div>
<div class="row mt-3">
<div class="row mt-4">
<div class="col-12">
<%= f.check_box :terms_of_service %> <label for="user_terms_of_service" style="font-size: 90%">I agree to the JamKazam <%= link_to "terms of service", corp_terms_path, :rel => "external" %></label>
</div>
</div>
<div class="row mb-2">
<div class="col-12 recaptcha">
<% if Rails.application.config.recaptcha_enable %>
<div id="recaptcha_select" name="recaptcha_response_field" class="g-recaptcha" data-sitekey="<%=Rails.application.config.recaptcha_public_key%>" data-callback="recaptcha_success" data-expired-callback="recaptcha_expired">
</div>
<% end %>
<%= f.check_box :terms_of_service %> <label for="user_terms_of_service" style="font-size: 90%">I agree to the JamKazam <%= link_to "terms of service", corp_terms_path, :rel => "external", :target => "_blank" %></label>
</div>
</div>
<div class="row mb-2">
<div class="col-12"><br />
<button id="create-account-submit" onClick="$document.forms['signup'].submit()" style="width:100%">Sign Up for JamKazam</button>
<button id="create-account-submit" style="width:100%">Sign Up for JamKazam</button>
</div>
</div>
<% end %>
@ -80,12 +72,17 @@
</div>
</div>
<%= content_for(:scripts) do %>
<%= content_for(:extra_js) do %>
<script type="text/javascript">
//window.signup.handle_location_changes()
// window.signup.handle_register_as_changes()
$('form#signup').on('submit', function(){
var password = $('form#signup input#jam_ruby_user_password').val()
$('form#signup input#jam_ruby_user_password_confirmation').val(password);
})
function recaptcha_success(response) {
//$("#create-account-submit").removeClass("disabled")
$("#create-account-submit").prop("disabled", false)

View File

@ -20,7 +20,7 @@ Rails.application.routes.draw do
# signup, and signup completed, related pages
get '/signup', to: 'users#new'
post '/signup', to: 'users#create'
get '/congratulations_musician', to: 'users#congratulations_musician'
get '/congratulations_musician', to: 'users#congratulations_musician', as: :congratulations_musician
get '/congratulations_fan', to: 'users#congratulations_fan'
get '/downloads', to: 'users#downloads'
@ -72,7 +72,7 @@ Rails.application.routes.draw do
get '/landing/general/signup', to: "users#new"
post '/landing/general/signup', to: "users#create"
get '/landing/general/downloads', to: "users#downloads"
get '/landing/general/downloads', to: "users#downloads", as: :landing_client_downloads
get '/affiliateProgram', to: 'landings#affiliate_program', as: 'affiliate_program'

View File

@ -13,7 +13,8 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
end
let(:user) { FactoryGirl.create(:user) }
let(:platforms) {[ 'Win32', 'MacOSX']}
#let(:platforms) {[ 'Win32', 'MacOSX']}
let(:platforms) {{ 'Win32' => 'Windows', 'MacOSX' => 'Mac' }}
describe "downloaded client" do
@ -22,13 +23,11 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
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
@ -36,10 +35,10 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
it "toggle active download" do
other_download = find(".download-others a")
other_download_platform = other_download['data-platform']
platforms.include?(other_download_platform).should be true
platforms.delete(other_download_platform)
platforms.keys.include?(other_download_platform).should be true
platforms.keys.delete(other_download_platform)
remaining_platform = platforms[0]
remaining_platform = platforms.keys[0]
#other_download.trigger(:click)
other_download.click
@ -49,6 +48,13 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
#find(".download-others a[data-platform='#{remaining_platform}']").trigger(:click)
find(".download-others a[data-platform='#{remaining_platform}']").click
find("a.current-os-download")['data-platform'].should == remaining_platform
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
@ -58,9 +64,6 @@ describe "Download", :js => true, :type => :feature, :capybara_feature => true
it_behaves_like :dowload_client do
let(:path){ "/downloads" }
end
it "renders web layout" do
visit "/downloads"
end
end
describe :landing_downloads_page do

View File

@ -19,29 +19,32 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
MaxMindManager.create_phony_database
end
shared_examples_for :signup_with_origin do
describe "with origin" do
before(:each) do
User.delete_all
#----------------------------------------
# shared examples
#----------------------------------------
shared_examples :default_signup_page do
it "has default signup page content" do
expect(page).to have_title "JamKazam | Register"
should have_content(/Live music platform/)
end
end
shared_examples :landing_signup_page do
it "has landing signup page content" do
expect(page).to have_title "JamKazam | Register"
should have_content(/JamKazam has spent the last 6 years/)
end
end
shared_examples :with_origin_signup_submit do
describe 'form submit' do
before do
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "withorigin1@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
end
# Successful signup with no invitation tells you to go sign up
it {
#visit "/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "withorigin1@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "CREATE ACCOUNT"
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
it{
user = User.find_by_email('withorigin1@jamkazam.com')
user.musician_instruments.length.should == 1
location = GeoIpLocations.lookup('127.0.0.1')
@ -54,45 +57,31 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
user.origin_utm_medium.should eql 'ads'
user.origin_referrer.should be_nil
}
it "redirects" do
if _page == 'default'
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
else
should have_title("JamKazam | Downloads")
should have_content("Your account is ready.")
should have_content("Signup successful!")
end
end
end
end
shared_examples :page_load_success do
it "should initialize successfully" do
expect(page).to have_title "JamKazam | Register"
end
end
shared_examples :default_signup_page do
it "has default signup page content" do
should have_content(/Live music platform/)
end
end
shared_examples :landing_signup_page do
it "has landing signup page content" do
should have_content(/JamKazam has spent the last 6 years/)
end
end
shared_examples :submit_signup_form do
before do
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser1@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
end
# Successful signup with no invitation tells you to go sign up
it {
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
shared_examples :without_origin_signup_submit do
describe 'form submit' do
before do
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "newuser1@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
end
it {
user = User.find_by_email('newuser1@jamkazam.com')
user.musician?.should == true
user.musician_instruments.length.should == 1
@ -103,56 +92,47 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
# an email is sent on no-invite signup
UserMailer.deliveries.length.should == 2
UserMailer.deliveries[0].html_part.body.include?("To confirm this email address")== 1
}
}
describe "user can confirm email and receive welcome email" do
before(:each) do
UserMailer.deliveries.clear
visit signup_confirm_path(User.find_by_email('newuser1@jamkazam.com').signup_token)
it "redirects" do
if _page == 'default'
should have_title("JamKazam | Congratulations")
should have_content("Your account is ready.")
else
should have_title("JamKazam | Downloads")
should have_content("Signup successful!")
end
end
it {
should have_title("Signup Confirmation")
should have_selector('h1', text: "Email Confirmed")
}
describe "user can confirm email and receive welcome email" do
before(:each) do
UserMailer.deliveries.clear
visit signup_confirm_path(User.find_by_email('newuser1@jamkazam.com').signup_token)
end
it {
should have_title("Signup Confirmation")
should have_selector('h1', text: "Email Confirmed")
}
end
end
end
shared_examples :submit_signup_form_with_errors do
before do
#submit without filling the form
find("#create-account-submit").click
end
# Successful signup with no invitation tells you to go sign up
it {
should_not have_title("JamKazam | Congratulations")
}
end
shared_examples :with_user_invite do
shared_examples :signup_with_invite do
let(:invited_user) { FactoryGirl.create(:invited_user, :email => "noone@jamkazam.com", :sender => FactoryGirl.create(:user)) }
before do
visit "#{path}?invitation_code=#{invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
UserMailer.deliveries.clear
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser2@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "newuser2@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
end
# Successful sign-in goes to the client
@ -161,33 +141,30 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
should have_selector('.flash-content', text: "Soon you can play with #{invited_user.sender.name}")
UserMailer.deliveries.length.should == 2
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => invited_user.sender.name)
if path =~ /landing/
"#{uri.path}?#{uri.query}".should == landing_client_downloads_path(:friend => invited_user.sender.name)
else
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => invited_user.sender.name)
end
}
end
shared_examples :with_user_invite_and_autofriend do
shared_examples :signup_with_invite_and_autofriend do
before(:each) do
User.destroy_all
InvitedUser.destroy_all
User.destroy_all
@user = FactoryGirl.create(:user)
@invited_user = FactoryGirl.create(:invited_user, :sender => @user, :autofriend => true, :email => "noone@jamkazam.com")
visit "#{path}?invitation_code=#{@invited_user.invitation_code}"
find('#jam_ruby_user_first_name')
sleep 1 # if I don't do this, first_name and/or last name intermittently fail to fill out
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser3@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "newuser3@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
end
# Successful sign-in goes to the client
@ -197,11 +174,16 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
@user.friends?(User.find_by_email("newuser3@jamkazam.com"))
User.find_by_email("newuser3@jamkazam.com").friends?(@user)
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => @invited_user.sender.name)
if path =~ /landing/
"#{uri.path}?#{uri.query}".should == landing_client_downloads_path(:friend => @invited_user.sender.name)
else
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => @invited_user.sender.name)
end
}
end
shared_examples :with_different_email do
shared_examples :signup_with_different_email do
let(:invited_user) { FactoryGirl.create(:invited_user, :email => "what@jamkazam.com", :sender => FactoryGirl.create(:user)) }
before do
@ -211,26 +193,27 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
UserMailer.deliveries.clear
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "newuser5@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "newuser5@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
end
it {
should have_title("JamKazam | Congratulations")
should have_selector('.flash-content', text: "Soon you can play with #{invited_user.sender.name}")
User.find_by_email('newuser5@jamkazam.com').musician_instruments.length.should == 1
User.find_by_email('what@jamkazam.com').should be_nil
# an email is sent when you invite but use a different email than the one used to invite
UserMailer.deliveries.length.should == 2
uri = URI.parse(current_url)
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => invited_user.sender.name)
if path =~ /landing/
should have_title("JamKazam | Downloads")
"#{uri.path}?#{uri.query}".should == landing_client_downloads_path(:friend => invited_user.sender.name)
else
should have_title("JamKazam | Congratulations")
"#{uri.path}?#{uri.query}".should == congratulations_musician_path(:friend => invited_user.sender.name)
end
sign_out
}
end
@ -249,15 +232,9 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
visit path
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "signup_hint_guy@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "signup_hint_guy@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
find('h1', text:'JamKazam Affiliate Program')
@ -280,103 +257,120 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
visit path
fill_in "jam_ruby_user[first_name]", with: "Mike"
fill_in "jam_ruby_user[last_name]", with: "Jones"
fill_in "jam_ruby_user[email]", with: "signup_hint_guy2@jamkazam.com"
fill_in "jam_ruby_user[password]", with: "jam123"
fill_in "jam_ruby_user[password_confirmation]", with: "jam123"
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
should have_title("JamKazam | Congratulations")
form_fill_and_submit({
first_name: "Mike", last_name: "Jones", email: "signup_hint_guy2@jamkazam.com", password: "jam123", password_confirmation: "jam123"
})
if path =~ /landing/
should have_title("JamKazam | Downloads")
else
should have_title("JamKazam | Congratulations")
end
user = User.find_by_email('signup_hint_guy2@jamkazam.com')
user.want_jamblaster.should be false
end
end
#----------------------------------------
# examples
#----------------------------------------
# Successful signup with no invitation tells you to go sign up
describe "with origin" do
describe :default_signup do
before do
User.destroy_all
visit "/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
end
it_behaves_like :signup_with_origin
it_behaves_like :default_signup_page
it_behaves_like :with_origin_signup_submit do
let(:_page){ 'default' }
end
end
describe :landing_signup do
before do
User.destroy_all
visit "/landing/general/signup?utm_source=abc&utm_medium=ads&utm_campaign=campaign1"
end
it_behaves_like :signup_with_origin
it_behaves_like :landing_signup_page
it_behaves_like :with_origin_signup_submit do
let(:_page){ 'landing' }
end
end
end
describe "signup form" do
before(:each) do
User.destroy_all
describe "without origin" do
describe :default_signup do
before do
User.destroy_all
visit signup_path
end
it_behaves_like :default_signup_page
it_behaves_like :without_origin_signup_submit do
let(:_page){ 'default' }
end
end
describe :landing_signup do
before do
User.destroy_all
visit "/landing/general/signup"
end
it_behaves_like :landing_signup_page
it_behaves_like :without_origin_signup_submit do
let(:_page){ 'landing' }
end
end
end
describe "submit form with errors" do
describe :default_signup do
before do
visit signup_path
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form
it_behaves_like :default_signup_page
it {
#submit without filling the form
find("#create-account-submit").click
expect(page).to have_title "JamKazam | Register"
should_not have_title("JamKazam | Congratulations")
}
end
describe :landing_signup do
before do
visit "/landing/general/signup"
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form
it_behaves_like :landing_signup_page
end
end
describe "signup form with errors" do
before(:each) do
User.destroy_all
end
describe :default_signup do
before do
visit signup_path
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form_with_errors
it_behaves_like :default_signup_page
end
describe :landing_signup do
before do
visit "/landing/general/signup"
end
it_behaves_like :page_load_success
it_behaves_like :submit_signup_form_with_errors
it_behaves_like :landing_signup_page
it {
#submit without filling the form
find("#create-account-submit").click
expect(page).to have_title "JamKazam | Register"
should_not have_title("JamKazam | Downloads")
}
end
end
describe "with user invite" do
before(:each) do
before(:each) do
InvitedUser.destroy_all
User.destroy_all
end
describe :default_signup do
it_behaves_like :with_user_invite do
it_behaves_like :signup_with_invite do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :with_user_invite do
it_behaves_like :signup_with_invite do
let(:path){ "/landing/general/signup" }
end
end
@ -385,13 +379,13 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
describe "with user invite and autofriend" do
describe :default_signup do
it_behaves_like :with_user_invite_and_autofriend do
it_behaves_like :signup_with_invite_and_autofriend do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :with_user_invite_and_autofriend do
it_behaves_like :signup_with_invite_and_autofriend do
let(:path){ "/landing/general/signup" }
end
end
@ -403,21 +397,21 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
end
describe :default_signup do
it_behaves_like :with_different_email do
it_behaves_like :signup_with_different_email do
let(:path){ "/signup" }
end
end
describe :landing_signup do
it_behaves_like :with_different_email do
it_behaves_like :signup_with_different_email do
let(:path){ "/landing/general/signup" }
end
end
end
describe "signup_hints" do
describe "signup hints" do
before(:each) do
User.destroy_all
end
@ -436,7 +430,24 @@ describe "Signup", :js => true, :type => :feature, :capybara_feature => true do
end
end
def form_fill_and_submit(vals)
fill_in "jam_ruby_user[first_name]", with: vals[:first_name]
fill_in "jam_ruby_user[last_name]", with: vals[:last_name]
fill_in "jam_ruby_user[email]", with: vals[:email]
fill_in "jam_ruby_user[password]", with: vals[:password]
password_confirmation = find('#jam_ruby_user_password_confirmation', visible: :all)
if password_confirmation.visible? #landing/general/signup form does not show password_confirmation field
fill_in "jam_ruby_user[password_confirmation]", with: vals[:password_confirmation]
end
check("jam_ruby_user[terms_of_service]")
#click_button "Sign Up for JamKazam"
find("#create-account-submit").click
end
#===
# def signup_invited_user
# visit "#{signup_path}?invitation_code=#{@invited_user.invitation_code}"
# find('#jam_ruby_user_first_name')