Compare commits

...

41 Commits

Author SHA1 Message Date
John McLear 438fe4e50f 10 clients for the lulz 2021-03-14 16:47:03 +00:00
John McLear 52d6fbfd0a test long run 2021-03-14 15:07:13 +00:00
John McLear 56c7e7a8d7 Update collaboration.yml 2021-03-14 14:54:56 +00:00
John McLear e3a90bbe38 Update collaboration.yml 2021-03-14 14:02:34 +00:00
John McLear b4f1c9da2e comma 2021-03-14 13:51:33 +00:00
John McLear ce21ac9ba4 aw 2021-03-14 13:42:02 +00:00
John McLear 954810b9f2 Update collaboration.yml 2021-03-14 13:29:22 +00:00
John McLear 972abfc3e9 Update collaboration.yml 2021-03-14 13:17:02 +00:00
John McLear 092d096d19 make one video 2021-03-14 13:11:59 +00:00
John McLear 1efc616508 Update collaborate.js 2021-03-14 12:40:45 +00:00
John McLear 83f08a6bc3 diff 2021-03-14 12:16:14 +00:00
John McLear b1fe9c1ef3 Update collaboration.yml 2021-03-14 12:09:47 +00:00
John McLear b13c6b74c7 Update collaboration.yml 2021-03-14 12:00:27 +00:00
John McLear 4351f2447e Update collaboration.yml 2021-03-14 10:54:26 +00:00
John McLear 25353fd315 Update collaboration.yml 2021-03-14 10:44:24 +00:00
John McLear 02688e873d Update collaboration.yml 2021-03-14 10:42:56 +00:00
John McLear 550f9cbd32 update 2021-03-14 10:19:00 +00:00
John McLear beaf2e8f1e Update collaborate.js 2021-03-14 10:07:32 +00:00
John McLear e73a4e79f6 Update collaboration.yml 2021-03-14 09:51:49 +00:00
John McLear 76469fff8f Update collaboration.yml 2021-03-14 09:47:30 +00:00
John McLear 96032ad361 timeouts 2021-03-14 09:37:05 +00:00
John McLear 622a2be177 why is video so slow? 2021-03-14 09:25:21 +00:00
John McLear cbf2a5898c Update collaborate.js 2021-03-14 09:06:13 +00:00
John McLear 6a1b2005bd Basis for test, no actual assertion yet for UX 2021-03-14 08:45:40 +00:00
John McLear 3f2c1ae1dd Update collaborate.js 2021-03-13 21:10:48 +00:00
John McLear 1f141710f5 Update collaboration.yml 2021-03-13 20:53:19 +00:00
John McLear e6600d45e4 cache node_modules maybe? 2021-03-13 20:34:09 +00:00
John McLear c63c621722 Update collaboration.yml 2021-03-13 20:28:18 +00:00
John McLear 6a57717236 test to see if wait is required 2021-03-13 20:19:34 +00:00
John McLear 72c41c228f Update collaborate.js 2021-03-13 19:56:17 +00:00
John McLear a549ca07ab parallel? 2021-03-13 19:38:23 +00:00
John McLear bc1baeb2fe Update collaboration.yml 2021-03-13 19:36:49 +00:00
John McLear 1581b713b9 Update collaboration.yml 2021-03-13 19:24:01 +00:00
John McLear 04e275ea15 Update collaboration.yml 2021-03-13 19:12:54 +00:00
John McLear af42e3e620 Update collaboration.yml 2021-03-13 18:57:16 +00:00
John McLear 878af5ee0a Update collaboration.yml 2021-03-13 18:51:06 +00:00
John McLear 51a8f0db22 Update collaboration.yml 2021-03-13 18:27:59 +00:00
John McLear ee41ca7807 Update collaborate.js 2021-03-13 17:19:21 +00:00
John McLear cc4253bf3f Update collaboration.yml 2021-03-13 16:54:30 +00:00
John McLear 89a661b448 tests: test to see if I can have multiple cypress clients collaborating at once 2021-03-13 16:46:14 +00:00
John McLear 92a42520ee tests: scrap buggy and non-functional responsiveness test 2021-03-13 16:45:49 +00:00
3 changed files with 171 additions and 91 deletions

71
.github/workflows/collaboration.yml vendored Normal file
View File

@ -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/

View File

@ -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
});
});

View File

@ -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);
});
});