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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 25 17:46:11 UTC 2020


 cypress_test/data/mobile/impress/nextcloud.odp                  |binary
 cypress_test/integration_tests/common/nextcloud_helper.js       |   25 +++++
 cypress_test/integration_tests/mobile/calc/nextcloud_spec.js    |   43 ++++++++++
 cypress_test/integration_tests/mobile/impress/nextcloud_spec.js |   38 ++++++++
 cypress_test/integration_tests/mobile/writer/nextcloud_spec.js  |   35 ++++++++
 5 files changed, 140 insertions(+), 1 deletion(-)

New commits:
commit 09aa1c17e1e7e1d77ffb17a116d399f9cf169747
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Sep 25 17:20:01 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Sep 25 19:45:53 2020 +0200

    cypress: NC: test restoring a document's previous version.
    
    Change-Id: I7cabd7138dbabe870382603b5ad9d5415c9db21c
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103412
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/data/mobile/impress/nextcloud.odp b/cypress_test/data/mobile/impress/nextcloud.odp
index 8907786e3..bc6d853ab 100644
Binary files a/cypress_test/data/mobile/impress/nextcloud.odp and b/cypress_test/data/mobile/impress/nextcloud.odp differ
diff --git a/cypress_test/integration_tests/common/nextcloud_helper.js b/cypress_test/integration_tests/common/nextcloud_helper.js
index 304c814e9..980355d35 100644
--- a/cypress_test/integration_tests/common/nextcloud_helper.js
+++ b/cypress_test/integration_tests/common/nextcloud_helper.js
@@ -2,7 +2,7 @@
 
 var mobileHelper = require('./mobile_helper');
 
-function checkAndCloseRevisionHistory() {
+function openRevisionHistory() {
 	mobileHelper.openHamburgerMenu();
 
 	cy.contains('.menu-entry-with-icon', 'File')
@@ -14,12 +14,18 @@ function checkAndCloseRevisionHistory() {
 			cy.wrap(item)
 				.click();
 		});
+
 	cy.get('#app-sidebar')
 		.should('be.visible');
 
 	cy.get('section#tab-versionsTabView')
 		.should('be.visible');
 
+}
+
+function checkAndCloseRevisionHistory() {
+	openRevisionHistory();
+
 	cy.get('.app-sidebar__close.icon-close')
 		.then(function(item) {
 			Cypress.env('IFRAME_LEVEL', '1');
@@ -35,6 +41,22 @@ function checkAndCloseRevisionHistory() {
 		});
 }
 
+function restorePreviousVersion() {
+	openRevisionHistory();
+
+	cy.get('#versionsTabView .versions li:nth-of-type(1) .revertVersion')
+		.click();
+
+	cy.get('.app-sidebar__close.icon-close')
+		.then(function(item) {
+			Cypress.env('IFRAME_LEVEL', '2');
+			cy.wrap(item)
+				.click();
+		});
+
+	cy.wait(10000);
+}
+
 function checkAndCloseSharing() {
 	mobileHelper.openHamburgerMenu();
 
@@ -121,3 +143,4 @@ module.exports.checkAndCloseRevisionHistory = checkAndCloseRevisionHistory;
 module.exports.checkAndCloseSharing = checkAndCloseSharing;
 module.exports.insertImageFromStorage = insertImageFromStorage;
 module.exports.saveFileAs = saveFileAs;
+module.exports.restorePreviousVersion = restorePreviousVersion;
diff --git a/cypress_test/integration_tests/mobile/calc/nextcloud_spec.js b/cypress_test/integration_tests/mobile/calc/nextcloud_spec.js
index a384e2c29..b6913cc83 100644
--- a/cypress_test/integration_tests/mobile/calc/nextcloud_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/nextcloud_spec.js
@@ -2,7 +2,9 @@
 
 var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
+var calcHelper = require('../../common/calc_helper');
 var nextcloudHelper = require('../../common/nextcloud_helper');
+var calcMobileHelper = require('./calc_mobile_helper');
 
 describe('Nextcloud specific tests.', function() {
 	var testFileName = 'nextcloud.ods';
@@ -66,5 +68,46 @@ describe('Nextcloud specific tests.', function() {
 
 		nextcloudHelper.checkAndCloseRevisionHistory();
 	});
+
+	it('Restore previous revision.', function() {
+		helper.beforeAll(testFileName, 'calc');
+
+		mobileHelper.enableEditingMobile();
+
+		// Initially we have "text" text in the document
+		calcMobileHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.text', 'Text');
+
+		// Change the document content and save it
+		calcHelper.clickOnFirstCell(false, true);
+
+		helper.selectAllText();
+
+		helper.typeIntoDocument('new');
+
+		calcMobileHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.text', 'new');
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'File')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Save')
+			.click();
+
+		nextcloudHelper.restorePreviousVersion();
+
+		mobileHelper.enableEditingMobile();
+
+		calcMobileHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.text', 'Text');
+	});
 });
 
diff --git a/cypress_test/integration_tests/mobile/impress/nextcloud_spec.js b/cypress_test/integration_tests/mobile/impress/nextcloud_spec.js
index b16398298..3628a5e6b 100644
--- a/cypress_test/integration_tests/mobile/impress/nextcloud_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/nextcloud_spec.js
@@ -3,6 +3,7 @@
 var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
 var nextcloudHelper = require('../../common/nextcloud_helper');
+var impressMobileHelper = require('./impress_mobile_helper');
 
 describe('Nextcloud specific tests.', function() {
 	var testFileName = 'nextcloud.odp';
@@ -65,5 +66,42 @@ describe('Nextcloud specific tests.', function() {
 
 		nextcloudHelper.checkAndCloseRevisionHistory();
 	});
+
+	it('Restore previous revision.', function() {
+		helper.beforeAll(testFileName, 'impress');
+
+		mobileHelper.enableEditingMobile();
+
+		// Initially we have "text" text in the document
+		impressMobileHelper.selectTextShapeInTheCenter();
+
+		impressMobileHelper.selectTextOfShape();
+
+		helper.expectTextForClipboard('text');
+
+		helper.typeIntoDocument('new');
+
+		helper.selectAllText();
+
+		helper.expectTextForClipboard('new');
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'File')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Save')
+			.click();
+
+		nextcloudHelper.restorePreviousVersion();
+
+		mobileHelper.enableEditingMobile();
+
+		impressMobileHelper.selectTextShapeInTheCenter();
+
+		impressMobileHelper.selectTextOfShape();
+
+		helper.expectTextForClipboard('text');
+	});
 });
 
diff --git a/cypress_test/integration_tests/mobile/writer/nextcloud_spec.js b/cypress_test/integration_tests/mobile/writer/nextcloud_spec.js
index 5224cb090..9a66b4e63 100644
--- a/cypress_test/integration_tests/mobile/writer/nextcloud_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/nextcloud_spec.js
@@ -3,6 +3,7 @@
 var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
 var nextcloudHelper = require('../../common/nextcloud_helper');
+var writerMobileHelper = require('./writer_mobile_helper');
 
 describe('Nextcloud specific tests.', function() {
 	var testFileName = 'nextcloud.odt';
@@ -64,5 +65,39 @@ describe('Nextcloud specific tests.', function() {
 
 		nextcloudHelper.checkAndCloseRevisionHistory();
 	});
+
+	it('Restore previous revision.', function() {
+		helper.beforeAll(testFileName, 'writer');
+
+		mobileHelper.enableEditingMobile();
+
+		// Initially we have "text" text in the document
+		writerMobileHelper.selectAllMobile();
+
+		helper.expectTextForClipboard('text');
+
+		// Change the document content and save it
+		helper.typeIntoDocument('new');
+
+		writerMobileHelper.selectAllMobile();
+
+		helper.expectTextForClipboard('new');
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'File')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Save')
+			.click();
+
+		nextcloudHelper.restorePreviousVersion();
+
+		mobileHelper.enableEditingMobile();
+
+		writerMobileHelper.selectAllMobile();
+
+		helper.expectTextForClipboard('text');
+	});
 });
 


More information about the Libreoffice-commits mailing list