From 7d246ef81784869bfc56cfcce9cc2f346cce26a4 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 29 May 2014 20:58:40 -0500 Subject: [PATCH 1/3] * fix reconnect and limit bands 3 test --- .../javascripts/gear/step_network_test.js | 17 +++++++++++++++++ .../assets/javascripts/gear/step_select_gear.js | 5 +++-- web/app/assets/javascripts/textMessageDialog.js | 2 ++ web/app/views/clients/index.html.erb | 2 +- web/spec/features/bands_spec.rb | 6 +++--- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/web/app/assets/javascripts/gear/step_network_test.js b/web/app/assets/javascripts/gear/step_network_test.js index 7cbc6fea1..220ccf068 100644 --- a/web/app/assets/javascripts/gear/step_network_test.js +++ b/web/app/assets/javascripts/gear/step_network_test.js @@ -34,6 +34,7 @@ var $currentScore = null; var $scoredClients = null; var $subscore = null; + var backendGuardTimeout = null; var serverClientId = ''; var isScoring = false; @@ -113,6 +114,10 @@ context.JK.alertSupportedNeeded("JamKazam is experiencing technical difficulties."); renderStopTest('', ''); } + else if(reason == 'backend_gone') { + context.JK.alertSupportedNeeded("The JamKazam client is experiencing technical difficulties."); + renderStopTest('', ''); + } else if(reason == "invalid_response") { context.JK.alertSupportedNeeded("The JamKazam client software had an unexpected problem while scoring your Internet connection. Reason=" + attempt.backend_data.reason + '.'); renderStopTest('', ''); @@ -151,6 +156,11 @@ return testSummary.attempts[testSummary.attempts.length - 1]; } + function backendTimedOut() { + testSummary.final = {reason: 'backend_gone'} + testFinished(); + } + function attemptTestPass() { @@ -170,6 +180,8 @@ updateProgress(0, false); + backendGuardTimeout = setTimeout(function(){backendTimedOut()}, 10000); + context.jamClient.TestNetworkPktBwRate(serverClientId, TEST_SUCCESS_CALLBACK, TEST_TIMEOUT_CALLBACK, NETWORK_TEST_TYPES.PktTest400LowLatency, gon.ftue_network_test_duration, @@ -410,6 +422,10 @@ reset(); } + function afterHide() { + + } + function initialize(_$step) { $step = _$step; @@ -427,6 +443,7 @@ } this.newSession = newSession; + this.afterHide = afterHide; this.beforeShow = beforeShow; this.initialize = initialize; diff --git a/web/app/assets/javascripts/gear/step_select_gear.js b/web/app/assets/javascripts/gear/step_select_gear.js index ba8260460..9f1afd38c 100644 --- a/web/app/assets/javascripts/gear/step_select_gear.js +++ b/web/app/assets/javascripts/gear/step_select_gear.js @@ -1056,7 +1056,8 @@ clearOutputPorts(); resetFrameBuffers(); } - function beforeHide() { + function afterHide() { + logger.debug("unregistering focus watch") $(window).off('focus', onFocus); } @@ -1098,7 +1099,7 @@ this.handleNext = handleNext; this.beforeShow = beforeShow; - this.beforeHide = beforeHide; + this.afterHide = afterHide; this.initialize = initialize; self = this; diff --git a/web/app/assets/javascripts/textMessageDialog.js b/web/app/assets/javascripts/textMessageDialog.js index 8099da112..a00a65671 100644 --- a/web/app/assets/javascripts/textMessageDialog.js +++ b/web/app/assets/javascripts/textMessageDialog.js @@ -201,11 +201,13 @@ } function renderNotConnected() { + console.log("RENDER NOT CONNECTED!!!!!!!!!") $interactionBlocker.addClass('active'); $disconnectedMsg.addClass('active'); } function renderConnected() { + console.log("RENDER CONNECTED!!!!!!!!!") $interactionBlocker.removeClass('active'); $disconnectedMsg.removeClass('active'); } diff --git a/web/app/views/clients/index.html.erb b/web/app/views/clients/index.html.erb index 74ca23a43..513d49d75 100644 --- a/web/app/views/clients/index.html.erb +++ b/web/app/views/clients/index.html.erb @@ -253,7 +253,7 @@ } JK.app = JK.JamKazam(); - var jamServer = new JK.JamServer(JK.app, function(event_type) {}); + var jamServer = new JK.JamServer(JK.app, function(event_type) {JK.app.activeElementEvent(event_type)}); jamServer.initialize(); JK.initJamClient(); diff --git a/web/spec/features/bands_spec.rb b/web/spec/features/bands_spec.rb index 43183d082..e2e65b1b8 100644 --- a/web/spec/features/bands_spec.rb +++ b/web/spec/features/bands_spec.rb @@ -88,15 +88,15 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do end it "limits genres to 3" do + genres = Genre.limit(4) navigate_band_setup within('#band-setup-form') do fill_in 'band-name', with: "whatever" fill_in 'band-biography', with: "a good story" - all('#band-genres input[type="checkbox"]').each_with_index do |cb, i| - cb.trigger(:click) unless i > 3 + genres.each do |genre| + find("#band-genres input[value='#{genre.id}']").trigger(:click) end end - sleep 1 find('#btn-band-setup-next').trigger(:click) expect(page).to have_selector('#tdBandGenres .error-text li', text: "No more than 3 genres are allowed.") end From 4919b9277127b5c7477ee77a43adfcd944cb1084 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 29 May 2014 21:13:50 -0500 Subject: [PATCH 2/3] * adding backend guard to network test step --- web/app/assets/javascripts/gear/step_network_test.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/web/app/assets/javascripts/gear/step_network_test.js b/web/app/assets/javascripts/gear/step_network_test.js index 220ccf068..784d3809d 100644 --- a/web/app/assets/javascripts/gear/step_network_test.js +++ b/web/app/assets/javascripts/gear/step_network_test.js @@ -161,6 +161,12 @@ testFinished(); } + function clearBackendGuard() { + if(backendGuardTimeout) { + clearTimeout(backendGuardTimeout); + backendGuardTimeout = null; + } + } function attemptTestPass() { @@ -180,7 +186,7 @@ updateProgress(0, false); - backendGuardTimeout = setTimeout(function(){backendTimedOut()}, 10000); + backendGuardTimeout = setTimeout(function(){backendTimedOut()}, gon.ftue_network_test_duration + 1000); context.jamClient.TestNetworkPktBwRate(serverClientId, TEST_SUCCESS_CALLBACK, TEST_TIMEOUT_CALLBACK, NETWORK_TEST_TYPES.PktTest400LowLatency, @@ -269,6 +275,8 @@ } function networkTestSuccess(data) { + clearBackendGuard(); + var attempt = getCurrentAttempt(); function refineTest(up) { @@ -378,6 +386,8 @@ } function networkTestTimeout(data) { + clearBackendGuard(); + logger.warn("network timeout when testing latency test: " + data); var attempt = getCurrentAttempt(); From 5cd947729cc20e8f303f7ffbe80b104cf500fa17 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Thu, 29 May 2014 21:51:02 -0500 Subject: [PATCH 3/3] * don't track user-agent of 'monitor' --- web/app/assets/javascripts/gear/step_network_test.js | 1 - web/app/views/shared/_ga.html.erb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/web/app/assets/javascripts/gear/step_network_test.js b/web/app/assets/javascripts/gear/step_network_test.js index 784d3809d..34f6710ee 100644 --- a/web/app/assets/javascripts/gear/step_network_test.js +++ b/web/app/assets/javascripts/gear/step_network_test.js @@ -178,7 +178,6 @@ attempt.server_client_id = serverClientId; attempt.received_progress = false; testSummary.attempts.push(attempt); - console.log("pushing attempt: " + testSummary.attempts.length) //context.jamClient.StopNetworkTest(''); diff --git a/web/app/views/shared/_ga.html.erb b/web/app/views/shared/_ga.html.erb index e3957a4d5..f22ac3a63 100644 --- a/web/app/views/shared/_ga.html.erb +++ b/web/app/views/shared/_ga.html.erb @@ -1,4 +1,4 @@ -<% if current_user.nil? || !Rails.application.config.ga_suppress_admin || !current_user.admin? # remove admin users from GA %> +<% if request.user_agent != "monitor" && (current_user.nil? || !Rails.application.config.ga_suppress_admin || !current_user.admin?) # remove admin users from GA %>