2020-02-02 22:34:25 -06:00
|
|
|
/* global describe it cy beforeEach require expect afterEach*/
|
2020-01-25 12:28:17 -06:00
|
|
|
|
|
|
|
var helper = require('../common/helper');
|
|
|
|
|
|
|
|
describe('Clipboard operations.', function() {
|
|
|
|
beforeEach(function() {
|
2020-02-20 15:01:27 -06:00
|
|
|
helper.loadTestDoc('copy_paste.odt');
|
2020-01-25 12:28:17 -06:00
|
|
|
});
|
|
|
|
|
2020-02-02 22:34:25 -06:00
|
|
|
afterEach(function() {
|
|
|
|
helper.afterAll();
|
|
|
|
});
|
|
|
|
|
2020-01-25 12:28:17 -06:00
|
|
|
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;
|
2020-02-17 11:05:28 -06:00
|
|
|
var YPos = marker[0].getBoundingClientRect().top - 5;
|
2020-01-25 12:28:17 -06:00
|
|
|
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:');
|
|
|
|
});
|
|
|
|
});
|