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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue May 19 19:10:21 UTC 2020


 cypress_test/data/mobile/calc/bottom_toolbar.ods                  |binary
 cypress_test/data/mobile/calc/bottom_toolbar2.ods                 |binary
 cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js |  284 ++++++++++
 cypress_test/integration_tests/mobile/calc/calc_helper.js         |    5 
 4 files changed, 288 insertions(+), 1 deletion(-)

New commits:
commit 129d89a9f4325152f46a737d0a55f08d6a92c47a
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue May 19 15:23:16 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue May 19 21:10:02 2020 +0200

    cypress: add tests for bottom toolbar in calc.
    
    Change-Id: I033800eadf5d3b1a454e31549b5adc1fd5d5ebd6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94532
    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/calc/bottom_toolbar.ods b/cypress_test/data/mobile/calc/bottom_toolbar.ods
new file mode 100644
index 000000000..ade730114
Binary files /dev/null and b/cypress_test/data/mobile/calc/bottom_toolbar.ods differ
diff --git a/cypress_test/data/mobile/calc/bottom_toolbar2.ods b/cypress_test/data/mobile/calc/bottom_toolbar2.ods
new file mode 100644
index 000000000..028e5604b
Binary files /dev/null and b/cypress_test/data/mobile/calc/bottom_toolbar2.ods differ
diff --git a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js
new file mode 100644
index 000000000..4bae5c170
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js
@@ -0,0 +1,284 @@
+/* global describe it cy require afterEach expect */
+
+var helper = require('../../common/helper');
+var mobileHelper = require('../../common/mobile_helper');
+var calcHelper = require('./calc_helper');
+
+describe('Interact with bottom toolbar.', function() {
+	function before(fileName, subPath) {
+		mobileHelper.beforeAllMobile(fileName, subPath);
+
+		// Click on edit button
+		mobileHelper.enableEditingMobile();
+
+		calcHelper.clickOnFirstCell();
+	}
+
+	afterEach(function() {
+		helper.afterAll('apply_font.ods');
+	});
+
+	function getTextPosForFirstCell() {
+		calcHelper.dblClickOnFirstCell();
+
+		// Select text content
+		cy.get('textarea.clipboard')
+			.type('{ctrl}a', {force: true});
+
+		helper.initAliasToNegative('currentTextPos');
+
+		cy.get('.leaflet-selection-marker-end')
+			.invoke('offset')
+			.its('left')
+			.as('currentTextPos');
+
+		cy.get('@currentTextPos')
+			.should('be.greaterThan', 0);
+
+		calcHelper.removeTextSelection();
+	}
+
+	it('Apply bold.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.bold')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td b')
+			.should('exist');
+	});
+
+	it('Apply italic.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.italic')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td i')
+			.should('exist');
+	});
+
+	it('Apply underline.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.underline')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td u')
+			.should('exist');
+	});
+
+	it('Apply strikeout.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.strikeout')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td s')
+			.should('exist');
+	});
+
+	it('Apply font color.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.textcolor')
+			.click();
+
+		cy.get('#color-picker-0-basic-color-5')
+			.click();
+
+		cy.get('#mobile-wizard-back')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td font')
+			.should('have.attr', 'color', '#00FF00');
+	});
+
+	it('Apply highlight color.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.backcolor')
+			.click();
+
+		cy.get('#color-picker-0-basic-color-5')
+			.click();
+
+		cy.get('#mobile-wizard-back')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'bgcolor', '#00FF00');
+	});
+
+	it('Merge cells', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		// Select the full row
+		cy.get('.spreadsheet-header-rows')
+			.then(function(items) {
+				expect(items).to.have.lengthOf(1);
+
+				var XPos = (items[0].getBoundingClientRect().right + items[0].getBoundingClientRect().left) / 2;
+				var YPos = items[0].getBoundingClientRect().top + 10;
+				cy.get('body')
+					.click(XPos, YPos);
+			});
+
+		cy.get('.spreadsheet-cell-resize-marker')
+			.should('exist');
+
+		cy.get('.spreadsheet-cell-resize-marker:nth-of-type(2)')
+			.should('not.be.visible');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.togglemergecells')
+			.click();
+
+		calcHelper.selectAllMobile(false);
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'colspan', '1024');
+	});
+
+	it('Apply left/right alignment', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		// Set right aligment first
+		cy.get('.w2ui-tb-image.w2ui-icon.alignright')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'align', 'right');
+
+		// Change alignment back
+		calcHelper.clickOnFirstCell();
+
+		cy.get('.w2ui-tb-image.w2ui-icon.alignleft')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'align', 'left');
+	});
+
+	it('Align to center.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.alignhorizontal')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'align', 'center');
+	});
+
+	it('Change to block alignment.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.alignblock')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table td')
+			.should('have.attr', 'align', 'justify');
+	});
+
+	it('Enable text wrapping.', function() {
+		before('bottom_toolbar.ods', 'calc');
+
+		helper.initAliasToNegative('originalTextPos');
+
+		getTextPosForFirstCell();
+		cy.get('@currentTextPos')
+			.as('originalTextPos');
+
+		cy.get('@currentTextPos')
+			.should('be.greaterThan', 0);
+
+		calcHelper.clickOnFirstCell();
+
+		cy.get('.w2ui-tb-image.w2ui-icon.wraptext')
+			.click();
+
+		// We use the text position as indicator
+		cy.get('body')
+			.should(function() {
+				getTextPosForFirstCell();
+
+				cy.get('@currentTextPos')
+					.then(function(currentTextPos) {
+						cy.get('@originalTextPos')
+							.then(function(originalTextPos) {
+								expect(originalTextPos).to.be.greaterThan(currentTextPos);
+							});
+					});
+			});
+	});
+
+	it('Insert row after.', function() {
+		before('bottom_toolbar2.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.insertrowsafter')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table tr')
+			.should('have.length', 3);
+
+		cy.get('#copy-paste-container table tr:nth-of-type(1)')
+			.should('contain.text', 'long line long line long line');
+
+		cy.get('#copy-paste-container table tr:nth-of-type(2)')
+			.should('not.contain.text', 'long line long line long line');
+
+		cy.get('#copy-paste-container table tr:nth-of-type(2)')
+			.should('not.contain.text', '2');
+
+		cy.get('#copy-paste-container table tr:nth-of-type(3)')
+			.should('contain.text', '2');
+	});
+
+	it('Insert column after.', function() {
+		before('bottom_toolbar2.ods', 'calc');
+
+		cy.get('.w2ui-tb-image.w2ui-icon.insertcolumnsafter')
+			.click();
+
+		calcHelper.selectAllMobile();
+
+		cy.get('#copy-paste-container table tr')
+			.should('have.length', 2);
+
+		cy.get('#copy-paste-container table tr:nth-of-type(1) td')
+			.should('have.length', 3);
+
+		cy.get('#copy-paste-container table tr:nth-of-type(1) td:nth-of-type(1)')
+			.should('contain.text', 'long line long line long line');
+
+		cy.get('#copy-paste-container table tr:nth-of-type(1) td:nth-of-type(2)')
+			.should('not.contain.text', 'long line long line long line');
+
+		cy.get('#copy-paste-container table tr:nth-of-type(1) td:nth-of-type(2)')
+			.should('not.contain.text', '1');
+
+		cy.get('#copy-paste-container table tr:nth-of-type(1) td:nth-of-type(3)')
+			.should('contain.text', '1');
+	});
+});
diff --git a/cypress_test/integration_tests/mobile/calc/calc_helper.js b/cypress_test/integration_tests/mobile/calc/calc_helper.js
index 788267019..aaa517029 100644
--- a/cypress_test/integration_tests/mobile/calc/calc_helper.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_helper.js
@@ -71,7 +71,10 @@ function selectAllMobile(removeSelection = true) {
 	cy.get('#spreadsheet-header-corner')
 		.click();
 
-	cy.get('.spreadsheet-cell-resize-marker')
+	cy.get('.spreadsheet-cell-resize-marker:nth-of-type(2)')
+		.should('not.be.visible');
+
+	cy.get('.spreadsheet-cell-resize-marker:nth-of-type(1)')
 		.invoke('attr', 'style')
 		.should('contain', '(-9px, -8px,');
 


More information about the Libreoffice-commits mailing list