libreoffice-online/cypress_test/integration_tests/desktop/copy_paste_spec.js
Tamás Zolnai b77cd954e0 cypress: use different test files for different test suits.
Change-Id: I29ad09ce99128fe6700070e23cf66dfc0c553b70
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89389
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2020-02-25 00:33:32 +01:00

39 lines
1.2 KiB
JavaScript

/* global describe it cy beforeEach require expect afterEach*/
var helper = require('../common/helper');
describe('Clipboard operations.', function() {
beforeEach(function() {
helper.loadTestDoc('copy_paste.odt');
});
afterEach(function() {
helper.afterAll();
});
it('Copy and Paste text.', function() {
// Select some text
cy.get('#document-container').dblclick();
cy.get('.leaflet-marker-icon')
.should('exist');
cy.get('.leaflet-marker-icon')
.then(function(marker) {
expect(marker).to.have.lengthOf(2);
var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2;
var YPos = marker[0].getBoundingClientRect().top - 5;
cy.wait(200);
cy.get('body').rightclick(XPos, YPos);
});
cy.get('.context-menu-list').should('be.visible')
.get('.context-menu-item .context-menu-link')
.contains('Copy')
.click();
// Loleaflet code can not execute document.execCommand() when executed by cypress
// https://github.com/cypress-io/cypress/issues/2851
cy.get('.vex-dialog-message p')
.contains('Your browser has very limited access to the clipboard, so use these keyboard shortcuts:');
});
});