diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-11-26 17:53:29 +0100 |
---|---|---|
committer | Tamás Zolnai <zolnaitamas2000@gmail.com> | 2020-12-01 13:25:20 +0100 |
commit | 52bb7186203f0604d76aa17ee0826dca68cee271 (patch) | |
tree | e2dddb663155b0b2f929d2c85161280bf3cfce76 /cypress_test/integration_tests/multiuser | |
parent | systemd was installed for /etc/localtime, so numeric user id of lool shifted ... (diff) | |
download | online-52bb7186203f0604d76aa17ee0826dca68cee271.tar.gz online-52bb7186203f0604d76aa17ee0826dca68cee271.zip |
cypress: introduce interference testing for mobile tests.
Added `make check-interfer-mobile` command for running
interference tests. Now it works with writer tests.
I'll generalize it later.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I2181a8653d61cc6ed873e2887a3e42767f46f177
Diffstat (limited to 'cypress_test/integration_tests/multiuser')
-rw-r--r-- | cypress_test/integration_tests/multiuser/interference_user_spec.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/cypress_test/integration_tests/multiuser/interference_user_spec.js b/cypress_test/integration_tests/multiuser/interference_user_spec.js new file mode 100644 index 0000000000..fb41e116a2 --- /dev/null +++ b/cypress_test/integration_tests/multiuser/interference_user_spec.js @@ -0,0 +1,68 @@ +/* global describe it cy require Cypress */ + +var helper = require('../common/helper'); +var mobileHelper = require('../common/mobile_helper'); + +describe('Interfering second user.', function() { + it('Spaming keyboard input.', function() { + cy.waitUntil(function() { + // Wait for the user-1 to open the document + cy.visit('http://admin:admin@localhost:' + + Cypress.env('SERVER_PORT') + + '/loleaflet/dist/admin/admin.html'); + + cy.get('#uptime') + .should('not.have.text', '0'); + + cy.get('#doclist > tr > td').eq(3) + .should('not.be.empty') + .invoke('text') + .then(function(text) { + + // We open the same document + helper.beforeAll(text, 'writer', true); + }); + + cy.get('#tb_actionbar_item_userlist', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) + .should('be.visible'); + + helper.doIfOnMobile(function() { + mobileHelper.enableEditingMobile(); + }); + + // We are doing some keyboard input activity here. + cy.waitUntil(function() { + for (var i = 0; i < 3; i++) { + helper.typeIntoDocument('{rightArrow}'); + } + for (var i = 0; i < 3; i++) { + helper.typeIntoDocument('{leftArrow}'); + } + + return cy.get('#tb_actionbar_item_userlist') + .then(function(userlist) { + return !Cypress.dom.isVisible(userlist[0]); + }); + }, {timeout: 60000}); + + // Check admin console, whether the first user is still active + // If there is no more document we can assume the test is finished. + cy.visit('http://admin:admin@localhost:' + + Cypress.env('SERVER_PORT') + + '/loleaflet/dist/admin/admin.html'); + + cy.get('#uptime') + .should('not.have.text', '0'); + + // Wait some time for our own instance to be closed. + cy.wait(5000); + + return cy.get('#doclist') + .invoke('text') + .then(function(text) { + return text.length === 0; + }); + + }, {timeout: 60000, log: false}); + }); +}); |