From 5acb525c43c95cdd385030f248231e11124ef1a3 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 10 Jun 2014 16:36:02 -0700 Subject: [PATCH 1/3] Wait for keyboard help fadein and fadeout. --- IPython/html/tests/notebook/dualmode.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/IPython/html/tests/notebook/dualmode.js b/IPython/html/tests/notebook/dualmode.js index cd2d30e89..9fbc4a392 100644 --- a/IPython/html/tests/notebook/dualmode.js +++ b/IPython/html/tests/notebook/dualmode.js @@ -47,14 +47,22 @@ casper.notebook_test(function () { this.evaluate(function(){ $('#keyboard_shortcuts a').click(); }, {}); + }); + // Wait for the dialog to fade in completely. + this.wait(1000); + this.then(function () { this.trigger_keydown('k'); this.validate_notebook_state('k in command mode while keyboard help is up', 'command', 3); // Close keyboard help this.evaluate(function(){ - $('div.modal button.close').click(); + $('div.modal-footer button.btn-default').click(); }, {}); + }); + // Wait for the dialog to fade out completely. + this.wait(1000); + this.then(function () { this.trigger_keydown('k'); this.validate_notebook_state('k in command mode', 'command', 2); From 22812d36b35576def96fca5c6f98cd078300dc10 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 10 Jun 2014 17:06:06 -0700 Subject: [PATCH 2/3] Use waits instead of sleeps. --- IPython/html/tests/notebook/dualmode.js | 30 +++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/IPython/html/tests/notebook/dualmode.js b/IPython/html/tests/notebook/dualmode.js index 9fbc4a392..ee577c7ce 100644 --- a/IPython/html/tests/notebook/dualmode.js +++ b/IPython/html/tests/notebook/dualmode.js @@ -48,10 +48,27 @@ casper.notebook_test(function () { $('#keyboard_shortcuts a').click(); }, {}); }); + // Wait for the dialog to fade in completely. - this.wait(1000); - this.then(function () { + this.waitForSelector('div.modal', function() { + this.evaluate(function(){ + IPython.modal_shown = false; + $('div.modal').on('shown.bs.modal', function (){ + IPython.modal_shown = true; + }); + $('div.modal').on('hidden.bs.modal', function (){ + IPython.modal_shown = false; + }); + }); + + }); + this.waitFor(function () { + return this.evaluate(function(){ + return IPython.modal_shown; + }); + }, + function() { this.trigger_keydown('k'); this.validate_notebook_state('k in command mode while keyboard help is up', 'command', 3); @@ -60,9 +77,14 @@ casper.notebook_test(function () { $('div.modal-footer button.btn-default').click(); }, {}); }); + // Wait for the dialog to fade out completely. - this.wait(1000); - this.then(function () { + this.waitFor(function () { + return this.evaluate(function(){ + return !IPython.modal_shown; + }); + }, + function() { this.trigger_keydown('k'); this.validate_notebook_state('k in command mode', 'command', 2); From 63f136af2b09c2d0f45e6fc7a23e771f66315628 Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Tue, 10 Jun 2014 17:32:17 -0700 Subject: [PATCH 3/3] Fixed test to reflect new Bootstrap3 toggle button behavior. --- IPython/html/tests/widgets/widget_selection.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IPython/html/tests/widgets/widget_selection.js b/IPython/html/tests/widgets/widget_selection.js index c4f03cc86..25d5b868f 100644 --- a/IPython/html/tests/widgets/widget_selection.js +++ b/IPython/html/tests/widgets/widget_selection.js @@ -105,6 +105,9 @@ casper.notebook_test(function () { this.test.assert(verify_selection(this, 2), 'List selection updated view states correctly.'); // Verify that selecting a multibutton option updates all of the others. + // Bootstrap3 has changed the toggle button group behavior. Two clicks + // are required to actually select an item. + this.cell_element_function(selection_index, multibtn_selector + ' .btn:nth-child(4)', 'click'); this.cell_element_function(selection_index, multibtn_selector + ' .btn:nth-child(4)', 'click'); }); this.wait_for_idle();