develop merge

This commit is contained in:
Jonathan Kolyer 2014-04-04 10:22:48 +00:00
commit e9f99dbe08
35 changed files with 735 additions and 57 deletions

View File

@ -29,7 +29,7 @@ gem 'will_paginate'
gem 'actionmailer', '3.2.13'
gem 'sendgrid', '1.2.0'
gem 'aws-sdk', '1.29.1'
gem 'carrierwave'
gem 'carrierwave', '0.9.0'
gem 'aasm', '3.0.16'
gem 'devise', '>= 1.1.2'
gem 'postgres-copy'

View File

@ -70,7 +70,6 @@ FOO
User.email_opt_in.find_in_batches(batch_size: 1000) do |users|
self.email_batch_sets << EmailBatchSet.deliver_set(self, users.map(&:id))
# BatchMailer.send_batch_email(self.id, users.map(&:id)).deliver
end
end
def test_count

View File

@ -270,6 +270,8 @@ module JamRuby
query = query.where(
%Q{
musician_access = true
OR
music_sessions.user_id = '#{current_user.id}'
OR
invitations.id IS NOT NULL
}

View File

@ -7,7 +7,6 @@ describe BatchMailer do
batch = FactoryGirl.create(:email_batch)
batch.send_test_batch
sleep(3)
batch.email_batch_sets.count.should == 1

View File

@ -22,7 +22,7 @@ end
gem 'oj'
gem 'builder'
gem 'rails', '~>3.2.11'
gem 'jquery-rails', '2.0.2'
gem 'jquery-rails'
gem 'jquery-ui-rails'
gem 'bootstrap-sass', '2.0.4'
gem 'bcrypt-ruby', '3.0.1'
@ -50,7 +50,7 @@ gem 'recaptcha', '0.3.4'
gem 'filepicker-rails', '0.1.0'
gem 'aws-sdk', '1.29.1'
gem 'aasm', '3.0.16'
gem 'carrierwave'
gem 'carrierwave', '0.9.0'
gem 'carrierwave_direct'
gem 'fog'
gem 'haml-rails'
@ -68,6 +68,9 @@ gem 'resque-failed-job-mailer'
gem 'resque-dynamic-queues'
gem 'resque-lonely_job', '~> 1.0.0'
gem 'resque_mailer'
#gem 'typescript-src', path: '../../typescript-src-ruby'
#gem 'typescript-node', path: '../../typescript-node-ruby'
#gem 'typescript-rails', path: '../../typescript-rails'
gem 'quiet_assets', :group => :development
gem 'bugsnag'

View File

@ -41,7 +41,7 @@
$('#band-profile-social').hide();
$('.band-profile-nav a.active').removeClass('active');
$('.band-profile-nav a.#band-profile-about-link').addClass('active');
$('.band-profile-nav a#band-profile-about-link').addClass('active');
}
/****************** MAIN PORTION OF SCREEN *****************/
@ -170,7 +170,7 @@
$('#band-profile-social').hide();
$('.band-profile-nav a.active').removeClass('active');
$('.band-profile-nav a.#band-profile-about-link').addClass('active');
$('.band-profile-nav a#band-profile-about-link').addClass('active');
bindAbout();
}

View File

@ -36,13 +36,13 @@
}
function removeSpinner() {
$('<div[layout-id=findSession] .content .spinner').remove();// remove any existing spinners
$('div[layout-id=findSession] .content .spinner').remove();// remove any existing spinners
}
function addSpinner() {
removeSpinner();
$('<div[layout-id=findSession] .content').append('<div class="spinner spinner-large"></div>')
$('div[layout-id=findSession] .content').append('<div class="spinner spinner-large"></div>')
}
function loadSessionsOriginal() {

View File

@ -497,7 +497,7 @@
* Load available drivers and populate the driver select box.
*/
function loadAudioDrivers() {
var drivers = jamClient.FTUEGetDevices(false);
var drivers = context.jamClient.FTUEGetDevices(false);
var chatDrivers = jamClient.FTUEGetChatInputs();
var optionsHtml = '<option selected="selected" value="">Choose...</option>';
var chatOptionsHtml = '<option selected="selected" value="">Choose...</option>';

View File

@ -0,0 +1,82 @@
(function (context, $) {
"use strict";
context.JK = context.JK || {};
context.JK.GearWizard = function (app) {
var $dialog = null;
var $wizardSteps = null;
var $currentWizardStep = null;
var step = 0;
function moveToStep() {
var $nextWizardStep = $wizardSteps.filter($('[layout-wizard-step=' + step + ']'));
$wizardSteps.hide();
$currentWizardStep = $nextWizardStep;
$currentWizardStep.show();
}
function reset() {
$currentWizardStep = null;
}
function beforeShow(args) {
step = args.d1;
if(!step) step = 0;
moveToStep();
}
function afterShow() {
}
function afterHide() {
}
function back() {
var currentStep = parseInt($(this).closest('.wizard-step').attr('layout-wizard-step'));
step = currentStep - 1;
moveToStep();
return false;
}
function next() {
var currentStep = parseInt($(this).closest('.wizard-step').attr('layout-wizard-step'));
step = currentStep + 1;
moveToStep();
return false;
}
function events() {
$('.btn-next').on('click', next);
$('.btn-back').on('click', back);
}
function route() {
}
function initialize() {
var dialogBindings = { beforeShow: beforeShow, afterShow: afterShow, afterHide: afterHide };
app.bindDialog('gear-wizard', dialogBindings);
$dialog = $('#gear-wizard-dialog');
$wizardSteps = $dialog.find('.wizard-step');
events();
}
this.initialize = initialize;
return this;
};
})(window, jQuery);

View File

@ -52,7 +52,7 @@
else {
audioDomElement.play();
audioDomElement.pause();
//loaded.resolve();
//loaded.resolve(); // will be resolved by 'canplay' even
}
}

View File

@ -552,6 +552,19 @@
}
}
// payload is a notification event from websocket gateway
function isNoisyNotification(payload) {
var openDialog = currentDialog();
if(!openDialog) return false;
if(typeof openDialog.isNoisyNotification === 'function') {
return !openDialog.isNoisyNotification(payload);
}
else {
return true;
}
}
/**
* Responsible for keeping N dialogs in correct stacked order,
* also moves the .dialog-overlay such that it hides/obscures all dialogs except the highest one
@ -875,8 +888,12 @@
showDialog(dialog, options);
};
this.dialogObscuredNotification = function() {
return dialogObscuredNotification();
this.dialogObscuredNotification = function(payload) {
return dialogObscuredNotification(payload);
}
this.isNoisyNotification= function(payload) {
return isNoisyNotification(payload);
}
this.isDialogShowing = function() {

View File

@ -52,7 +52,7 @@
$count.addClass('highlighted');
}
function queueNotificationSeen(notificationId, notificationCreatedAt) {
function queueNotificationSeen(notificationId, notificationCreatedAt, type) {
var time = new Date(notificationCreatedAt);
@ -80,10 +80,17 @@
app.updateNotificationSeen(payload.notification_id, payload.created_at);
}
else {
queueNotificationSeen(payload.notification_id, payload.created_at);
highlightCount();
incrementNotificationCount();
missedNotificationsWhileAway = true;
if(app.layout.isNoisyNotification(payload) && !missedNotificationsWhileAway) {
// this handles a special case--if a notification is too noisy while away, then don't bother
// incrementing anything on the sidebar or otherwise distracting the user
app.updateNotificationSeen(payload.notification_id, payload.created_at);
}
else {
queueNotificationSeen(payload.notification_id, payload.created_at, payload.description);
highlightCount();
incrementNotificationCount();
missedNotificationsWhileAway = true;
}
}
}

View File

@ -67,8 +67,8 @@
function resultDivVisibility(val, isSidebar) {
if (isSidebar) {
$('div[layout=sidebar user-id=' + val.id + '].sidebar-search-connected').hide();
$('div[layout=sidebar user-id=' + val.id + '].sidebar-search-result').show();
$('div[layout="sidebar"][user-id="' + val.id + '"].sidebar-search-connected').hide();
$('div[layout="sidebar"][user-id="' + val.id + '"].sidebar-search-result').show();
}
else {
$('div[user-id=' + val.id + '].search-connected').hide();
@ -202,8 +202,8 @@
function friendRequestCallbackSidebar(userId) {
// toggle the pre-click and post-click divs
$('div[layout=sidebar] div[user-id=' + userId + '].sidebar-search-connected').show();
$('div[layout=sidebar] div[user-id=' + userId + '].sidebar-search-result').hide();
$('div[layout=sidebar] div[user-id="' + userId + '"].sidebar-search-connected').show();
$('div[layout=sidebar] div[user-id="' + userId + '"].sidebar-search-result').hide();
}
function friendRequestCallbackSearchResults(userId) {

View File

@ -190,7 +190,10 @@
openTerms(sessionId);
}
else {
if (session.musician_access) {
if(session.user_id == JK.currentUserId) {
openTerms(sessionId);
}
else if (session.musician_access) {
if (session.approval_required) {
openAlert(sessionId);
}

View File

@ -128,6 +128,10 @@
return showing && payload.description == "TEXT_MESSAGE" && payload.sender_id == otherId;
}
function isNoisyNotification(payload) {
return handledNotification(payload);
}
function afterShow(args) {
$textBox.focus();
}

View File

@ -33,6 +33,7 @@
*= require ./account
*= require ./search
*= require ./ftue
*= require ./gearWizard
*= require ./whatsNextDialog
*= require ./invitationDialog
*= require ./shareDialog

View File

@ -0,0 +1,368 @@
/* Custom Styles for the FTUE Dialogs */
@import "client/common.css.scss";
@charset "UTF-8";
.dialog.gear-wizard {
min-width: 800px;
max-width: 800px;
min-height: 400px;
max-height: 400px;
.ftue-inner {
line-height: 1.3em;
width:750px;
padding:25px;
font-size:15px;
color:#aaa;
.wizard-step {
display:none;
}
a {
text-decoration: underline;
}
p {
margin-top: 12px;
}
.device_type ul {
list-style:disc;
}
.device_type li {
margin: 15px 12px 15px 36px;
}
select {
max-width: 220px;
}
.settings-profile {
margin-top: 12px;
}
p.intro {
margin-top:0px;
}
.easydropdown-wrapper {
width:100%;
max-width:220px;
}
.ftue-new {
clear:both;
position:relative;
width:100%;
height: 54px;
margin-top: 12px;
select {
font-size: 15px;
padding: 3px;
}
.latency {
position: absolute;
top: 120px;
font-size: 12px;
.report {
color:#fff;
position: absolute;
top: 20px;
left: 0px;
width: 105px;
height: 50px;
background-color: #72a43b;
padding: 10px;
text-align: center;
.ms-label {
padding-top: 10px;
font-size: 34px;
font-family: Arial, sans-serif;
}
p {
margin-top: 4px;
}
}
.report.neutral, .report.start, .report.unknown {
background-color: #666;
}
.report.good {
background-color: #72a43b;
}
.report.acceptable {
background-color: #D6A800;
}
.report.bad {
background-color: #7B0C00;
}
.instructions {
color:#fff;
position: absolute;
top: 20px;
left: 125px;
width: 595px;
height: 50px;
padding: 10px;
background-color: #666;
}
.instructions p.start, .instructions p.neutral {
padding-top: 4px;
}
.instructions p.unknown {
margin-top:0px;
padding-top: 4px;
}
.instructions p.good {
padding-top: 4px;
}
.instructions p.acceptable {
margin-top: -6px;
}
.instructions p.bad {
margin-top: -6px;
line-height: 16px;
}
.instructions p a {
font-weight: bold;
}
}
.column {
position:absolute;
width: 220px;
height: 50px;
margin-right:8px;
}
.settings-2-device {
left:0px;
}
.settings-2-center {
left:50%;
margin-left: -110px;
.buttons {
margin-top: 14px;
a {
margin-right: 0px;
}
}
}
.settings-2-voice {
top: 0px;
right:0px;
}
.controls {
margin-top: 16px;
background-color: #222;
height: 48px;
width: 220px;
}
.ftue-vu-left {
position:relative;
top: 0px;
}
.ftue-vu-right {
position:relative;
top: 22px;
}
.ftue-fader {
position:relative;
top: 14px;
left: 8px;
}
.gain-label {
color: $ColorScreenPrimary;
position:absolute;
top: 76px;
right: 6px;
}
.subcolumn {
position:absolute;
top: 60px;
font-size: 12px !important;
width: 68px;
height: 48px;
}
.subcolumn select {
width: 68px;
}
.subcolumn.first {
left:0px;
}
.subcolumn.second {
left:50%;
margin-left:-34px;
}
.subcolumn.third {
right:0px;
}
}
.asio-settings {
clear:both;
position:relative;
width:100%;
height: 54px;
margin-top: 8px;
.column {
position:absolute;
width: 220px;
height: 50px;
margin-right:8px;
}
.settings-driver {
left:0px;
}
.settings-asio {
left:50%;
margin-left: -110px;
}
.settings-asio.mac {
left:0px;
margin-left: 0px;
}
.settings-asio-button {
right:0px;
height: 45px;
.bottom {
position:absolute;
bottom:0px;
}
}
.settings-asio-button.mac {
right:auto;
left:50%;
margin-left: -110px;
}
.subcolumn {
position:absolute;
width: 68px;
height: 48px;
}
.subcolumn select {
width: 68px;
}
.subcolumn.first {
left:0px;
}
.subcolumn.second {
left:50%;
margin-left:-34px;
}
.subcolumn.third {
right:0px;
}
}
.settings-controls {
clear:both;
position:relative;
width: 100%;
height: 100px;
div.section {
position:absolute;
width: 220px;
height: 100px;
select {
display:block;
width: 100%;
}
}
.audio-input {
left:0px;
}
.voice-chat-input {
left:50%;
margin-left: -110px;
}
.audio-output {
right:0px;
}
.ftue-controls {
margin-top: 16px;
position:relative;
height: 48px;
width: 220px;
background-color: #222;
}
.ftue-vu-left {
position:relative;
top: 0px;
}
.ftue-vu-right {
position:relative;
top: 22px;
}
.ftue-fader {
position:relative;
top: 14px;
left: 8px;
}
.gain-label {
color: $ColorScreenPrimary;
position:absolute;
top: 14px;
right: 6px;
}
}
.buttonbar {
position:absolute;
bottom: 24px;
right: 0px;
a {
color: darken(#fff, 5);
text-decoration: none;
}
.spinner-small {
display:none;
margin-top: 3px;
position: relative;
top: 12px;
}
}
input[type=text], input[type=password] {
padding:3px;
font-size:13px;
width:145px;
}
select.audiodropdown {
width:223px;
color:#666;
}
a {
color:#ccc;
}
a:hover {
color:#fff;
}
.ftue-instrumentlist {
width:340px;
height:178px;
background-color:#c5c5c5;
border:none;
-webkit-box-shadow: inset 2px 2px 3px 0px #888;
box-shadow: inset 2px 2px 3px 0px #888;
color:#666;
overflow:auto;
font-size:14px;
}
.ftue-instrumentlist select, .ftue-instrumentlist .easydropdown {
width:100%;
color:#666;
}
}
}

View File

@ -0,0 +1,8 @@
/**
*= require client/ie
*= require client/jamkazam
*= require client/screen_common
*= require client/content
*= require client/ftue
*= require minimal/minimial_main
*/

View File

@ -0,0 +1,11 @@
html {
height:100%;
}
body {
//position:absolute !important;
padding:0 !important;
overflow: visible !important;
height:100%;
margin:0 !important;
}

View File

@ -0,0 +1,8 @@
class VideosController < ApplicationController
def show_dialog
@video_id = @params[:video_id]
end
end

View File

@ -74,6 +74,7 @@
<input type="submit" style="display:none"/>
</form>
</div>
<br clear="all" />
</div>
<!-- end content wrapper -->

View File

@ -0,0 +1,16 @@
- show_back ||= local_assigns[:show_back] = local_assigns.fetch(:show_back, true)
- show_next ||= local_assigns[:show_next] = local_assigns.fetch(:show_next, true)
- total_steps = 7
.buttons
- if step > 0 && step != total_steps
%a.button-orange.btn-back{href:'#'} BACK
- if step != total_steps
%a.button-orange.btn-next{href:'#'} NEXT
- if step == total_steps
%a.button-orange.btn-close{href:'#', 'layout-action' => 'close'} CLOSE

View File

@ -0,0 +1,43 @@
.dialog.gear-wizard{ layout: 'dialog', 'layout-id' => 'gear-wizard', id: 'gear-wizard-dialog'}
.content-head
%h1 audio gear setup
.ftue-inner{ 'layout-wizard' => 'gear-wizard' }
.wizard-step{ 'layout-wizard-step' => "0", 'dialog-title' => "Understand Your Gear", 'dialog-purpose' => "Intro"}
read this
= render :partial => "clients/gear/buttons", locals: { step: 0 }
.wizard-step{ 'layout-wizard-step' => "1", 'dialog-title' => "Select & Test Audio Gear", 'dialog-purpose' => "SelectAudioGear" }
select audio gear
= render :partial => "clients/gear/buttons", locals: { step: 1 }
.wizard-step{ 'layout-wizard-step' => "2", 'dialog-title' => "Configure Tracks", 'dialog-purpose' => "ConfigureTracks" }
configure tracks
= render :partial => "clients/gear/buttons", locals: { step: 2 }
.wizard-step{ 'layout-wizard-step' => "3", 'dialog-title' => "Configure Voice Chat", 'dialog-purpose' => "ConfigureVoiceChat" }
configure voice chat
= render :partial => "clients/gear/buttons", locals: { step: 3 }
.wizard-step{ 'layout-wizard-step' => "4", 'dialog-title' => "Turn Off Direct Monitoring", 'dialog-purpose' => "DirectMonitoring" }
turn off direct monitoring
= render :partial => "clients/gear/buttons", locals: { step: 4 }
.wizard-step{ 'layout-wizard-step' => "5", 'dialog-title' => "Test Router & Network", 'dialog-purpose' => "TestRouterNetwork" }
test router network
= render :partial => "clients/gear/buttons", locals: { step: 5 }
.wizard-step{ 'layout-wizard-step' => "6", 'dialog-title' => "Success!", 'dialog-purpose' => "Success" }
success!
= render :partial => "clients/gear/buttons", locals: { step: 6 }

View File

@ -14,6 +14,7 @@
<%= render "faders" %>
<%= render "vu_meters" %>
<%= render "ftue" %>
<%= render "clients/gear/gear_wizard" %>
<%= render "terms" %>
<%= render "leaveSessionWarning" %>
<%= render "alert" %>
@ -235,6 +236,9 @@
var ftueWizard = new JK.FtueWizard(JK.app);
ftueWizard.initialize();
var gearWizard = new JK.GearWizard(JK.app);
gearWizard.initialize();
var testBridgeScreen = new JK.TestBridgeScreen(JK.app);
testBridgeScreen.initialize();
@ -263,10 +267,15 @@
interceptedJamClient[jsKey] = function() {
var original = originalJamClient[key]
var start = new Date();
var returnVal = original.apply(originalJamClient, arguments)
if(key == "FTUEGetDevices()") {
var returnVal = eval('originalJamClient.FTUEGetDevices(' + arguments[0] + ')');
}
else {
var returnVal = original.apply(originalJamClient, arguments);
}
var time = new Date().getTime() - start.getTime();
if(time > 0) { // if 0, you'll see ALL bridge calls. If you set it to a higher value, you'll only see calls that are beyond that threshold
console.error(time + "ms jamClient." + jsKey);
if(time >= 0) { // if 0, you'll see ALL bridge calls. If you set it to a higher value, you'll only see calls that are beyond that threshold
console.error(time + "ms jamClient." + jsKey + ' returns=', returnVal);
}
return returnVal;

View File

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/ie.css" media="screen, projection"/>
<![endif]-->
<script src="//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js"></script>
<script>
WebFont.load({
google: {
families: ['Raleway:100,200,300,400,500,600,700']
},
timeout :5000
});
</script>
<!--<link href='http://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700' rel='stylesheet' type='text/css'>-->
<%= stylesheet_link_tag "minimal/minimal", media: "all" %>
<% if bugsnag? %>
<!-- THIS NEEDS TO BE IN FRONT OF ANY OTHER JAVASCRIPT INCLUDES ACCORDING TO BUGSNAG -->
<script src="//d2wy8f7a9ursnm.cloudfront.net/bugsnag-1.0.9.min.js" data-apikey="<%= Rails.application.config.bugsnag_key %>"></script>
<% end %>
<%= include_gon(:init => true) %>
<%= csrf_meta_tags %>
<% if content_for?(:social_meta) %>
<%= yield(:social_meta) %>
<% else %>
<%= render "layouts/social_meta" %>
<% end %>
</head>
<body class="jam">
<div id="minimal-container">
<%= javascript_include_tag "minimal/minimal" %>
<%= yield %>
</div>
<script type="text/javascript">
$(function () {
JK = JK || {};
JK.root_url = "<%= root_url %>"
<% if current_user %>
JK.currentUserId = '<%= current_user.id %>';
JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
JK.currentUserName = '<%= current_user.name %>';
<% else %>
JK.currentUserId = null;
JK.currentUserAvatarUrl = null;
JK.currentUserName = null;
<% end %>
})
</script>
<%= render "shared/ga" %>
<!-- version info: <%= version %> -->
</body>
</html>
c

View File

@ -83,6 +83,7 @@ if defined?(Bundler)
config.assets.precompile += %w( landing/landing.js landing/landing.css )
config.assets.precompile += %w( corp/corporate.js corp/corporate.css )
config.assets.precompile += %w( web/web.js web/web.css )
config.assets.precompile += %w( minimal/minimal.js minimal/minimal.css )
# where is rabbitmq?

View File

@ -63,6 +63,8 @@ SampleApp::Application.routes.draw do
match '/events/:slug', to: 'events#show', :via => :get, :as => 'event'
match '/video/dialog/:id', to: 'videos#show', :via => :get
# temporarily allow for debugging--only allows admini n
match '/listen_in', to: 'spikes#listen_in'

View File

@ -3,12 +3,17 @@ require 'spec_helper'
describe "Feed", :js => true, :type => :feature, :capybara_feature => true do
let (:user) { FactoryGirl.create(:user) }
before(:all) do
MusicSessionHistory.delete_all
Recording.delete_all
end
describe "sessions" do
before(:each) do
create_session(user)
create_session(creator: user)
formal_leave_by(user)
end

View File

@ -114,7 +114,7 @@ describe "Home Screen", :js => true, :type => :feature, :capybara_feature => tru
describe 'Home Screen while in Native Client' do
before(:each) do
UserMailer.deliveries.clear
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
emulate_client
sign_in_poltergeist user
visit "/client"
end

View File

@ -5,8 +5,6 @@ describe "In a Session", :js => true, :type => :feature, :capybara_feature => tr
subject { page }
before(:all) do
Capybara.javascript_driver = :poltergeist
Capybara.current_driver = Capybara.javascript_driver
Capybara.default_wait_time = 15
end
@ -20,26 +18,29 @@ describe "In a Session", :js => true, :type => :feature, :capybara_feature => tr
it "can't see a private session until it is made public", :slow => true do
pending "fails on build server"
create_session(user, description = "Public or private, I cant decide!")
description = "Public or private, I cant decide!"
create_session(creator: user, description: description)
in_client(user) do
set_session_as_private
end
in_client(finder) do
emulate_client
sign_in_poltergeist finder
visit "/client#/findSession"
expect(page).to have_selector('#sessions-none-found') # verify private session is not found
sign_out_poltergeist(validate: true)
end
in_client(user) do
set_session_as_public
end
join_session(finder, description) # verify the public session is able to be joined
join_session(finder, description: description) # verify the public session is able to be joined
end
it "can open the Configure Tracks modal, and Add New Audio Gear", :slow => true do
create_session(user, description = "I'm gonna bail at some point!")
join_session(finder, description)
description = "I'm gonna bail at some point!"
create_session(creator: user, description: description)
join_session(finder, description: description)
assert_all_tracks_seen(users=[user, finder])
@ -72,7 +73,7 @@ describe "In a Session", :js => true, :type => :feature, :capybara_feature => tr
end
it "a user can change the genre and the Find Session screen will be updated" do
create_session(user)
create_session(creator: user)
in_client(finder) { sign_in_poltergeist finder }
2.times do
in_client(user) do
@ -83,4 +84,16 @@ describe "In a Session", :js => true, :type => :feature, :capybara_feature => tr
end
end
end
it "can rejoin private session as creator" do
creator, description = create_join_session(user, [finder])
in_client(user) do
set_session_as_private
formal_leave_by user
sign_out_poltergeist user
end
join_session(user, description: description)
end
end

View File

@ -25,7 +25,7 @@ describe "Welcome", :js => true, :type => :feature, :capybara_feature => true d
User.where(email: 'twitter_user1@jamkazam.com').delete_all
User.where(email: 'twitter_user2@jamkazam.com').delete_all
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
emulate_client
sign_in_poltergeist user
visit "/"
find('h1', text: 'Play music together over the Internet as if in the same room')

View File

@ -16,7 +16,7 @@ describe "Welcome", :js => true, :type => :feature, :capybara_feature => true d
MusicSessionHistory.delete_all
Recording.delete_all
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
emulate_client
visit "/"
find('h1', text: 'Play music together over the Internet as if in the same room')

View File

@ -12,7 +12,7 @@ describe "Home Screen", :js => true, :type => :feature, :capybara_feature => tru
before(:each) do
sign_in_poltergeist user
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
emulate_client
visit "/client"
end
@ -62,7 +62,7 @@ describe "Home Screen", :js => true, :type => :feature, :capybara_feature => tru
# 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
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
emulate_client
sleep 1
visit "/client"
wait_until_curtain_gone

View File

@ -187,14 +187,17 @@ end
# takes, or creates, a unique session description which is returned for subsequent calls to join_session to use
# in finding this session)
def create_session(creator = FactoryGirl.create(:user), unique_session_desc = nil, genre = nil)
unique_session_desc ||= "create_join_session #{SecureRandom.urlsafe_base64}"
genre ||= 'Rock'
def create_session(options={})
creator = options[:creator] || FactoryGirl.create(:user)
unique_session_desc = options[:description] || "create_join_session #{SecureRandom.urlsafe_base64}"
genre = options[:genre] || 'Rock'
musician_access = options[:musician_access].nil? ? true : options[:musician_access]
fan_access = options[:fan_access].nil? ? true : options[:fan_access]
# create session in one client
in_client(creator) do
page.driver.resize(1500, 800) # makes sure all the elements are visible
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
emulate_client
sign_in_poltergeist creator
wait_until_curtain_gone
visit "/client#/createSession"
@ -204,8 +207,9 @@ def create_session(creator = FactoryGirl.create(:user), unique_session_desc = ni
fill_in('description', :with => unique_session_desc)
#select(genre, :from => 'genres', :visible => false) # this works, but is 'cheating' because easydropdown hides the native select element
jk_select(genre, '#create-session-form select[name="genres"]')
jk_select('Public', '#create-session-form select#musician-access')
jk_select('Public', '#create-session-form select#fan-access')
jk_select(musician_access ? 'Public' : 'Private', '#create-session-form select#musician-access')
jk_select(fan_access ? 'Public' : 'Private', '#create-session-form select#fan-access')
find('#create-session-form div.musician-access-false.iradio_minimal').trigger(:click)
find('div.intellectual-property ins').trigger(:click)
find('#btn-create-session').trigger(:click) # fails if page width is low
@ -220,18 +224,20 @@ def create_session(creator = FactoryGirl.create(:user), unique_session_desc = ni
end
# this code assumes that there are no music sessions in the database. it should fail on the
# find('.join-link') call if > 1 session exists because capybara will complain of multiple matches
def join_session(joiner, unique_session_desc)
def join_session(joiner, options)
description = options[:description]
in_client(joiner) do
page.driver.resize(1500, 800) # makes sure all the elements are visible
emulate_client
sign_in_poltergeist joiner
wait_until_curtain_gone
visit "/client#/findSession"
# verify the session description is seen by second client
expect(page).to have_text(unique_session_desc)
expect(page).to have_text(description)
find('.join-link').trigger(:click)
find('#btn-accept-terms').trigger(:click)
expect(page).to have_selector('h2', text: 'my tracks')
@ -240,13 +246,21 @@ def join_session(joiner, unique_session_desc)
end
def create_join_session(creator, joiners=[], genre=nil)
creator, unique_session_desc = create_session(creator, nil, genre)
def emulate_client
page.driver.headers = { 'User-Agent' => ' JamKazam ' }
end
def create_join_session(creator, joiners=[], options={})
options[:creator] = creator
creator, unique_session_desc = create_session(options)
# find session in second client
joiners.each do |joiner|
join_session(joiner, unique_session_desc)
join_session(joiner, description: unique_session_desc)
end
return creator, unique_session_desc
end
def formal_leave_by user
@ -258,7 +272,7 @@ def formal_leave_by user
end
def start_recording_with(creator, joiners=[], genre=nil)
create_join_session(creator, joiners, genre)
create_join_session(creator, joiners, {genre: genre})
in_client(creator) do
find('#recording-start-stop').trigger(:click)
find('#recording-status').should have_content 'Stop Recording'
@ -299,15 +313,17 @@ end
def set_session_as_private()
find('#session-settings-button').trigger(:click)
within('#session-settings-dialog') do
select('Private', :from => 'session-settings-musician-access')
find('#session-settings-dialog-submit').trigger(:click)
jk_select("Private", '#session-settings-dialog #session-settings-musician-access')
#select('Private', :from => 'session-settings-musician-access')
find('#session-settings-dialog-submit').trigger(:click)
end
end
def set_session_as_public()
find('#session-settings-button').trigger(:click)
within('#session-settings-dialog') do
select('Public', :from => 'session-settings-musician-access')
jk_select("Public", '#session-settings-dialog #session-settings-musician-access')
# select('Public', :from => 'session-settings-musician-access')
find('#session-settings-dialog-submit').trigger(:click)
end
end