From 211264c6de70e4655cae75dc4f26583a65136d19 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 15 Mar 2021 15:28:28 +0000 Subject: [PATCH] Update responsiveness.js --- src/tests/frontend/specs/responsiveness.js | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/tests/frontend/specs/responsiveness.js b/src/tests/frontend/specs/responsiveness.js index 9a517e1ab..47a3ac66f 100644 --- a/src/tests/frontend/specs/responsiveness.js +++ b/src/tests/frontend/specs/responsiveness.js @@ -8,14 +8,14 @@ describe('Responsiveness of Editor', function () { // create a new pad before each test run beforeEach(function (cb) { helper.newPad(cb, 'TEST_PAD_collab'); - this.timeout(60000000); + this.timeout(120000); }); it('Fast response to keypress in pad with large amount of contents', async function () { - this.timeout(999999999); + this.timeout(120000); if (top.window.location.search.indexOf('&collab=true') === -1) this.skip(); const numberOfEdits = 3000; // creates 700+ lines - const allowableLatency = 100; + const allowableLatency = 100; // allow 100 ms of latency to see our edit // wait a minute for everyone to connect, this is skipped if &test=true is in the url // so that it's easier to do local debug/testing without lots of users connected @@ -23,31 +23,31 @@ describe('Responsiveness of Editor', function () { await helper.waitForPromise( () => parseInt(helper.padChrome$('#online_count').text()) >= 4, 60000); } - // send random characters to last div + let i = 0; while (i < numberOfEdits) { helper.padOuter$('#outerdocbody').scrollTop(helper.padOuter$('#outerdocbody').height()); + // move the caret to increase randomness of span lengths and increase likelihood that this + // authors content is within another authors span. + helper.padInner$('div').last().sendkeys('{rightarrow}'); + helper.padInner$('div').last().sendkeys('{rightarrow}'); + helper.padInner$('div').last().sendkeys('{rightarrow}'); + helper.padInner$('div').last().sendkeys('{rightarrow}'); // Put the text contents into the pad // intentional white space at end of string - helper.padInner$('div').last().sendkeys('{rightarrow}'); - helper.padInner$('div').last().sendkeys('{rightarrow}'); - helper.padInner$('div').last().sendkeys('{rightarrow}'); - helper.padInner$('div').last().sendkeys('{rightarrow}'); helper.padInner$('div').last().sendkeys(`${i}: ${Math.random().toString(36).substring(7)} `); // 5% chance for every word we will do an enter - // This doesn't appear to be working in Chrome? if (Math.random() < 0.05) { - helper.padInner$('div').last().sendkeys('{leftarrow}'); + helper.padInner$('div').last().sendkeys('{leftarrow}'); // To force enter on Chrome? helper.padInner$('div').last().sendkeys('{enter}'); } // wait 1500 milliseconds to simulate 40wpm if you have 20 authors you would do this - // but to speed up the test and as we only have 5 authors, we can do things 4 times faster - // and a bit more to get the test done on time... + // but to speed up the test and as we only have 5 authors, we can do things ~7 times faster await wait(200); i++; } - // do an edit, ensure it's on the screen within 200 ms. + // do an edit, ensure it's on the screen within x ms. const rand = Math.random().toString(36).substring(7); helper.padInner$('div').last().sendkeys(`finaledit: ${rand}`); await helper.waitForPromise(