summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-01-25 19:28:17 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-01-26 02:41:06 +0100
commit18511101392846319453f02d5b82b55017ae19f4 (patch)
treeeb97653d9936059c35a633dbaa5698d65d4fbac6
parentcypress: Extract test document loading code. (diff)
downloadonline-18511101392846319453f02d5b82b55017ae19f4.tar.gz
online-18511101392846319453f02d5b82b55017ae19f4.zip
cypress: Add an example for copy-ing.
Unfortunatly cypress does not support clipboard events by now. Change-Id: Iffdaf0f15275ecb27aa3ebf2731c72cf4bdd46de
-rw-r--r--cypress_test/integration_tests/desktop/copy_paste_spec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/cypress_test/integration_tests/desktop/copy_paste_spec.js b/cypress_test/integration_tests/desktop/copy_paste_spec.js
new file mode 100644
index 0000000000..015905d318
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/copy_paste_spec.js
@@ -0,0 +1,35 @@
+/* global describe it cy beforeEach require expect*/
+
+var helper = require('../common/helper');
+
+describe('Clipboard operations.', function() {
+ beforeEach(function() {
+ helper.loadTestDoc('simple.odt');
+ });
+
+ 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:');
+ });
+});