libreoffice-online/cypress_test/integration_tests/common/impress_helper.js
Tamás Zolnai dbe8502a58 cypress: introduce typeIntoDocument helper method.
It was not consistent what we used to type into the
document (e.g. 'body', 'textarea.clipboard' or
'#document-container'). Also we need to use force
parameter because 'textarea.clipboard' has no actual area
which makes cypress fail with: '`cy.type()` failed because
the center of this element is hidden from view'.

Change-Id: I04e0a82ed8450d583e407715fde1855197cae109
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100574
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2020-08-12 14:59:30 +02:00

67 lines
1.6 KiB
JavaScript

/* global cy require*/
var helper = require('./helper');
// Assert that Impress is *not* in Text Edit Mode.
function assertNotInTextEditMode() {
cy.log('Verifying NO Text-Edit context.');
// In edit mode, we should have the blinking cursor.
cy.get('.leaflet-cursor.blinking-cursor')
.should('not.exist');
cy.get('.leaflet-cursor-container')
.should('not.exist');
helper.assertNoKeyboardInput();
cy.log('NO Text-Edit context verified.');
}
// Assert that Impress is in Text Edit Mode.
function assertInTextEditMode() {
cy.log('Verifying Impress in Text-Edit context.');
// In edit mode, we should have the edit container.
cy.get('#doc-clipboard-container')
.should('exist');
cy.get('.leaflet-zoom-animated')
.should('exist');
cy.get('.leaflet-interactive')
.should('exist');
cy.get('.leaflet-pane.leaflet-overlay-pane svg g')
.should('exist');
helper.assertCursorAndFocus();
cy.log('Impress Text-Edit context verified.');
}
// Enter some text and confirm we get it back.
function typeTextAndVerify(text, expected) {
if (!expected)
expected = text;
assertInTextEditMode();
// Type some text.
helper.typeIntoDocument(text);
// Still in edit mode.
assertInTextEditMode();
helper.selectAllText();
helper.expectTextForClipboard(expected);
}
function assertNumberOfSlidePreviews(slides) {
cy.get('#slide-sorter .preview-frame')
.should('have.length', slides + 1);
}
module.exports.assertNotInTextEditMode = assertNotInTextEditMode;
module.exports.assertInTextEditMode = assertInTextEditMode;
module.exports.typeTextAndVerify = typeTextAndVerify;
module.exports.assertNumberOfSlidePreviews = assertNumberOfSlidePreviews;