summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2020-09-28 15:12:02 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2020-09-28 16:43:06 +0200
commit18c57369643f95bcf449556666fcff9c53a5101b (patch)
tree00ae20020abe3d5ca4e78f3d8f5a0ce74461be65
parent2375cccad50634a56f21aa85df9ed283398db891 (diff)
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@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--cypress_test/data/mobile/calc/chart.odsbin0 -> 7743 bytes
-rw-r--r--cypress_test/integration_tests/mobile/calc/chart_spec.js123
2 files changed, 123 insertions, 0 deletions
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
--- /dev/null
+++ b/cypress_test/data/mobile/calc/chart.ods
Binary files 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);
+ });
+});