cypress: don't copy the test file by the second user.

We use file copying to create a clean test document
in the working directory. We don't need to do this twice,
the first user will do it first, then the second user
will open the same document.

Change-Id: Ide01b162b0c6a2b3a694706848c3ce93758f3f22
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100125
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
This commit is contained in:
Tamás Zolnai 2020-08-04 17:40:28 +02:00
parent 7620b39400
commit f657321d2b
6 changed files with 23 additions and 20 deletions

View file

@ -2,24 +2,27 @@
require('cypress-wait-until');
function loadTestDoc(fileName, subFolder) {
function loadTestDoc(fileName, subFolder, noFileCopy) {
cy.log('Loading test document - start.');
cy.log('Param - fileName: ' + fileName);
cy.log('Param - subFolder: ' + subFolder);
cy.log('Param - noFileCopy: ' + noFileCopy);
// Get a clean test document
if (subFolder === undefined) {
cy.task('copyFile', {
sourceDir: Cypress.env('DATA_FOLDER'),
destDir: Cypress.env('WORKDIR'),
fileName: fileName,
});
} else {
cy.task('copyFile', {
sourceDir: Cypress.env('DATA_FOLDER') + subFolder + '/',
destDir: Cypress.env('WORKDIR') + subFolder + '/',
fileName: fileName,
});
if (noFileCopy !== true) {
if (subFolder === undefined) {
cy.task('copyFile', {
sourceDir: Cypress.env('DATA_FOLDER'),
destDir: Cypress.env('WORKDIR'),
fileName: fileName,
});
} else {
cy.task('copyFile', {
sourceDir: Cypress.env('DATA_FOLDER') + subFolder + '/',
destDir: Cypress.env('WORKDIR') + subFolder + '/',
fileName: fileName,
});
}
}
doIfOnMobile(function() {
@ -156,8 +159,8 @@ function matchClipboardText(regexp) {
});
}
function beforeAll(fileName, subFolder) {
loadTestDoc(fileName, subFolder);
function beforeAll(fileName, subFolder, noFileCop) {
loadTestDoc(fileName, subFolder, noFileCop);
}
function afterAll(fileName) {

View file

@ -9,7 +9,7 @@ describe('Change paragraph properties: user-2.', function() {
// Wait here, before loading the document.
// Opening two clients at the same time causes an issue.
cy.wait(5000);
helper.beforeAll(testFileName);
helper.beforeAll(testFileName, undefined, true);
});
afterEach(function() {

View file

@ -9,7 +9,7 @@ describe('Sheet operations: user-2.', function() {
// Wait here, before loading the document.
// Opening two clients at the same time causes an issue.
cy.wait(5000);
helper.beforeAll(testFileName);
helper.beforeAll(testFileName, undefined, true);
});
afterEach(function() {

View file

@ -9,7 +9,7 @@ describe('Sidebar visibility: user-2.', function() {
// Wait here, before loading the document.
// Opening two clients at the same time causes an issue.
cy.wait(5000);
helper.beforeAll(testFileName);
helper.beforeAll(testFileName, undefined, true);
});
afterEach(function() {

View file

@ -9,7 +9,7 @@ describe('Simultaneous typing: user-2.', function() {
// Wait here, before loading the document.
// Opening two clients at the same time causes an issue.
cy.wait(5000);
helper.beforeAll(testFileName);
helper.beforeAll(testFileName, undefined, true);
});
afterEach(function() {

View file

@ -10,7 +10,7 @@ describe('Slide operations: user-2.', function() {
// Wait here, before loading the document.
// Opening two clients at the same time causes an issue.
cy.wait(5000);
helper.beforeAll(testFileName);
helper.beforeAll(testFileName, undefined, true);
});
afterEach(function() {