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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 10 16:30:32 UTC 2020


 cypress_test/integration_tests/common/impress_helper.js                 |    7 
 cypress_test/integration_tests/desktop/impress/slide_operations_spec.js |   14 
 cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js    |  175 ++++++++++
 cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js  |    7 
 4 files changed, 193 insertions(+), 10 deletions(-)

New commits:
commit a8e25571b1bed641d61f622f5b3ba6e9d1e788ef
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jul 10 14:15:19 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Jul 10 18:30:23 2020 +0200

    cypress: add slide operation tests (mobile).
    
    Change-Id: I0ee6ee840c381263315305336e01f46dfdbcf1f4
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98525
    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/integration_tests/common/impress_helper.js b/cypress_test/integration_tests/common/impress_helper.js
index dab641ac4..dc350492c 100644
--- a/cypress_test/integration_tests/common/impress_helper.js
+++ b/cypress_test/integration_tests/common/impress_helper.js
@@ -56,6 +56,13 @@ function typeTextAndVerify(text, expected) {
 
 	helper.expectTextForClipboard(expected);
 }
+
+function assertNumberOfSlidePreviews(slides) {
+	cy.get('#slide-sorter .preview-frame')
+		.should('have.length', slides + 1);
+}
+
 module.exports.assertNotInTextEditMode = assertNotInTextEditMode;
 module.exports.assertInTextEditMode = assertInTextEditMode;
 module.exports.typeTextAndVerify = typeTextAndVerify;
+module.exports.assertNumberOfSlidePreviews = assertNumberOfSlidePreviews;
diff --git a/cypress_test/integration_tests/desktop/impress/slide_operations_spec.js b/cypress_test/integration_tests/desktop/impress/slide_operations_spec.js
index fb490ac6c..3541c577a 100644
--- a/cypress_test/integration_tests/desktop/impress/slide_operations_spec.js
+++ b/cypress_test/integration_tests/desktop/impress/slide_operations_spec.js
@@ -1,6 +1,7 @@
 /* global describe it cy require afterEach beforeEach*/
 
 var helper = require('../../common/helper');
+var impressHelper = require('../../common/impress_helper');
 
 describe('Slide operations', function() {
 	var testFileName = 'slide_operations.odp';
@@ -13,17 +14,12 @@ describe('Slide operations', function() {
 		helper.afterAll(testFileName);
 	});
 
-	function assertNumberOfSlides(slides) {
-		cy.get('.preview-frame')
-			.should('have.length', slides + 1);
-	}
-
 	it('Add slides', function() {
 		cy.get('#tb_presentation-toolbar_item_insertpage')
 			.should('not.have.class', 'disabled')
 			.click();
 
-		assertNumberOfSlides(2);
+		impressHelper.assertNumberOfSlidePreviews(2);
 	});
 
 	it('Remove slides', function() {
@@ -32,7 +28,7 @@ describe('Slide operations', function() {
 			.should('not.have.class', 'disabled')
 			.click();
 
-		assertNumberOfSlides(2);
+		impressHelper.assertNumberOfSlidePreviews(2);
 
 		// Remove Slides
 		cy.get('#tb_presentation-toolbar_item_deletepage')
@@ -44,7 +40,7 @@ describe('Slide operations', function() {
 		cy.get('#tb_presentation-toolbar_item_deletepage')
 			.should('have.class', 'disabled');
 
-		assertNumberOfSlides(1);
+		impressHelper.assertNumberOfSlidePreviews(1);
 
 	});
 
@@ -53,7 +49,7 @@ describe('Slide operations', function() {
 			.should('not.have.class', 'disabled')
 			.click();
 
-		assertNumberOfSlides(2);
+		impressHelper.assertNumberOfSlidePreviews(2);
 
 	});
 });
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 51dc9e68e..e176fd901 100644
--- a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
@@ -1,6 +1,7 @@
 /* global describe it cy require afterEach expect */
 
 var helper = require('../../common/helper');
+var impressHelper = require('../../common/impress_helper');
 var mobileHelper = require('../../common/mobile_helper');
 var impressMobileHelper = require('./impress_mobile_helper');
 
@@ -361,6 +362,73 @@ describe('Trigger hamburger menu options.', function() {
 			.should('be.visible');
 	});
 
+	it('Slide: New Slide.', function() {
+		before('hamburger_menu.odp');
+
+		impressHelper.assertNumberOfSlidePreviews(1);
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Slide')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'New Slide')
+			.click();
+
+		impressHelper.assertNumberOfSlidePreviews(2);
+	});
+
+	it('Slide: Duplicate Slide.', function() {
+		before('hamburger_menu.odp');
+
+		impressHelper.assertNumberOfSlidePreviews(1);
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Slide')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Duplicate Slide')
+			.click();
+
+		impressHelper.assertNumberOfSlidePreviews(2);
+	});
+
+	it('Slide: Delete Slide.', function() {
+		before('hamburger_menu.odp');
+
+		impressHelper.assertNumberOfSlidePreviews(1);
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Slide')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'New Slide')
+			.click();
+
+		impressHelper.assertNumberOfSlidePreviews(2);
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Slide')
+			.click();
+
+		cy.contains('.menu-entry-with-icon', 'Delete Slide')
+			.click();
+
+		cy.get('.vex-content')
+			.should('exist');
+
+		cy.get('.vex-dialog-button-primary')
+			.click();
+
+		cy.get('.vex-content')
+			.should('not.exist');
+
+		impressHelper.assertNumberOfSlidePreviews(1);
+	});
+
 	it('Full Screen.', function() {
 		before('hamburger_menu.odp');
 
commit 4fd2d2c56a4df1caf75fa6f87b6dff55fff42215
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Jul 10 13:49:14 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Jul 10 18:30:13 2020 +0200

    cypress: some more tests for impress's hamburger menu (mobile).
    
    Change-Id: I3eb5afe1e67911b71e3152181c38eb2a2f9016f9
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/98524
    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/integration_tests/mobile/impress/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
index 8f870fe83..51dc9e68e 100644
--- a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js
@@ -360,4 +360,111 @@ describe('Trigger hamburger menu options.', function() {
 		cy.get('.leaflet-selection-marker-start')
 			.should('be.visible');
 	});
+
+	it('Full Screen.', function() {
+		before('hamburger_menu.odp');
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Full Screen')
+			.click();
+
+		// TODO: We can't hit the actual full screen from cypress
+		cy.wait(500);
+	});
+
+	it('Automatic spell checking.', function() {
+		before('hamburger_menu.odp');
+
+		// Add a spelling error to the shape
+		impressMobileHelper.selectTextShapeInTheCenter();
+
+		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition tspan')
+			.should('have.text', 'X');
+
+		// Type a new character
+		dblclickOnShape();
+
+		cy.get('textarea.clipboard')
+			.type('qqqqqq');
+
+		impressMobileHelper.triggerNewSVGForShapeInTheCenter();
+
+		cy.get('.leaflet-pane.leaflet-overlay-pane g.Page .TextPosition tspan')
+			.should('have.text', 'Xqqqqqq');
+
+		// Make everything white on tile
+		impressMobileHelper.selectTextOfShape();
+
+		mobileHelper.openMobileWizard();
+
+		helper.clickOnIdle('#TextPropertyPanel');
+
+		cy.get('#Bold')
+			.should('be.visible');
+
+		helper.clickOnIdle('#Color');
+
+		mobileHelper.selectFromColorPalette(0, 0, 7);
+
+		mobileHelper.closeMobileWizard();
+
+		impressMobileHelper.removeShapeSelection();
+
+		var preiew = '.preview-frame:nth-of-type(2) img';
+		helper.imageShouldBeFullWhiteOrNot(preiew, false);
+
+		// Disable automatic spell checking
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Automatic Spell Checking')
+			.click();
+
+		helper.imageShouldBeFullWhiteOrNot(preiew, true);
+	});
+
+	it('Fullscreen presentation.', function() {
+		before('hamburger_menu.odp');
+
+		cy.get('iframe.leaflet-slideshow')
+			.should('not.exist');
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'Fullscreen presentation')
+			.click();
+
+		cy.get('iframe.leaflet-slideshow')
+			.should('exist');
+	});
+
+	it('Check version information.', function() {
+		before('hamburger_menu.odp');
+
+		mobileHelper.openHamburgerMenu();
+
+		cy.contains('.menu-entry-with-icon', 'About')
+			.click();
+
+		cy.get('.vex-content')
+			.should('exist');
+
+		// Check the version
+		if (helper.getLOVersion() === 'master') {
+			cy.contains('#lokit-version', 'LibreOffice')
+				.should('exist');
+		} else if (helper.getLOVersion() === 'cp-6-2' ||
+				   helper.getLOVersion() === 'cp-6-4')
+		{
+			cy.contains('#lokit-version', 'Collabora Office')
+				.should('exist');
+		}
+
+		// Close about dialog
+		cy.get('.vex-close')
+			.click({force : true});
+
+		cy.get('.vex-content')
+			.should('not.exist');
+	});
 });
diff --git a/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js b/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js
index 24f2caade..90702bd90 100644
--- a/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js
+++ b/cypress_test/integration_tests/mobile/impress/impress_mobile_helper.js
@@ -40,7 +40,7 @@ function selectTextOfShape() {
 	helper.selectAllText(false);
 }
 
-function triggerNewSVGForShapeInTheCenter() {
+function removeShapeSelection() {
 	// Remove selection first with clicking next to the rotate handler
 	cy.get('.transform-handler--rotate')
 		.then(function(items) {
@@ -57,6 +57,10 @@ function triggerNewSVGForShapeInTheCenter() {
 
 	cy.get('.leaflet-drag-transform-marker')
 		.should('not.exist');
+}
+
+function triggerNewSVGForShapeInTheCenter() {
+	removeShapeSelection();
 
 	// If we click too fast on the shape again
 	// then it steps into edit mode, might be a bug
@@ -69,3 +73,4 @@ function triggerNewSVGForShapeInTheCenter() {
 module.exports.selectTextShapeInTheCenter = selectTextShapeInTheCenter;
 module.exports.triggerNewSVGForShapeInTheCenter = triggerNewSVGForShapeInTheCenter;
 module.exports.selectTextOfShape = selectTextOfShape;
+module.exports.removeShapeSelection = removeShapeSelection;


More information about the Libreoffice-commits mailing list