libreoffice-online/cypress_test/integration_tests/desktop/writer/copy_paste_spec.js
Ashod Nakashian de74eae245 cypress: give each test a unique test document
We copy each test document into the work-dir
and now we also give them a random prefix.
This is critical to ensure that parallel runs
do not re-use the same document.

Also, when closing a document, we wait for the
document-name to disappear from the admin
console. Sharing the same document, or even the
name, means we are likely to see random results.

Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit d998f2c1c8a163c3ef870bbe8581a364df3905bb)

Change-Id: I2f41566952c49c9c63ee206bcba6a4dd49cdd6d0
2022-01-11 09:28:03 +01:00

44 lines
1.2 KiB
JavaScript

/* global describe it cy beforeEach require expect afterEach*/
var helper = require('../../common/helper');
describe('Clipboard operations.', function() {
var origTestFileName = 'copy_paste.odt';
var testFileName;
beforeEach(function() {
testFileName = helper.beforeAll(origTestFileName, 'writer');
});
afterEach(function() {
helper.afterAll(testFileName, this.currentTest.state);
});
it('Copy and Paste text.', function() {
// Select some text
helper.selectAllText();
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.get('body').rightclick(XPos, YPos);
});
cy.contains('.context-menu-link', 'Copy')
.click();
// COOL code can not execute document.execCommand() when executed by cypress
// https://github.com/cypress-io/cypress/issues/2851
cy.get('.vex-dialog-message p')
.should('have.text', 'Your browser has very limited access to the clipboard, so use these keyboard shortcuts:');
cy.get('.vex-dialog-form button[type=\'submit\']')
.click();
cy.get('.vex-dialog-form')
.should('not.exist');
});
});