libreoffice-online/cypress_test/integration_tests/common/impress_helper.js
Tamás Zolnai 76e45490a4 cypress: consistent naming of helper files.
Change-Id: I245dc0ee49684751f9042ff25e190dd883bca536
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95284
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2020-06-01 20:43:06 +02:00

61 lines
1.4 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.
cy.get('#document-container')
.type(text);
// Still in edit mode.
assertInTextEditMode();
helper.selectAllText();
helper.expectTextForClipboard(expected);
}
module.exports.assertNotInTextEditMode = assertNotInTextEditMode;
module.exports.assertInTextEditMode = assertInTextEditMode;
module.exports.typeTextAndVerify = typeTextAndVerify;