mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 00:46:16 -04:00
Low hanging lint frontend tests (#4695)
* lint: low hanging specs/alphabet.js * lint: low hanging specs/authorship_of_editions.js * lint: low hanging specs/bold.js * lint: low hanging specs/caret.js * lint: low hanging specs/change_user_color.js * lint: low hanging specs/change_user_name.js * lint: low hanging specs/chat.js * lint: low hanging specs/chat_load_messages.js * lint: low hanging specs/clear_authorship_colors.js * lint: low hanging specs/delete.js * lint: low hanging specs/drag_and_drop.js * lint: low hanging specs/embed_value.js * lint: low hanging specs/enter.js * lint: low hanging specs/font_type.js * lint: low hanging specs/helper.js * lint: low hanging specs/importexport.js * lint: low hanging specs/importindents.js * lint: low hanging specs/indentation.js * lint: low hanging specs/italic.js * lint: low hanging specs/language.js * lint: low hanging specs/multiple_authors_clear_authorship_colors.js * lint: low hanging specs/ordered_list.js * lint: low hanging specs/pad_modal.js * lint: low hanging specs/redo.js * lint: low hanging specs/responsiveness.js * lint: low hanging specs/select_formatting_buttons.js * lint: low hanging specs/strikethrough.js * lint: low hanging specs/timeslider.js * lint: low hanging specs/timeslider_labels.js * lint: low hanging specs/timeslider_numeric_padID.js * lint: low hanging specs/timeslider_revisions.js * lint: low hanging specs/undo.js * lint: low hanging specs/unordered_list.js * lint: low hanging specs/xxauto_reconnect.js * lint: attempt to do remote_runner.js * lint: helper linting * lint: rate limit linting * use constructor for Event to make eslint happier * for squash: lint fix refinements * for squash: lint fix refinements Co-authored-by: Richard Hansen <rhansen@rhansen.org>
This commit is contained in:
parent
759e2aaec3
commit
915849b319
39 changed files with 595 additions and 357 deletions
|
@ -1,14 +1,19 @@
|
|||
'use strict';
|
||||
|
||||
// Test for https://github.com/ether/etherpad-lite/issues/1763
|
||||
|
||||
// This test fails in Opera, IE and Safari
|
||||
// Opera fails due to a weird way of handling the order of execution, yet actual performance seems fine
|
||||
// Opera fails due to a weird way of handling the order of execution,
|
||||
// yet actual performance seems fine
|
||||
// Safari fails due the delay being too great yet the actual performance seems fine
|
||||
// Firefox might panic that the script is taking too long so will fail
|
||||
// IE will fail due to running out of memory as it can't fit 2M chars in memory.
|
||||
|
||||
// Just FYI Google Docs crashes on large docs whilst trying to Save, it's likely the limitations we are
|
||||
// Just FYI Google Docs crashes on large docs whilst trying to Save,
|
||||
// it's likely the limitations we are
|
||||
// experiencing are more to do with browser limitations than improper implementation.
|
||||
// A ueber fix for this would be to have a separate lower cpu priority thread that handles operations that aren't
|
||||
// A ueber fix for this would be to have a separate lower cpu priority
|
||||
// thread that handles operations that aren't
|
||||
// visible to the user.
|
||||
|
||||
// Adapted from John McLear's original test case.
|
||||
|
@ -20,16 +25,18 @@ xdescribe('Responsiveness of Editor', function () {
|
|||
this.timeout(6000);
|
||||
});
|
||||
// JM commented out on 8th Sep 2020 for a release, after release this needs uncommenting
|
||||
// And the test needs to be fixed to work in Firefox 52 on Windows 7. I am not sure why it fails on this specific platform
|
||||
// The errors show this.timeout... then crash the browser but I am sure something is actually causing the stack trace and
|
||||
// And the test needs to be fixed to work in Firefox 52 on Windows 7.
|
||||
// I am not sure why it fails on this specific platform
|
||||
// The errors show this.timeout... then crash the browser but
|
||||
// I am sure something is actually causing the stack trace and
|
||||
// I just need to narrow down what, offers to help accepted.
|
||||
it('Fast response to keypress in pad with large amount of contents', function (done) {
|
||||
// skip on Windows Firefox 52.0
|
||||
if (window.bowser && window.bowser.windows && window.bowser.firefox && window.bowser.version == '52.0') {
|
||||
if (window.bowser &&
|
||||
window.bowser.windows && window.bowser.firefox && window.bowser.version === '52.0') {
|
||||
this.skip();
|
||||
}
|
||||
const inner$ = helper.padInner$;
|
||||
const chrome$ = helper.padChrome$;
|
||||
const chars = '0000000000'; // row of placeholder chars
|
||||
const amount = 200000; // number of blocks of chars we will insert
|
||||
const length = (amount * (chars.length) + 1); // include a counter for each space
|
||||
|
@ -39,7 +46,7 @@ xdescribe('Responsiveness of Editor', function () {
|
|||
// get keys to send
|
||||
const keyMultiplier = 10; // multiplier * 10 == total number of key events
|
||||
let keysToSend = '';
|
||||
for (var i = 0; i <= keyMultiplier; i++) {
|
||||
for (let i = 0; i <= keyMultiplier; i++) {
|
||||
keysToSend += chars;
|
||||
}
|
||||
|
||||
|
@ -47,23 +54,23 @@ xdescribe('Responsiveness of Editor', function () {
|
|||
textElement.sendkeys('{selectall}'); // select all
|
||||
textElement.sendkeys('{del}'); // clear the pad text
|
||||
|
||||
for (var i = 0; i <= amount; i++) {
|
||||
for (let i = 0; i <= amount; i++) {
|
||||
text = `${text + chars} `; // add the chars and space to the text contents
|
||||
}
|
||||
inner$('div').first().text(text); // Put the text contents into the pad
|
||||
|
||||
helper.waitFor(() => // Wait for the new contents to be on the pad
|
||||
inner$('div').text().length > length
|
||||
).done(() => {
|
||||
expect(inner$('div').text().length).to.be.greaterThan(length); // has the text changed?
|
||||
// Wait for the new contents to be on the pad
|
||||
helper.waitFor(() => inner$('div').text().length > length).done(() => {
|
||||
// has the text changed?
|
||||
expect(inner$('div').text().length).to.be.greaterThan(length);
|
||||
const start = Date.now(); // get the start time
|
||||
|
||||
// send some new text to the screen (ensure all 3 key events are sent)
|
||||
const el = inner$('div').first();
|
||||
for (let i = 0; i < keysToSend.length; ++i) {
|
||||
var x = keysToSend.charCodeAt(i);
|
||||
const x = keysToSend.charCodeAt(i);
|
||||
['keyup', 'keypress', 'keydown'].forEach((type) => {
|
||||
const e = $.Event(type);
|
||||
const e = new $.Event(type);
|
||||
e.keyCode = x;
|
||||
el.trigger(e);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue