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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 28 14:43:25 UTC 2020


 cypress_test/data/mobile/calc/chart.ods                  |binary
 cypress_test/integration_tests/mobile/calc/chart_spec.js |  123 +++++++++++++++
 2 files changed, 123 insertions(+)

New commits:
commit 18c57369643f95bcf449556666fcff9c53a5101b
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Sep 28 15:12:02 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon Sep 28 16:43:06 2020 +0200

    cypress: add chart test on mobile.
    
    This use case is crashing now, so let's disable it
    for now.
    
    Change-Id: Ie63af52eed39c6235f628687f93372ef526319c6
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/103555
    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/chart.ods b/cypress_test/data/mobile/calc/chart.ods
new file mode 100644
index 000000000..f7ee02b25
Binary files /dev/null and b/cypress_test/data/mobile/calc/chart.ods differ
diff --git a/cypress_test/integration_tests/mobile/calc/chart_spec.js b/cypress_test/integration_tests/mobile/calc/chart_spec.js
new file mode 100644
index 000000000..9115b7557
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/calc/chart_spec.js
@@ -0,0 +1,123 @@
+/* global describe it cy beforeEach require afterEach expect*/
+
+require('cypress-file-upload');
+
+var helper = require('../../common/helper');
+var mobileHelper = require('../../common/mobile_helper');
+var calcMobileHelper = require('./calc_mobile_helper');
+
+describe('Calc insertion wizard.', function() {
+	var testFileName = 'chart.ods';
+
+	beforeEach(function() {
+		helper.beforeAll(testFileName, 'calc');
+
+		mobileHelper.enableEditingMobile();
+
+		calcMobileHelper.selectFirstColumn();
+
+		insertChart();
+	});
+
+	afterEach(function() {
+		helper.afterAll(testFileName);
+	});
+
+	function insertChart() {
+		mobileHelper.openInsertionWizard();
+
+		cy.contains('.menu-entry-with-icon', 'Chart...')
+			.click();
+
+		cy.get('.leaflet-drag-transform-marker')
+			.should('have.length', 8);
+
+		cy.get('svg .OLE2')
+			.should('exist');
+
+		cy.get('svg .OLE2 g g path')
+			.should('have.length', 40);
+	}
+
+	function stepIntoChartEditing() {
+		cy.get('.leaflet-drag-transform-marker')
+			.should('exist');
+
+		// Double click onto the chart shape
+		cy.get('svg g .leaflet-interactive')
+			.then(function(items) {
+				expect(items).to.have.length(1);
+				var boundingRect = items[0].getBoundingClientRect();
+				var XPos = boundingRect.left + 10;
+				var YPos = (boundingRect.top + boundingRect.bottom) / 2;
+
+				cy.get('body')
+					.dblclick(XPos, YPos);
+			});
+
+		cy.get('.leaflet-drag-transform-marker')
+			.should('not.exist');
+	}
+
+	function exitChartEditing() {
+		// Select cell on bottom
+		cy.get('.spreadsheet-header-rows')
+			.then(function(header) {
+				var rect = header[0].getBoundingClientRect();
+				var posX = rect.right + 10;
+				var posY = rect.bottom - 10;
+
+				var moveY = 0.0;
+				cy.waitUntil(function() {
+					cy.get('body')
+						.click(posX, posY + moveY);
+
+					moveY -= 1.0;
+					var regex = /A[0-9]+$/;
+					return cy.get('input#addressInput')
+						.should('have.prop', 'value')
+						.then(function(value) {
+							return regex.test(value);
+						});
+				});
+			});
+	}
+
+	function selectChartOnCenter() {
+		cy.get('#document-container')
+			.then(function(items) {
+				expect(items).to.have.length(1);
+				var boundingRect = items[0].getBoundingClientRect();
+				var XPos = (boundingRect.left + boundingRect.right) / 2;
+				var YPos = (boundingRect.top + boundingRect.bottom) / 2;
+				cy.get('body')
+					.click(XPos, YPos);
+			});
+
+		cy.get('.leaflet-drag-transform-marker')
+			.should('be.visible');
+	}
+
+	it.skip('Change chart type.', function() {
+		stepIntoChartEditing();
+
+		mobileHelper.openMobileWizard();
+
+		helper.clickOnIdle('#ChartTypePanel');
+
+		helper.clickOnIdle('#cmb_chartType');
+
+		helper.clickOnIdle('.ui-combobox-text', 'Pie');
+
+		mobileHelper.closeMobileWizard();
+
+		// TODO: crashes here
+
+		exitChartEditing();
+
+		selectChartOnCenter();
+
+		cy.get('svg .OLE2 g g path')
+			.should('have.length', 4);
+	});
+});


More information about the Libreoffice-commits mailing list