diff --git a/tests/frontend/specs/responsiveness.js b/tests/frontend/specs/responsiveness.js index 121851c25..b34e7cae1 100644 --- a/tests/frontend/specs/responsiveness.js +++ b/tests/frontend/specs/responsiveness.js @@ -57,7 +57,8 @@ describe('Responsiveness of Editor', function() { return inner$('div').text().length > length; }).done(function(){ - expect( inner$('div').text().length ).to.be.greaterThan( length ); // has the text changed? + var oldLength = inner$('body')[0].textContent.length; + console.log(oldLength) var start = Date.now(); // get the start time // send some new text to the screen (ensure all 3 key events are sent) @@ -72,17 +73,18 @@ describe('Responsiveness of Editor', function() { } helper.waitFor(function(){ // Wait for the ability to process + console.log(inner$('body')[0].textContent.length) var el = inner$('body'); - if(el[0].textContent.length > amount) return true; - }).done(function(){ + if(el[0].textContent.length > oldLength) return true; + }, 5000).done(function(){ var end = Date.now(); // get the current time var delay = end - start; // get the delay as the current time minus the start time expect(delay).to.be.below(600); done(); - }, 5000); + }); - }, 10000); + }); }); }); diff --git a/tests/frontend/specs/select_formatting_buttons.js b/tests/frontend/specs/select_formatting_buttons.js index 9bc6f1017..75c7e2401 100644 --- a/tests/frontend/specs/select_formatting_buttons.js +++ b/tests/frontend/specs/select_formatting_buttons.js @@ -105,8 +105,9 @@ describe("select formatting buttons when selection has style applied", function( applyStyleOnLineAndSelectIt(FIRST_LINE, style, done); }); - after(function () { + after(function (done) { undo(); + done(); }); testIfFormattingButtonIsSelected(style); @@ -118,8 +119,9 @@ describe("select formatting buttons when selection has style applied", function( applyStyleOnLineAndPlaceCaretOnit(FIRST_LINE, style, done); }); - after(function () { + after(function (done) { undo(); + done(); }); testIfFormattingButtonIsSelected(style) @@ -128,13 +130,15 @@ describe("select formatting buttons when selection has style applied", function( context('when user applies a style and the selection does not change', function() { var style = STYLES[0]; // italic - before(function () { + before(function (done) { applyStyleOnLine(style, FIRST_LINE); + done(); }); // clean the style applied - after(function () { + after(function (done) { applyStyleOnLine(style, FIRST_LINE); + done(); }); it('selects the style button', function (done) { @@ -146,15 +150,17 @@ describe("select formatting buttons when selection has style applied", function( SHORTCUT_KEYS.forEach(function(key, index){ var styleOfTheShortcut = STYLES[index]; // italic, bold, ... context('when user presses CMD + ' + key, function() { - before(function () { + before(function (done) { pressFormattingShortcutOnSelection(key); + done(); }); testIfFormattingButtonIsSelected(styleOfTheShortcut); context('and user presses CMD + ' + key + ' again', function() { - before(function () { + before(function (done) { pressFormattingShortcutOnSelection(key); + done(); }); testIfFormattingButtonIsDeselected(styleOfTheShortcut);