Compare commits
41 Commits
develop
...
restore-re
Author | SHA1 | Date |
---|---|---|
John McLear | 438fe4e50f | |
John McLear | 52d6fbfd0a | |
John McLear | 56c7e7a8d7 | |
John McLear | e3a90bbe38 | |
John McLear | b4f1c9da2e | |
John McLear | ce21ac9ba4 | |
John McLear | 954810b9f2 | |
John McLear | 972abfc3e9 | |
John McLear | 092d096d19 | |
John McLear | 1efc616508 | |
John McLear | 83f08a6bc3 | |
John McLear | b1fe9c1ef3 | |
John McLear | b13c6b74c7 | |
John McLear | 4351f2447e | |
John McLear | 25353fd315 | |
John McLear | 02688e873d | |
John McLear | 550f9cbd32 | |
John McLear | beaf2e8f1e | |
John McLear | e73a4e79f6 | |
John McLear | 76469fff8f | |
John McLear | 96032ad361 | |
John McLear | 622a2be177 | |
John McLear | cbf2a5898c | |
John McLear | 6a1b2005bd | |
John McLear | 3f2c1ae1dd | |
John McLear | 1f141710f5 | |
John McLear | e6600d45e4 | |
John McLear | c63c621722 | |
John McLear | 6a57717236 | |
John McLear | 72c41c228f | |
John McLear | a549ca07ab | |
John McLear | bc1baeb2fe | |
John McLear | 1581b713b9 | |
John McLear | 04e275ea15 | |
John McLear | af42e3e620 | |
John McLear | 878af5ee0a | |
John McLear | 51a8f0db22 | |
John McLear | ee41ca7807 | |
John McLear | cc4253bf3f | |
John McLear | 89a661b448 | |
John McLear | 92a42520ee |
|
@ -0,0 +1,71 @@
|
|||
name: "Collaboration"
|
||||
|
||||
# any branch is useful for testing before a PR is submitted
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# run on pushes to any branch
|
||||
# run on PRs from external forks
|
||||
if: |
|
||||
(github.event_name != 'pull_request')
|
||||
|| (github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id)
|
||||
name: Test
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 12
|
||||
|
||||
- name: Install all dependencies and symlink for ep_etherpad-lite
|
||||
run: src/bin/installDeps.sh
|
||||
|
||||
- name: Install XVFB
|
||||
run: sudo apt-get install xvfb
|
||||
|
||||
- name: Install Cypress
|
||||
run: npm install cypress -g
|
||||
|
||||
# - name: Create settings.json
|
||||
# run: cp settings.json.template settings.json
|
||||
|
||||
# - name: Disable import/export rate limiting
|
||||
# run: |
|
||||
# sed -e '/^ *"importExportRateLimiting":/,/^ *\}/ s/"max":.*/"max": 0/' -i settings.json
|
||||
|
||||
- name: Run Etherpad & Tests
|
||||
run: |
|
||||
node src/node/server.js &
|
||||
# check for initial connectivity
|
||||
curl --connect-timeout 10 --max-time 20 --retry 5 --retry-delay 10 --retry-max-time 60 --retry-connrefused http://127.0.0.1:9001/p/test
|
||||
cd src/tests/frontend
|
||||
# build first
|
||||
xvfb-run -a cypress run --spec cypress/integration/test.js --config-file cypress/cypress.json --config video=false
|
||||
# run collaboration tests
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false &
|
||||
xvfb-run -a cypress run --spec cypress/integration/collaborate.js --config-file cypress/cypress.json --config video=false,screenshotsFolder=cypress/screenshots
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: cypress-videos
|
||||
path: src/tests/frontend/cypress/videos/
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: always()
|
||||
with:
|
||||
name: cypress-screenshots
|
||||
path: src/tests/frontend/cypress/screenshots/
|
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
|
||||
// This test is for https://github.com/ether/etherpad-lite/issues/1763
|
||||
// Multiple browsers edit a pad and we check to ensure we can still perform
|
||||
// a task quickly.
|
||||
// We need to get up to 700 lines so the additional space breaks and enter keys
|
||||
// in specialKeys are intentional.
|
||||
|
||||
const numberOfEdits = 700; // 7000 total
|
||||
const specialKeys = ['{{}',
|
||||
'{backspace}',
|
||||
'{del}',
|
||||
'{downarrow}',
|
||||
'{end}',
|
||||
'{enter}',
|
||||
'{enter}',
|
||||
'{enter}',
|
||||
'{enter}',
|
||||
'{esc}',
|
||||
'{home}',
|
||||
'{insert}',
|
||||
'{leftarrow}',
|
||||
'{movetoend}',
|
||||
'{movetostart}',
|
||||
'{pagedown}',
|
||||
'{pageup}',
|
||||
'{rightarrow}',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
' ',
|
||||
'{uparrow}']; // includes intentional white space
|
||||
|
||||
Cypress.Commands.add('iframe', {prevSubject: 'element'},
|
||||
($iframe) => new Cypress.Promise((resolve) => {
|
||||
$iframe.ready(() => {
|
||||
resolve($iframe.contents().find('body'));
|
||||
});
|
||||
}));
|
||||
|
||||
describe(__filename, () => {
|
||||
it('Makes edits to pad', () => {
|
||||
let originalLineCount;
|
||||
cy.visit('http://127.0.0.1:9001/p/collab', {timeout: 120000});
|
||||
// Until we find a better way, this is required.
|
||||
cy.get('iframe[name="ace_outer"]', {timeout: 120000}).iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe()
|
||||
.find('.ace-line:first')
|
||||
.should('be.visible');
|
||||
|
||||
cy.get('iframe[name="ace_outer"]').iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe()
|
||||
.find('div')
|
||||
.should(($lines) => {
|
||||
originalLineCount = $lines.length;
|
||||
});
|
||||
|
||||
let i = 0;
|
||||
let enterKeyCount = 0;
|
||||
while (i < numberOfEdits) {
|
||||
const specialKey = specialKeys[Math.floor(Math.random() * specialKeys.length)];
|
||||
if (specialKey === '{enter}') enterKeyCount++;
|
||||
|
||||
cy.get('iframe[name="ace_outer"]').iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe()
|
||||
.type(specialKey);
|
||||
|
||||
cy.get('iframe[name="ace_outer"]').iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe()
|
||||
.type(`${Math.random().toString(36).slice(2)} ${Math.random().toString(36).slice(2)}`);
|
||||
// shameless copy/pasted from
|
||||
// https://stackoverflow.com/questions/10726909/random-alpha-numeric-string-in-javascript
|
||||
i++;
|
||||
}
|
||||
|
||||
// Now all pad content should exist we can assert some things..
|
||||
cy.get('iframe[name="ace_outer"]').iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe()
|
||||
.should('be.visible')
|
||||
.should(($inner) => {
|
||||
// editor exists
|
||||
expect($inner).to.have.length(1);
|
||||
// and is visible
|
||||
expect($inner).to.be.visible;
|
||||
// line count has grown
|
||||
expect($inner.find('div').length).to.be.at.least(enterKeyCount + originalLineCount);
|
||||
});
|
||||
|
||||
// Now make one final edit and make sure it's visible within 10 ms.
|
||||
cy.get('iframe[name="ace_outer"]').iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe()
|
||||
.type(`${Math.random().toString(36).slice(2)} ${Math.random().toString(36).slice(2)}`);
|
||||
|
||||
cy.get('iframe[name="ace_outer"]').iframe()
|
||||
.find('iframe[name="ace_inner"]').iframe();
|
||||
// TODO. test
|
||||
});
|
||||
});
|
|
@ -1,91 +0,0 @@
|
|||
'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
|
||||
// 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
|
||||
// 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
|
||||
// visible to the user.
|
||||
|
||||
// Adapted from John McLear's original test case.
|
||||
|
||||
xdescribe('Responsiveness of Editor', function () {
|
||||
// create a new pad before each test run
|
||||
beforeEach(function (cb) {
|
||||
helper.newPad(cb);
|
||||
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
|
||||
// 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') {
|
||||
this.skip();
|
||||
}
|
||||
const inner$ = helper.padInner$;
|
||||
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
|
||||
let text = ''; // the text we're gonna insert
|
||||
this.timeout(amount * 150); // Changed from 100 to 150 to allow Mac OSX Safari to be slow.
|
||||
|
||||
// get keys to send
|
||||
const keyMultiplier = 10; // multiplier * 10 == total number of key events
|
||||
let keysToSend = '';
|
||||
for (let i = 0; i <= keyMultiplier; i++) {
|
||||
keysToSend += chars;
|
||||
}
|
||||
|
||||
const textElement = inner$('div');
|
||||
textElement.sendkeys('{selectall}'); // select all
|
||||
textElement.sendkeys('{del}'); // clear the pad text
|
||||
|
||||
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
|
||||
|
||||
// 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) {
|
||||
const x = keysToSend.charCodeAt(i);
|
||||
['keyup', 'keypress', 'keydown'].forEach((type) => {
|
||||
const e = new $.Event(type);
|
||||
e.keyCode = x;
|
||||
el.trigger(e);
|
||||
});
|
||||
}
|
||||
|
||||
helper.waitFor(() => { // Wait for the ability to process
|
||||
const el = inner$('body');
|
||||
if (el[0].textContent.length > amount) return true;
|
||||
}).done(() => {
|
||||
const end = Date.now(); // get the current time
|
||||
const delay = end - start; // get the delay as the current time minus the start time
|
||||
|
||||
expect(delay).to.be.below(600);
|
||||
done();
|
||||
}, 5000);
|
||||
}, 10000);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue