5e023c745e
Change-Id: I2a68f397e2ef8e392ccea421020a2d3cfaf9d3b5 Signed-off-by: Henry Castro <hcastro@collabora.com>
88 lines
2.3 KiB
JavaScript
88 lines
2.3 KiB
JavaScript
/* global describe it cy require Cypress */
|
|
|
|
var helper = require('./helper');
|
|
var mobileHelper = require('./mobile_helper');
|
|
|
|
describe('Interfering second user.', function() {
|
|
function getComponent(fileName) {
|
|
if (fileName.endsWith('.odt'))
|
|
return 'writer';
|
|
else if (fileName.endsWith('.ods'))
|
|
return 'calc';
|
|
else if (fileName.endsWith('.odp'))
|
|
return 'impress';
|
|
}
|
|
|
|
it('Spaming keyboard\mouse input.', function() {
|
|
cy.waitUntil(function() {
|
|
// Wait for the user-1 to open the document
|
|
cy.visit('http://admin:admin@localhost:' +
|
|
Cypress.env('SERVER_PORT') +
|
|
'/browser/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, getComponent(text), true);
|
|
});
|
|
|
|
cy.get('#tb_actionbar_item_userlist', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 })
|
|
.should('be.visible');
|
|
|
|
helper.doIfOnMobile(function() {
|
|
mobileHelper.enableEditingMobile();
|
|
});
|
|
|
|
// Do some interfering activity.
|
|
cy.waitUntil(function() {
|
|
// We are doing some keyboard input activity for non impress test cases.
|
|
helper.doIfNotInImpress(function() {
|
|
for (var i = 0; i < 3; i++) {
|
|
helper.typeIntoDocument('{rightArrow}');
|
|
}
|
|
for (var i = 0; i < 3; i++) {
|
|
helper.typeIntoDocument('{leftArrow}');
|
|
}
|
|
});
|
|
|
|
// In Impress we do some mouse activity.
|
|
helper.doIfInImpress(function() {
|
|
for (var i = 0; i < 5; i++) {
|
|
cy.get('.leaflet-pane.leaflet-tile-pane')
|
|
.click(10, 10);
|
|
}
|
|
});
|
|
|
|
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') +
|
|
'/browser/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});
|
|
});
|
|
});
|