diff --git a/src/tests/frontend/specs/caret.js b/src/tests/frontend/specs/caret.js index e5ce255b8..c4db08013 100644 --- a/src/tests/frontend/specs/caret.js +++ b/src/tests/frontend/specs/caret.js @@ -297,7 +297,7 @@ console.log(inner$); }); */ }); - +/* // generates a random document with random content on n lines const prepareDocument = (n, target) => { let i = 0; @@ -350,3 +350,4 @@ const caretPosition = ($) => { pos.x = pos.anchorNode.parentElement.offsetLeft; return pos; }; +*/ diff --git a/src/tests/frontend/specs/drag_and_drop.js b/src/tests/frontend/specs/drag_and_drop.js index 2d1339beb..1b08facd2 100644 --- a/src/tests/frontend/specs/drag_and_drop.js +++ b/src/tests/frontend/specs/drag_and_drop.js @@ -23,9 +23,13 @@ describe('drag and drop', function () { }); context('and user triggers UNDO', function () { - before(function () { + before(async function () { + const originalHTML = helper.padInner$('body').html(); const $undoButton = helper.padChrome$('.buttonicon-undo'); $undoButton.click(); + await helper.waitForPromise( + () => originalHTML !== helper.padInner$('body').html() + ); }); it('moves text back to its original place', function (done) { @@ -58,9 +62,13 @@ describe('drag and drop', function () { }); context('and user triggers UNDO', function () { - before(function () { + before(async function () { + const originalHTML = helper.padInner$('body').html(); const $undoButton = helper.padChrome$('.buttonicon-undo'); $undoButton.click(); + await helper.waitForPromise( + () => originalHTML !== helper.padInner$('body').html() + ); }); it('moves text back to its original place', function (done) { diff --git a/src/tests/frontend/specs/ordered_list.js b/src/tests/frontend/specs/ordered_list.js index d069a6487..3ad6f4ab1 100644 --- a/src/tests/frontend/specs/ordered_list.js +++ b/src/tests/frontend/specs/ordered_list.js @@ -19,9 +19,12 @@ describe('assign ordered list', function () { context('when user presses Ctrl+Shift+N', function () { context('and pad shortcut is enabled', function () { - beforeEach(function () { + beforeEach(async function () { + const originalHTML = helper.padInner$('body').html(); makeSureShortcutIsEnabled('cmdShiftN'); triggerCtrlShiftShortcut('N'); + await helper.waitForPromise( + () => helper.padInner$('body').html !== originalHTML); }); it('inserts unordered list', function (done) { @@ -30,9 +33,12 @@ describe('assign ordered list', function () { }); context('and pad shortcut is disabled', function () { - beforeEach(function () { + beforeEach(async function () { + const originalHTML = helper.padInner$('body').html(); makeSureShortcutIsDisabled('cmdShiftN'); triggerCtrlShiftShortcut('N'); + await helper.waitForPromise( + () => helper.padInner$('body').html !== originalHTML); }); it('does not insert unordered list', function (done) { @@ -48,9 +54,12 @@ describe('assign ordered list', function () { context('when user presses Ctrl+Shift+1', function () { context('and pad shortcut is enabled', function () { - beforeEach(function () { + beforeEach(async function () { + const originalHTML = helper.padInner$('body').html(); makeSureShortcutIsEnabled('cmdShift1'); triggerCtrlShiftShortcut('1'); + await helper.waitForPromise( + () => helper.padInner$('body').html !== originalHTML); }); it('inserts unordered list', function (done) { @@ -59,9 +68,12 @@ describe('assign ordered list', function () { }); context('and pad shortcut is disabled', function () { - beforeEach(function () { + beforeEach(async function () { + const originalHTML = helper.padInner$('body').html(); makeSureShortcutIsDisabled('cmdShift1'); triggerCtrlShiftShortcut('1'); + await helper.waitForPromise( + () => helper.padInner$('body').html !== originalHTML); }); it('does not insert unordered list', function (done) { @@ -117,71 +129,71 @@ describe('assign ordered list', function () { const makeSureShortcutIsEnabled = (shortcut) => { helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = true; }; -}); -describe('Pressing Tab in an OL increases and decreases indentation', function () { - // create a new pad before each test run - beforeEach(function (cb) { - helper.newPad(cb); - this.timeout(60000); + describe('Pressing Tab in an OL increases and decreases indentation', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); + + it('indent and de-indent list item with keypress', function (done) { + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; + + // get the first text element out of the inner iframe + const $firstTextElement = inner$('div').first(); + + // select this text element + $firstTextElement.sendkeys('{selectall}'); + + const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); + $insertorderedlistButton.click(); + + const e = new inner$.Event(helper.evtType); + e.keyCode = 9; // tab + inner$('#innerdocbody').trigger(e); + + expect(inner$('div').first().find('.list-number2').length === 1).to.be(true); + e.shiftKey = true; // shift + e.keyCode = 9; // tab + inner$('#innerdocbody').trigger(e); + + helper.waitFor(() => inner$('div').first().find('.list-number1').length === 1).done(done); + }); }); - it('indent and de-indent list item with keypress', function (done) { - const inner$ = helper.padInner$; - const chrome$ = helper.padChrome$; - // get the first text element out of the inner iframe - const $firstTextElement = inner$('div').first(); + describe('Pressing indent/outdent button in an OL increases and ' + + 'decreases indentation and bullet / ol formatting', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); - // select this text element - $firstTextElement.sendkeys('{selectall}'); + it('indent and de-indent list item with indent button', function (done) { + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; - const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); - $insertorderedlistButton.click(); + // get the first text element out of the inner iframe + const $firstTextElement = inner$('div').first(); - const e = new inner$.Event(helper.evtType); - e.keyCode = 9; // tab - inner$('#innerdocbody').trigger(e); + // select this text element + $firstTextElement.sendkeys('{selectall}'); - expect(inner$('div').first().find('.list-number2').length === 1).to.be(true); - e.shiftKey = true; // shift - e.keyCode = 9; // tab - inner$('#innerdocbody').trigger(e); + const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); + $insertorderedlistButton.click(); - helper.waitFor(() => inner$('div').first().find('.list-number1').length === 1).done(done); - }); -}); - - -describe('Pressing indent/outdent button in an OL increases and ' + - 'decreases indentation and bullet / ol formatting', function () { - // create a new pad before each test run - beforeEach(function (cb) { - helper.newPad(cb); - this.timeout(60000); - }); - - it('indent and de-indent list item with indent button', function (done) { - const inner$ = helper.padInner$; - const chrome$ = helper.padChrome$; - - // get the first text element out of the inner iframe - const $firstTextElement = inner$('div').first(); - - // select this text element - $firstTextElement.sendkeys('{selectall}'); - - const $insertorderedlistButton = chrome$('.buttonicon-insertorderedlist'); - $insertorderedlistButton.click(); - - const $indentButton = chrome$('.buttonicon-indent'); - $indentButton.click(); // make it indented twice - - expect(inner$('div').first().find('.list-number2').length === 1).to.be(true); - - const $outdentButton = chrome$('.buttonicon-outdent'); - $outdentButton.click(); // make it deindented to 1 - - helper.waitFor(() => inner$('div').first().find('.list-number1').length === 1).done(done); + const $indentButton = chrome$('.buttonicon-indent'); + $indentButton.click(); // make it indented twice + + expect(inner$('div').first().find('.list-number2').length === 1).to.be(true); + + const $outdentButton = chrome$('.buttonicon-outdent'); + $outdentButton.click(); // make it deindented to 1 + + helper.waitFor(() => inner$('div').first().find('.list-number1').length === 1).done(done); + }); }); }); diff --git a/src/tests/frontend/specs/pad_modal.js b/src/tests/frontend/specs/pad_modal.js index 30277d5de..fe665df54 100644 --- a/src/tests/frontend/specs/pad_modal.js +++ b/src/tests/frontend/specs/pad_modal.js @@ -24,14 +24,11 @@ describe('Pad modal', function () { }); context('and user clicks on editor', function () { - beforeEach(function () { - clickOnPadInner(); - }); - it('does not close the modal', function (done) { + clickOnPadInner(); const $modal = helper.padChrome$(MODAL_SELECTOR); const modalIsVisible = $modal.hasClass('popup-show'); - + helper.waitForPromise(() => $modal.hasClass('popup-show') === true); expect(modalIsVisible).to.be(true); done(); @@ -39,14 +36,13 @@ describe('Pad modal', function () { }); context('and user clicks on pad outer', function () { - beforeEach(function () { - clickOnPadOuter(); - }); - it('does not close the modal', function (done) { const $modal = helper.padChrome$(MODAL_SELECTOR); const modalIsVisible = $modal.hasClass('popup-show'); + clickOnPadOuter(); + + helper.waitForPromise(() => $modal.hasClass('popup-show') === true); expect(modalIsVisible).to.be(true); done(); @@ -73,22 +69,18 @@ describe('Pad modal', function () { }); */ context('and user clicks on editor', function () { - beforeEach(function () { - clickOnPadInner(); - }); - it('closes the modal', function (done) { + clickOnPadInner(); + helper.waitForPromise(() => isModalOpened(MODAL_SELECTOR) === false); expect(isModalOpened(MODAL_SELECTOR)).to.be(false); done(); }); }); context('and user clicks on pad outer', function () { - beforeEach(function () { - clickOnPadOuter(); - }); - it('closes the modal', function (done) { + clickOnPadOuter(); + helper.waitForPromise(() => isModalOpened(MODAL_SELECTOR) === false); expect(isModalOpened(MODAL_SELECTOR)).to.be(false); done(); }); diff --git a/src/tests/frontend/specs/redo.js b/src/tests/frontend/specs/redo.js index 3e8d3a168..b0334ba82 100644 --- a/src/tests/frontend/specs/redo.js +++ b/src/tests/frontend/specs/redo.js @@ -45,12 +45,12 @@ describe('undo button then redo button', function () { const modifiedValue = $firstTextElement.text(); // get the modified value expect(modifiedValue).not.to.be(originalValue); // expect the value to change - let e = inner$.Event(helper.evtType); + let e = new inner$.Event(helper.evtType); e.ctrlKey = true; // Control key e.which = 90; // z inner$('#innerdocbody').trigger(e); - e = inner$.Event(helper.evtType); + e = new inner$.Event(helper.evtType); e.ctrlKey = true; // Control key e.which = 121; // y inner$('#innerdocbody').trigger(e); diff --git a/src/tests/frontend/specs/scrollTo.js b/src/tests/frontend/specs/scrollTo.js index 47fe1ca7e..ba96f8164 100755 --- a/src/tests/frontend/specs/scrollTo.js +++ b/src/tests/frontend/specs/scrollTo.js @@ -2,12 +2,15 @@ describe('scrolls to line', function () { // create a new pad with URL hash set before each test run - beforeEach(function (cb) { - helper.newPad({ + before(async function () { + this.timeout(60000); + await new Promise((resolve, reject) => helper.newPad({ + cb: (err) => { + if (err != null) return reject(err); + resolve(); + }, hash: 'L4', - cb, - }); - this.timeout(10000); + })); }); it('Scrolls down to Line 4', async function () { @@ -19,25 +22,28 @@ describe('scrolls to line', function () { return (topOffset >= 100); }); }); -}); -describe('doesnt break on weird hash input', function () { - // create a new pad with URL hash set before each test run - beforeEach(function (cb) { - helper.newPad({ - hash: '#DEEZ123123NUTS', - cb, + describe('doesnt break on weird hash input', function () { + // create a new pad with URL hash set before each test run + before(async function () { + this.timeout(60000); + await new Promise((resolve, reject) => helper.newPad({ + cb: (err) => { + if (err != null) return reject(err); + resolve(); + }, + hash: '#DEEZ123123NUTS', + })); }); - this.timeout(10000); - }); - it('Does NOT change scroll', async function () { - this.timeout(10000); - const chrome$ = helper.padChrome$; - await helper.waitForPromise(() => { - const topOffset = parseInt(chrome$('iframe').first('iframe') - .contents().find('#outerdocbody').css('top')); - return (!topOffset); // no css top should be set. + it('Does NOT change scroll', async function () { + this.timeout(10000); + const chrome$ = helper.padChrome$; + await helper.waitForPromise(() => { + const topOffset = parseInt(chrome$('iframe').first('iframe') + .contents().find('#outerdocbody').css('top')); + return (!topOffset); // no css top should be set. + }); }); }); }); diff --git a/src/tests/frontend/specs/select_formatting_buttons.js b/src/tests/frontend/specs/select_formatting_buttons.js index 358d9e5b7..67b78ed0a 100644 --- a/src/tests/frontend/specs/select_formatting_buttons.js +++ b/src/tests/frontend/specs/select_formatting_buttons.js @@ -35,9 +35,11 @@ describe('select formatting buttons when selection has style applied', function $line.sendkeys('{leftarrow}'); }; - const undo = function () { + const undo = async function () { + const originalHTML = helper.padInner$('body').html(); const $undoButton = helper.padChrome$('.buttonicon-undo'); $undoButton.click(); + await helper.waitFor(() => originalHTML !== helper.padInner$('body').html()); }; const testIfFormattingButtonIsDeselected = function (style) { @@ -80,9 +82,11 @@ describe('select formatting buttons when selection has style applied', function // }, 1000); }; - const pressFormattingShortcutOnSelection = function (key) { + const pressFormattingShortcutOnSelection = async function (key) { const inner$ = helper.padInner$; + const originalHTML = helper.padInner$('body').html(); + helper.waitFor(() => originalHTML !== helper.padInner$('body').html()); // get the first text element out of the inner iframe const $firstTextElement = inner$('div').first(); @@ -93,6 +97,8 @@ describe('select formatting buttons when selection has style applied', function e.ctrlKey = true; // Control key e.which = key.charCodeAt(0); // I, U, B, 5 inner$('#innerdocbody').trigger(e); + await helper.waitForPromise( + () => originalHTML !== helper.padInner$('body').html()); }; STYLES.forEach((style) => { @@ -102,8 +108,8 @@ describe('select formatting buttons when selection has style applied', function applyStyleOnLineAndSelectIt(FIRST_LINE, style, done); }); - after(function () { - undo(); + after(async function () { + await undo(); }); testIfFormattingButtonIsSelected(style); @@ -115,8 +121,8 @@ describe('select formatting buttons when selection has style applied', function applyStyleOnLineAndPlaceCaretOnit(FIRST_LINE, style, done); }); - after(function () { - undo(); + after(async function () { + await undo(); }); testIfFormattingButtonIsSelected(style); @@ -125,33 +131,27 @@ describe('select formatting buttons when selection has style applied', function context('when user applies a style and the selection does not change', function () { const style = STYLES[0]; // italic - before(function () { - applyStyleOnLine(style, FIRST_LINE); - }); - // clean the style applied - after(function () { + it('selects the style button', async function () { applyStyleOnLine(style, FIRST_LINE); - }); - - it('selects the style button', function (done) { + await helper.waitForPromise(() => isButtonSelected(style) === true); expect(isButtonSelected(style)).to.be(true); - done(); + applyStyleOnLine(style, FIRST_LINE); }); }); SHORTCUT_KEYS.forEach((key, index) => { const styleOfTheShortcut = STYLES[index]; // italic, bold, ... context(`when user presses CMD + ${key}`, function () { - before(function () { - pressFormattingShortcutOnSelection(key); + before(async function () { + await pressFormattingShortcutOnSelection(key); }); testIfFormattingButtonIsSelected(styleOfTheShortcut); context(`and user presses CMD + ${key} again`, function () { - before(function () { - pressFormattingShortcutOnSelection(key); + before(async function () { + await pressFormattingShortcutOnSelection(key); }); testIfFormattingButtonIsDeselected(styleOfTheShortcut); diff --git a/src/tests/frontend/specs/unordered_list.js b/src/tests/frontend/specs/unordered_list.js index 22d1a6fe2..cd3bebc76 100644 --- a/src/tests/frontend/specs/unordered_list.js +++ b/src/tests/frontend/specs/unordered_list.js @@ -31,135 +31,135 @@ describe('assign unordered list', function () { }); }); }); -}); -describe('unassign unordered list', function () { - // create a new pad before each test run - beforeEach(function (cb) { - helper.newPad(cb); - this.timeout(60000); + describe('unassign unordered list', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); + + it('insert unordered list text then remove by clicking list again', function (done) { + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; + const originalText = inner$('div').first().text(); + + const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); + $insertunorderedlistButton.click(); + + helper.waitFor(() => { + const newText = inner$('div').first().text(); + if (newText === originalText) { + return inner$('div').first().find('ul li').length === 1; + } + }).done(() => { + // remove indentation by bullet and ensure text string remains the same + $insertunorderedlistButton.click(); + helper.waitFor(() => { + const isList = inner$('div').find('ul').length === 1; + // sohuldn't be list + return (isList === false); + }).done(() => { + done(); + }); + }); + }); }); - it('insert unordered list text then remove by clicking list again', function (done) { - const inner$ = helper.padInner$; - const chrome$ = helper.padChrome$; - const originalText = inner$('div').first().text(); - const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); - $insertunorderedlistButton.click(); + describe('keep unordered list on enter key', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); - helper.waitFor(() => { - const newText = inner$('div').first().text(); - if (newText === originalText) { - return inner$('div').first().find('ul li').length === 1; - } - }).done(() => { - // remove indentation by bullet and ensure text string remains the same - $insertunorderedlistButton.click(); - helper.waitFor(() => { - const isList = inner$('div').find('ul').length === 1; - // sohuldn't be list - return (isList === false); - }).done(() => { + it('Keeps the unordered list on enter for the new line', function (done) { + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; + + const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); + $insertorderedlistButton.click(); + + // type a bit, make a line break and type again + const $firstTextElement = inner$('div span').first(); + $firstTextElement.sendkeys('line 1'); + $firstTextElement.sendkeys('{enter}'); + $firstTextElement.sendkeys('line 2'); + $firstTextElement.sendkeys('{enter}'); + + helper.waitFor(() => inner$('div span').first().text().indexOf('line 2') === -1).done(() => { + const $newSecondLine = inner$('div').first().next(); + const hasULElement = $newSecondLine.find('ul li').length === 1; + expect(hasULElement).to.be(true); + expect($newSecondLine.text()).to.be('line 2'); done(); }); }); }); -}); + describe('Pressing Tab in an UL increases and decreases indentation', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); -describe('keep unordered list on enter key', function () { - // create a new pad before each test run - beforeEach(function (cb) { - helper.newPad(cb); - this.timeout(60000); + it('indent and de-indent list item with keypress', function (done) { + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; + + // get the first text element out of the inner iframe + const $firstTextElement = inner$('div').first(); + + // select this text element + $firstTextElement.sendkeys('{selectall}'); + + const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); + $insertorderedlistButton.click(); + + const e = new inner$.Event(helper.evtType); + e.keyCode = 9; // tab + inner$('#innerdocbody').trigger(e); + + expect(inner$('div').first().find('.list-bullet2').length === 1).to.be(true); + e.shiftKey = true; // shift + e.keyCode = 9; // tab + inner$('#innerdocbody').trigger(e); + + helper.waitFor(() => inner$('div').first().find('.list-bullet1').length === 1).done(done); + }); }); - it('Keeps the unordered list on enter for the new line', function (done) { - const inner$ = helper.padInner$; - const chrome$ = helper.padChrome$; + describe('Pressing indent/outdent button in an UL increases and decreases indentation ' + + 'and bullet / ol formatting', function () { + // create a new pad before each test run + beforeEach(function (cb) { + helper.newPad(cb); + this.timeout(60000); + }); - const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); - $insertorderedlistButton.click(); + it('indent and de-indent list item with indent button', function (done) { + const inner$ = helper.padInner$; + const chrome$ = helper.padChrome$; - // type a bit, make a line break and type again - const $firstTextElement = inner$('div span').first(); - $firstTextElement.sendkeys('line 1'); - $firstTextElement.sendkeys('{enter}'); - $firstTextElement.sendkeys('line 2'); - $firstTextElement.sendkeys('{enter}'); + // get the first text element out of the inner iframe + const $firstTextElement = inner$('div').first(); - helper.waitFor(() => inner$('div span').first().text().indexOf('line 2') === -1).done(() => { - const $newSecondLine = inner$('div').first().next(); - const hasULElement = $newSecondLine.find('ul li').length === 1; - expect(hasULElement).to.be(true); - expect($newSecondLine.text()).to.be('line 2'); - done(); + // select this text element + $firstTextElement.sendkeys('{selectall}'); + + const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); + $insertunorderedlistButton.click(); + + const $indentButton = chrome$('.buttonicon-indent'); + $indentButton.click(); // make it indented twice + + expect(inner$('div').first().find('.list-bullet2').length === 1).to.be(true); + const $outdentButton = chrome$('.buttonicon-outdent'); + $outdentButton.click(); // make it deindented to 1 + + helper.waitFor(() => inner$('div').first().find('.list-bullet1').length === 1).done(done); }); }); }); - -describe('Pressing Tab in an UL increases and decreases indentation', function () { - // create a new pad before each test run - beforeEach(function (cb) { - helper.newPad(cb); - this.timeout(60000); - }); - - it('indent and de-indent list item with keypress', function (done) { - const inner$ = helper.padInner$; - const chrome$ = helper.padChrome$; - - // get the first text element out of the inner iframe - const $firstTextElement = inner$('div').first(); - - // select this text element - $firstTextElement.sendkeys('{selectall}'); - - const $insertorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); - $insertorderedlistButton.click(); - - const e = inner$.Event(helper.evtType); - e.keyCode = 9; // tab - inner$('#innerdocbody').trigger(e); - - expect(inner$('div').first().find('.list-bullet2').length === 1).to.be(true); - e.shiftKey = true; // shift - e.keyCode = 9; // tab - inner$('#innerdocbody').trigger(e); - - helper.waitFor(() => inner$('div').first().find('.list-bullet1').length === 1).done(done); - }); -}); - -describe('Pressing indent/outdent button in an UL increases and decreases indentation ' + - 'and bullet / ol formatting', function () { - // create a new pad before each test run - beforeEach(function (cb) { - helper.newPad(cb); - this.timeout(60000); - }); - - it('indent and de-indent list item with indent button', function (done) { - const inner$ = helper.padInner$; - const chrome$ = helper.padChrome$; - - // get the first text element out of the inner iframe - const $firstTextElement = inner$('div').first(); - - // select this text element - $firstTextElement.sendkeys('{selectall}'); - - const $insertunorderedlistButton = chrome$('.buttonicon-insertunorderedlist'); - $insertunorderedlistButton.click(); - - const $indentButton = chrome$('.buttonicon-indent'); - $indentButton.click(); // make it indented twice - - expect(inner$('div').first().find('.list-bullet2').length === 1).to.be(true); - const $outdentButton = chrome$('.buttonicon-outdent'); - $outdentButton.click(); // make it deindented to 1 - - helper.waitFor(() => inner$('div').first().find('.list-bullet1').length === 1).done(done); - }); -}); diff --git a/src/tests/frontend/specs/xxauto_reconnect.js b/src/tests/frontend/specs/xxauto_reconnect.js index d92936563..af35e528e 100644 --- a/src/tests/frontend/specs/xxauto_reconnect.js +++ b/src/tests/frontend/specs/xxauto_reconnect.js @@ -34,9 +34,11 @@ describe('Automatic pad reload on Force Reconnect message', function () { }); context('and user clicks on Cancel', function () { - beforeEach(function () { + beforeEach(async function () { const $errorMessageModal = helper.padChrome$('#connectivity .userdup'); $errorMessageModal.find('#cancelreconnect').click(); + await helper.waitForPromise( + () => helper.padChrome$('#connectivity .userdup').is(':visible') === true); }); it('does not show Cancel button nor timer anymore', function (done) { @@ -54,16 +56,16 @@ describe('Automatic pad reload on Force Reconnect message', function () { context('and user does not click on Cancel until timer expires', function () { let padWasReloaded = false; - beforeEach(function () { + beforeEach(async function () { $originalPadFrame.one('load', () => { padWasReloaded = true; }); }); it('reloads the pad', function (done) { - helper.waitFor(() => padWasReloaded, 5000).done(done); + helper.waitFor(() => padWasReloaded, 10000).done(done); - this.timeout(5000); + this.timeout(10000); }); }); });