[Libreoffice-commits] online.git: 25 commits - configure.ac cypress_test/cypress.json cypress_test/data cypress_test/.eslintignore cypress_test/.gitignore cypress_test/integration_tests cypress_test/Makefile.am cypress_test/package.json cypress_test/plugins cypress_test/README loleaflet/src

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 21 15:44:20 UTC 2020


 configure.ac                                                         |    1 
 cypress_test/.eslintignore                                           |    2 
 cypress_test/.gitignore                                              |    4 
 cypress_test/Makefile.am                                             |  110 +++++
 cypress_test/README                                                  |   53 ++
 cypress_test/cypress.json                                            |    5 
 cypress_test/data/desktop/simple.odt                                 |binary
 cypress_test/data/mobile/empty.odt                                   |binary
 cypress_test/integration_tests/desktop/example_desktop_test_spec.js  |   39 ++
 cypress_test/integration_tests/desktop/example_desktop_test_spec2.js |   39 ++
 cypress_test/integration_tests/mobile/focus_spec.js                  |  117 ++++++
 cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js    |  167 ++++++++
 cypress_test/integration_tests/mobile/toolbar_spec.js                |  192 ++++++++++
 cypress_test/package.json                                            |   14 
 cypress_test/plugins/index.js                                        |   13 
 cypress_test/plugins/tasks.js                                        |   19 
 loleaflet/src/control/Control.Toolbar.js                             |    4 
 loleaflet/src/core/Browser.js                                        |    4 
 18 files changed, 783 insertions(+)

New commits:
commit 7da6ea84044cd5e944b9427b017f800d2ab95d74
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 21 15:56:45 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: mobile: Fix 'Close mobile wizard by context wizard' test case
    
    It needs a better indicator that the mobile wizard actually opened
    with the right content.
    
    Change-Id: If1d146a6b02b2b5f79e1ac627dbec4fc43906f43

diff --git a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js b/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
index 453dd32f5..bb4073381 100644
--- a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
+++ b/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
@@ -139,8 +139,8 @@ describe('Mobile wizard state tests', function() {
 			.click();
 
 		// Mobile wizard is opened and it has any content
-		cy.get('#mobile-wizard-content')
-			.should('not.be.empty');
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .ui-header-left')
+			.contains('Style');
 		cy.get('#tb_actionbar_item_mobile_wizard table')
 			.should('have.class', 'checked');
 
commit 8f498034a2a73fd4983db13eac460dacab692795
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 20 16:25:58 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Update README with instructions how to run one test case.
    
    Change-Id: Ib6e80f92d64565471f30abc89b3ed4a1bbcebb20
    (cherry picked from commit e11c0f8efa8a873eb699873613e86395d7e23200)

diff --git a/cypress_test/README b/cypress_test/README
index 0bc100241..04fc24e31 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -30,6 +30,13 @@ To run one specific test suit of mobile tests:
 
     make check-mobile spec=toolbar_spec.js
 
+To run one test case of a test suit you can use Mocha's
+'only' feature. Just replace the it(...) function with
+it.only(...) in the spec file for the selected test case
+and run the test suit using the spec parameter (see above).
+This 'only' feature affects both make check and make run
+commands.
+
 You can also open cypress tests in the browser, so you can
 check what happens during test run. It's useful for writing
 new tests or checking why an existing test fails.
commit 423f2eb0db4bc0ee67a7dffa25a59dc5566f1a6d
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 20 15:26:44 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Don't run cypress test for top level make check for now.
    
    Change-Id: I06c724e82b3717e36a7a4550118baba3aac1a7f6
    (cherry picked from commit b48ac5933c4b8671e8ba68c9f9d50216ff4dd620)

diff --git a/Makefile.am b/Makefile.am
index c6d417185..d17bb8d99 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ endif
 
 else
 
-SUBDIRS = . test loleaflet cypress_test
+SUBDIRS = . test loleaflet
 
 export ENABLE_DEBUG
 
commit e82719b99e73ad7b466214b4ba8b802451ba2128
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jan 17 19:10:45 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: mobile: Add some tests about the state of mobile wizard.
    
    Change-Id: I38869d7fcc03690610a19c7803a596cfebf75c7a

diff --git a/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js b/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
new file mode 100644
index 000000000..453dd32f5
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/mobile_wizard_state_spec.js
@@ -0,0 +1,167 @@
+/* global describe it cy Cypress beforeEach*/
+
+describe('Mobile wizard state tests', function() {
+	beforeEach(function() {
+		// Get a clean test document
+		cy.task('copyFile', {
+			sourceDir: Cypress.env('DATA_FOLDER'),
+			destDir: Cypress.env('WORKDIR'),
+			fileName: 'empty.odt',
+		});
+
+		// Open test document
+		cy.viewport('iphone-3');
+		cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+			Cypress.env('WORKDIR') + 'empty.odt');
+
+		// Wait for the document to fully load
+		cy.get('.leaflet-tile-loaded');
+	});
+
+	it('Open and close mobile wizard by toolbar item.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Click on mobile wizard toolbar item
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+
+		// Toolbar button is checked
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// Mobile wizard is closed
+		cy.get('#mobile-wizard')
+			.should('not.be.visible');
+
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('not.have.class', 'checked');
+
+		// Open mobile wizard again
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// Mobile wizard is opened and it has any content
+		// TODO: fix this bug
+		/*cy.get('#mobile-wizard-content')
+			.should('not.be.empty'); */
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+	});
+
+	it('Close mobile wizard by hamburger menu.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Click on mobile wizard toolbar item
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+
+		// Open hamburger menu
+		cy.get('#toolbar-hamburger').click();
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon')
+			.contains('About');
+
+		// Close hamburger menu
+		cy.get('#toolbar-hamburger').click();
+		// Mobile wizard is closed
+		cy.get('#mobile-wizard')
+			.should('not.be.visible');
+
+		// Open mobile wizard again
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// TODO: fix this bug
+		//cy.get('#mobile-wizard-content')
+		//	.should('not.be.empty');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+	});
+
+	it('Close mobile wizard by back button.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Click on mobile wizard toolbar item
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+
+		// Close mobile wizard by clicking on the back button
+		cy.get('#mobile-wizard-back').click();
+		cy.get('#mobile-wizard')
+			.should('not.be.visible');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('not.have.class', 'checked');
+
+		// Open mobile wizard again
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// TODO: fix this bug
+		//cy.get('#mobile-wizard-content')
+		//	.should('not.be.empty');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+	});
+
+	it('Close mobile wizard by context wizard.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Click on mobile wizard toolbar item
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked');
+
+		// Open context wizard by right click on document
+		cy.get('#document-container').rightclick();
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon')
+			.contains('Paste');
+
+		// TODO: fix this bug
+		//cy.get('#tb_actionbar_item_mobile_wizard table')
+		//	.should('not.have.class', 'checked');
+
+		// Open mobile wizard again
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// TODO: fix this bug
+		//cy.get('#mobile-wizard-content')
+		//	.should('not.be.empty');
+		//cy.get('#tb_actionbar_item_mobile_wizard table')
+		//	.should('have.class', 'checked');
+	});
+});
+
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 18461d5b7..3b976c035 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -131,15 +131,6 @@ describe('Toolbar tests', function() {
 
 		cy.get('#tb_actionbar_item_mobile_wizard table')
 			.should('not.have.class', 'checked')
-
-		// Open mobile wizard again
-		cy.get('#tb_actionbar_item_mobile_wizard')
-			.click()
-
-		// Mobile wizard is opened and it has any content
-		// TODO: fix this bug
-		/*cy.get('#mobile-wizard-content')
-			.should('not.be.empty'); */
 	})
 
 	it('Open and close insertion mobile wizard by toolbar item.', function() {
commit 76c01fbe8268fae302c19ecde4080856a29063b4
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jan 17 17:42:23 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: mobile: Fix mobile wizard id.
    
    Change-Id: I171f98705e894f5a73afd7c92b489620f3bec4ac

diff --git a/cypress_test/integration_tests/mobile/focus_spec.js b/cypress_test/integration_tests/mobile/focus_spec.js
index 78bef645f..e960099f9 100644
--- a/cypress_test/integration_tests/mobile/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/focus_spec.js
@@ -107,7 +107,7 @@ describe('Focus tests', function() {
 		// Insert a field
 		cy.get('.ui-header.level-1.mobile-wizard.ui-widget .menu-entry-with-icon')
 			.contains('Page Number').click();
-		cy.get('#mobile_wizard').should('not.be.visible');
+		cy.get('#mobile-wizard').should('not.be.visible');
 
 		// This fails here: the focus is not on the document body
 		// The document should have the focus again
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 3ef580d3a..18461d5b7 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -127,8 +127,7 @@ describe('Toolbar tests', function() {
 			.click()
 
 		// Mobile wizard is closed
-		cy.get('#mobile_wizard')
-			.should('not.be.visible');
+		cy.get('#mobile-wizard').should('not.be.visible');
 
 		cy.get('#tb_actionbar_item_mobile_wizard table')
 			.should('not.have.class', 'checked')
@@ -165,8 +164,7 @@ describe('Toolbar tests', function() {
 			.click()
 
 		// Mobile wizard is closed
-		cy.get('#mobile_wizard')
-			.should('not.be.visible');
+		cy.get('#mobile-wizard').should('not.be.visible');
 
 		cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
 			.should('not.have.class', 'checked')
commit abac31d4feb85492c28ff182b10b649906ba46c6
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Jan 16 15:51:43 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Remove obsolete scripts.
    
    These were replaced by make commands.
    
    Change-Id: I98978b52801b44a36c09388cf5eb3ed5a09326c3

diff --git a/cypress_test/package.json b/cypress_test/package.json
index 70f7f46fe..fe33a789f 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -10,11 +10,5 @@
   "repository": {
     "type": "git",
     "url": "git://gerrit.libreoffice.org/online.git"
-  },
-  "scripts": {
-    "cyrun_desktop": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/desktop --headless",
-    "cyrun_mobile": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\" --headless",
-    "cyopen_desktop": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/desktop",
-    "cyopen_mobile": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\""
   }
 }
commit 58d99a8f6193ae8b7fbd87c7dd913d33711326da
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Jan 16 15:00:54 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: mobile: add some examples for testing focus.
    
    Change-Id: I63267bdd1d4b4db0d30da78c61b82c5d7d5535dc

diff --git a/cypress_test/integration_tests/mobile/focus_spec.js b/cypress_test/integration_tests/mobile/focus_spec.js
new file mode 100644
index 000000000..78bef645f
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/focus_spec.js
@@ -0,0 +1,117 @@
+/* global describe it cy Cypress beforeEach*/
+
+describe('Focus tests', function() {
+	beforeEach(function() {
+		// Get a clean test document
+		cy.task('copyFile', {
+			sourceDir: Cypress.env('DATA_FOLDER'),
+			destDir: Cypress.env('WORKDIR'),
+			fileName: 'empty.odt',
+		});
+
+		// Open test document
+		cy.viewport('iphone-3');
+		cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+			Cypress.env('WORKDIR') + 'empty.odt');
+
+		// Wait for the document to fully load
+		cy.get('.leaflet-tile-loaded');
+	})
+
+	it('Focus after document fully loaded.', function() {
+		// The document body should have the focus
+		cy.document().its('activeElement.tagName')
+			.should('be.eq', 'BODY')
+	})
+
+	it('Focus after closing a dialog.', function() {
+		// The document body has the focus first
+		cy.document().its('activeElement.tagName')
+			.should('be.eq', 'BODY')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Open comment insertion dialog
+		cy.get('#tb_actionbar_item_insertcomment')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		cy.get('.loleaflet-annotation-table').should('be.visible');
+
+		// The dialog grabs the focus
+		cy.document().its('activeElement.className')
+			.should('be.eq', 'loleaflet-annotation-textarea')
+
+		// Close the dialog
+		cy.contains('Cancel').click();
+		cy.get('.loleaflet-annotation-table').should('be.not.visible');
+
+		// The document should have the focus again
+		cy.document().its('activeElement.tagName')
+			.should('be.eq', 'BODY')
+	})
+
+	it('Focus when using insertion mobile wizard.', function() {
+		// The document body has the focus first
+		cy.document().its('activeElement.tagName')
+			.should('be.eq', 'BODY')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Open insertion mobile wizard
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+
+		// This fails here: the document still has the focus
+		// The wizard changes the focus
+		//cy.document().its('activeElement.className')
+		//	.should('be.eq', 'clipboard')
+
+		// Close the mobile wizard
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard').click()
+		cy.get('#mobile-wizard').should('not.be.visible');
+
+		// This fails here: the focus is not on the document body
+		// The document should have the focus again
+		//cy.document().its('activeElement.tagName')
+		//	.should('be.eq', 'BODY')
+	})
+
+	it('Focus after insertion.', function() {
+		// The document body has the focus first
+		cy.document().its('activeElement.tagName')
+			.should('be.eq', 'BODY')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Open insertion mobile wizard
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty')
+
+		// Select More Fields
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .sub-menu-title')
+			.contains('More Fields...')
+			.parent().click();
+
+		// Insert a field
+		cy.get('.ui-header.level-1.mobile-wizard.ui-widget .menu-entry-with-icon')
+			.contains('Page Number').click();
+		cy.get('#mobile_wizard').should('not.be.visible');
+
+		// This fails here: the focus is not on the document body
+		// The document should have the focus again
+		//cy.document().its('activeElement.tagName')
+		//	.should('be.eq', 'BODY')
+	})
+})
commit d5f698acd550aa9e2a9e542be9bacf20ccc9be41
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 15 15:27:30 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Don't run npm install unconditionally.
    
    Change-Id: I51ff6e7706075d15c213617fede89088499226ed

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 1e6b8ad46..fcb9b5201 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -10,30 +10,26 @@ MOBILE_DATA_FOLDER = ${abs_srcdir}/data/mobile/
 MOBILE_WORKDIR = ${abs_srcdir}/workdir/mobile/
 
 if HAVE_LO_PATH
-check-local: @JAILS_PATH@
-	@npm install
+check-local: @JAILS_PATH@ node_modules
 	$(call run_JS_error_check,$(abs_srcdir))
 	$(call start_loolwsd)
 	$(call run_desktop_tests)
 	$(call run_mobile_tests)
 	@pkill loolwsd || true
 
-check-desktop: @JAILS_PATH@
-	@npm install
+check-desktop: @JAILS_PATH@ node_modules
 	$(call run_JS_error_check,$(abs_srcdir)/integration_tests/desktop)
 	$(call start_loolwsd)
 	$(call run_desktop_tests,$(spec))
 	@pkill loolwsd || true
 
-check-mobile: @JAILS_PATH@
-	@npm install
+check-mobile: @JAILS_PATH@ node_modules
 	$(call run_JS_error_check,$(abs_srcdir)/integration_tests/mobile)
 	$(call start_loolwsd)
 	$(call run_mobile_tests,$(spec))
 	@pkill loolwsd || true
 
-run-desktop: @JAILS_PATH@
-	@npm install
+run-desktop: @JAILS_PATH@ node_modules
 	$(call start_loolwsd)
 	@echo
 	@echo "Open cypress with desktop tests..."
@@ -43,8 +39,7 @@ run-desktop: @JAILS_PATH@
 			|| true
 	@pkill loolwsd || true
 
-run-mobile: @JAILS_PATH@
-	@npm install
+run-mobile: @JAILS_PATH@ node_modules
 	$(call start_loolwsd)
 	@echo
 	@echo "Open cypress with mobile tests..."
@@ -102,6 +97,10 @@ define run_mobile_tests
 			|| (pkill loolwsd && false)
 endef
 
+node_modules:
+	@npm install
+	@touch node_modules
+
 endif
 
 clean-local:
commit a410b54c47c819aa0cc7530ff2bc7a71b3576868
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 15 14:55:03 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Introduce more make rules to make easier to run tests.
    
    Change-Id: Ic8ae881864ae931fe6abed73a6a6086d6e0e591d

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 529939da9..1e6b8ad46 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -1,13 +1,18 @@
 CYPRESS_BINARY = ${abs_srcdir}/node_modules/cypress/bin/cypress
 
 DESKTOP_TEST_FOLDER = integration_tests/desktop
-MOBILE_TEST_FOLDER = integration_tests/mobile
+DESKTOP_DATA_FOLDER = ${abs_srcdir}/data/desktop/
+DESKTOP_WORKDIR = ${abs_srcdir}/workdir/desktop/
+
 MOBILE_USER_AGENT = "cypress mobile test"
+MOBILE_TEST_FOLDER = integration_tests/mobile
+MOBILE_DATA_FOLDER = ${abs_srcdir}/data/mobile/
+MOBILE_WORKDIR = ${abs_srcdir}/workdir/mobile/
 
 if HAVE_LO_PATH
 check-local: @JAILS_PATH@
 	@npm install
-	$(call run_JS_error_check)
+	$(call run_JS_error_check,$(abs_srcdir))
 	$(call start_loolwsd)
 	$(call run_desktop_tests)
 	$(call run_mobile_tests)
@@ -15,28 +20,51 @@ check-local: @JAILS_PATH@
 
 check-desktop: @JAILS_PATH@
 	@npm install
-	$(call run_JS_error_check)
+	$(call run_JS_error_check,$(abs_srcdir)/integration_tests/desktop)
 	$(call start_loolwsd)
-	$(call run_desktop_tests)
+	$(call run_desktop_tests,$(spec))
 	@pkill loolwsd || true
 
 check-mobile: @JAILS_PATH@
 	@npm install
-	$(call run_JS_error_check)
+	$(call run_JS_error_check,$(abs_srcdir)/integration_tests/mobile)
 	$(call start_loolwsd)
-	$(call run_mobile_tests)
+	$(call run_mobile_tests,$(spec))
+	@pkill loolwsd || true
+
+run-desktop: @JAILS_PATH@
+	@npm install
+	$(call start_loolwsd)
+	@echo
+	@echo "Open cypress with desktop tests..."
+	@echo
+	$(CYPRESS_BINARY) open --config integrationFolder=$(DESKTOP_TEST_FOLDER) \
+			--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR) \
+			|| true
+	@pkill loolwsd || true
+
+run-mobile: @JAILS_PATH@
+	@npm install
+	$(call start_loolwsd)
+	@echo
+	@echo "Open cypress with mobile tests..."
+	@echo
+	$(CYPRESS_BINARY) open --config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
+			--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR) \
+			|| true
 	@pkill loolwsd || true
 
 define run_JS_error_check
-	@echo "Checking for cypress JS errors..."
-	@NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(abs_srcdir) \
+	@echo "Checking for JS errors in the next folder..."
+	@echo $(1)
+	@NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(1) \
 		--ignore-path $(abs_srcdir)/.eslintignore --config $(abs_top_srcdir)/loleaflet/.eslintrc
 	@echo
 endef
 
 define start_loolwsd
 	@pkill loolwsd || true
-	@echo "Launching loolwsd for testing.."
+	@echo "Launching loolwsd for testing..."
 	@fc-cache "@LO_PATH@"/share/fonts/truetype
 	@echo
 	../loolwsd --o:sys_template_path="@SYSTEMPLATE_PATH@" \
@@ -57,8 +85,9 @@ define run_desktop_tests
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(DESKTOP_TEST_FOLDER) \
 			--headless \
-			--env DATA_FOLDER=$(abs_srcdir)/data/desktop/,WORKDIR=$(abs_srcdir)/workdir/desktop/ || \
-			(pkill loolwsd && false)
+			--env DATA_FOLDER=$(DESKTOP_DATA_FOLDER),WORKDIR=$(DESKTOP_WORKDIR) \
+			$(if $(1), --spec=integration_tests/desktop/$(1)) \
+			|| (pkill loolwsd && false)
 endef
 
 define run_mobile_tests
@@ -68,8 +97,9 @@ define run_mobile_tests
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
 			--headless \
-			--env DATA_FOLDER=$(abs_srcdir)/data/mobile/,WORKDIR=$(abs_srcdir)/workdir/mobile/ || \
-			(pkill loolwsd && false)
+			--env DATA_FOLDER=$(MOBILE_DATA_FOLDER),WORKDIR=$(MOBILE_WORKDIR) \
+			$(if $(1), --spec=integration_tests/mobile/$(1)) \
+			|| (pkill loolwsd && false)
 endef
 
 endif
diff --git a/cypress_test/README b/cypress_test/README
index c5841b9dc..0bc100241 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -10,13 +10,9 @@ cypress_test folder to run cypress tests only.
 
     make check
 
-To run cypress test cases selectively, you need to start loolwsd
-server first. To do that you can call make run on a separate
-command line window, so LibreOffice online is started.
-
-After the server is running you can execute the tests,
-calling the given run command. You need to run the
-command under cypress_test\ folder.
+To run cypress test cases selectively, you need to
+go in to the cypress_test folder first and run one of
+the following commands.
 
 To run all desktop tests:
 
@@ -28,11 +24,11 @@ To run all mobile tests:
 
 To run one specific test suit of desktop tests:
 
-    npm run cyrun_desktop --spec example_desktop_test_spec.js
+    make check-desktop spec=example_desktop_test_spec.js
 
 To run one specific test suit of mobile tests:
 
-    npm run cyrun_mobile --spec toolbar_spec.js
+    make check-mobile spec=toolbar_spec.js
 
 You can also open cypress tests in the browser, so you can
 check what happens during test run. It's useful for writing
@@ -40,11 +36,11 @@ new tests or checking why an existing test fails.
 
 To open desktop tests in browser:
 
-    npm run cyopen_desktop
+    make run-desktop
 
 To open mobile tests in browser:
 
-    npm run cyopen_mobile
+    make run-mobile
 
 During the build we run the tests with Chrome browser, so make sure
 you select Chrome browser on the GUI while checking tests.
commit 545f3f943167e9220b0710a415c1e9c330ab1f79
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 19:37:17 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Introduce make rules for running group of tests.
    
    It can handle dependencies and can use environment
    variables.
    
    Change-Id: Ib386cb7019d85b3dbd6c28417b3a481944b18aca

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 5af4c338e..529939da9 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -7,11 +7,34 @@ MOBILE_USER_AGENT = "cypress mobile test"
 if HAVE_LO_PATH
 check-local: @JAILS_PATH@
 	@npm install
-	@echo "Checking for loleaflet JS errors..."
-	@NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(abs_srcdir) \
-			--ignore-path $(abs_srcdir)/.eslintignore --config $(abs_top_srcdir)/loleaflet/.eslintrc
+	$(call run_JS_error_check)
+	$(call start_loolwsd)
+	$(call run_desktop_tests)
+	$(call run_mobile_tests)
+	@pkill loolwsd || true
+
+check-desktop: @JAILS_PATH@
+	@npm install
+	$(call run_JS_error_check)
+	$(call start_loolwsd)
+	$(call run_desktop_tests)
+	@pkill loolwsd || true
+
+check-mobile: @JAILS_PATH@
+	@npm install
+	$(call run_JS_error_check)
+	$(call start_loolwsd)
+	$(call run_mobile_tests)
+	@pkill loolwsd || true
 
+define run_JS_error_check
+	@echo "Checking for cypress JS errors..."
+	@NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(abs_srcdir) \
+		--ignore-path $(abs_srcdir)/.eslintignore --config $(abs_top_srcdir)/loleaflet/.eslintrc
 	@echo
+endef
+
+define start_loolwsd
 	@pkill loolwsd || true
 	@echo "Launching loolwsd for testing.."
 	@fc-cache "@LO_PATH@"/share/fonts/truetype
@@ -25,6 +48,10 @@ check-local: @JAILS_PATH@
 			--o:logging.file[@enable]=true --o:logging.level=trace > /dev/null 2>&1 &
 	@sleep 10
 	@echo
+endef
+
+define run_desktop_tests
+	@echo
 	@echo "Running cypress desktop tests..."
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
@@ -32,6 +59,9 @@ check-local: @JAILS_PATH@
 			--headless \
 			--env DATA_FOLDER=$(abs_srcdir)/data/desktop/,WORKDIR=$(abs_srcdir)/workdir/desktop/ || \
 			(pkill loolwsd && false)
+endef
+
+define run_mobile_tests
 	@echo
 	@echo "Running cypress mobile tests..."
 	@echo
@@ -40,7 +70,8 @@ check-local: @JAILS_PATH@
 			--headless \
 			--env DATA_FOLDER=$(abs_srcdir)/data/mobile/,WORKDIR=$(abs_srcdir)/workdir/mobile/ || \
 			(pkill loolwsd && false)
-	@pkill loolwsd || true
+endef
+
 endif
 
 clean-local:
diff --git a/cypress_test/README b/cypress_test/README
index 86f1c77b2..c5841b9dc 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -20,11 +20,11 @@ command under cypress_test\ folder.
 
 To run all desktop tests:
 
-    npm run cyrun_desktop
+    make check-desktop
 
 To run all mobile tests:
 
-    npm run cyrun_mobile
+    make check-mobile
 
 To run one specific test suit of desktop tests:
 
commit d413d55f91cab2baa51cd34e785b6a8fbbb6bf45
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 19:14:18 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Use eslint to check coding conventions during build.
    
    Use loleaflet's config file to have the same
    conventions under cypress_test folder too.
    Update test code to pass esling check.
    
    Change-Id: Iade932e6d3cd8941b5fc0897c56c68d2493f0dce

diff --git a/cypress_test/.eslintignore b/cypress_test/.eslintignore
new file mode 100644
index 000000000..308b8fdc1
--- /dev/null
+++ b/cypress_test/.eslintignore
@@ -0,0 +1,2 @@
+# We only directly edit toolbar.js in dist/
+**/cypress
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index cbee18e7d..5af4c338e 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -1,4 +1,4 @@
-CYPRESS_BINARY = ${top_srcdir}/cypress_test/node_modules/cypress/bin/cypress
+CYPRESS_BINARY = ${abs_srcdir}/node_modules/cypress/bin/cypress
 
 DESKTOP_TEST_FOLDER = integration_tests/desktop
 MOBILE_TEST_FOLDER = integration_tests/mobile
@@ -7,6 +7,10 @@ MOBILE_USER_AGENT = "cypress mobile test"
 if HAVE_LO_PATH
 check-local: @JAILS_PATH@
 	@npm install
+	@echo "Checking for loleaflet JS errors..."
+	@NODE_PATH=$(abs_srcdir)/node_modules $(NODE) node_modules/eslint/bin/eslint.js $(abs_srcdir) \
+			--ignore-path $(abs_srcdir)/.eslintignore --config $(abs_top_srcdir)/loleaflet/.eslintrc
+
 	@echo
 	@pkill loolwsd || true
 	@echo "Launching loolwsd for testing.."
@@ -26,7 +30,7 @@ check-local: @JAILS_PATH@
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(DESKTOP_TEST_FOLDER) \
 			--headless \
-			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/desktop/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/desktop/ || \
+			--env DATA_FOLDER=$(abs_srcdir)/data/desktop/,WORKDIR=$(abs_srcdir)/workdir/desktop/ || \
 			(pkill loolwsd && false)
 	@echo
 	@echo "Running cypress mobile tests..."
@@ -34,7 +38,7 @@ check-local: @JAILS_PATH@
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
 			--headless \
-			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/mobile/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/mobile/ || \
+			--env DATA_FOLDER=$(abs_srcdir)/data/mobile/,WORKDIR=$(abs_srcdir)/workdir/mobile/ || \
 			(pkill loolwsd && false)
 	@pkill loolwsd || true
 endif
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
index c09604996..8a39b455f 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -1,37 +1,39 @@
+/* global describe it cy Cypress */
+
 describe('Example test suit 1', function() {
-  it('Example test case 1', function() {
-    // Get a clean test document
-    cy.task('copyFile', {
-      source_dir: Cypress.env('DATA_FOLDER'),
-      dest_dir: Cypress.env('WORKDIR'),
-      file_name: 'simple.odt',
-    });
+	it('Example test case 1', function() {
+		// Get a clean test document
+		cy.task('copyFile', {
+			sourceDir: Cypress.env('DATA_FOLDER'),
+			destDir: Cypress.env('WORKDIR'),
+			fileName: 'simple.odt',
+		});
 
-    // Open test document
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
-      Cypress.env('WORKDIR') + 'simple.odt')
+		// Open test document
+		cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+		Cypress.env('WORKDIR') + 'simple.odt')
 
-    // Wait for the document to fully load
-    cy.get('.leaflet-tile-loaded')
+		// Wait for the document to fully load
+		cy.get('.leaflet-tile-loaded')
 
-    // Select a text
-    cy.get('#document-container').dblclick()
-    cy.get(".leaflet-marker-icon")
+		// Select a text
+		cy.get('#document-container').dblclick()
+		cy.get('.leaflet-marker-icon')
 
-    // Click on bold toolbar button
-    cy.get('#tb_editbar_item_bold').click()
+		// Click on bold toolbar button
+		cy.get('#tb_editbar_item_bold').click()
 
-    // Remove selection and do a reselection
-    cy.get('#document-container').click()
-    cy.get('.leaflet-marker-icon').should('not.be.visible');
+		// Remove selection and do a reselection
+		cy.get('#document-container').click()
+		cy.get('.leaflet-marker-icon').should('not.be.visible');
 
-    cy.get('#document-container').dblclick()
-    cy.get(".leaflet-marker-icon")
+		cy.get('#document-container').dblclick()
+		cy.get('.leaflet-marker-icon')
 
-    // Bold toolbar button is checked
-    cy.get('#tb_editbar_item_bold table.w2ui-button.checked')
+		// Bold toolbar button is checked
+		cy.get('#tb_editbar_item_bold table.w2ui-button.checked')
 
-    // Click on bold toolbar button
-    cy.get('#tb_editbar_item_bold').click()
-  })
+		// Click on bold toolbar button
+		cy.get('#tb_editbar_item_bold').click()
+	})
 })
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
index 63a9a43ca..163a28c84 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -1,37 +1,39 @@
+/* global describe it cy Cypress */
+
 describe('Example test suit 2', function() {
-  it('Example test case 1', function() {
-    // Get a clean test document
-    cy.task('copyFile', {
-      source_dir: Cypress.env('DATA_FOLDER'),
-      dest_dir: Cypress.env('WORKDIR'),
-      file_name: 'simple.odt',
-    });
+	it('Example test case 1', function() {
+		// Get a clean test document
+		cy.task('copyFile', {
+			sourceDir: Cypress.env('DATA_FOLDER'),
+			destDir: Cypress.env('WORKDIR'),
+			fileName: 'simple.odt',
+		});
 
-    // Open test document
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
-      Cypress.env('WORKDIR') + 'simple.odt')
+		// Open test document
+		cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+			Cypress.env('WORKDIR') + 'simple.odt')
 
-    // Wait for the document to fully load
-    cy.get('.leaflet-tile-loaded')
+		// Wait for the document to fully load
+		cy.get('.leaflet-tile-loaded')
 
-    // Select a text
-    cy.get('#document-container').dblclick()
-    cy.get(".leaflet-marker-icon")
+		// Select a text
+		cy.get('#document-container').dblclick()
+		cy.get('.leaflet-marker-icon')
 
-    // Click on bold toolbar button
-    cy.get('#tb_editbar_item_italic').click()
+		// Click on bold toolbar button
+		cy.get('#tb_editbar_item_italic').click()
 
-    // Remove selection and do a reselection
-    cy.get('#document-container').click()
-    cy.get('.leaflet-marker-icon').should('not.be.visible');
+		// Remove selection and do a reselection
+		cy.get('#document-container').click()
+		cy.get('.leaflet-marker-icon').should('not.be.visible');
 
-    cy.get('#document-container').dblclick()
-    cy.get(".leaflet-marker-icon")
+		cy.get('#document-container').dblclick()
+		cy.get('.leaflet-marker-icon')
 
-    // Bold toolbar button is checked
-    cy.get('#tb_editbar_item_italic table.w2ui-button.checked')
+		// Bold toolbar button is checked
+		cy.get('#tb_editbar_item_italic table.w2ui-button.checked')
 
-    // Click on bold toolbar button
-    cy.get('#tb_editbar_item_italic').click()
-  })
+		// Click on bold toolbar button
+		cy.get('#tb_editbar_item_italic').click()
+	})
 })
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index a7df48fa4..3ef580d3a 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -1,201 +1,203 @@
+/* global describe it cy Cypress beforeEach*/
+
 describe('Toolbar tests', function() {
-  beforeEach(function() {
-    // Get a clean test document
-    cy.task('copyFile', {
-      source_dir: Cypress.env('DATA_FOLDER'),
-      dest_dir: Cypress.env('WORKDIR'),
-      file_name: 'empty.odt',
-    });
-
-    // Open test document
-    cy.viewport('iphone-3')
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
-      Cypress.env('WORKDIR') + 'empty.odt')
-
-    // Wait for the document to fully load
-    cy.get('.leaflet-tile-loaded')
-  });
-
-  it('State of mobile wizard toolbar item.', function() {
-    // Mobile wizard toolbar button is disabled by default
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .should('have.class', 'disabled')
-
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Button should be enabled now
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .should('not.have.class', 'disabled')
-  })
-
-  it('State of insertion mobile wizard toolbar item.', function() {
-    // Insertion mobile wizard toolbar button is disabled by default
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-      .should('have.class', 'disabled')
-
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Button should be enabled now
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-      .should('not.have.class', 'disabled')
-  })
-
-  it('State of insert comment toolbar item.', function() {
-    // Insertion mobile wizard toolbar button is disabled by default
-    cy.get('#tb_actionbar_item_insertcomment')
-      .should('have.class', 'disabled')
-
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Button should be enabled now
-    cy.get('#tb_actionbar_item_insertcomment')
-      .should('not.have.class', 'disabled')
-  })
-
-  it('State of undo toolbar item.', function() {
-    // Insertion mobile wizard toolbar button is disabled by default
-    cy.get('#tb_actionbar_item_undo')
-      .should('have.class', 'disabled')
-
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Button should be still disabled
-    cy.get('#tb_actionbar_item_undo')
-      .should('have.class', 'disabled')
-
-    // Type somthing in the document
-    cy.get('#document-container').type("x")
-
-    // Button should become enabled
-    cy.get('#tb_actionbar_item_undo')
-      .should('not.have.class', 'disabled')
-  })
-
-  it('State of redo toolbar item.', function() {
-    // Insertion mobile wizard toolbar button is disabled by default
-    cy.get('#tb_actionbar_item_redo')
-      .should('have.class', 'disabled')
-
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Button should be still disabled
-    cy.get('#tb_actionbar_item_redo')
-      .should('have.class', 'disabled')
-
-    // Type somthing in the document
-    cy.get('#document-container').type("x")
-
-    // Button should be still disabled
-    cy.get('#tb_actionbar_item_redo')
-      .should('have.class', 'disabled')
-
-    // Do an undo
-    cy.get('#tb_actionbar_item_undo')
-      .should('not.have.class', 'disabled')
-    cy.get('#tb_actionbar_item_undo').click()
-
-    // Button should become enabled
-    cy.get('#tb_actionbar_item_redo')
-      .should('not.have.class', 'disabled')
-  })
-
-  it('Open and close mobile wizard by toolbar item.', function() {
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Click on mobile wizard toolbar item
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .should('not.have.class', 'disabled')
-      .click()
-
-    // Mobile wizard is opened and it has any content
-    cy.get('#mobile-wizard-content')
-      .should('not.be.empty');
-
-    // Toolbar button is checked
-    cy.get('#tb_actionbar_item_mobile_wizard table')
-      .should('have.class', 'checked')
-
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .click()
-
-    // Mobile wizard is closed
-    cy.get('#mobile_wizard')
-      .should('not.be.visible');
-
-    cy.get('#tb_actionbar_item_mobile_wizard table')
-      .should('not.have.class', 'checked')
-
-    // Open mobile wizard again
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .click()
-
-    // Mobile wizard is opened and it has any content
-    // TODO: fix this bug
-    /*cy.get('#mobile-wizard-content')
-      .should('not.be.empty'); */
-  })
-
-  it('Open and close insertion mobile wizard by toolbar item.', function() {
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Click on toolbar item
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-      .should('not.have.class', 'disabled')
-      .click()
-
-    // Mobile wizard is opened and it has any content
-    cy.get('#mobile-wizard-content')
-      .should('not.be.empty');
-
-    // Toolbar button is checked
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
-      .should('have.class', 'checked')
-
-    // Click on toolbar item again
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-      .click()
-
-    // Mobile wizard is closed
-    cy.get('#mobile_wizard')
-      .should('not.be.visible');
-
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
-      .should('not.have.class', 'checked')
-
-    // Open mobile wizard again
-    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
-      .click()
-
-    // Mobile wizard is opened and it has any content
-    cy.get('#mobile-wizard-content')
-      .should('not.be.empty');
-  })
-
-  it('Open insert comment dialog by toolbar item.', function() {
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Click on toolbar item
-    cy.get('#tb_actionbar_item_insertcomment')
-      .should('not.have.class', 'disabled')
-      .click()
-
-    // Comment insertion dialog is opened
-    cy.get('.loleaflet-annotation-table')
-      .should('be.visible');
-
-    // Close the dialog
-    cy.contains('Cancel')
-      .click()
-
-    cy.get('.loleaflet-annotation-table')
-      .should('be.not.visible');
-  })
+	beforeEach(function() {
+		// Get a clean test document
+		cy.task('copyFile', {
+			sourceDir: Cypress.env('DATA_FOLDER'),
+			destDir: Cypress.env('WORKDIR'),
+			fileName: 'empty.odt',
+		});
+
+		// Open test document
+		cy.viewport('iphone-3')
+		cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+			Cypress.env('WORKDIR') + 'empty.odt')
+
+		// Wait for the document to fully load
+		cy.get('.leaflet-tile-loaded')
+	});
+
+	it('State of mobile wizard toolbar item.', function() {
+		// Mobile wizard toolbar button is disabled by default
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('have.class', 'disabled')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Button should be enabled now
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+	})
+
+	it('State of insertion mobile wizard toolbar item.', function() {
+		// Insertion mobile wizard toolbar button is disabled by default
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('have.class', 'disabled')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Button should be enabled now
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('not.have.class', 'disabled')
+	})
+
+	it('State of insert comment toolbar item.', function() {
+		// Insertion mobile wizard toolbar button is disabled by default
+		cy.get('#tb_actionbar_item_insertcomment')
+			.should('have.class', 'disabled')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Button should be enabled now
+		cy.get('#tb_actionbar_item_insertcomment')
+			.should('not.have.class', 'disabled')
+	})
+
+	it('State of undo toolbar item.', function() {
+		// Insertion mobile wizard toolbar button is disabled by default
+		cy.get('#tb_actionbar_item_undo')
+			.should('have.class', 'disabled')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Button should be still disabled
+		cy.get('#tb_actionbar_item_undo')
+			.should('have.class', 'disabled')
+
+		// Type somthing in the document
+		cy.get('#document-container').type('x')
+
+		// Button should become enabled
+		cy.get('#tb_actionbar_item_undo')
+			.should('not.have.class', 'disabled')
+	})
+
+	it('State of redo toolbar item.', function() {
+		// Insertion mobile wizard toolbar button is disabled by default
+		cy.get('#tb_actionbar_item_redo')
+			.should('have.class', 'disabled')
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Button should be still disabled
+		cy.get('#tb_actionbar_item_redo')
+			.should('have.class', 'disabled')
+
+		// Type somthing in the document
+		cy.get('#document-container').type('x')
+
+		// Button should be still disabled
+		cy.get('#tb_actionbar_item_redo')
+			.should('have.class', 'disabled')
+
+		// Do an undo
+		cy.get('#tb_actionbar_item_undo')
+			.should('not.have.class', 'disabled')
+		cy.get('#tb_actionbar_item_undo').click()
+
+		// Button should become enabled
+		cy.get('#tb_actionbar_item_redo')
+			.should('not.have.class', 'disabled')
+	})
+
+	it('Open and close mobile wizard by toolbar item.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Click on mobile wizard toolbar item
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click()
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+
+		// Toolbar button is checked
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('have.class', 'checked')
+
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click()
+
+		// Mobile wizard is closed
+		cy.get('#mobile_wizard')
+			.should('not.be.visible');
+
+		cy.get('#tb_actionbar_item_mobile_wizard table')
+			.should('not.have.class', 'checked')
+
+		// Open mobile wizard again
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click()
+
+		// Mobile wizard is opened and it has any content
+		// TODO: fix this bug
+		/*cy.get('#mobile-wizard-content')
+			.should('not.be.empty'); */
+	})
+
+	it('Open and close insertion mobile wizard by toolbar item.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Click on toolbar item
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click()
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+
+		// Toolbar button is checked
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+			.should('have.class', 'checked')
+
+		// Click on toolbar item again
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.click()
+
+		// Mobile wizard is closed
+		cy.get('#mobile_wizard')
+			.should('not.be.visible');
+
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+			.should('not.have.class', 'checked')
+
+		// Open mobile wizard again
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.click()
+
+		// Mobile wizard is opened and it has any content
+		cy.get('#mobile-wizard-content')
+			.should('not.be.empty');
+	})
+
+	it('Open insert comment dialog by toolbar item.', function() {
+		// Click on edit button
+		cy.get('#mobile-edit-button').click()
+
+		// Click on toolbar item
+		cy.get('#tb_actionbar_item_insertcomment')
+			.should('not.have.class', 'disabled')
+			.click()
+
+		// Comment insertion dialog is opened
+		cy.get('.loleaflet-annotation-table')
+			.should('be.visible');
+
+		// Close the dialog
+		cy.contains('Cancel')
+			.click()
+
+		cy.get('.loleaflet-annotation-table')
+			.should('be.not.visible');
+	})
 })
diff --git a/cypress_test/package.json b/cypress_test/package.json
index 7bc27e046..70f7f46fe 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -4,7 +4,8 @@
   "description": "Cypress integration test suit",
   "license": "MPL-2.0",
   "dependencies": {
-    "cypress": "3.8.1"
+    "cypress": "3.8.1",
+    "eslint": "6.8.0"
   },
   "repository": {
     "type": "git",
diff --git a/cypress_test/plugins/index.js b/cypress_test/plugins/index.js
index 60070efcb..8bf86dcba 100644
--- a/cypress_test/plugins/index.js
+++ b/cypress_test/plugins/index.js
@@ -1,10 +1,13 @@
-const tasks = require('./tasks');
+/* global require */
 
-module.exports = (on, config) => {
-  // `on` is used to hook into various events Cypress emits
-  on('task', {
-    copyFile: tasks.copyFile,
-  });
+var tasks = require('./tasks');
 
-  return config;
-};
+function plugin(on, config) {
+	on('task', {
+		copyFile: tasks.copyFile
+	});
+
+	return config;
+}
+
+module.exports = plugin;
diff --git a/cypress_test/plugins/tasks.js b/cypress_test/plugins/tasks.js
index 2488d610c..1f2f52a53 100644
--- a/cypress_test/plugins/tasks.js
+++ b/cypress_test/plugins/tasks.js
@@ -1,16 +1,19 @@
-const fs = require('fs');
+/* global require Promise */
 
-const copyFile = args =>
-  new Promise(resolve => {
-    var source_file = args.source_dir + args.file_name
-    var dest_file = args.dest_dir + args.file_name
+var fs = require('fs');
 
-    if (fs.existsSync(source_file)) {
-      fs.mkdirSync(args.dest_dir, { recursive: true });
-      fs.writeFileSync(dest_file, fs.readFileSync(source_file));
-      resolve(`File ${source_file} copied to ${dest_file}`);
-    }
-    resolve(`File ${source_file} does not exist`);
-  });
+function copyFile(args) {
+	return new Promise(function(resolve) {
+		var sourceFile = args.sourceDir + args.fileName;
+		var destFile = args.destDir + args.fileName;
 
-module.exports = { copyFile };
+		if (fs.existsSync(sourceFile)) {
+			fs.mkdirSync(args.destDir, { recursive: true });
+			fs.writeFileSync(destFile, fs.readFileSync(sourceFile));
+			resolve('File ${sourceFile} copied to ${destFile}');
+		}
+		resolve('File ${sourceFile} does not exist');
+	});
+}
+
+module.exports.copyFile = copyFile;
commit d614865b46c10fd2893f711a42f529644899fadf
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 18:19:09 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Move general cypress options to cypress.json
    
    Change-Id: Iad6263f31ec9ef813424e4aab673c2ade1f7f3e5

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 4efdfea24..cbee18e7d 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -24,7 +24,7 @@ check-local: @JAILS_PATH@
 	@echo "Running cypress desktop tests..."
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
-			--config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false,pluginsFile=plugins/index.js \
+			--config integrationFolder=$(DESKTOP_TEST_FOLDER) \
 			--headless \
 			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/desktop/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/desktop/ || \
 			(pkill loolwsd && false)
@@ -32,7 +32,7 @@ check-local: @JAILS_PATH@
 	@echo "Running cypress mobile tests..."
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
-			--config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT),pluginsFile=plugins/index.js \
+			--config integrationFolder=$(MOBILE_TEST_FOLDER),userAgent=$(MOBILE_USER_AGENT) \
 			--headless \
 			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/mobile/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/mobile/ || \
 			(pkill loolwsd && false)
@@ -43,3 +43,4 @@ clean-local:
 	rm -rf node_modules
 	rm -rf workdir
 	rm -rf cypress
+	rm -rf package-lock.json
diff --git a/cypress_test/cypress.json b/cypress_test/cypress.json
index 92401d400..c4e304f82 100644
--- a/cypress_test/cypress.json
+++ b/cypress_test/cypress.json
@@ -1,3 +1,5 @@
 {
-    "integrationFolder": "integration_tests"
+    "integrationFolder" : "integration_tests",
+    "video" : false,
+    "pluginsFile" : "plugins/index.js"
 }
commit eb47f78824cd6609914d1d681946d30aa71aa7ab
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 18:14:23 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Move plugins folder out of cypress subfolder
    
    Change-Id: Ia3a9a58b7f7e5e64c1e2f4211b75a33bbbb00c0e

diff --git a/cypress_test/.gitignore b/cypress_test/.gitignore
index 007b3cfbe..3e5e8dbd2 100644
--- a/cypress_test/.gitignore
+++ b/cypress_test/.gitignore
@@ -1,8 +1,4 @@
 node_modules
-cypress/fixtures
-cypress/integration
-cypress/screenshots
-cypress/support
-cypress/videos
+cypress
 package-lock.json
 workdir
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 4a6e77930..4efdfea24 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -24,7 +24,7 @@ check-local: @JAILS_PATH@
 	@echo "Running cypress desktop tests..."
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
-			--config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false \
+			--config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false,pluginsFile=plugins/index.js \
 			--headless \
 			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/desktop/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/desktop/ || \
 			(pkill loolwsd && false)
@@ -32,7 +32,7 @@ check-local: @JAILS_PATH@
 	@echo "Running cypress mobile tests..."
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
-			--config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) \
+			--config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT),pluginsFile=plugins/index.js \
 			--headless \
 			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/mobile/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/mobile/ || \
 			(pkill loolwsd && false)
@@ -42,8 +42,4 @@ endif
 clean-local:
 	rm -rf node_modules
 	rm -rf workdir
-	rm -rf cypress/fixtures
-	rm -rf cypress/integration
-	rm -rf cypress/screenshots
-	rm -rf cypress/support
-	rm -rf cypress/videos
+	rm -rf cypress
diff --git a/cypress_test/cypress/plugins/index.js b/cypress_test/plugins/index.js
similarity index 100%
rename from cypress_test/cypress/plugins/index.js
rename to cypress_test/plugins/index.js
diff --git a/cypress_test/cypress/plugins/tasks.js b/cypress_test/plugins/tasks.js
similarity index 100%
rename from cypress_test/cypress/plugins/tasks.js
rename to cypress_test/plugins/tasks.js
commit aab8b4ada65c58667019dcf80ba79f9c071241a3
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 18:08:51 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Always create a copy of the test document.
    
    Before test execution. So the modifications won't
    change the test documents.
    
    Change-Id: I1b04fe96e8182033d44aeeaa3a7632dd81031a05

diff --git a/cypress_test/.gitignore b/cypress_test/.gitignore
index 27d395a6a..007b3cfbe 100644
--- a/cypress_test/.gitignore
+++ b/cypress_test/.gitignore
@@ -1,3 +1,8 @@
 node_modules
-cypress/
+cypress/fixtures
+cypress/integration
+cypress/screenshots
+cypress/support
+cypress/videos
 package-lock.json
+workdir
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index ec992c254..4a6e77930 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -26,7 +26,7 @@ check-local: @JAILS_PATH@
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false \
 			--headless \
-			--env TEST_DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/desktop/ || \
+			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/desktop/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/desktop/ || \
 			(pkill loolwsd && false)
 	@echo
 	@echo "Running cypress mobile tests..."
@@ -34,11 +34,16 @@ check-local: @JAILS_PATH@
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) \
 			--headless \
-			--env TEST_DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/mobile/ || \
+			--env DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/mobile/,WORKDIR=$(abs_top_srcdir)/cypress_test/workdir/mobile/ || \
 			(pkill loolwsd && false)
 	@pkill loolwsd || true
 endif
 
 clean-local:
 	rm -rf node_modules
-	rm -rf cypress
+	rm -rf workdir
+	rm -rf cypress/fixtures
+	rm -rf cypress/integration
+	rm -rf cypress/screenshots
+	rm -rf cypress/support
+	rm -rf cypress/videos
diff --git a/cypress_test/cypress/plugins/index.js b/cypress_test/cypress/plugins/index.js
new file mode 100644
index 000000000..60070efcb
--- /dev/null
+++ b/cypress_test/cypress/plugins/index.js
@@ -0,0 +1,10 @@
+const tasks = require('./tasks');
+
+module.exports = (on, config) => {
+  // `on` is used to hook into various events Cypress emits
+  on('task', {
+    copyFile: tasks.copyFile,
+  });
+
+  return config;
+};
diff --git a/cypress_test/cypress/plugins/tasks.js b/cypress_test/cypress/plugins/tasks.js
new file mode 100644
index 000000000..2488d610c
--- /dev/null
+++ b/cypress_test/cypress/plugins/tasks.js
@@ -0,0 +1,16 @@
+const fs = require('fs');
+
+const copyFile = args =>
+  new Promise(resolve => {
+    var source_file = args.source_dir + args.file_name
+    var dest_file = args.dest_dir + args.file_name
+
+    if (fs.existsSync(source_file)) {
+      fs.mkdirSync(args.dest_dir, { recursive: true });
+      fs.writeFileSync(dest_file, fs.readFileSync(source_file));
+      resolve(`File ${source_file} copied to ${dest_file}`);
+    }
+    resolve(`File ${source_file} does not exist`);
+  });
+
+module.exports = { copyFile };
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
index d8b4f52a4..c09604996 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -1,8 +1,15 @@
 describe('Example test suit 1', function() {
   it('Example test case 1', function() {
+    // Get a clean test document
+    cy.task('copyFile', {
+      source_dir: Cypress.env('DATA_FOLDER'),
+      dest_dir: Cypress.env('WORKDIR'),
+      file_name: 'simple.odt',
+    });
+
     // Open test document
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
-      Cypress.env('TEST_DATA_FOLDER') + 'simple.odt')
+      Cypress.env('WORKDIR') + 'simple.odt')
 
     // Wait for the document to fully load
     cy.get('.leaflet-tile-loaded')
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
index 37ffc5dc6..63a9a43ca 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -1,8 +1,15 @@
 describe('Example test suit 2', function() {
   it('Example test case 1', function() {
+    // Get a clean test document
+    cy.task('copyFile', {
+      source_dir: Cypress.env('DATA_FOLDER'),
+      dest_dir: Cypress.env('WORKDIR'),
+      file_name: 'simple.odt',
+    });
+
     // Open test document
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
-      Cypress.env('TEST_DATA_FOLDER') + 'simple.odt')
+      Cypress.env('WORKDIR') + 'simple.odt')
 
     // Wait for the document to fully load
     cy.get('.leaflet-tile-loaded')
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 8dc950dd9..a7df48fa4 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -1,9 +1,16 @@
 describe('Toolbar tests', function() {
   beforeEach(function() {
+    // Get a clean test document
+    cy.task('copyFile', {
+      source_dir: Cypress.env('DATA_FOLDER'),
+      dest_dir: Cypress.env('WORKDIR'),
+      file_name: 'empty.odt',
+    });
+
     // Open test document
     cy.viewport('iphone-3')
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
-      Cypress.env('TEST_DATA_FOLDER') + 'empty.odt')
+      Cypress.env('WORKDIR') + 'empty.odt')
 
     // Wait for the document to fully load
     cy.get('.leaflet-tile-loaded')
commit c5478b7a668b35bb24c0b098c1e672b7875aa8c6
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 17:10:07 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Use env variable to get file path.
    
    Instead of a hard coded one. Also create new
    test documents for cypress tests.
    
    Change-Id: I5f9b2c6914669f77742e1a011d736bbf18c54877

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index ae5725cca..ec992c254 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -11,9 +11,6 @@ check-local: @JAILS_PATH@
 	@pkill loolwsd || true
 	@echo "Launching loolwsd for testing.."
 	@fc-cache "@LO_PATH@"/share/fonts/truetype
-	@cp $(top_srcdir)/test/data/hello.odt $(top_srcdir)/test/data/hello-world.odt
-	@cp $(top_srcdir)/test/data/hello.ods $(top_srcdir)/test/data/hello-world.ods
-	@cp $(top_srcdir)/test/data/hello.odp $(top_srcdir)/test/data/hello-world.odp
 	@echo
 	../loolwsd --o:sys_template_path="@SYSTEMPLATE_PATH@" \
 			--o:child_root_path="@JAILS_PATH@" --o:storage.filesystem[@allow]=true \
@@ -28,14 +25,16 @@ check-local: @JAILS_PATH@
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false \
-			--headless || \
+			--headless \
+			--env TEST_DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/desktop/ || \
 			(pkill loolwsd && false)
 	@echo
 	@echo "Running cypress mobile tests..."
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome \
 			--config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) \
-			--headless || \
+			--headless \
+			--env TEST_DATA_FOLDER=$(abs_top_srcdir)/cypress_test/data/mobile/ || \
 			(pkill loolwsd && false)
 	@pkill loolwsd || true
 endif
diff --git a/cypress_test/data/desktop/simple.odt b/cypress_test/data/desktop/simple.odt
new file mode 100644
index 000000000..833aa18fa
Binary files /dev/null and b/cypress_test/data/desktop/simple.odt differ
diff --git a/cypress_test/data/mobile/empty.odt b/cypress_test/data/mobile/empty.odt
new file mode 100644
index 000000000..b8fe3d9dc
Binary files /dev/null and b/cypress_test/data/mobile/empty.odt differ
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
index 68d6b4f18..d8b4f52a4 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -1,7 +1,8 @@
 describe('Example test suit 1', function() {
   it('Example test case 1', function() {
-    // Open test documnt
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+    // Open test document
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+      Cypress.env('TEST_DATA_FOLDER') + 'simple.odt')
 
     // Wait for the document to fully load
     cy.get('.leaflet-tile-loaded')
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
index fde36a757..37ffc5dc6 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -1,7 +1,8 @@
 describe('Example test suit 2', function() {
   it('Example test case 1', function() {
-    // Open test documnt
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+    // Open test document
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+      Cypress.env('TEST_DATA_FOLDER') + 'simple.odt')
 
     // Wait for the document to fully load
     cy.get('.leaflet-tile-loaded')
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 83851f976..8dc950dd9 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -1,8 +1,9 @@
 describe('Toolbar tests', function() {
   beforeEach(function() {
-    // Open test documnt
+    // Open test document
     cy.viewport('iphone-3')
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+      Cypress.env('TEST_DATA_FOLDER') + 'empty.odt')
 
     // Wait for the document to fully load
     cy.get('.leaflet-tile-loaded')
commit 20e5295ddd9b88fe99cf7c8efa0d473bc0a89400
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 16:05:33 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Make sure loolwsd is killed after make check.
    
    Even if ony of the tests fails.
    
    Change-Id: I18e7daff854fd51d4ba374d9d537ba76e171269c

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index bb4740348..ae5725cca 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -26,11 +26,17 @@ check-local: @JAILS_PATH@
 	@echo
 	@echo "Running cypress desktop tests..."
 	@echo
-	$(CYPRESS_BINARY) run --browser chrome --config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false --headless
+	$(CYPRESS_BINARY) run --browser chrome \
+			--config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false \
+			--headless || \
+			(pkill loolwsd && false)
 	@echo
 	@echo "Running cypress mobile tests..."
 	@echo
-	$(CYPRESS_BINARY) run --browser chrome --config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) --headless
+	$(CYPRESS_BINARY) run --browser chrome \
+			--config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) \
+			--headless || \
+			(pkill loolwsd && false)
 	@pkill loolwsd || true
 endif
 
commit 66eb1218560482208c30110c04ae40d847df35b8
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 14 14:19:06 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Running make check locally works better then cyrun.
    
    Change-Id: Ifcbefa925b3b46e7955cd3cfb107b105f053cf59

diff --git a/cypress_test/README b/cypress_test/README
index efeb6e10a..86f1c77b2 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -5,22 +5,19 @@ Running tests
 ------------------
 
 All tests are part of the make check build. So you can
-just execute it from the root folder of online repository.
+just execute it from the root folder or under the
+cypress_test folder to run cypress tests only.
 
     make check
 
-To run only cypress test cases, you need to start loolwsd
+To run cypress test cases selectively, you need to start loolwsd
 server first. To do that you can call make run on a separate
 command line window, so LibreOffice online is started.
 
-After the server is running you can execute the test,
+After the server is running you can execute the tests,
 calling the given run command. You need to run the
 command under cypress_test\ folder.
 
-To run all cypress tests:
-
-    npm run cyrun
-
 To run all desktop tests:
 
     npm run cyrun_desktop
diff --git a/cypress_test/package.json b/cypress_test/package.json
index a9d281112..7bc27e046 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -11,7 +11,6 @@
     "url": "git://gerrit.libreoffice.org/online.git"
   },
   "scripts": {
-    "cyrun": "npm run cyrun_desktop && npm run cyrun_mobile",
     "cyrun_desktop": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/desktop --headless",
     "cyrun_mobile": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\" --headless",
     "cyopen_desktop": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/desktop",
commit 96c9e5789435692f559aa51f1fe2bb385c0a5a7b
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 13 21:01:01 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: mobile: Add some tests about pushing toolbar items.
    
    Change-Id: I2b40dbee18fa04fbece4f4da0630e3ac619e0968

diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 24838aeb8..83851f976 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -95,4 +95,99 @@ describe('Toolbar tests', function() {
     cy.get('#tb_actionbar_item_redo')
       .should('not.have.class', 'disabled')
   })
+
+  it('Open and close mobile wizard by toolbar item.', function() {
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Click on mobile wizard toolbar item
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .should('not.have.class', 'disabled')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    cy.get('#mobile-wizard-content')
+      .should('not.be.empty');
+
+    // Toolbar button is checked
+    cy.get('#tb_actionbar_item_mobile_wizard table')
+      .should('have.class', 'checked')
+
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .click()
+
+    // Mobile wizard is closed
+    cy.get('#mobile_wizard')
+      .should('not.be.visible');
+
+    cy.get('#tb_actionbar_item_mobile_wizard table')
+      .should('not.have.class', 'checked')
+
+    // Open mobile wizard again
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    // TODO: fix this bug
+    /*cy.get('#mobile-wizard-content')
+      .should('not.be.empty'); */
+  })
+
+  it('Open and close insertion mobile wizard by toolbar item.', function() {
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Click on toolbar item
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .should('not.have.class', 'disabled')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    cy.get('#mobile-wizard-content')
+      .should('not.be.empty');
+
+    // Toolbar button is checked
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+      .should('have.class', 'checked')
+
+    // Click on toolbar item again
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .click()
+
+    // Mobile wizard is closed
+    cy.get('#mobile_wizard')
+      .should('not.be.visible');
+
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
+      .should('not.have.class', 'checked')
+
+    // Open mobile wizard again
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .click()
+
+    // Mobile wizard is opened and it has any content
+    cy.get('#mobile-wizard-content')
+      .should('not.be.empty');
+  })
+
+  it('Open insert comment dialog by toolbar item.', function() {
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Click on toolbar item
+    cy.get('#tb_actionbar_item_insertcomment')
+      .should('not.have.class', 'disabled')
+      .click()
+
+    // Comment insertion dialog is opened
+    cy.get('.loleaflet-annotation-table')
+      .should('be.visible');
+
+    // Close the dialog
+    cy.contains('Cancel')
+      .click()
+
+    cy.get('.loleaflet-annotation-table')
+      .should('be.not.visible');
+  })
 })
commit 740267611fa0d3fa10f4b5950a976aef05b70fc6
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 13 20:20:30 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Update README about test execution.
    
    Change-Id: I6c7b7fd8c77f89289630a06f9dbaf94ae5082aa8

diff --git a/cypress_test/README b/cypress_test/README
index aebd3fa34..efeb6e10a 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -5,38 +5,49 @@ Running tests
 ------------------
 
 All tests are part of the make check build. So you can
-just execute it in the top folder.
+just execute it from the root folder of online repository.
 
     make check
 
 To run only cypress test cases, you need to start loolwsd
-server first and then run the given cyrun command.
+server first. To do that you can call make run on a separate
+command line window, so LibreOffice online is started.
+
+After the server is running you can execute the test,
+calling the given run command. You need to run the
+command under cypress_test\ folder.
+
 To run all cypress tests:
 
-    make run &
-    cd cypress
     npm run cyrun
 
 To run all desktop tests:
 
-    cd cypress
     npm run cyrun_desktop
 
 To run all mobile tests:
 
-    cd cypress
     npm run cyrun_mobile
 
+To run one specific test suit of desktop tests:
+
+    npm run cyrun_desktop --spec example_desktop_test_spec.js
+
+To run one specific test suit of mobile tests:
+
+    npm run cyrun_mobile --spec toolbar_spec.js
+
 You can also open cypress tests in the browser, so you can
 check what happens during test run. It's useful for writing
 new tests or checking why an existing test fails.
 
 To open desktop tests in browser:
 
-    cd cypress
     npm run cyopen_desktop
 
 To open mobile tests in browser:
 
-    cd cypress
     npm run cyopen_mobile
+
+During the build we run the tests with Chrome browser, so make sure
+you select Chrome browser on the GUI while checking tests.
diff --git a/cypress_test/package.json b/cypress_test/package.json
index 6f7d05a17..a9d281112 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -14,7 +14,7 @@
     "cyrun": "npm run cyrun_desktop && npm run cyrun_mobile",
     "cyrun_desktop": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/desktop --headless",
     "cyrun_mobile": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\" --headless",
-    "cyopen_desktop": "node_modules/cypress/bin/cypress open --browser chrome --config integrationFolder=integration_tests/desktop",
-    "cyopen_mobile": "node_modules/cypress/bin/cypress open --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\""
+    "cyopen_desktop": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/desktop",
+    "cyopen_mobile": "node_modules/cypress/bin/cypress open --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\""
   }
 }
commit 11ef897266589322d32dbc6c2408e219c14fa29e
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jan 13 20:08:38 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Added a better wait method for document load.
    
    Change-Id: I482df38159009f5583ad7ed9f676e09a350bb0a8

diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
index c5b1ab1b0..68d6b4f18 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -3,8 +3,8 @@ describe('Example test suit 1', function() {
     // Open test documnt
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
 
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
+    // Wait for the document to fully load
+    cy.get('.leaflet-tile-loaded')
 
     // Select a text
     cy.get('#document-container').dblclick()
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
index 6b2c9b9bd..fde36a757 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -3,8 +3,8 @@ describe('Example test suit 2', function() {
     // Open test documnt
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
 
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
+    // Wait for the document to fully load
+    cy.get('.leaflet-tile-loaded')
 
     // Select a text
     cy.get('#document-container').dblclick()
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 36982f3ee..24838aeb8 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -4,8 +4,8 @@ describe('Toolbar tests', function() {
     cy.viewport('iphone-3')
     cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
 
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
+    // Wait for the document to fully load
+    cy.get('.leaflet-tile-loaded')
   });
 
   it('State of mobile wizard toolbar item.', function() {
commit 66d89d749f49e5be5c8570a57e894e9af83ffbb3
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Jan 12 13:05:04 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Run tests only if HAVE_LO_PATH is set.
    
    Change-Id: I7d3103aa787f5bb1ed28a477276f2a656a915737

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 1e8fbe9fc..bb4740348 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -4,6 +4,7 @@ DESKTOP_TEST_FOLDER = integration_tests/desktop
 MOBILE_TEST_FOLDER = integration_tests/mobile
 MOBILE_USER_AGENT = "cypress mobile test"
 
+if HAVE_LO_PATH
 check-local: @JAILS_PATH@
 	@npm install
 	@echo
@@ -31,6 +32,7 @@ check-local: @JAILS_PATH@
 	@echo
 	$(CYPRESS_BINARY) run --browser chrome --config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) --headless
 	@pkill loolwsd || true
+endif
 
 clean-local:
 	rm -rf node_modules
commit 893a3df57b192d114fa88a812f428e83ab911932
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Jan 12 12:28:33 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Add package-lock.json to gitignore
    
    Change-Id: I3ec64262a50e6edf6116f5b7c546ee3a84d4d449

diff --git a/cypress_test/.gitignore b/cypress_test/.gitignore
index 8a3bdd6c1..27d395a6a 100644
--- a/cypress_test/.gitignore
+++ b/cypress_test/.gitignore
@@ -1,2 +1,3 @@
 node_modules
 cypress/
+package-lock.json
commit f2444df7269270ca7f2c4883be237b3608612798
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Jan 12 12:27:59 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Add some commands to make easier to run tests.
    
    Change-Id: I9428522717d3912ca20374a1efb1c61999ffc77f

diff --git a/cypress_test/README b/cypress_test/README
new file mode 100644
index 000000000..aebd3fa34
--- /dev/null
+++ b/cypress_test/README
@@ -0,0 +1,42 @@
+Cypress based test framework for LibreOffice Online
+====================================================
+
+Running tests
+------------------
+
+All tests are part of the make check build. So you can
+just execute it in the top folder.
+
+    make check
+
+To run only cypress test cases, you need to start loolwsd
+server first and then run the given cyrun command.
+To run all cypress tests:
+
+    make run &
+    cd cypress
+    npm run cyrun
+
+To run all desktop tests:
+
+    cd cypress
+    npm run cyrun_desktop
+
+To run all mobile tests:
+
+    cd cypress
+    npm run cyrun_mobile
+
+You can also open cypress tests in the browser, so you can
+check what happens during test run. It's useful for writing
+new tests or checking why an existing test fails.
+
+To open desktop tests in browser:
+
+    cd cypress
+    npm run cyopen_desktop
+
+To open mobile tests in browser:
+
+    cd cypress
+    npm run cyopen_mobile
diff --git a/cypress_test/package.json b/cypress_test/package.json
index c3d1c5265..6f7d05a17 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -11,7 +11,10 @@
     "url": "git://gerrit.libreoffice.org/online.git"
   },
   "scripts": {
-    "cy_run": "node_modules/cypress/bin/cypress run",
-    "cy_open": "node_modules/cypress/bin/cypress open"
+    "cyrun": "npm run cyrun_desktop && npm run cyrun_mobile",
+    "cyrun_desktop": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/desktop --headless",
+    "cyrun_mobile": "node_modules/cypress/bin/cypress run --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\" --headless",
+    "cyopen_desktop": "node_modules/cypress/bin/cypress open --browser chrome --config integrationFolder=integration_tests/desktop",
+    "cyopen_mobile": "node_modules/cypress/bin/cypress open --browser chrome --config integrationFolder=integration_tests/mobile,userAgent=\"cypress mobile test\""
   }
 }
commit d3dd01eb1b648c9553f9b9a04236e1291187f3ff
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Jan 12 12:14:35 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: mobile: Add more tests for toolbar.
    
    Change-Id: I144982a796e2e1c5178bdefa27575a0cfe47439b

diff --git a/cypress_test/integration_tests/mobile/example_mobile_test_spec.js b/cypress_test/integration_tests/mobile/example_mobile_test_spec.js
deleted file mode 100644
index ebaeb96e6..000000000
--- a/cypress_test/integration_tests/mobile/example_mobile_test_spec.js
+++ /dev/null
@@ -1,21 +0,0 @@
-describe('Example test suit 1', function() {
-  it('Example test case 1', function() {
-    // Open test documnt
-    cy.viewport('iphone-3')
-    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
-
-    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
-    cy.wait(1000)
-
-    // Mobile wizard toolbar button is disabled by default
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .should('have.class', 'disabled')
-
-    // Click on edit button
-    cy.get('#mobile-edit-button').click()
-
-    // Mobile wizard should be enabled now
-    cy.get('#tb_actionbar_item_mobile_wizard')
-      .should('not.have.class', 'disabled')
-  })
-})
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
new file mode 100644
index 000000000..36982f3ee
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -0,0 +1,98 @@
+describe('Toolbar tests', function() {
+  beforeEach(function() {
+    // Open test documnt
+    cy.viewport('iphone-3')
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+
+    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
+    cy.wait(1000)
+  });
+
+  it('State of mobile wizard toolbar item.', function() {
+    // Mobile wizard toolbar button is disabled by default
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .should('have.class', 'disabled')
+
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Button should be enabled now
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .should('not.have.class', 'disabled')
+  })
+
+  it('State of insertion mobile wizard toolbar item.', function() {
+    // Insertion mobile wizard toolbar button is disabled by default
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .should('have.class', 'disabled')
+
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Button should be enabled now
+    cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+      .should('not.have.class', 'disabled')
+  })
+
+  it('State of insert comment toolbar item.', function() {
+    // Insertion mobile wizard toolbar button is disabled by default
+    cy.get('#tb_actionbar_item_insertcomment')
+      .should('have.class', 'disabled')
+
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Button should be enabled now
+    cy.get('#tb_actionbar_item_insertcomment')
+      .should('not.have.class', 'disabled')
+  })
+
+  it('State of undo toolbar item.', function() {
+    // Insertion mobile wizard toolbar button is disabled by default
+    cy.get('#tb_actionbar_item_undo')
+      .should('have.class', 'disabled')
+
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Button should be still disabled
+    cy.get('#tb_actionbar_item_undo')
+      .should('have.class', 'disabled')
+
+    // Type somthing in the document
+    cy.get('#document-container').type("x")
+
+    // Button should become enabled
+    cy.get('#tb_actionbar_item_undo')
+      .should('not.have.class', 'disabled')
+  })
+
+  it('State of redo toolbar item.', function() {
+    // Insertion mobile wizard toolbar button is disabled by default
+    cy.get('#tb_actionbar_item_redo')
+      .should('have.class', 'disabled')
+
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Button should be still disabled
+    cy.get('#tb_actionbar_item_redo')
+      .should('have.class', 'disabled')
+
+    // Type somthing in the document
+    cy.get('#document-container').type("x")
+
+    // Button should be still disabled
+    cy.get('#tb_actionbar_item_redo')
+      .should('have.class', 'disabled')
+
+    // Do an undo
+    cy.get('#tb_actionbar_item_undo')
+      .should('not.have.class', 'disabled')
+    cy.get('#tb_actionbar_item_undo').click()
+
+    // Button should become enabled
+    cy.get('#tb_actionbar_item_redo')
+      .should('not.have.class', 'disabled')
+  })
+})
commit 524bbb3398dca8d142ded65a9d08c3926c2f87c6
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jan 10 16:38:37 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jan 21 16:13:01 2020 +0100

    cypress: Initial integration of cypress test framework.
    
    Change-Id: Ibf300b33d32ce3e7f1affbaf0a59364ddb618b56

diff --git a/Makefile.am b/Makefile.am
index d17bb8d99..c6d417185 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,7 @@ endif
 
 else
 
-SUBDIRS = . test loleaflet
+SUBDIRS = . test loleaflet cypress_test
 
 export ENABLE_DEBUG
 
diff --git a/configure.ac b/configure.ac
index 9b1b50a91..f502934ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -960,6 +960,7 @@ AC_CONFIG_FILES([Makefile
                  android/lib/libSettings.gradle
                  android/lib/src/main/cpp/CMakeLists.txt
                  android/Makefile
+                 cypress_test/Makefile
                  gtk/Makefile
                  ios/config.h
                  ios/Mobile/Info.plist
diff --git a/cypress_test/.gitignore b/cypress_test/.gitignore
new file mode 100644
index 000000000..8a3bdd6c1
--- /dev/null
+++ b/cypress_test/.gitignore
@@ -0,0 +1,2 @@
+node_modules
+cypress/
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
new file mode 100644
index 000000000..1e8fbe9fc
--- /dev/null
+++ b/cypress_test/Makefile.am
@@ -0,0 +1,37 @@
+CYPRESS_BINARY = ${top_srcdir}/cypress_test/node_modules/cypress/bin/cypress
+
+DESKTOP_TEST_FOLDER = integration_tests/desktop
+MOBILE_TEST_FOLDER = integration_tests/mobile
+MOBILE_USER_AGENT = "cypress mobile test"
+
+check-local: @JAILS_PATH@
+	@npm install
+	@echo
+	@pkill loolwsd || true
+	@echo "Launching loolwsd for testing.."
+	@fc-cache "@LO_PATH@"/share/fonts/truetype
+	@cp $(top_srcdir)/test/data/hello.odt $(top_srcdir)/test/data/hello-world.odt
+	@cp $(top_srcdir)/test/data/hello.ods $(top_srcdir)/test/data/hello-world.ods
+	@cp $(top_srcdir)/test/data/hello.odp $(top_srcdir)/test/data/hello-world.odp
+	@echo
+	../loolwsd --o:sys_template_path="@SYSTEMPLATE_PATH@" \
+			--o:child_root_path="@JAILS_PATH@" --o:storage.filesystem[@allow]=true \
+			--o:ssl.cert_file_path="$(abs_top_srcdir)/etc/cert.pem" \
+			--o:ssl.key_file_path="$(abs_top_srcdir)/etc/key.pem" \
+			--o:ssl.ca_file_path="$(abs_top_srcdir)/etc/ca-chain.cert.pem" \
+			--o:admin_console.username=admin --o:admin_console.password=admin \
+			--o:logging.file[@enable]=true --o:logging.level=trace > /dev/null 2>&1 &
+	@sleep 10
+	@echo
+	@echo "Running cypress desktop tests..."
+	@echo
+	$(CYPRESS_BINARY) run --browser chrome --config integrationFolder=$(DESKTOP_TEST_FOLDER),video=false --headless
+	@echo
+	@echo "Running cypress mobile tests..."
+	@echo
+	$(CYPRESS_BINARY) run --browser chrome --config integrationFolder=$(MOBILE_TEST_FOLDER),video=false,userAgent=$(MOBILE_USER_AGENT) --headless
+	@pkill loolwsd || true
+
+clean-local:
+	rm -rf node_modules
+	rm -rf cypress
diff --git a/cypress_test/cypress.json b/cypress_test/cypress.json
new file mode 100644
index 000000000..92401d400
--- /dev/null
+++ b/cypress_test/cypress.json
@@ -0,0 +1,3 @@
+{
+    "integrationFolder": "integration_tests"
+}
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
new file mode 100644
index 000000000..c5b1ab1b0
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -0,0 +1,29 @@
+describe('Example test suit 1', function() {
+  it('Example test case 1', function() {
+    // Open test documnt
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+
+    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
+    cy.wait(1000)
+
+    // Select a text
+    cy.get('#document-container').dblclick()
+    cy.get(".leaflet-marker-icon")
+
+    // Click on bold toolbar button
+    cy.get('#tb_editbar_item_bold').click()
+
+    // Remove selection and do a reselection
+    cy.get('#document-container').click()
+    cy.get('.leaflet-marker-icon').should('not.be.visible');
+
+    cy.get('#document-container').dblclick()
+    cy.get(".leaflet-marker-icon")
+
+    // Bold toolbar button is checked
+    cy.get('#tb_editbar_item_bold table.w2ui-button.checked')
+
+    // Click on bold toolbar button
+    cy.get('#tb_editbar_item_bold').click()
+  })
+})
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
new file mode 100644
index 000000000..6b2c9b9bd
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -0,0 +1,29 @@
+describe('Example test suit 2', function() {
+  it('Example test case 1', function() {
+    // Open test documnt
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+
+    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
+    cy.wait(1000)
+
+    // Select a text
+    cy.get('#document-container').dblclick()
+    cy.get(".leaflet-marker-icon")
+
+    // Click on bold toolbar button
+    cy.get('#tb_editbar_item_italic').click()
+
+    // Remove selection and do a reselection
+    cy.get('#document-container').click()
+    cy.get('.leaflet-marker-icon').should('not.be.visible');
+
+    cy.get('#document-container').dblclick()
+    cy.get(".leaflet-marker-icon")
+
+    // Bold toolbar button is checked
+    cy.get('#tb_editbar_item_italic table.w2ui-button.checked')
+
+    // Click on bold toolbar button
+    cy.get('#tb_editbar_item_italic').click()
+  })
+})
diff --git a/cypress_test/integration_tests/mobile/example_mobile_test_spec.js b/cypress_test/integration_tests/mobile/example_mobile_test_spec.js
new file mode 100644
index 000000000..ebaeb96e6
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/example_mobile_test_spec.js
@@ -0,0 +1,21 @@
+describe('Example test suit 1', function() {
+  it('Example test case 1', function() {
+    // Open test documnt
+    cy.viewport('iphone-3')
+    cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file:///home/zolnai/libreoffice/online/test/data/hello-world.odt')
+
+    // Wait for the document to fully load (TODO: find an item which we can be used to wait for instead)
+    cy.wait(1000)
+
+    // Mobile wizard toolbar button is disabled by default
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .should('have.class', 'disabled')
+
+    // Click on edit button
+    cy.get('#mobile-edit-button').click()
+
+    // Mobile wizard should be enabled now
+    cy.get('#tb_actionbar_item_mobile_wizard')
+      .should('not.have.class', 'disabled')
+  })
+})
diff --git a/cypress_test/package.json b/cypress_test/package.json
new file mode 100644
index 000000000..c3d1c5265
--- /dev/null
+++ b/cypress_test/package.json
@@ -0,0 +1,17 @@
+{
+  "name": "cypress_test",
+  "version": "1.0.0",
+  "description": "Cypress integration test suit",
+  "license": "MPL-2.0",
+  "dependencies": {
+    "cypress": "3.8.1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://gerrit.libreoffice.org/online.git"
+  },
+  "scripts": {
+    "cy_run": "node_modules/cypress/bin/cypress run",
+    "cy_open": "node_modules/cypress/bin/cypress open"
+  }
+}
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index b8f74b279..f09b4dea7 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -11,6 +11,10 @@ var map;
 
 // has to match small screen size requirement
 function _inMobileMode() {
+	if (L.Browser.cypressMobileTest) {
+		return true;
+	}
+
 	return L.Browser.mobile && screen.width < 768;
 }
 
diff --git a/loleaflet/src/core/Browser.js b/loleaflet/src/core/Browser.js
index c17fc0641..b4daab8ba 100644
--- a/loleaflet/src/core/Browser.js
+++ b/loleaflet/src/core/Browser.js
@@ -32,6 +32,7 @@
 	    win = navigator.platform.indexOf('Win') === 0,
 
 	    mobile = typeof orientation !== 'undefined' || ua.indexOf('mobile') !== -1,
+	    cypressMobileTest = ua.indexOf('cypress mobile test') !== -1,
 	    msPointer = !window.PointerEvent && window.MSPointerEvent,
 	    pointer = (window.PointerEvent && navigator.pointerEnabled && navigator.maxTouchPoints) || msPointer,
 
@@ -136,6 +137,9 @@
 		// `true` for gecko-based browsers running in a mobile device.
 		mobileGecko: mobile && gecko,
 
+		// @property cypressMobileTest: Boolean
+		// `true` when running cypress in mobile mode
+		cypressMobileTest: cypressMobileTest,
 
 		// @property touch: Boolean
 		// `true` for all browsers supporting [touch events](https://developer.mozilla.org/docs/Web/API/Touch_events).


More information about the Libreoffice-commits mailing list