libreoffice-online/cypress_test/integration_tests/idle/calc/idle_spec.js
Neil Guertin ae918ea449 Enable Idle test
Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: I109e8c1b4e14be096741ceea5285456b77a38d04
2024-01-18 11:11:33 -05:00

53 lines
1.5 KiB
JavaScript

/* global describe it cy beforeEach require afterEach */
var helper = require('../../common/helper');
var calcHelper = require('../../common/calc_helper');
describe(['tagdesktop'], 'Idle', function() {
var origTestFileName = 'idle.ods';
var testFileName;
var dimDialogSelector = '#modal-dialog-inactive_user_message-overlay';
beforeEach(function() {
testFileName = helper.beforeAll(origTestFileName, 'calc');
});
afterEach(function() {
helper.afterAll(testFileName, this.currentTest.state);
});
function checkIfIsInteractiveAgain() {
calcHelper.dblClickOnFirstCell();
const content = 'New content';
helper.typeIntoDocument(content + '{enter}');
calcHelper.selectEntireSheet();
helper.waitUntilIdle('#copy-paste-container tbody');
calcHelper.assertDataClipboardTable(['C' + content + 'ypress Test', 'Status', 'Test 1', 'Pass', 'Test 2', 'Fail', 'Test 3', 'Pass', 'Test 4', '', 'Test 5', 'Fail']);
}
it('Check idle out of focus', function() {
cy.getFrameWindow()
.its('L')
.then(function(L) {
L.Map.THIS._onLostFocus();
});
cy.cGet(dimDialogSelector, { timeout: 1000 }).should('not.exist');
cy.wait(1100); // out of focus timeout is 1s
cy.cGet(dimDialogSelector, { timeout: 1000 }).should('exist');
checkIfIsInteractiveAgain();
});
it('Check idle after inactivity', function() {
cy.cGet(dimDialogSelector).should('not.exist');
cy.wait(7100); // inactivity timeout is 7s
cy.cGet(dimDialogSelector).should('exist');
checkIfIsInteractiveAgain();
});
});