[Libreoffice-commits] online.git: 2 commits - cypress_test/data cypress_test/integration_tests cypress_test/README

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 12 18:14:45 UTC 2020


 cypress_test/README                                                             |   12 +-
 cypress_test/integration_tests/common/helper.js                                 |   42 +++++++---
 cypress_test/integration_tests/mobile/calc/calc_focus_spec.js                   |   22 ++---
 cypress_test/integration_tests/mobile/impress/impress_focus_spec.js             |    4 
 cypress_test/integration_tests/mobile/writer/apply_font_spec.js                 |    4 
 cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js |    4 
 cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js             |    4 
 cypress_test/integration_tests/mobile/writer/focus_spec.js                      |    4 
 cypress_test/integration_tests/mobile/writer/insert_field_spec.js               |    4 
 cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js     |    4 
 cypress_test/integration_tests/mobile/writer/insert_object_spec.js              |    4 
 cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js        |    4 
 cypress_test/integration_tests/mobile/writer/styles_spec.js                     |    4 
 cypress_test/integration_tests/mobile/writer/table_properties_spec.js           |    6 -
 cypress_test/integration_tests/mobile/writer/toolbar_spec.js                    |    4 
 15 files changed, 74 insertions(+), 52 deletions(-)

New commits:
commit 5d41b930e6467a98b1749d92bff7a8a58f29470e
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Feb 12 18:01:47 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Feb 12 19:14:42 2020 +0100

    cypress: mobile: Organize tests based on component.
    
    Change-Id: I49f6e76b219e4c55add05b5a8489e51c518625ab
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88553
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/README b/cypress_test/README
index 79d236a47..11a05cd32 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -35,13 +35,17 @@ To run all mobile tests:
 
     make check-mobile
 
-To run one specific test suit of desktop tests:
+To run one specific test suit of desktop tests,
+use spec argument with a relative path to
+cypress_test/data/desktop/:
 
     make check-desktop spec=example_desktop_test_spec.js
 
-To run one specific test suit of mobile tests:
+To run one specific test suit of mobile tests,
+use spec argument with a relative path to
+cypress_test/data/mobile/:
 
-    make check-mobile spec=toolbar_spec.js
+    make check-mobile spec=writer/toolbar_spec.js
 
 
 Running one specific test
@@ -60,7 +64,7 @@ inside apply_font_spec.js file, you need to add it.only():
 
 Then run the test suit with:
 
-    make check-mobile spec=apply_font_spec.js
+    make check-mobile spec=writer/apply_font_spec.js
 
 Or open the file in the interactive test runner.
 
diff --git a/cypress_test/data/mobile/empty.ods b/cypress_test/data/mobile/calc/empty.ods
similarity index 100%
rename from cypress_test/data/mobile/empty.ods
rename to cypress_test/data/mobile/calc/empty.ods
diff --git a/cypress_test/data/mobile/empty.odp b/cypress_test/data/mobile/impress/empty.odp
similarity index 100%
rename from cypress_test/data/mobile/empty.odp
rename to cypress_test/data/mobile/impress/empty.odp
diff --git a/cypress_test/data/mobile/empty.odt b/cypress_test/data/mobile/writer/empty.odt
similarity index 100%
rename from cypress_test/data/mobile/empty.odt
rename to cypress_test/data/mobile/writer/empty.odt
diff --git a/cypress_test/data/mobile/simple.odt b/cypress_test/data/mobile/writer/simple.odt
similarity index 100%
rename from cypress_test/data/mobile/simple.odt
rename to cypress_test/data/mobile/writer/simple.odt
diff --git a/cypress_test/data/mobile/table.odt b/cypress_test/data/mobile/writer/table.odt
similarity index 100%
rename from cypress_test/data/mobile/table.odt
rename to cypress_test/data/mobile/writer/table.odt
diff --git a/cypress_test/data/mobile/table_with_text.odt b/cypress_test/data/mobile/writer/table_with_text.odt
similarity index 100%
rename from cypress_test/data/mobile/table_with_text.odt
rename to cypress_test/data/mobile/writer/table_with_text.odt
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index c881d60df..04df7db71 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -1,22 +1,40 @@
 /* global cy Cypress expect*/
 
-function loadTestDoc(fileName, mobile) {
+function loadTestDoc(fileName, subFolder, mobile) {
 	// Get a clean test document
-	cy.task('copyFile', {
-		sourceDir: Cypress.env('DATA_FOLDER'),
-		destDir: Cypress.env('WORKDIR'),
-		fileName: fileName,
-	});
+	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 (mobile === true) {
 		cy.viewport('iphone-6');
 	}
 
 	// Open test document
-	cy.visit('http://localhost:9980/loleaflet/' +
-		Cypress.env('WSD_VERSION_HASH') +
-		'/loleaflet.html?file_path=file://' +
-		Cypress.env('WORKDIR') + fileName, {
+	var URI;
+	if (subFolder === undefined) {
+		URI = 'http://localhost:9980/loleaflet/' +
+			Cypress.env('WSD_VERSION_HASH') +
+			'/loleaflet.html?file_path=file://' +
+			Cypress.env('WORKDIR') + fileName;
+	} else {
+		URI = 'http://localhost:9980/loleaflet/' +
+			Cypress.env('WSD_VERSION_HASH') +
+			'/loleaflet.html?file_path=file://' +
+			Cypress.env('WORKDIR') + subFolder + '/' + fileName;
+	}
+
+	cy.visit(URI, {
 		onLoad: function(win) {
 			win.onerror = cy.onUncaughtException;
 		}});
@@ -121,8 +139,8 @@ function copyTableToClipboard() {
 		.should('not.exist');
 }
 
-function beforeAllMobile(fileName) {
-	loadTestDoc(fileName, true);
+function beforeAllMobile(fileName, subFolder) {
+	loadTestDoc(fileName, subFolder, true);
 
 	detectLOCoreVersion();
 }
diff --git a/cypress_test/integration_tests/mobile/calc_focus_spec.js b/cypress_test/integration_tests/mobile/calc/calc_focus_spec.js
similarity index 95%
rename from cypress_test/integration_tests/mobile/calc_focus_spec.js
rename to cypress_test/integration_tests/mobile/calc/calc_focus_spec.js
index 9ef9a7ef8..40b6a7c65 100644
--- a/cypress_test/integration_tests/mobile/calc_focus_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_focus_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Calc focus tests', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.ods');
+		helper.beforeAllMobile('empty.ods', 'calc');
 	});
 
 	afterEach(function() {
diff --git a/cypress_test/integration_tests/mobile/impress_focus_spec.js b/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js
similarity index 91%
rename from cypress_test/integration_tests/mobile/impress_focus_spec.js
rename to cypress_test/integration_tests/mobile/impress/impress_focus_spec.js
index 8e2753f3b..9340a6111 100644
--- a/cypress_test/integration_tests/mobile/impress_focus_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Impress focus tests', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.odp');
+		helper.beforeAllMobile('empty.odp', 'impress');
 	});
 
 	afterEach(function() {
diff --git a/cypress_test/integration_tests/mobile/apply_font_spec.js b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js
similarity index 98%
rename from cypress_test/integration_tests/mobile/apply_font_spec.js
rename to cypress_test/integration_tests/mobile/writer/apply_font_spec.js
index 52dd9fc0f..92b62f285 100644
--- a/cypress_test/integration_tests/mobile/apply_font_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Apply font changes.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('simple.odt');
+		helper.beforeAllMobile('simple.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js
similarity index 99%
rename from cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js
rename to cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js
index ea2c71ab8..9245b1453 100644
--- a/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require expect afterEach Cypress*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Apply paragraph properties.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('simple.odt');
+		helper.beforeAllMobile('simple.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
similarity index 98%
rename from cypress_test/integration_tests/mobile/bottom_toolbar_spec.js
rename to cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
index 6a718ff0c..6383987b7 100644
--- a/cypress_test/integration_tests/mobile/bottom_toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach expect*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Pushing bottom toolbar items.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('simple.odt');
+		helper.beforeAllMobile('simple.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js
similarity index 98%
rename from cypress_test/integration_tests/mobile/focus_spec.js
rename to cypress_test/integration_tests/mobile/writer/focus_spec.js
index e1acd82af..d17302675 100644
--- a/cypress_test/integration_tests/mobile/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach expect*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Focus tests', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.odt');
+		helper.beforeAllMobile('empty.odt', 'writer');
 	});
 
 	afterEach(function() {
diff --git a/cypress_test/integration_tests/mobile/insert_field_spec.js b/cypress_test/integration_tests/mobile/writer/insert_field_spec.js
similarity index 97%
rename from cypress_test/integration_tests/mobile/insert_field_spec.js
rename to cypress_test/integration_tests/mobile/writer/insert_field_spec.js
index c00d16699..9cd7296fb 100644
--- a/cypress_test/integration_tests/mobile/insert_field_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_field_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Insert fields via insertion wizard.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('simple.odt');
+		helper.beforeAllMobile('simple.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js b/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js
similarity index 97%
rename from cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js
rename to cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js
index 773416c5c..3fe2d3b4c 100644
--- a/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require expect afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Insert formatting mark via insertion wizard.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('simple.odt');
+		helper.beforeAllMobile('simple.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
similarity index 98%
rename from cypress_test/integration_tests/mobile/insert_object_spec.js
rename to cypress_test/integration_tests/mobile/writer/insert_object_spec.js
index 58935135e..c8333b221 100644
--- a/cypress_test/integration_tests/mobile/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require expect afterEach Cypress*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Insert objects via insertion wizard.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.odt');
+		helper.beforeAllMobile('empty.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js b/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js
similarity index 97%
rename from cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
rename to cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js
index e4074e51c..d9c25ecb5 100644
--- a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Mobile wizard state tests', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.odt');
+		helper.beforeAllMobile('empty.odt', 'writer');
 	});
 
 	afterEach(function() {
diff --git a/cypress_test/integration_tests/mobile/styles_spec.js b/cypress_test/integration_tests/mobile/writer/styles_spec.js
similarity index 97%
rename from cypress_test/integration_tests/mobile/styles_spec.js
rename to cypress_test/integration_tests/mobile/writer/styles_spec.js
index d7a97aa4f..1f393afd4 100644
--- a/cypress_test/integration_tests/mobile/styles_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/styles_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Apply/modify styles.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('simple.odt');
+		helper.beforeAllMobile('simple.odt', 'writer');
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/table_properties_spec.js b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js
similarity index 99%
rename from cypress_test/integration_tests/mobile/table_properties_spec.js
rename to cypress_test/integration_tests/mobile/writer/table_properties_spec.js
index c19b78654..249dc413d 100644
--- a/cypress_test/integration_tests/mobile/table_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy require afterEach expect Cypress beforeEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Change table properties / layout via mobile wizard.', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.odt');
+		helper.beforeAllMobile('empty.odt', 'writer');
 	});
 
 	afterEach(function() {
@@ -12,7 +12,7 @@ describe('Change table properties / layout via mobile wizard.', function() {
 	});
 
 	function before(testFile) {
-		helper.loadTestDoc(testFile, true);
+		helper.loadTestDoc(testFile, 'writer', true);
 
 		// Click on edit button
 		cy.get('#mobile-edit-button').click();
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js
similarity index 98%
rename from cypress_test/integration_tests/mobile/toolbar_spec.js
rename to cypress_test/integration_tests/mobile/writer/toolbar_spec.js
index 32cc73126..a0e935405 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js
@@ -1,10 +1,10 @@
 /* global describe it cy beforeEach require afterEach*/
 
-var helper = require('../common/helper');
+var helper = require('../../common/helper');
 
 describe('Toolbar tests', function() {
 	beforeEach(function() {
-		helper.beforeAllMobile('empty.odt');
+		helper.beforeAllMobile('empty.odt', 'writer');
 	});
 
 	afterEach(function() {
commit f8116809f771f44ed940d6458c26d21003c72f19
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Feb 12 17:21:40 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Feb 12 19:14:25 2020 +0100

    cypress: mobile: Fix up calc focus test.
    
    Change-Id: I674f7b6945b367f9c7a9541681a56f4c556c1cb7
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88552
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/integration_tests/mobile/calc_focus_spec.js b/cypress_test/integration_tests/mobile/calc_focus_spec.js
index a9c0a2970..9ef9a7ef8 100644
--- a/cypress_test/integration_tests/mobile/calc_focus_spec.js
+++ b/cypress_test/integration_tests/mobile/calc_focus_spec.js
@@ -22,23 +22,23 @@ describe('Calc focus tests', function() {
 		cy.document().its('activeElement.tagName')
 			.should('be.eq', 'BODY');
 
-		// Double tap on a cell gives the focus to the document
-		cy.get('#document-container')
-			.dblclick(20, 20);
-
-		// Document has the focus
-		cy.document().its('activeElement.className')
-			.should('be.eq', 'clipboard');
-
 		// One tap on an other cell -> no focus on the document
 		cy.get('#document-container')
-			.click(0, 0);
+			.click(120, 120);
 
 		cy.get('.leaflet-marker-icon.spreadsheet-cell-resize-marker');
 
 		// No focus
 		cy.document().its('activeElement.tagName')
 			.should('be.eq', 'BODY');
+
+		// Double tap on a cell gives the focus to the document
+		cy.get('#document-container')
+			.dblclick(20, 20);
+
+		// Document has the focus
+		cy.document().its('activeElement.className')
+			.should('be.eq', 'clipboard');
 	});
 
 	it('Focus on second tap.', function() {


More information about the Libreoffice-commits mailing list