From 18c57369643f95bcf449556666fcff9c53a5101b Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Mon, 28 Sep 2020 15:12:02 +0200 Subject: cypress: add chart test on mobile. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Tamás Zolnai --- cypress_test/data/mobile/calc/chart.ods | Bin 0 -> 7743 bytes .../integration_tests/mobile/calc/chart_spec.js | 123 +++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 cypress_test/data/mobile/calc/chart.ods create mode 100644 cypress_test/integration_tests/mobile/calc/chart_spec.js 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); + }); +}); -- cgit v1.2.3