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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue May 26 12:01:32 UTC 2020


 cypress_test/data/mobile/impress/slide_properties.odp                  |binary
 cypress_test/integration_tests/mobile/impress/slide_properties_spec.js |  174 ++++++++--
 dev/null                                                               |binary
 3 files changed, 150 insertions(+), 24 deletions(-)

New commits:
commit f2a5ba30148e6571a4b41877fd78a35b5df8a5af
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue May 26 11:44:36 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue May 26 14:01:13 2020 +0200

    cypress: more slide settings related tests.
    
    Change-Id: I733b7cb4d53650de9901c7b7ebaaf22a73f80930
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94856
    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/data/mobile/impress/slide_properties.odp b/cypress_test/data/mobile/impress/slide_properties.odp
index 1002f7beb..52c0a3c0f 100644
Binary files a/cypress_test/data/mobile/impress/slide_properties.odp and b/cypress_test/data/mobile/impress/slide_properties.odp differ
diff --git a/cypress_test/data/mobile/impress/slide_properties2.odp b/cypress_test/data/mobile/impress/slide_properties2.odp
deleted file mode 100644
index c92dc927c..000000000
Binary files a/cypress_test/data/mobile/impress/slide_properties2.odp and /dev/null differ
diff --git a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js
index 571236c30..aae3b8689 100644
--- a/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/slide_properties_spec.js
@@ -1,13 +1,12 @@
-/* global describe it cy require afterEach expect */
+/* global describe it cy require afterEach expect beforeEach */
 
 var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
 
 describe('Changing slide properties.', function() {
-	var testFileName;
+	var testFileName = 'slide_properties.odp';
 
-	function before(fileName) {
-		testFileName = fileName;
+	beforeEach(function() {
 		mobileHelper.beforeAllMobile(testFileName, 'impress');
 
 		mobileHelper.enableEditingMobile();
@@ -15,7 +14,7 @@ describe('Changing slide properties.', function() {
 		previewShouldBeFullWhite();
 
 		mobileHelper.openMobileWizard();
-	}
+	});
 
 	afterEach(function() {
 		helper.afterAll(testFileName);
@@ -51,8 +50,6 @@ describe('Changing slide properties.', function() {
 	}
 
 	it('Apply solid color background.', function() {
-		before('slide_properties.odp');
-
 		// Change fill style
 		cy.get('#fillstyle')
 			.click();
@@ -62,11 +59,11 @@ describe('Changing slide properties.', function() {
 
 		cy.get('#fillstyle .ui-header-left')
 			.should('have.text', 'Color');
-			
+
 		// Check the default color
 		cy.get('#fillattr .color-sample-selected')
 			.should('have.attr', 'style', 'background-color: rgb(114, 159, 207);');
-		
+
 		// Change the color
 		cy.get('#fillattr')
 			.click();
@@ -94,8 +91,6 @@ describe('Changing slide properties.', function() {
 	});
 
 	it('Apply gradient fill.', function() {
-		before('slide_properties.odp');
-
 		// Change fill style
 		cy.get('#fillstyle')
 			.click();
@@ -155,8 +150,6 @@ describe('Changing slide properties.', function() {
 	});
 
 	it('Apply hatching fill.', function() {
-		before('slide_properties.odp');
-
 		// Change fill style
 		cy.get('#fillstyle')
 			.click();
@@ -195,8 +188,6 @@ describe('Changing slide properties.', function() {
 	});
 
 	it('Apply bitmap fill.', function() {
-		before('slide_properties.odp');
-
 		// Change fill style
 		cy.get('#fillstyle')
 			.click();
@@ -235,8 +226,6 @@ describe('Changing slide properties.', function() {
 	});
 
 	it('Apply pattern fill.', function() {
-		before('slide_properties.odp');
-
 		// Change fill style
 		cy.get('#fillstyle')
 			.click();
@@ -275,8 +264,6 @@ describe('Changing slide properties.', function() {
 	});
 
 	it('Remove slide fill.', function() {
-		before('slide_properties.odp');
-
 		// Apply color fill first
 		cy.get('#fillstyle')
 			.click();
@@ -317,9 +304,38 @@ describe('Changing slide properties.', function() {
 	});
 
 	it('Change master background.', function() {
-		before('slide_properties2.odp');
+		// The default master slide does not have background
+		// So switch to a different master slide first
+		cy.get('#masterslide')
+			.click();
+
+		cy.contains('.ui-combobox-text', 'Colored')
+			.click();
+
+		cy.get('#masterslide .ui-header-left')
+			.should('have.text', 'Colored');
+
+		previewShouldBeFullWhite(false);
+
+		// Reopen mobile wizard and change the setting
+		mobileHelper.closeMobileWizard();
+		mobileHelper.openMobileWizard();
+
+		cy.get('input#displaymasterbackground')
+			.should('have.prop', 'checked', true);
+
+		cy.get('input#displaymasterbackground')
+			.click();
+
+		cy.get('input#displaymasterbackground')
+			.should('not.have.prop', 'checked', true);
+
+		previewShouldBeFullWhite();
+
+		// Reopen mobile wizard and change the setting again
+		mobileHelper.closeMobileWizard();
+		mobileHelper.openMobileWizard();
 
-		// Master background is disabled, enable it first
 		cy.get('input#displaymasterbackground')
 			.should('not.have.prop', 'checked', true);
 
@@ -330,20 +346,130 @@ describe('Changing slide properties.', function() {
 			.should('have.prop', 'checked', true);
 
 		previewShouldBeFullWhite(false);
+	});
+
+	it('Change master objects visibility.', function() {
+		// Master objects are disabled, enable the settings first
+		cy.get('input#displaymasterobjects')
+			.should('not.have.prop', 'checked', true);
+
+		cy.get('input#displaymasterobjects')
+			.click();
+
+		cy.get('input#displaymasterobjects')
+			.should('have.prop', 'checked', true);
+
+		// We have an image which changes the preview
+		previewShouldBeFullWhite(false);
 
 		// Reopen mobile wizard and change the settings again
 		mobileHelper.closeMobileWizard();
 		mobileHelper.openMobileWizard();
 
-		cy.get('input#displaymasterbackground')
+		cy.get('input#displaymasterobjects')
 			.should('have.prop', 'checked', true);
 
-		cy.get('input#displaymasterbackground')
+		cy.get('input#displaymasterobjects')
 			.click();
 
-		cy.get('input#displaymasterbackground')
+		cy.get('input#displaymasterobjects')
 			.should('not.have.prop', 'checked', true);
 
 		previewShouldBeFullWhite();
 	});
+
+	it('Change paper format.', function() {
+		var EPS = 0.1;
+
+		cy.get('#paperformat .ui-header-left')
+			.should('have.text', 'Screen 16:9');
+
+		// Preview should have the correct ratio
+		cy.get('.preview-frame:nth-of-type(2) img')
+			.should(function(previews) {
+				var sizeRatio = previews[0].width / previews[0].height;
+				expect(sizeRatio).to.be.greaterThan(16 / 9 - EPS);
+				expect(sizeRatio).to.be.lessThan(16 / 9 + EPS);
+			});
+
+		cy.get('#paperformat')
+			.click();
+
+		cy.contains('.ui-combobox-text', 'Screen 4:3')
+			.click();
+
+		cy.get('#paperformat .ui-header-left')
+			.should('have.text', 'Screen 4:3');
+
+		cy.get('.preview-frame:nth-of-type(2) img')
+			.should(function(previews) {
+				var sizeRatio = previews[0].width / previews[0].height;
+				expect(sizeRatio).to.be.greaterThan(4 / 3 - EPS);
+				expect(sizeRatio).to.be.lessThan(4 / 3 + EPS);
+			});
+
+		// Reopen mobile wizard and check the settings again
+		mobileHelper.closeMobileWizard();
+		mobileHelper.openMobileWizard();
+
+		cy.get('#paperformat .ui-header-left')
+			.should('have.text', 'Screen 4:3');
+	});
+
+	it('Change slide orientation.', function() {
+		// Preview should have the correct ratio (16/9)
+		cy.get('.preview-frame:nth-of-type(2) img')
+			.should(function(previews) {
+				expect(previews[0].width).to.be.greaterThan(previews[0].height);
+			});
+
+		cy.get('#orientation .ui-header-left')
+			.should('have.text', 'Landscape');
+
+		cy.get('#orientation')
+			.click();
+
+		cy.contains('.ui-combobox-text', 'Portrait')
+			.click();
+
+		cy.get('#orientation .ui-header-left')
+			.should('have.text', 'Portrait');
+
+		cy.get('.preview-frame:nth-of-type(2) img')
+			.should(function(previews) {
+				expect(previews[0].width).to.be.lessThan(previews[0].height);
+			});
+
+		// Reopen mobile wizard and check the settings again
+		mobileHelper.closeMobileWizard();
+		mobileHelper.openMobileWizard();
+
+		cy.get('#orientation .ui-header-left')
+			.should('have.text', 'Portrait');
+	});
+
+	it('Apply master slide layout.', function() {
+		// We have white background by deafult checked by before() method
+		// Select a new master slide with a background color
+		cy.get('#masterslide .ui-header-left')
+			.should('have.text', 'Default');
+
+		cy.get('#masterslide')
+			.click();
+
+		cy.contains('.ui-combobox-text', 'Colored')
+			.click();
+
+		cy.get('#masterslide .ui-header-left')
+			.should('have.text', 'Colored');
+
+		previewShouldBeFullWhite(false);
+
+		// Reopen mobile wizard and check the settings again
+		mobileHelper.closeMobileWizard();
+		mobileHelper.openMobileWizard();
+
+		cy.get('#masterslide .ui-header-left')
+			.should('have.text', 'Colored');
+	});
 });


More information about the Libreoffice-commits mailing list