2020-11-16 08:39:19 -06:00
|
|
|
/* global cy require*/
|
|
|
|
|
|
|
|
var helper = require('./helper');
|
|
|
|
|
2021-02-26 06:11:39 -06:00
|
|
|
// 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.
|
2020-11-16 08:39:19 -06:00
|
|
|
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');
|
|
|
|
|
2021-02-05 08:12:51 -06:00
|
|
|
helper.selectAllText();
|
2020-11-16 08:39:19 -06:00
|
|
|
|
|
|
|
cy.log('Select all text of Writer document - end.');
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports.selectAllTextOfDoc = selectAllTextOfDoc;
|