libreoffice-online/cypress_test/integration_tests/common/writer_helper.js
Tamás Zolnai 5554133f59 cypress: document some more helper methods.
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Change-Id: I004bbb33167bfeee9f7f332516cb4b4a805a5885
2021-02-26 14:19:31 +01:00

31 lines
948 B
JavaScript

/* global cy require*/
var helper = require('./helper');
// A special text selection method for Writer. It selects
// all text of the document, but it also removes previous
// selection if exists. This selection removal is helpful,
// when we use the copy-paste-container to check the selected
// text's content, because reselection will force an update
// on this content, so we don't need to worry about testing an
// out-dated content.
function selectAllTextOfDoc() {
cy.log('Select all text of Writer document - start.');
// Remove selection if exist
cy.get('.leaflet-marker-pane')
.then(function(body) {
if (body.find('.leaflet-selection-marker-start').length !== 0) {
helper.typeIntoDocument('{downarrow}');
}
});
cy.get('.leaflet-selection-marker-start')
.should('not.exist');
helper.selectAllText();
cy.log('Select all text of Writer document - end.');
}
module.exports.selectAllTextOfDoc = selectAllTextOfDoc;