libreoffice-online/cypress_test/integration_tests/desktop/copy_paste_spec.js
Tamás Zolnai 1cfc1c59e9 cypress: Check the admin console to make sure the test document is closed.
Change-Id: I485e8596a30c7bb1efae140143627078cde66bca
2020-02-03 05:53:22 +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('simple.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;
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:');
});
});