cypress_test/Makefile.am | 3 cypress_test/data/multiuser/simultaneous_typing.odt |binary cypress_test/integration_tests/common/helper.js | 4 cypress_test/integration_tests/multiuser/simultaneous_typing_user1_spec.js | 49 ++++++++++ cypress_test/integration_tests/multiuser/simultaneous_typing_user2_spec.js | 45 +++++++++ 5 files changed, 98 insertions(+), 3 deletions(-)
New commits: commit 27d3055dcfc56f1c08ee5cf4ffefa27aeeac5aeb Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Jul 29 11:14:30 2020 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Jul 29 13:00:28 2020 +0200 cypress: add a simultaneous typing multi-user test. Change-Id: Ib4c410f95443c3775626465d474f52499705da97 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/99676 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am index 233915b35..a3f153c20 100644 --- a/cypress_test/Makefile.am +++ b/cypress_test/Makefile.am @@ -64,7 +64,8 @@ DEKSTOP_TEST_FILES=$(subst $(DESKTOP_TEST_FOLDER)/,,$(wildcard $(DESKTOP_TEST_FO MULTIUSER_TEST_FILES= \ paragraph_prop_user1_spec.js,paragraph_prop_user2_spec.js \ - sidebar_visibility_user1_spec.js,sidebar_visibility_user2_spec.js + sidebar_visibility_user1_spec.js,sidebar_visibility_user2_spec.js \ + simultaneous_typing_user1_spec.js,simultaneous_typing_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/simultaneous_typing.odt b/cypress_test/data/multiuser/simultaneous_typing.odt new file mode 100644 index 000000000..3c97e9549 Binary files /dev/null and b/cypress_test/data/multiuser/simultaneous_typing.odt differ diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index d206d63a8..675391ea9 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -249,9 +249,9 @@ function doIfInWriter(callback) { // Sometimes cy.type results in random character insertion, // this avoids that, which is not clear why it happens. function typeText(selector, text, delayMs=0) { - var elem= cy.get(selector); for (var i = 0; i < text.length; i++) { - elem.type(text.charAt(i)); + cy.get(selector) + .type(text.charAt(i)); if (delayMs > 0) cy.wait(delayMs); } diff --git a/cypress_test/integration_tests/multiuser/simultaneous_typing_user1_spec.js b/cypress_test/integration_tests/multiuser/simultaneous_typing_user1_spec.js new file mode 100644 index 000000000..e618512dc --- /dev/null +++ b/cypress_test/integration_tests/multiuser/simultaneous_typing_user1_spec.js @@ -0,0 +1,49 @@ +/* global describe it cy beforeEach require afterEach */ + +var helper = require('../common/helper'); + +describe('Simultaneous typing: user-1.', function() { + var testFileName = 'simultaneous_typing.odt'; + + beforeEach(function() { + helper.beforeAllDesktop(testFileName); + }); + + afterEach(function() { + helper.afterAll(testFileName); + }); + + it('Simultaneous typing.', 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'); + + // We have a table in the document, move the cursor into the second row. + cy.get('textarea.clipboard') + .type('{downarrow}'); + // And now type some text, while user-2 does the same. + var text = 'qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq'; + helper.typeText('textarea.clipboard', text, 100); + + helper.selectAllText(); + + cy.get('#copy-paste-container p') + .should('have.text', text); + + // Change paragraph alignment to trigger user-2 actions + cy.get('textarea.clipboard') + .type('{uparrow}'); + + cy.get('#tb_editbar_item_centerpara .w2ui-button') + .click(); + + // user-2 changes the paragraph alignment after finished + cy.get('#tb_editbar_item_rightpara .w2ui-button') + .should('have.class', 'checked'); + }); + +}); diff --git a/cypress_test/integration_tests/multiuser/simultaneous_typing_user2_spec.js b/cypress_test/integration_tests/multiuser/simultaneous_typing_user2_spec.js new file mode 100644 index 000000000..5e4eea2ee --- /dev/null +++ b/cypress_test/integration_tests/multiuser/simultaneous_typing_user2_spec.js @@ -0,0 +1,45 @@ +/* global describe it cy beforeEach require afterEach */ + +var helper = require('../common/helper'); + +describe('Simultaneous typing: user-2.', function() { + var testFileName = 'simultaneous_typing.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('Simultaneous typing.', 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'); + + // Now type some text, while user-1 does the same. + var text = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; + helper.typeText('textarea.clipboard', text, 100); + + helper.selectAllText(); + + cy.get('#copy-paste-container p') + .should('have.text', text); + + // user-1 changes the paragraph alignment after finished + cy.get('#tb_editbar_item_centerpara .w2ui-button') + .should('have.class', 'checked'); + + // Change paragraph alignment to trigger user-2 actions + cy.get('#tb_editbar_item_rightpara .w2ui-button') + .click(); + }); +}); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits