summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2021-12-13 06:00:59 -0500
committerJan Holesovsky <holesovsky@gmail.com>2022-01-11 09:28:03 +0100
commit4a559a6ff1da21bee33748a5f2dec602a5667c86 (patch)
tree66d930bcf9445ab60751eeada3b22cd55bae6a9f /cypress_test/integration_tests
parentwsd: correct use the exit code from UnitWSD (diff)
downloadonline-4a559a6ff1da21bee33748a5f2dec602a5667c86.tar.gz
online-4a559a6ff1da21bee33748a5f2dec602a5667c86.zip
cypress: close the test document before reloading
The test document wasn't properly closed before reopening. This went unnoticed until the 'unload' phase grew longer such that the new load command basically added a view on the existing document, instead of create a new instance altogether. This clearly was an issue that caused timing-based instabilities. Now we properly close and wait until we confirm the document is closed before opening a new instance. Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk> (cherry picked from commit 54999291e95d75626426e2f306afa55b7a4f6fa3) Change-Id: Icda6d7870c1352cc90002ced3c74e692fa849444
Diffstat (limited to 'cypress_test/integration_tests')
-rw-r--r--cypress_test/integration_tests/common/helper.js17
-rw-r--r--cypress_test/integration_tests/desktop/calc/top_toolbar_spec.js2
-rw-r--r--cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js2
-rw-r--r--cypress_test/integration_tests/mobile/calc/annotation_spec.js2
-rw-r--r--cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js2
-rw-r--r--cypress_test/integration_tests/mobile/impress/annotation_spec.js2
-rw-r--r--cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js2
-rw-r--r--cypress_test/integration_tests/mobile/writer/annotation_spec.js2
-rw-r--r--cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js2
9 files changed, 24 insertions, 9 deletions
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 0dace13e4a..bbd40a1243 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -496,17 +496,30 @@ function matchClipboardText(regexp) {
});
}
+
+// This is called during a test to reload the same document after
+// some modification. The purpose is typically to verify that
+// said changes were preserved in the document upon closing.
+function reload(fileName, subFolder, noFileCopy, subsequentLoad) {
+ closeDocument(fileName, '');
+ loadTestDoc(fileName, subFolder, noFileCopy, subsequentLoad);
+}
+
function beforeAll(fileName, subFolder, noFileCopy, isMultiUser, subsequentLoad, hasInteractionBeforeLoad) {
loadTestDoc(fileName, subFolder, noFileCopy, isMultiUser, subsequentLoad, hasInteractionBeforeLoad);
}
+function afterAll(fileName, testState) {
+ closeDocument(fileName, testState);
+}
+
// This method is intended to call after each test case.
// We use this method to close the document, before step
// on to the next test case.
// Parameters:
// fileName - test document name (we can check it on the admin console).
// testState - whether the test passed or failed before this method was called.
-function afterAll(fileName, testState) {
+function closeDocument(fileName, testState) {
cy.log('Waiting for closing the document - start.');
if (Cypress.env('INTEGRATION') === 'nextcloud') {
@@ -1228,6 +1241,8 @@ module.exports.selectAllText = selectAllText;
module.exports.clearAllText = clearAllText;
module.exports.expectTextForClipboard = expectTextForClipboard;
module.exports.matchClipboardText = matchClipboardText;
+module.exports.closeDocument = closeDocument;
+module.exports.reload = reload;
module.exports.afterAll = afterAll;
module.exports.initAliasToNegative = initAliasToNegative;
module.exports.doIfInCalc = doIfInCalc;
diff --git a/cypress_test/integration_tests/desktop/calc/top_toolbar_spec.js b/cypress_test/integration_tests/desktop/calc/top_toolbar_spec.js
index 16edaeacf9..3c1d4c26c9 100644
--- a/cypress_test/integration_tests/desktop/calc/top_toolbar_spec.js
+++ b/cypress_test/integration_tests/desktop/calc/top_toolbar_spec.js
@@ -35,7 +35,7 @@ describe('Top toolbar tests.', function() {
return originalFn(selector, options);
});
- helper.beforeAll(testFileName, 'calc', true);
+ helper.reload(testFileName, 'calc', true);
calcHelper.selectEntireSheet();
diff --git a/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js b/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js
index 499a35519d..6a2ff53028 100644
--- a/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js
+++ b/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js
@@ -387,7 +387,7 @@ describe('Top toolbar tests.', function() {
desktopHelper.actionOnSelector('save', (selector) => { cy.get(selector).click(); });
- helper.beforeAll(testFileName, 'writer', true);
+ helper.reload(testFileName, 'writer', true);
cy.wait(2000);
diff --git a/cypress_test/integration_tests/mobile/calc/annotation_spec.js b/cypress_test/integration_tests/mobile/calc/annotation_spec.js
index 4403c97e7a..c4a171d3f2 100644
--- a/cypress_test/integration_tests/mobile/calc/annotation_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/annotation_spec.js
@@ -28,7 +28,7 @@ describe('Annotation Tests',function() {
return originalFn(selector, options);
});
- helper.beforeAll(testFileName, 'calc', true);
+ helper.reload(testFileName, 'calc', true);
mobileHelper.enableEditingMobile();
diff --git a/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js
index 211b7e5a8f..f77483d76b 100644
--- a/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/hamburger_menu_spec.js
@@ -45,7 +45,7 @@ describe('Trigger hamburger menu options.', function() {
});
// Reopen the document and check content.
- helper.beforeAll(testFileName, 'calc', true);
+ helper.reload(testFileName, 'calc', true);
mobileHelper.enableEditingMobile();
diff --git a/cypress_test/integration_tests/mobile/impress/annotation_spec.js b/cypress_test/integration_tests/mobile/impress/annotation_spec.js
index bee9a900cf..1cf47a0e2e 100644
--- a/cypress_test/integration_tests/mobile/impress/annotation_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/annotation_spec.js
@@ -24,7 +24,7 @@ describe('Annotation tests.', function() {
mobileHelper.selectHamburgerMenuItem(['File', 'Save']);
- helper.beforeAll(testFileName, 'impress', true);
+ helper.reload(testFileName, 'impress', true);
mobileHelper.enableEditingMobile();
diff --git a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
index 477eef0f76..588c8b65ac 100644
--- a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
@@ -46,7 +46,7 @@ describe('Trigger hamburger menu options.', function() {
});
// Reopen the document and check content.
- helper.beforeAll(testFileName, 'impress', true);
+ helper.reload(testFileName, 'impress', true);
mobileHelper.enableEditingMobile();
diff --git a/cypress_test/integration_tests/mobile/writer/annotation_spec.js b/cypress_test/integration_tests/mobile/writer/annotation_spec.js
index 6a8c02308b..004a4335b9 100644
--- a/cypress_test/integration_tests/mobile/writer/annotation_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/annotation_spec.js
@@ -30,7 +30,7 @@ describe.skip('Annotation tests.', function() {
return originalFn(selector, options);
});
- helper.beforeAll(testFileName, 'writer', true);
+ helper.reload(testFileName, 'writer', true);
mobileHelper.enableEditingMobile();
diff --git a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
index 3be723b419..1eac6d89d2 100644
--- a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js
@@ -74,7 +74,7 @@ describe('Trigger hamburger menu options.', function() {
});
// Reopen the document and check content.
- helper.beforeAll(testFileName, 'writer', true);
+ helper.reload(testFileName, 'writer', true);
mobileHelper.enableEditingMobile();