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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 28 16:31:23 UTC 2020


 cypress_test/Makefile.am                                                  |    3 
 cypress_test/data/multiuser/sidebar_visibility.odt                        |binary
 cypress_test/integration_tests/common/desktop_helper.js                   |   42 ++++++
 cypress_test/integration_tests/multiuser/paragraph_prop_user1_spec.js     |    2 
 cypress_test/integration_tests/multiuser/paragraph_prop_user2_spec.js     |    2 
 cypress_test/integration_tests/multiuser/sidebar_visibility_user1_spec.js |   60 +++++++++
 cypress_test/integration_tests/multiuser/sidebar_visibility_user2_spec.js |   63 ++++++++++
 7 files changed, 169 insertions(+), 3 deletions(-)

New commits:
commit 6cfe358fc518f086e40c1b85e63992f7eeb223f3
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jul 28 15:24:00 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jul 28 18:31:11 2020 +0200

    cypress: rename test file to match with the test name.
    
    Change-Id: Ifaee988ac9abf8f5862d1e54b6a5bc7f7158cd0c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99632
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/data/multiuser/userlist.odt b/cypress_test/data/multiuser/paragraph_prop.odt
similarity index 100%
rename from cypress_test/data/multiuser/userlist.odt
rename to cypress_test/data/multiuser/paragraph_prop.odt
diff --git a/cypress_test/integration_tests/multiuser/paragraph_prop_user1_spec.js b/cypress_test/integration_tests/multiuser/paragraph_prop_user1_spec.js
index c64babdf3..c435af0a4 100644
--- a/cypress_test/integration_tests/multiuser/paragraph_prop_user1_spec.js
+++ b/cypress_test/integration_tests/multiuser/paragraph_prop_user1_spec.js
@@ -3,7 +3,7 @@
 var helper = require('../common/helper');
 
 describe('Change paragraph properties: user-1.', function() {
-	var testFileName = 'userlist.odt';
+	var testFileName = 'paragraph_prop.odt';
 
 	beforeEach(function() {
 		helper.beforeAllDesktop(testFileName);
diff --git a/cypress_test/integration_tests/multiuser/paragraph_prop_user2_spec.js b/cypress_test/integration_tests/multiuser/paragraph_prop_user2_spec.js
index 3267f093c..288707351 100644
--- a/cypress_test/integration_tests/multiuser/paragraph_prop_user2_spec.js
+++ b/cypress_test/integration_tests/multiuser/paragraph_prop_user2_spec.js
@@ -3,7 +3,7 @@
 var helper = require('../common/helper');
 
 describe('Change paragraph properties: user-2.', function() {
-	var testFileName = 'userlist.odt';
+	var testFileName = 'paragraph_prop.odt';
 
 	beforeEach(function() {
 		// Wait here, before loading the document.
commit 8ee8f1e1bdf05179649a1782e6f621ec2c21fce1
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jul 28 15:21:10 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Jul 28 18:31:04 2020 +0200

    cypress: add sidebar visibility multi-user test.
    
    Change-Id: I790a2c149face5fc4899f183833c99471ceb20e1
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99631
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 2a0fc221a..233915b35 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -63,7 +63,8 @@ MOBILE_TEST_FILES=$(subst $(MOBILE_TEST_FOLDER)/,,$(wildcard $(MOBILE_TEST_FOLDE
 DEKSTOP_TEST_FILES=$(subst $(DESKTOP_TEST_FOLDER)/,,$(wildcard $(DESKTOP_TEST_FOLDER)/*_spec.js) $(wildcard $(DESKTOP_TEST_FOLDER)/*/*_spec.js))
 
 MULTIUSER_TEST_FILES= \
-	paragraph_prop_user1_spec.js,paragraph_prop_user2_spec.js
+	paragraph_prop_user1_spec.js,paragraph_prop_user2_spec.js \
+	sidebar_visibility_user1_spec.js,sidebar_visibility_user2_spec.js
 
 MOBILE_TEST_FILES_DONE= \
 	$(foreach test_file,$(MOBILE_TEST_FILES),$(MOBILE_TRACK_FOLDER)/$(test_file).done)
diff --git a/cypress_test/data/multiuser/sidebar_visibility.odt b/cypress_test/data/multiuser/sidebar_visibility.odt
new file mode 100644
index 000000000..f7494e82f
Binary files /dev/null and b/cypress_test/data/multiuser/sidebar_visibility.odt differ
diff --git a/cypress_test/integration_tests/common/desktop_helper.js b/cypress_test/integration_tests/common/desktop_helper.js
new file mode 100644
index 000000000..b5022a59a
--- /dev/null
+++ b/cypress_test/integration_tests/common/desktop_helper.js
@@ -0,0 +1,42 @@
+/* global cy */
+
+function showSidebar() {
+	cy.log('Showing sidebar - start.');
+
+	cy.get('#tb_editbar_item_sidebar .w2ui-button')
+		.should('not.have.class', 'checked');
+	cy.get('#sidebar-panel')
+		.should('not.be.visible');
+
+	cy.get('#tb_editbar_item_sidebar .w2ui-button')
+		.click({force: true});
+
+	cy.get('#tb_editbar_item_sidebar .w2ui-button')
+		.should('have.class', 'checked');
+	cy.get('#sidebar-panel')
+		.should('be.visible');
+
+	cy.log('Showing sidebar - end.');
+}
+
+function hideSidebar() {
+	cy.log('Hiding sidebar - start.');
+
+	cy.get('#tb_editbar_item_sidebar .w2ui-button')
+		.should('have.class', 'checked');
+	cy.get('#sidebar-panel')
+		.should('be.visible');
+
+	cy.get('#tb_editbar_item_sidebar .w2ui-button')
+		.click({force: true});
+
+	cy.get('#tb_editbar_item_sidebar .w2ui-button')
+		.should('not.have.class', 'checked');
+	cy.get('#sidebar-panel')
+		.should('not.be.visible');
+
+	cy.log('Hiding sidebar - end.');
+}
+
+module.exports.showSidebar = showSidebar;
+module.exports.hideSidebar = hideSidebar;
diff --git a/cypress_test/integration_tests/multiuser/sidebar_visibility_user1_spec.js b/cypress_test/integration_tests/multiuser/sidebar_visibility_user1_spec.js
new file mode 100644
index 000000000..c0c1272bb
--- /dev/null
+++ b/cypress_test/integration_tests/multiuser/sidebar_visibility_user1_spec.js
@@ -0,0 +1,60 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../common/helper');
+var desktopHelper = require('../common/desktop_helper');
+
+describe('Sidebar visibility: user-1.', function() {
+	var testFileName = 'sidebar_visibility.odt';
+
+	beforeEach(function() {
+		helper.beforeAllDesktop(testFileName);
+	});
+
+	afterEach(function() {
+		helper.afterAll(testFileName);
+	});
+
+	it('Show/hide sidebar.', function() {
+		// user-2 loads the same document
+
+		cy.get('#tb_actionbar_item_userlist')
+			.should('be.visible');
+
+		cy.get('#tb_actionbar_item_userlist .w2ui-tb-caption')
+			.should('have.text', '2 users');
+
+		// Visible by default
+		cy.get('#sidebar-panel')
+			.should('be.visible');
+
+		desktopHelper.hideSidebar();
+
+		// Change paragraph alignment to trigger user-2 actions
+		cy.get('#tb_editbar_item_centerpara .w2ui-button')
+			.click();
+
+		// user-2 changes the paragraph alignment
+		cy.get('#tb_editbar_item_rightpara .w2ui-button')
+			.should('have.class', 'checked');
+
+		// sidebar should be still invisible
+		cy.get('#sidebar-panel')
+			.should('not.be.visible');
+
+		// Show sidebar again
+		desktopHelper.showSidebar();
+
+		// Change paragraph alignment to trigger user-2 actions
+		cy.get('#tb_editbar_item_justifypara .w2ui-button')
+			.click();
+
+		// user-2 changes the paragraph alignment
+		cy.get('#tb_editbar_item_leftpara .w2ui-button')
+			.should('have.class', 'checked');
+
+		// sidebar should be still visible
+		cy.get('#sidebar-panel')
+			.should('be.visible');
+	});
+
+});
diff --git a/cypress_test/integration_tests/multiuser/sidebar_visibility_user2_spec.js b/cypress_test/integration_tests/multiuser/sidebar_visibility_user2_spec.js
new file mode 100644
index 000000000..4d28c0aa6
--- /dev/null
+++ b/cypress_test/integration_tests/multiuser/sidebar_visibility_user2_spec.js
@@ -0,0 +1,63 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../common/helper');
+var desktopHelper = require('../common/desktop_helper');
+
+describe('Sidebar visibility: user-2.', function() {
+	var testFileName = 'sidebar_visibility.odt';
+
+	beforeEach(function() {
+		// Wait here, before loading the document.
+		// Opening two clients at the same time causes an issue.
+		cy.wait(5000);
+		helper.beforeAllDesktop(testFileName);
+	});
+
+	afterEach(function() {
+		helper.afterAll(testFileName);
+	});
+
+	it('Show/hide sidebar.', function() {
+		// user-1 loads the same document
+
+		cy.get('#tb_actionbar_item_userlist')
+			.should('be.visible');
+
+		cy.get('#tb_actionbar_item_userlist .w2ui-tb-caption')
+			.should('have.text', '2 users');
+
+		// Visible by default
+		cy.get('#sidebar-panel')
+			.should('be.visible');
+
+		// user-1 changes the paragraph alignment
+		cy.get('#tb_editbar_item_centerpara .w2ui-button')
+			.should('have.class', 'checked');
+
+		// sidebar should be still visible (user-1 hid his own sidebar)
+		cy.get('#sidebar-panel')
+			.should('be.visible');
+
+		// Hide sidebar
+		desktopHelper.hideSidebar();
+
+		// Change paragraph alignment to trigger user-1 actions
+		cy.get('#tb_editbar_item_rightpara .w2ui-button')
+			.click();
+
+		// user-1 changes the paragraph alignment
+		cy.get('#tb_editbar_item_justifypara .w2ui-button')
+			.should('have.class', 'checked');
+
+		// sidebar should be still invisible (user-1 showed his own sidebar)
+		cy.get('#sidebar-panel')
+			.should('not.be.visible');
+
+		// Show sidebar again
+		desktopHelper.showSidebar();
+
+		// Change paragraph alignment to trigger user-1 actions
+		cy.get('#tb_editbar_item_leftpara .w2ui-button')
+			.click();
+	});
+});


More information about the Libreoffice-commits mailing list