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>
This commit is contained in:
Tamás Zolnai
2020-09-28 15:12:02 +02:00
parent 2375cccad5
commit 18c5736964
2 changed files with 123 additions and 0 deletions

Binary file not shown.

View File

@ -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);
});
});