mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-06-15 10:44:41 -04:00
Update responsiveness.js
This commit is contained in:
parent
05d8ba2f5a
commit
211264c6de
1 changed files with 13 additions and 13 deletions
|
@ -8,14 +8,14 @@ describe('Responsiveness of Editor', function () {
|
||||||
// create a new pad before each test run
|
// create a new pad before each test run
|
||||||
beforeEach(function (cb) {
|
beforeEach(function (cb) {
|
||||||
helper.newPad(cb, 'TEST_PAD_collab');
|
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 () {
|
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();
|
if (top.window.location.search.indexOf('&collab=true') === -1) this.skip();
|
||||||
const numberOfEdits = 3000; // creates 700+ lines
|
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
|
// 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
|
// 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(
|
await helper.waitForPromise(
|
||||||
() => parseInt(helper.padChrome$('#online_count').text()) >= 4, 60000);
|
() => parseInt(helper.padChrome$('#online_count').text()) >= 4, 60000);
|
||||||
}
|
}
|
||||||
// send random characters to last div
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
while (i < numberOfEdits) {
|
while (i < numberOfEdits) {
|
||||||
helper.padOuter$('#outerdocbody').scrollTop(helper.padOuter$('#outerdocbody').height());
|
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
|
// Put the text contents into the pad
|
||||||
// intentional white space at end of string
|
// 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)} `);
|
helper.padInner$('div').last().sendkeys(`${i}: ${Math.random().toString(36).substring(7)} `);
|
||||||
// 5% chance for every word we will do an enter
|
// 5% chance for every word we will do an enter
|
||||||
// This doesn't appear to be working in Chrome?
|
|
||||||
if (Math.random() < 0.05) {
|
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}');
|
helper.padInner$('div').last().sendkeys('{enter}');
|
||||||
}
|
}
|
||||||
// wait 1500 milliseconds to simulate 40wpm if you have 20 authors you would do this
|
// 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
|
// but to speed up the test and as we only have 5 authors, we can do things ~7 times faster
|
||||||
// and a bit more to get the test done on time...
|
|
||||||
await wait(200);
|
await wait(200);
|
||||||
i++;
|
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);
|
const rand = Math.random().toString(36).substring(7);
|
||||||
helper.padInner$('div').last().sendkeys(`finaledit: ${rand}`);
|
helper.padInner$('div').last().sendkeys(`finaledit: ${rand}`);
|
||||||
await helper.waitForPromise(
|
await helper.waitForPromise(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue