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