From 622a2be177d1d9acefc72ddd2fb577e54c5e0a9d Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 14 Mar 2021 09:25:21 +0000 Subject: [PATCH] why is video so slow? --- .github/workflows/collaboration.yml | 4 ++-- .../cypress/integration/collaborate.js | 19 ++++--------------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/.github/workflows/collaboration.yml b/.github/workflows/collaboration.yml index 12ea78fbe..6c3617e47 100644 --- a/.github/workflows/collaboration.yml +++ b/.github/workflows/collaboration.yml @@ -52,8 +52,8 @@ jobs: run: | node src\node\server.js & cd src\tests\frontend - cypress run --spec cypress\integration\collaborate.js --config-file cypress\cypress.json --config videosFolder=cypress/videos/browser1 & - cypress run --spec cypress\integration\collaborate.js --config-file cypress\cypress.json --config videosFolder=cypress/videos/browser2 & + # cypress run --spec cypress\integration\collaborate.js --config-file cypress\cypress.json --config videosFolder=cypress/videos/browser1 & + # cypress run --spec cypress\integration\collaborate.js --config-file cypress\cypress.json --config videosFolder=cypress/videos/browser2 & cypress run --spec cypress\integration\collaborate.js --config-file cypress\cypress.json --config videosFolder=cypress/videos/browser3 & cypress run --spec cypress\integration\collaborate.js --config-file cypress\cypress.json --config videosFolder=cypress/videos/browser4 diff --git a/src/tests/frontend/cypress/integration/collaborate.js b/src/tests/frontend/cypress/integration/collaborate.js index deb86a677..ae6b48255 100644 --- a/src/tests/frontend/cypress/integration/collaborate.js +++ b/src/tests/frontend/cypress/integration/collaborate.js @@ -6,7 +6,7 @@ // We need to get up to 700 lines so the additional space breaks and enter keys // in specialKeys are intentional. -const numberOfEdits = 100; +const numberOfEdits = 10; // should be 1750 const specialKeys = ['{{}', '{backspace}', '{del}', @@ -72,8 +72,9 @@ describe(__filename, () => { cy.get('iframe[name="ace_outer"]').iframe() .find('iframe[name="ace_inner"]').iframe() .find('.ace-line:last') - .type(randomString(16)); - + .type(Math.random().toString(36).slice(2)); + // shameless copy/pasted from + // https://stackoverflow.com/questions/10726909/random-alpha-numeric-string-in-javascript i++; } @@ -91,15 +92,3 @@ describe(__filename, () => { }); }); }); - -const randomString = (stringLength) => { - let randomstring = ''; - for (let i = 0; i < stringLength; i++) { - const charNumber = Math.random() * (300 - 1) + 1; - const str = String.fromCharCode(parseInt(charNumber)); - // This method generates sufficient noise - // It also includes white space and non ASCII Chars - randomstring += str; - } - return randomstring; -};