summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRash419 <rashesh.padia@collabora.com>2021-07-12 15:16:50 +0530
committerRashesh Padia <rasheshpadia419@gmail.com>2021-07-27 14:58:09 +0530
commit74844c3dc85579756b620ede0bd5f7ed941850e4 (patch)
tree3d6d6302046759a67852794ee08c790c1a70d5e3
parentCalc: Buttons for scrolling tabs list were not working. (diff)
downloadonline-74844c3dc85579756b620ede0bd5f7ed941850e4.tar.gz
online-74844c3dc85579756b620ede0bd5f7ed941850e4.zip
cypress: introducing multiuser tests
Signed-off-by: Rash419 <rashesh.padia@collabora.com> Change-Id: Ib6c86d74dd7f0414f3c63ed66e99504c870516a3
-rw-r--r--cypress_test/Makefile.am72
-rw-r--r--cypress_test/README2
-rw-r--r--cypress_test/data/multiuser/cypress-multiuser.html17
-rw-r--r--cypress_test/data/multiuser/writer/track_changes.odtbin0 -> 8218 bytes
-rw-r--r--cypress_test/integration_tests/common/desktop_helper.js24
-rw-r--r--cypress_test/integration_tests/common/helper.js184
-rw-r--r--cypress_test/integration_tests/common/interference_user_spec.js (renamed from cypress_test/integration_tests/multiuser/interference_user_spec.js)4
-rw-r--r--cypress_test/integration_tests/desktop/calc/macro_spec.js2
-rw-r--r--cypress_test/integration_tests/multiuser/calc/sheet_operations_spec.js82
-rw-r--r--cypress_test/integration_tests/multiuser/calc/sheet_operations_user1_spec.js48
-rw-r--r--cypress_test/integration_tests/multiuser/calc/sheet_operations_user2_spec.js50
-rw-r--r--cypress_test/integration_tests/multiuser/writer/paragraph_prop_spec.js57
-rw-r--r--cypress_test/integration_tests/multiuser/writer/paragraph_prop_user1_spec.js37
-rw-r--r--cypress_test/integration_tests/multiuser/writer/paragraph_prop_user2_spec.js32
-rw-r--r--cypress_test/integration_tests/multiuser/writer/sidebar_visibility_spec.js42
-rw-r--r--cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user1_spec.js60
-rw-r--r--cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user2_spec.js53
-rw-r--r--cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user1_spec.js38
-rw-r--r--cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user2_spec.js34
-rw-r--r--cypress_test/integration_tests/multiuser/writer/track_changes_spec.js129
-rw-r--r--cypress_test/package.json1
-rwxr-xr-xcypress_test/run_parallel.sh4
-rw-r--r--cypress_test/support/index.js11
-rw-r--r--loleaflet/Makefile.am5
24 files changed, 498 insertions, 490 deletions
diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 22a4f7a8c8..5c2d0245a0 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -68,11 +68,7 @@ MOBILE_TEST_FILES=$(subst $(MOBILE_TEST_FOLDER)/,,$(wildcard $(MOBILE_TEST_FOLDE
DESKTOP_TEST_FILES=$(subst $(DESKTOP_TEST_FOLDER)/,,$(wildcard $(DESKTOP_TEST_FOLDER)/*_spec.js) $(wildcard $(DESKTOP_TEST_FOLDER)/*/*_spec.js))
-MULTIUSER_TESTS= \
- writer/paragraph_prop \
- writer/sidebar_visibility \
- writer/simultaneous_typing \
- calc/sheet_operations
+MULTIUSER_TEST_FILES=$(subst $(MULTIUSER_TEST_FOLDER)/,,$(wildcard $(MULTIUSER_TEST_FOLDER)/*_spec.js) $(wildcard $(MULTIUSER_TEST_FOLDER)/*/*_spec.js))
MOBILE_TEST_FILES_DONE= \
$(foreach test_file,$(MOBILE_TEST_FILES),$(MOBILE_TRACK_FOLDER)/$(test_file).done)
@@ -118,7 +114,7 @@ $(DESKTOP_TEST_FILES_DONE): $(PID_FILE)
)
$(MULTIUSER_TESTS_DONE): $(PID_FILE) $(MOBILE_TEST_FILES_DONE)
- $(foreach test,$(MULTIUSER_TESTS),$(call run_multiuser_test,$(test),$(1)))
+ $(call run_all_multiuser_tests)
@mkdir -p $(dir $@) && touch $@
@JAILS_PATH@:
@@ -320,14 +316,7 @@ endef
###################
# Multi-user tests.
###################
-
-check-multi: do-multi-check-log
- $(if $(wildcard $(ERROR_LOG)),$(error CypressError: some tests failed!))
-
-do-multi-check-log: do-multi-check
- $(if $(wildcard $(ERROR_LOG)),@cat $(ERROR_LOG))
-
-do-multi-check: @JAILS_PATH@ $(NODE_BINS)
+check-multi: @JAILS_PATH@ $(NODE_BINS)
$(call cleanup_before_run)
$(call run_JS_error_check)
$(call start_loolwsd)
@@ -340,23 +329,7 @@ run-multi: @JAILS_PATH@ $(NODE_BINS)
$(call cleanup_before_run)
$(call run_JS_error_check)
$(call start_loolwsd)
- @echo
- @echo "Running multi-user test in interactive test runner..."
- @echo
- $(call check_spec_existence,$(spec),multi)\
- $(if $(filter 1,$(user)), \
- $(eval BACKGROUND_USER_SPEC=$(spec)_user2_spec.js), \
- $(eval BACKGROUND_USER_SPEC=$(spec)_user1_spec.js))
- $(if $(filter 1,$(user)), \
- $(eval INTERACTIVE_USER_SPEC=$(spec)_user1_spec.js), \
- $(eval INTERACTIVE_USER_SPEC=$(spec)_user2_spec.js))
- $(eval BACKGROUND_USER_LOG=$(MULTIUSER_TRACK_FOLDER)/$(BACKGROUND_USER_SPEC).log)
- $(eval INTERACTIVE_USER_SPEC=$(MULTIUSER_TEST_FOLDER)/$(INTERACTIVE_USER_SPEC))
- @$(call run_test_parallel,\
- $(MULTIUSER_CONFIG),$(MULTIUSER_ENV),$(BACKGROUND_USER_SPEC),multi-user,$(BACKGROUND_USER_LOG)) &
- @sleep 5
- $(call run_interactive_single,\
- $(MULTIUSER_CONFIG),$(MULTIUSER_ENV),$(INTERACTIVE_USER_SPEC)) || true
+ $(call run_interactive_multiuser,$(spec)) || true
@$(KILL_COMMAND) || true
MULTIUSER_CONFIG = \
@@ -369,7 +342,22 @@ MULTIUSER_ENV = \
# Parameters:
# 1 - +env (optional): additional env variables (will be appended to $(MULTIUSER_ENV).
define run_all_multiuser_tests
- $(foreach test,$(MULTIUSER_TESTS),$(call run_multiuser_test,$(test),$(1)))
+ $(foreach test,$(MULTIUSER_TEST_FILES),$(call run_multiuser_test,$(test),$(1)))
+endef
+
+# Run one multiuser test / all multiuser tests in interactive test runner.
+# Parameters:
+# 1 - spec (optional): test file to run, if not specified all desktop tests are run.
+define run_interactive_multiuser
+ @echo "Open cypress with multiuser tests..."
+ @echo
+ $(if $(1),\
+ $(eval SPEC_FILE=$(MULTIUSER_TEST_FOLDER)/$(1))\
+ $(call check_spec_existence,$(1),multi)\
+ $(call run_interactive_single,$(MULTIUSER_CONFIG),$(MULTIUSER_ENV),$(SPEC_FILE))\
+ ,\
+ $(call run_interactive_all,$(MULTIUSER_CONFIG),$(MULTIUSER_ENV))\
+ )
endef
# Run one multi-user test in headless mode.
@@ -378,19 +366,12 @@ endef
# 2 - +env (optional): additional env variables (will be appended to $(MULTIUSER_ENV).
define run_multiuser_test
$(call check_spec_existence,$(1),multi)
- $(eval USER1_SPEC=$(strip $(1))_user1_spec.js)
- $(eval USER2_SPEC=$(strip $(1))_user2_spec.js)
- $(eval USER1_LOG=$(MULTIUSER_TRACK_FOLDER)/$(USER1_SPEC).log)
- $(eval USER2_LOG=$(MULTIUSER_TRACK_FOLDER)/$(USER2_SPEC).log)
@echo "Running cypress multi-user test: $(1)"
@echo
$(eval ENV_EXTENDED=$(MULTIUSER_ENV)$(if $(2),$(COMMA)$(2)))
- @$(call run_test_parallel,\
- $(MULTIUSER_CONFIG),$(ENV_EXTENDED),$(USER1_SPEC),multi-user,$(USER1_LOG)) & \
- sleep 5 && \
- $(call run_test_parallel,\
- $(MULTIUSER_CONFIG),$(ENV_EXTENDED),$(USER2_SPEC),multi-user,$(USER2_LOG)) && \
- wait # waits the background process to be finished
+ $(eval SPEC_FILE=$(if $(1),$(MULTIUSER_TEST_FOLDER)/$(1)))
+ $(call run_test_headless,\
+ $(MULTIUSER_CONFIG),$(ENV_EXTENDED),$(SPEC_FILE))
endef
############################
@@ -437,7 +418,7 @@ INTERFER_MOBILE_ENV1 = \
DATA_FOLDER=$(MOBILE_DATA_FOLDER),DATA_WORKDIR=$(MULTIUSER_DATA_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT),LO_CORE_VERSION="$(CORE_VERSION)",INTEGRATION=$(CYPRESS_INTEGRATION),INTERFERENCE_TEST=true
INTERFER_MOBILE_CONFIG2 = \
- integrationFolder=$(MULTIUSER_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(MOBILE_USER_AGENT),defaultCommandTimeout=30000,retries=0
+ supportFile=$(SUPPORT_FILE),userAgent=$(MOBILE_USER_AGENT),defaultCommandTimeout=30000,retries=0
INTERFER_MOBILE_ENV2 = \
DATA_FOLDER=$(MOBILE_DATA_FOLDER),DATA_WORKDIR=$(MULTIUSER_DATA_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT),LO_CORE_VERSION="$(CORE_VERSION)",INTEGRATION=$(CYPRESS_INTEGRATION)
@@ -510,7 +491,7 @@ INTERFER_DESKTOP_ENV1 = \
DATA_FOLDER=$(DESKTOP_DATA_FOLDER),DATA_WORKDIR=$(MULTIUSER_DATA_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT),LO_CORE_VERSION="$(CORE_VERSION)",INTEGRATION=$(CYPRESS_INTEGRATION),INTERFERENCE_TEST=true
INTERFER_DESKTOP_CONFIG2 = \
- integrationFolder=$(MULTIUSER_TEST_FOLDER),supportFile=$(SUPPORT_FILE),userAgent=$(DESKTOP_USER_AGENT),defaultCommandTimeout=30000,retries=0
+ supportFile=$(SUPPORT_FILE),userAgent=$(DESKTOP_USER_AGENT),defaultCommandTimeout=30000,retries=0
INTERFER_DESKTOP_ENV2 = \
DATA_FOLDER=$(DESKTOP_DATA_FOLDER),DATA_WORKDIR=$(MULTIUSER_DATA_WORKDIR),WSD_VERSION_HASH=$(LOOLWSD_VERSION_HASH),SERVER_PORT=$(FREE_PORT),LO_CORE_VERSION="$(CORE_VERSION)",INTEGRATION=$(CYPRESS_INTEGRATION)
@@ -639,7 +620,8 @@ endef
# 2 - test type: mobile, desktop or multi test.
define check_spec_existence
$(eval TEST_FILES=$(if $(filter mobile,$(2)),$(MOBILE_TEST_FILES),\
- $(if $(filter desktop,$(2)),$(DESKTOP_TEST_FILES),$(MULTIUSER_TESTS))))
+ $(if $(filter desktop,$(2)),$(DESKTOP_TEST_FILES),\
+ $(if $(filter multi,$(2)),$(MULTIUSER_TEST_FILES)))))
$(if $(filter $(1),$(TEST_FILES)),,$(error CypressError: Can't find the given spec file!))
endef
diff --git a/cypress_test/README b/cypress_test/README
index 7eb1773e9f..6e22e34d94 100644
--- a/cypress_test/README
+++ b/cypress_test/README
@@ -190,7 +190,7 @@ To open one specific desktop test suit in interactive test runner:
make run-interfer-desktop spec=writer/form_field_spec.js
The implementation of interference testing can be found in
-cypress_test/integration_tests/multiuser/interference_user_spec.js
+cypress_test/integration_tests/common/interference_user_spec.js
test file.
Running tests in different browsers
diff --git a/cypress_test/data/multiuser/cypress-multiuser.html b/cypress_test/data/multiuser/cypress-multiuser.html
new file mode 100644
index 0000000000..0d1fd9e29e
--- /dev/null
+++ b/cypress_test/data/multiuser/cypress-multiuser.html
@@ -0,0 +1,17 @@
+<!-- when cypress is enabled this html will be copied to dist folder to use it for multiuser tests -->
+<html style="height:100%"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Multiuser tests</title>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0">
+</head>
+<body>
+ <iframe id="iframe1" src="" frameborder="0" scrolling="yes" style="height: 100%;
+ width: 49%; float: left; " height="100%" width="49%" align="left">
+ </iframe>
+
+ <iframe id="iframe2" src="" frameborder="0" scrolling="yes" style="overflow: hidden; height: 100%;
+ width: 49%; " height="100%" width="49%" align="right">
+ </iframe>
+</body>
+</html>
+
diff --git a/cypress_test/data/multiuser/writer/track_changes.odt b/cypress_test/data/multiuser/writer/track_changes.odt
new file mode 100644
index 0000000000..585fd5ce56
--- /dev/null
+++ b/cypress_test/data/multiuser/writer/track_changes.odt
Binary files differ
diff --git a/cypress_test/integration_tests/common/desktop_helper.js b/cypress_test/integration_tests/common/desktop_helper.js
index 106984bcd5..ecb244c49b 100644
--- a/cypress_test/integration_tests/common/desktop_helper.js
+++ b/cypress_test/integration_tests/common/desktop_helper.js
@@ -5,22 +5,22 @@ const { clickOnIdle } = require('./helper');
// Make the sidebar visible by clicking on the corresponding toolbar item.
// We assume that the sidebar is hidden, when this method is called.
-function showSidebar() {
+function showSidebar(frameId) {
cy.log('Showing sidebar - start.');
- cy.get('#tb_editbar_item_sidebar .w2ui-button')
+ cy.customGet('#tb_editbar_item_sidebar .w2ui-button', frameId)
.should('not.have.class', 'checked');
- cy.get('#sidebar-dock-wrapper')
+ cy.customGet('#sidebar-dock-wrapper', frameId)
.should('not.be.visible');
- cy.get('#tb_editbar_item_sidebar .w2ui-button')
+ cy.customGet('#tb_editbar_item_sidebar .w2ui-button', frameId)
.click({force: true});
- cy.get('#tb_editbar_item_sidebar .w2ui-button')
+ cy.customGet('#tb_editbar_item_sidebar .w2ui-button', frameId)
.should('have.class', 'checked');
- cy.get('#sidebar-dock-wrapper')
+ cy.customGet('#sidebar-dock-wrapper', frameId)
.should('be.visible');
cy.log('Showing sidebar - end.');
@@ -28,22 +28,22 @@ function showSidebar() {
// Hide the sidebar by clicking on the corresponding toolbar item.
// We assume that the sidebar is visible, when this method is called.
-function hideSidebar() {
+function hideSidebar(frameId) {
cy.log('Hiding sidebar - start.');
- cy.get('#tb_editbar_item_sidebar .w2ui-button')
+ cy.customGet('#tb_editbar_item_sidebar .w2ui-button', frameId)
.should('have.class', 'checked');
- cy.get('#sidebar-dock-wrapper')
+ cy.customGet('#sidebar-dock-wrapper', frameId)
.should('be.visible');
- cy.get('#tb_editbar_item_sidebar .w2ui-button')
+ cy.customGet('#tb_editbar_item_sidebar .w2ui-button', frameId)
.click({force: true});
- cy.get('#tb_editbar_item_sidebar .w2ui-button')
+ cy.customGet('#tb_editbar_item_sidebar .w2ui-button', frameId)
.should('not.have.class', 'checked');
- cy.get('#sidebar-dock-wrapper')
+ cy.customGet('#sidebar-dock-wrapper', frameId)
.should('not.be.visible');
cy.log('Hiding sidebar - end.');
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index d7954f3f23..0753ee4f19 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -1,20 +1,20 @@
/* global cy Cypress expect */
var mobileWizardIdleTime = 1250;
-
// Loading the test document directly in Collabora Online.
// Parameters:
// fileName - test document file name (without path)
// subFolder - sub folder inside data folder (e.g. writer, calc, impress)
// noFileCopy - whether to create a copy of the test file before run the test.
-// By default, we create a copy to have a clear test document
-// but when we open the same document with another user (multi-user tests),
-// then we intend to open the same document without modification.
-function loadTestDocNoIntegration(fileName, subFolder, noFileCopy) {
+// By default, we create a copy to have a clear test document but
+// but when we test saving functionality we need to open same docuement
+// isMultiUser - whether the test is for multiuser
+function loadTestDocNoIntegration(fileName, subFolder, noFileCopy, isMultiUser) {
cy.log('Loading test document with a local build - start.');
cy.log('Param - fileName: ' + fileName);
cy.log('Param - subFolder: ' + subFolder);
cy.log('Param - noFileCopy: ' + noFileCopy);
+ cy.log('Param - isMultiUser: ' + isMultiUser);
// Get a clean test document, by creating a copy of it in the workdir
// We overwrite this copy everytime we run a new test case.
@@ -54,11 +54,26 @@ function loadTestDocNoIntegration(fileName, subFolder, noFileCopy) {
Cypress.env('DATA_WORKDIR') + subFolder + '/' + fileName;
}
- cy.visit(URI, {
- onLoad: function(win) {
- win.onerror = cy.onUncaughtException;
- }});
-
+ if (isMultiUser) {
+ cy.viewport(2000,660);
+ var frameURI = 'http://localhost' +
+ ':' + Cypress.env('SERVER_PORT') +
+ '/loleaflet/' +
+ Cypress.env('WSD_VERSION_HASH') +
+ '/cypress-multiuser.html';
+
+ cy.visit(frameURI, {
+ onLoad: function(win) {
+ win.onerror = cy.onUncaughtException;
+ win.document.getElementById('iframe1').src = URI;
+ win.document.getElementById('iframe2').src = URI;
+ }});
+ } else {
+ cy.visit(URI, {
+ onLoad: function(win) {
+ win.onerror = cy.onUncaughtException;
+ }});
+ }
cy.log('Loading test document with a local build - end.');
}
@@ -272,17 +287,18 @@ function waitForInterferingUser() {
// fileName - test document file name (without path)
// subFolder - sub folder inside data folder (e.g. writer, calc, impress)
// noFileCopy - whether to create a copy of the test file before run the test.
-// By default, we create a copy to have a clear test document
-// but when we open the same document with another user (multi-user tests),
-// then we intend to open the same document without modification.
+// By default, we create a copy to have a clear test document but
+// but when we test saving functionality we need to open same docueme
+// isMultiUser - whether test is a multiuser test
// subsequentLoad - whether we load a test document for the first time in the
// test case or not. It's important for nextcloud because we need to sign in
// with the username + password only for the first time.
-function loadTestDoc(fileName, subFolder, noFileCopy, subsequentLoad, hasInteractionBeforeLoad) {
+function loadTestDoc(fileName, subFolder, noFileCopy, isMultiUser, subsequentLoad, hasInteractionBeforeLoad) {
cy.log('Loading test document - start.');
cy.log('Param - fileName: ' + fileName);
cy.log('Param - subFolder: ' + subFolder);
cy.log('Param - noFileCopy: ' + noFileCopy);
+ cy.log('Param - isMultiUser: ' + isMultiUser);
cy.log('Param - subsequentLoad: ' + subsequentLoad);
cy.log('Param - hasInteractionBeforeLoad: ' + hasInteractionBeforeLoad);
@@ -294,22 +310,35 @@ function loadTestDoc(fileName, subFolder, noFileCopy, subsequentLoad, hasInterac
if (Cypress.env('INTEGRATION') === 'nextcloud') {
loadTestDocNextcloud(fileName, subFolder, subsequentLoad);
} else {
- loadTestDocNoIntegration(fileName, subFolder, noFileCopy);
+ loadTestDocNoIntegration(fileName, subFolder, noFileCopy, isMultiUser);
}
// When dialog appears before document load (eg. macro warning, csv import options)
if (hasInteractionBeforeLoad === true)
return;
- checkIfDocIsLoaded();
+ if (!isMultiUser) {
+ checkIfDocIsLoaded();
+ } else {
+ checkIfBothDocIsLoaded();
+ }
}
-function checkIfDocIsLoaded() {
+function checkIfBothDocIsLoaded() {
+
+ //assert both the frames are loaded
+ cy.frameLoaded('#iframe1');
+ cy.frameLoaded('#iframe2');
+
+ checkIfDocIsLoaded('#iframe1');
+ checkIfDocIsLoaded('#iframe2');
+}
+function checkIfDocIsLoaded(frameId) {
// Wait for the document to fully load
- cy.get('.leaflet-canvas-container canvas', {timeout : Cypress.config('defaultCommandTimeout') * 2.0});
+ cy.customGet('.leaflet-canvas-container canvas', frameId, {timeout : Cypress.config('defaultCommandTimeout') * 2.0});
// Wait until anything is drawn on tile canvas.
- canvasShouldNotBeFullWhite('.leaflet-canvas-container canvas');
+ canvasShouldNotBeFullWhite('.leaflet-canvas-container canvas',frameId);
// With php-proxy the client is irresponsive for some seconds after load, because of the incoming messages.
if (Cypress.env('INTEGRATION') === 'php-proxy') {
@@ -320,12 +349,12 @@ function checkIfDocIsLoaded() {
if (Cypress.env('INTEGRATION') !== 'nextcloud') {
doIfOnDesktop(function() {
if (Cypress.env('pdf-view') !== true)
- cy.get('#sidebar-panel').should('be.visible');
+ cy.customGet('#sidebar-panel', frameId).should('be.visible');
// Check that the document does not take the whole window width.
cy.window()
.then(function(win) {
- cy.get('#document-container')
+ cy.customGet('#document-container', frameId)
.should(function(doc) {
expect(doc).to.have.lengthOf(1);
if (Cypress.env('pdf-view') !== true)
@@ -335,8 +364,8 @@ function checkIfDocIsLoaded() {
// Check also that the inputbar is drawn in Calc.
doIfInCalc(function() {
- canvasShouldNotBeFullWhite('#calc-inputbar .inputbar_canvas');
- });
+ canvasShouldNotBeFullWhite('#calc-inputbar .inputbar_canvas', frameId);
+ }, frameId);
});
}
@@ -354,13 +383,13 @@ function assertNoKeyboardInput() {
}
// Assert that keyboard input is accepted (i.e. keyboard should be VISIBLE).
-function assertHaveKeyboardInput() {
- cy.get('textarea.clipboard')
+function assertHaveKeyboardInput(frameId) {
+ cy.customGet('textarea.clipboard', frameId)
.should('have.attr', 'data-accept-input', 'true');
}
// Assert that we have cursor and focus on the text area of the document.
-function assertCursorAndFocus() {
+function assertCursorAndFocus(frameId) {
cy.log('Verifying Cursor and Focus - start');
if (Cypress.env('INTEGRATION') !== 'nextcloud') {
@@ -370,40 +399,40 @@ function assertCursorAndFocus() {
}
// In edit mode, we should have the blinking cursor.
- cy.get('.leaflet-cursor.blinking-cursor')
+ cy.customGet('.leaflet-cursor.blinking-cursor', frameId)
.should('exist');
- cy.get('.leaflet-cursor-container')
+ cy.customGet('.leaflet-cursor-container', frameId)
.should('exist');
- assertHaveKeyboardInput();
+ assertHaveKeyboardInput(frameId);
cy.log('Verifying Cursor and Focus - end');
}
// Select all text via CTRL+A shortcut.
-function selectAllText() {
+function selectAllText(frameId) {
cy.log('Select all text - start');
- typeIntoDocument('{ctrl}a');
+ typeIntoDocument('{ctrl}a',frameId);
- textSelectionShouldExist();
+ textSelectionShouldExist(frameId);
cy.log('Select all text - end');
}
// Clear all text by selecting all and deleting.
-function clearAllText() {
+function clearAllText(frameId) {
cy.log('Clear all text - start');
- assertCursorAndFocus();
+ //assertCursorAndFocus(frameId);
// Trigger select all
- selectAllText();
+ selectAllText(frameId);
// Then remove
- typeIntoDocument('{del}');
+ typeIntoDocument('{del}',frameId);
- textSelectionShouldNotExist();
+ textSelectionShouldNotExist(frameId);
cy.log('Clear all text - end');
}
@@ -411,28 +440,30 @@ function clearAllText() {
// Check that the clipboard text matches with the specified text.
// Parameters:
// expectedPlainText - a string, the clipboard container should have.
-function expectTextForClipboard(expectedPlainText) {
-
+function expectTextForClipboard(expectedPlainText, frameId) {
+ cy.log('Text:' + expectedPlainText , 'FrameID:' + frameId);
doIfInWriter(function() {
- cy.get('#copy-paste-container p')
+ cy.customGet('#copy-paste-container p', frameId)
.then(function(pItem) {
if (pItem.children('font').length !== 0) {
- cy.get('#copy-paste-container p font')
+ cy.customGet('#copy-paste-container p font', frameId)
.should('have.text', expectedPlainText);
} else {
- cy.get('#copy-paste-container p')
+ cy.customGet('#copy-paste-container p', frameId)
.should('have.text', expectedPlainText);
}
});
- });
+ }, frameId);
+
doIfInCalc(function() {
- cy.get('#copy-paste-container pre')
+ cy.customGet('#copy-paste-container pre')
.should('have.text', expectedPlainText);
- });
+ }, frameId);
+
doIfInImpress(function() {
- cy.get('#copy-paste-container pre')
+ cy.customGet('#copy-paste-container pre')
.should('have.text', expectedPlainText);
- });
+ }, frameId);
}
// Check that the clipboard text matches with the
@@ -455,8 +486,8 @@ function matchClipboardText(regexp) {
});
}
-function beforeAll(fileName, subFolder, noFileCopy, subsequentLoad, hasInteractionBeforeLoad) {
- loadTestDoc(fileName, subFolder, noFileCopy, subsequentLoad, hasInteractionBeforeLoad);
+function beforeAll(fileName, subFolder, noFileCopy, isMultiUser, subsequentLoad, hasInteractionBeforeLoad) {
+ loadTestDoc(fileName, subFolder, noFileCopy, isMultiUser, subsequentLoad, hasInteractionBeforeLoad);
}
// This method is intended to call after each test case.
@@ -579,8 +610,8 @@ function initAliasToNegative(aliasName) {
}
// Run a code snippet if we are inside Calc.
-function doIfInCalc(callback) {
- cy.get('#document-container')
+function doIfInCalc(callback, frameId) {
+ cy.customGet('#document-container',frameId)
.then(function(doc) {
if (doc.hasClass('spreadsheet-doctype')) {
callback();
@@ -599,8 +630,8 @@ function doIfNotInCalc(callback) {
}
// Run a code snippet if we are inside Impress.
-function doIfInImpress(callback) {
- cy.get('#document-container')
+function doIfInImpress(callback, frameId) {
+ cy.customGet('#document-container', frameId)
.then(function(doc) {
if (doc.hasClass('presentation-doctype')) {
callback();
@@ -619,8 +650,8 @@ function doIfNotInImpress(callback) {
}
// Run a code snippet if we are inside Writer.
-function doIfInWriter(callback) {
- cy.get('#document-container')
+function doIfInWriter(callback, frameId) {
+ cy.customGet('#document-container', frameId)
.then(function(doc) {
if (doc.hasClass('text-doctype')) {
callback();
@@ -645,15 +676,17 @@ function doIfNotInWriter(callback) {
// selector - a CSS selector to query a DOM element to type in.
// text - a text, what we'll type char-by-char.
// delayMs - delay in ms between the characters.
-function typeText(selector, text, delayMs=0) {
+function typeText(selector, text, delayMs=0, frameId) {
for (var i = 0; i < text.length; i++) {
- cy.get(selector)
+ cy.customGet(selector, frameId)
.type(text.charAt(i));
if (delayMs > 0)
cy.wait(delayMs);
}
}
+
+
// Check whether an img DOM element has only white colored pixels or not.
// Parameters:
// selector - a CSS selector to query the img DOM element.
@@ -711,14 +744,15 @@ function imageShouldNotBeFullWhite(selector) {
// selector - a CSS selector to query the canvas DOM element.
// fullWhite - this specifies what we expect here, that the canvas is full white
// or on the contrary.
-function canvasShouldBeFullWhiteOrNot(selector, fullWhite = true) {
+// frameId - this specifies which frame to look into, in multiuser tests
+function canvasShouldBeFullWhiteOrNot(selector, fullWhite = true,frameId) {
cy.log('Check whether a canvas is full white or not - start.');
cy.log('Param - selector: ' + selector);
cy.log('Param - fullWhite: ' + fullWhite);
expect(selector).to.have.string('canvas');
- cy.get(selector)
+ cy.customGet(selector,frameId)
.should(function(canvas) {
var context = canvas[0].getContext('2d');
var pixelData = context.getImageData(0, 0, canvas[0].width, canvas[0].height).data;
@@ -742,8 +776,8 @@ function canvasShouldBeFullWhite(selector) {
}
// Check whether a canvas DOM element has any non-white pixels.
-function canvasShouldNotBeFullWhite(selector) {
- canvasShouldBeFullWhiteOrNot(selector, false);
+function canvasShouldNotBeFullWhite(selector,frameId) {
+ canvasShouldBeFullWhiteOrNot(selector, false, frameId);
}
// Waits until a DOM element becomes idle (does not change for a given time).
@@ -891,7 +925,7 @@ function doIfOnDesktop(callback) {
// cursorSelector - selector for the cursor DOM element (document cursor is the default).
function moveCursor(direction, modifier,
checkCursorVis = true,
- cursorSelector = '.cursor-overlay .blinking-cursor') {
+ cursorSelector = '.cursor-overlay .blinking-cursor', frameId) {
cy.log('Moving text cursor - start.');
cy.log('Param - direction: ' + direction);
cy.log('Param - modifier: ' + modifier);
@@ -900,7 +934,7 @@ function moveCursor(direction, modifier,
// Get the original cursor position.
var origCursorPos = 0;
- cy.get(cursorSelector)
+ cy.customGet(cursorSelector, frameId)
.should(function(cursor) {
if (direction === 'up' ||
direction === 'down' ||
@@ -938,10 +972,10 @@ function moveCursor(direction, modifier,
key += '{end}';
}
- typeIntoDocument(key);
+ typeIntoDocument(key, frameId);
// Make sure the cursor position was changed.
- cy.get(cursorSelector)
+ cy.customGet(cursorSelector, frameId)
.should(function(cursor) {
if (direction === 'up' ||
direction === 'down' ||
@@ -958,7 +992,7 @@ function moveCursor(direction, modifier,
// Cursor should be visible after move, because the view always follows it.
if (checkCursorVis === true) {
- cy.get(cursorSelector)
+ cy.customGet(cursorSelector, frameId)
.should('be.visible');
}
@@ -966,10 +1000,10 @@ function moveCursor(direction, modifier,
}
// Type something into the document. It can be some text or special characters too.
-function typeIntoDocument(text) {
+function typeIntoDocument(text, frameId) {
cy.log('Typing into document - start.');
- cy.get('textarea.clipboard')
+ cy.customGet('textarea.clipboard', frameId)
.type(text, {force: true});
cy.log('Typing into document - end.');
@@ -993,30 +1027,30 @@ function getCursorPos(offsetProperty, aliasName, cursorSelector = '.cursor-overl
}
// We make sure we have a text selection..
-function textSelectionShouldExist() {
+function textSelectionShouldExist(frameId) {
cy.log('Make sure text selection exists - start.');
- cy.get('.leaflet-selection-marker-start')
+ cy.customGet('.leaflet-selection-marker-start', frameId)
.should('exist');
- cy.get('.leaflet-selection-marker-end')
+ cy.customGet('.leaflet-selection-marker-end', frameId)
.should('exist');
// One of the marker should be visible at least (if not both).
- cy.get('.leaflet-selection-marker-start, .leaflet-selection-marker-end')
+ cy.customGet('.leaflet-selection-marker-start, .leaflet-selection-marker-end', frameId)
.should('be.visible');
cy.log('Make sure text selection exists - end.');
}
// We make sure we don't have a text selection..
-function textSelectionShouldNotExist() {
+function textSelectionShouldNotExist(frameId) {
cy.log('Make sure there is no text selection - start.');
- cy.get('.leaflet-selection-marker-start')
+ cy.customGet('.leaflet-selection-marker-start', frameId)
.should('not.exist');
- cy.get('.leaflet-selection-marker-end')
+ cy.customGet('.leaflet-selection-marker-end', frameId)
.should('not.exist');
cy.log('Make sure there is no text selection - end.');
diff --git a/cypress_test/integration_tests/multiuser/interference_user_spec.js b/cypress_test/integration_tests/common/interference_user_spec.js
index d6d5c8b544..0955cc7375 100644
--- a/cypress_test/integration_tests/multiuser/interference_user_spec.js
+++ b/cypress_test/integration_tests/common/interference_user_spec.js
@@ -1,7 +1,7 @@
/* global describe it cy require Cypress */
-var helper = require('../common/helper');
-var mobileHelper = require('../common/mobile_helper');
+var helper = require('./helper');
+var mobileHelper = require('./mobile_helper');
describe('Interfering second user.', function() {
function getComponent(fileName) {
diff --git a/cypress_test/integration_tests/desktop/calc/macro_spec.js b/cypress_test/integration_tests/desktop/calc/macro_spec.js
index 871782559d..643368602b 100644
--- a/cypress_test/integration_tests/desktop/calc/macro_spec.js
+++ b/cypress_test/integration_tests/desktop/calc/macro_spec.js
@@ -15,7 +15,7 @@ describe('macro dialog tests', function() {
}
beforeEach(function() {
- helper.beforeAll(testFileName, 'calc', undefined, undefined, true);
+ helper.beforeAll(testFileName, 'calc', undefined, undefined, undefined, true);
acceptMacroExecution();
helper.checkIfDocIsLoaded();
});
diff --git a/cypress_test/integration_tests/multiuser/calc/sheet_operations_spec.js b/cypress_test/integration_tests/multiuser/calc/sheet_operations_spec.js
new file mode 100644
index 0000000000..fc2c2d1f6d
--- /dev/null
+++ b/cypress_test/integration_tests/multiuser/calc/sheet_operations_spec.js
@@ -0,0 +1,82 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../../common/helper');
+
+describe.skip('Multiuser sheet operations', function() {
+ var testFileName = 'sheet_operations.ods';
+
+ beforeEach(function() {
+ helper.beforeAll(testFileName, 'calc', undefined, true);
+ });
+
+ afterEach(function() {
+ helper.afterAll(testFileName, this.currentTest.state);
+ });
+
+ function testInsertDelete(frameId1, frameId2) {
+ // We have one sheet by default
+ //assert for user-1/2
+ cy.customGet('.spreadsheet-tab', frameId1)
+ .should('have.length', 1);
+ cy.customGet('#spreadsheet-tab0', frameId1)
+ .should('have.text', 'Sheet1');
+
+ //assert for user-1/2
+ cy.customGet('.spreadsheet-tab', frameId2)
+ .should('have.length', 1);
+ cy.customGet('#spreadsheet-tab0', frameId2)
+ .should('have.text', 'Sheet1');
+
+ // Add one more sheet
+ cy.customGet('#tb_spreadsheet-toolbar_item_insertsheet', frameId1)
+ .click();
+
+ //assert for user-1/2
+ cy.customGet('.spreadsheet-tab', frameId1)
+ .should('have.length', 2);
+
+ cy.customGet('#spreadsheet-tab1', frameId1)
+ .should('have.text', 'Sheet2');
+
+ //assert for user-1/2
+ cy.customGet('.spreadsheet-tab', frameId2)
+ .should('have.length', 2);
+
+ cy.customGet('#spreadsheet-tab1', frameId2)
+ .should('have.text', 'Sheet2');
+
+ cy.wait(2000);
+
+ //user-1/2 removes it
+ cy.customGet('#spreadsheet-tab0', frameId2)
+ .rightclick();
+
+ cy.iframe(frameId2).contains('.context-menu-link', 'Delete Sheet...')
+ .click();
+
+ cy.customGet('.vex-dialog-form .vex-dialog-button-primary', frameId2)
+ .click();
+
+ //assert for user-1/2
+ cy.customGet('.spreadsheet-tab', frameId2)
+ .should('have.length', 1);
+
+ cy.customGet('#spreadsheet-tab0', frameId2)
+ .should('have.text', 'Sheet2');
+
+ //assert for user-1/2
+ cy.customGet('.spreadsheet-tab', frameId1)
+ .should('have.length', 1);
+
+ cy.customGet('#spreadsheet-tab0', frameId1)
+ .should('have.text', 'Sheet2');
+ }
+ it('user-1 insert and user-2 delete sheet.', function() {
+ testInsertDelete('#iframe1', '#iframe2');
+ });
+
+ it('user-2 insert and user-1 delete sheet', function() {
+ testInsertDelete('#iframe2', '#iframe1');
+ });
+
+});
diff --git a/cypress_test/integration_tests/multiuser/calc/sheet_operations_user1_spec.js b/cypress_test/integration_tests/multiuser/calc/sheet_operations_user1_spec.js
deleted file mode 100644
index e6b10b4ea7..0000000000
--- a/cypress_test/integration_tests/multiuser/calc/sheet_operations_user1_spec.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* global describe it cy beforeEach require afterEach */
-
-var helper = require('../../common/helper');
-
-describe('Sheet operations: user-1.', function() {
- var testFileName = 'sheet_operations.ods';
-
- beforeEach(function() {
- helper.beforeAll(testFileName, 'calc');
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- it('Insert/delete sheet.', 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 one sheet by default
- cy.get('.spreadsheet-tab')
- .should('have.length', 1);
- cy.get('#spreadsheet-tab0')
- .should('have.text', 'Sheet1');
-
- // Add one more sheet
- cy.get('#tb_spreadsheet-toolbar_item_insertsheet')
- .click();
- cy.get('.spreadsheet-tab')
- .should('have.length', 2);
- cy.get('#spreadsheet-tab1')
- .should('have.text', 'Sheet2');
-
- cy.wait(1000);
-
- // user-2 remove the first sheet
- cy.get('.spreadsheet-tab')
- .should('have.length', 1);
- cy.get('#spreadsheet-tab0')
- .should('have.text', 'Sheet2');
- });
-
-});
diff --git a/cypress_test/integration_tests/multiuser/calc/sheet_operations_user2_spec.js b/cypress_test/integration_tests/multiuser/calc/sheet_operations_user2_spec.js
deleted file mode 100644
index f7b4c815da..0000000000
--- a/cypress_test/integration_tests/multiuser/calc/sheet_operations_user2_spec.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* global describe it cy beforeEach require afterEach */
-
-var helper = require('../../common/helper');
-
-describe('Sheet operations: user-2.', function() {
- var testFileName = 'sheet_operations.ods';
-
- beforeEach(function() {
- helper.beforeAll(testFileName, 'calc', true);
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- it('Insert/delete sheet.', 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');
-
- // user-1 inserts a new sheet
- cy.get('.spreadsheet-tab')
- .should('have.length', 2);
- cy.get('#spreadsheet-tab0')
- .should('have.text', 'Sheet1');
- cy.get('#spreadsheet-tab1')
- .should('have.text', 'Sheet2');
-
- cy.wait(1000);
-
- // remove the first tab
- cy.get('#spreadsheet-tab0')
- .rightclick();
-
- cy.contains('.context-menu-link', 'Delete Sheet...')
- .click();
-
- cy.get('.vex-dialog-form .vex-dialog-button-primary')
- .click();
-
- cy.get('.spreadsheet-tab')
- .should('have.length', 1);
- cy.get('#spreadsheet-tab0')
- .should('have.text', 'Sheet2');
- });
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/paragraph_prop_spec.js b/cypress_test/integration_tests/multiuser/writer/paragraph_prop_spec.js
new file mode 100644
index 0000000000..599c4d0090
--- /dev/null
+++ b/cypress_test/integration_tests/multiuser/writer/paragraph_prop_spec.js
@@ -0,0 +1,57 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../../common/helper');
+
+describe('Change paragraph properties', function() {
+ var testFileName = 'paragraph_prop.odt';
+
+ beforeEach(function() {
+ helper.beforeAll(testFileName, 'writer', undefined, true);
+ });
+
+ afterEach(function() {
+ helper.afterAll(testFileName, this.currentTest.state);
+ });
+
+ it('Change paragraph alignment.', function() {
+
+ //user 1 change the paragraph alignment
+ cy.customGet('.leaflet-layer', '#iframe1')
+ .click();
+
+ cy.customGet('#tb_editbar_item_rightpara', '#iframe1')
+ .click();
+
+ helper.selectAllText('#iframe1');
+
+ //assert for user-1
+ cy.customGet('#copy-paste-container p', '#iframe1')
+ .should('have.attr', 'align', 'right');
+
+ //assert for user-2
+ cy.customGet('.leaflet-layer', '#iframe2')
+ .click();
+
+ helper.selectAllText('#iframe2');
+
+ cy.customGet('#copy-paste-container p', '#iframe2')
+ .should('have.attr', 'align', 'right');
+
+ //user-2 changes alignment to left
+ cy.customGet('.leaflet-layer', '#iframe2')
+ .click();
+
+ cy.customGet('#tb_editbar_item_leftpara', '#iframe2')
+ .click();
+
+ helper.selectAllText('#iframe2');
+
+ //assert for user-2
+ cy.customGet('#copy-paste-container p', '#iframe2')
+ .should('have.attr', 'align', 'left');
+
+ //assert for user-1
+ cy.customGet('#copy-paste-container p', '#iframe1')
+ .should('have.attr', 'align', 'left');
+ });
+});
diff --git a/cypress_test/integration_tests/multiuser/writer/paragraph_prop_user1_spec.js b/cypress_test/integration_tests/multiuser/writer/paragraph_prop_user1_spec.js
deleted file mode 100644
index 43103a6c74..0000000000
--- a/cypress_test/integration_tests/multiuser/writer/paragraph_prop_user1_spec.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* global describe it cy beforeEach require afterEach */
-
-var helper = require('../../common/helper');
-
-describe('Change paragraph properties: user-1.', function() {
- var testFileName = 'paragraph_prop.odt';
-
- beforeEach(function() {
- helper.beforeAll(testFileName, 'writer');
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- it('Change paragraph alignment.', 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');
-
- // Change the paragraph alignment
- cy.get('#tb_editbar_item_leftpara .w2ui-button')
- .should('have.class', 'checked');
-
- 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');
- });
-
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/paragraph_prop_user2_spec.js b/cypress_test/integration_tests/multiuser/writer/paragraph_prop_user2_spec.js
deleted file mode 100644
index 8e5d7faab7..0000000000
--- a/cypress_test/integration_tests/multiuser/writer/paragraph_prop_user2_spec.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* global describe it cy beforeEach require afterEach */
-
-var helper = require('../../common/helper');
-
-describe('Change paragraph properties: user-2.', function() {
- var testFileName = 'paragraph_prop.odt';
-
- beforeEach(function() {
- helper.beforeAll(testFileName, 'writer', true);
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- it('Change paragraph alignment.', 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');
-
- // user-1 changes the paragraph alignment
- cy.get('#tb_editbar_item_centerpara .w2ui-button')
- .should('have.class', 'checked');
-
- cy.get('#tb_editbar_item_rightpara .w2ui-button')
- .click();
- });
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_spec.js b/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_spec.js
new file mode 100644
index 0000000000..d2032505c1
--- /dev/null
+++ b/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_spec.js
@@ -0,0 +1,42 @@
+/* global describe it cy beforeEach require afterEach */
+
+var helper = require('../../common/helper');
+var desktopHelper = require('../../common/desktop_helper');
+
+describe('Sidebar visibility', function() {
+ var testFileName = 'sidebar_visibility.odt';
+
+ beforeEach(function() {
+ helper.beforeAll(testFileName, 'writer', undefined, true);
+ });
+
+ afterEach(function() {
+ helper.afterAll(testFileName, this.currentTest.state);
+ });
+
+ function testSidebarVisiblity(frameId1 ,frameId2) {
+ // Visible by default
+ cy.customGet('#sidebar-dock-wrapper', frameId1)
+ .should('be.visible');
+
+ desktopHelper.hideSidebar(frameId1);
+
+ //sidebar should be visible of user-2
+ cy.customGet('#sidebar-dock-wrapper', frameId2)
+ .should('be.visible');
+
+ // Show sidebar again
+ desktopHelper.showSidebar(frameId1);
+
+ cy.customGet('#sidebar-dock-wrapper', frameId2)
+ .should('be.visible');
+ }
+ it('Show/hide sidebar:user-1', function() {
+ testSidebarVisiblity('#iframe1', '#iframe2');
+ });
+
+ it('Show/hide sidebar:user-2', function() {
+ testSidebarVisiblity('#iframe2', '#iframe1');
+ });
+
+});
diff --git a/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user1_spec.js b/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user1_spec.js
deleted file mode 100644
index ee25e81370..0000000000
--- a/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user1_spec.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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.beforeAll(testFileName, 'writer');
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- 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-dock-wrapper')
- .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-dock-wrapper')
- .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-dock-wrapper')
- .should('be.visible');
- });
-
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user2_spec.js b/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user2_spec.js
deleted file mode 100644
index fe4c43cdcf..0000000000
--- a/cypress_test/integration_tests/multiuser/writer/sidebar_visibility_user2_spec.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* global describe it cy beforeEach require afterEach */
-
-var helper = require('../../common/helper');
-
-describe('Sidebar visibility: user-2.', function() {
- var testFileName = 'sidebar_visibility.odt';
-
- beforeEach(function() {
- helper.beforeAll(testFileName, 'writer', true);
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- 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-dock-wrapper')
- .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-dock-wrapper')
- .should('be.visible');
-
- // 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 visible
- cy.get('#sidebar-dock-wrapper')
- .should('be.visible');
-
- // Change paragraph alignment to trigger user-1 actions
- cy.get('#tb_editbar_item_leftpara .w2ui-button')
- .click();
- });
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user1_spec.js b/cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user1_spec.js
deleted file mode 100644
index acc6b39e3d..0000000000
--- a/cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user1_spec.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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.beforeAll(testFileName, 'writer');
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- 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.
- helper.moveCursor('down');
-
- // 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('contain.text', text);
- });
-
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user2_spec.js b/cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user2_spec.js
deleted file mode 100644
index f577b064ad..0000000000
--- a/cypress_test/integration_tests/multiuser/writer/simultaneous_typing_user2_spec.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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() {
- helper.beforeAll(testFileName, 'writer', true);
- });
-
- afterEach(function() {
- helper.afterAll(testFileName, this.currentTest.state);
- });
-
- 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('contain.text', text);
- });
-});
diff --git a/cypress_test/integration_tests/multiuser/writer/track_changes_spec.js b/cypress_test/integration_tests/multiuser/writer/track_changes_spec.js
new file mode 100644
index 0000000000..3aa753639d
--- /dev/null
+++ b/cypress_test/integration_tests/multiuser/writer/track_changes_spec.js
@@ -0,0 +1,129 @@
+/* global describe it cy beforeEach require afterEach*/
+
+var helper = require('../../common/helper');
+
+describe('Track Changes', function () {
+ var testFileName = 'track_changes.odt';
+
+ beforeEach(function () {
+ helper.beforeAll(testFileName, 'writer', undefined, true);
+ });
+
+ afterEach(function () {
+ helper.afterAll(testFileName, this.currentTest.state);
+ });
+
+ function confirmChange(frameId, action) {
+ cy.enter(frameId).then(getBody => {
+ getBody().find('#menu-editmenu')
+ .click()
+ .find('#menu-changesmenu')
+ .click()
+ .contains(action)
+ .click();
+ });
+ }
+
+ //enable record for track changes
+ function enableRecord(frameId) {
+ cy.enter(frameId).then(getBody => {
+ getBody().find('#menu-editmenu')
+ .click()
+ .find('#menu-changesmenu')
+ .click()
+ .contains('Record')
+ .click();
+
+ //if we don't wait , the test will fail in CLI
+ cy.wait(200);
+
+ getBody().find('#menu-editmenu')
+ .click()
+ .find('#menu-changesmenu')
+ .click()
+ .contains('Record')
+ .should('have.class', 'lo-menu-item-checked');
+
+ //to close
+ getBody().find('#menu-changesmenu')
+ .click();
+ });
+ }
+
+ function acceptAll(frameId1, frameId2) {
+
+ cy.customGet('.leaflet-layer', frameId1).click();
+
+ helper.typeIntoDocument('Hello World', frameId1);
+
+ enableRecord(frameId1);
+
+ cy.wait(1000);
+
+ helper.clearAllText(frameId1);
+ //if we don't wait , the test will fail in CLI
+ cy.wait(200);
+
+ helper.selectAllText(frameId1);
+
+ confirmChange(frameId2,'Accept All');
+
+ //assert in frame1/frame2 depending on the parameters
+ helper.typeIntoDocument('{ctrl}a', frameId1);
+
+ helper.textSelectionShouldNotExist(frameId1);
+
+ //assert in frame2/frame1 depending on the parameters
+ helper.typeIntoDocument('{ctrl}a', frameId2);
+
+ helper.textSelectionShouldNotExist(frameId2);
+ }
+
+ function rejectAll(frameId1, frameId2) {
+
+ cy.customGet('.leaflet-layer', frameId1).click();
+
+ helper.typeIntoDocument('Hello World', frameId1);
+
+ enableRecord(frameId1);
+
+ cy.wait(1000);
+
+ helper.clearAllText(frameId1);
+
+ cy.wait(400);
+
+ confirmChange(frameId2, 'Reject All');
+
+ cy.customGet('.leaflet-layer', frameId1).click();
+
+ helper.selectAllText(frameId1);
+
+ //assert for user-1/2 depending on parameters
+ helper.expectTextForClipboard('\nHello World', frameId1);
+
+ //assert for user-2/1 depending on parameters
+ cy.customGet('.leaflet-layer', frameId2).click();
+
+ helper.selectAllText(frameId2);
+
+ helper.expectTextForClipboard('\nHello World', frameId2);
+ }
+
+
+ it('Accept All by user-2', function () {
+ acceptAll('#iframe1', '#iframe2');
+ });
+
+ it('Accept All by user-1', function () {
+ acceptAll('#iframe2', '#iframe1');
+ });
+
+ it('Reject All by user-2', function() {
+ rejectAll('#iframe1', '#iframe2');
+ });
+
+ it('Reject All by user-1', function() {
+ rejectAll('#iframe2', '#iframe1');
+ });
+});
diff --git a/cypress_test/package.json b/cypress_test/package.json
index cda3c4cc2d..5dcb276c17 100644
--- a/cypress_test/package.json
+++ b/cypress_test/package.json
@@ -9,6 +9,7 @@
"cypress": "6.8.0",
"cypress-failed-log": "2.9.1",
"cypress-file-upload": "5.0.2",
+ "cypress-iframe": "1.0.1",
"cypress-log-to-output": "1.1.2",
"cypress-select-tests": "1.7.0",
"cypress-wait-until": "1.7.1",
diff --git a/cypress_test/run_parallel.sh b/cypress_test/run_parallel.sh
index dbd444121d..93f272804c 100755
--- a/cypress_test/run_parallel.sh
+++ b/cypress_test/run_parallel.sh
@@ -56,8 +56,10 @@ if [ "${TEST_TYPE}" = "desktop" -o "${TEST_TYPE}" = "interfer-desktop" ]; then
TEST_FILE_PATH=${DESKTOP_TEST_FOLDER}${TEST_FILE};
elif [ "${TEST_TYPE}" = "mobile" -o "${TEST_TYPE}" = "interfer-mobile" ]; then
TEST_FILE_PATH=${MOBILE_TEST_FOLDER}${TEST_FILE};
-elif [ "${TEST_TYPE}" = "multi-user" -o "${TEST_TYPE}" = "interfer" ]; then
+elif [ "${TEST_TYPE}" = "multi-user" ]; then
TEST_FILE_PATH=${MULTIUSER_TEST_FOLDER}${TEST_FILE};
+elif [ "${TEST_TYPE}" = "interfer" ]; then
+ TEST_FILE_PATH="${DIR}/integration_tests/common/"${TEST_FILE};
fi
RUN_COMMAND="${CYPRESS_BINARY} run \
diff --git a/cypress_test/support/index.js b/cypress_test/support/index.js
index eb90ebcdc1..340b984edf 100644
--- a/cypress_test/support/index.js
+++ b/cypress_test/support/index.js
@@ -1,8 +1,9 @@
-/* global require Cypress Promise */
+/* global require cy Cypress Promise */
require('cypress-failed-log');
require('cypress-wait-until');
require('cypress-file-upload');
+require('cypress-iframe');
if (Cypress.env('INTEGRATION') === 'php-proxy') {
Cypress.Server.defaults({
@@ -41,3 +42,11 @@ Cypress.Commands.overwrite('waitUntil', function(originalFn, subject, checkFunct
options.interval = 10; // ms
return originalFn(subject, checkFunction, options);
});
+
+Cypress.Commands.add('customGet', function(selector, frameId, options) {
+ if (typeof frameId === 'undefined') {
+ return cy.get(selector, options);
+ } else {
+ return cy.iframe(frameId).find(selector,options);
+ }
+});
diff --git a/loleaflet/Makefile.am b/loleaflet/Makefile.am
index 740cfd481f..926d9acb6d 100644
--- a/loleaflet/Makefile.am
+++ b/loleaflet/Makefile.am
@@ -463,6 +463,11 @@ if ENABLE_ANDROIDAPP
@echo "JS, HTML and CSS has been updated (android/lib/src/main/assets/dist)."
endif
+if ENABLE_CYPRESS
+ cp -a "$(srcdir)/../cypress_test/data/multiuser/cypress-multiuser.html" "$(DIST_FOLDER)/cypress-multiuser.html"
+ @echo "Added HTML file for multiuser tests"
+endif
+
$(DIST_FOLDER)/admin-bundle.js: $(LOLEAFLET_ADMIN_DST) \
$(INTERMEDIATE_DIR)/admin-src.js
@NODE_PATH=$(abs_builddir)/node_modules:$(INTERMEDIATE_DIR) $(NODE) node_modules/browserify/bin/cmd.js -g browserify-css $(if $(IS_DEBUG),--debug,-g uglifyify) -o $@ $(srcdir)/admin/main-admin.js