cypress: mobile: Add more tests for table panel of mobile wizard.
Change-Id: I4a3126ccb01ed7afdefd0de6bacec11d23a7406a
This commit is contained in:
parent
4a1c877127
commit
1a8b128ac2
3 changed files with 295 additions and 15 deletions
BIN
cypress_test/data/mobile/table_with_text.odt
Normal file
BIN
cypress_test/data/mobile/table_with_text.odt
Normal file
Binary file not shown.
|
@ -99,7 +99,7 @@ function copyTableToClipboard() {
|
|||
}
|
||||
}
|
||||
|
||||
var XPos = startPos.right + 30;
|
||||
var XPos = startPos.right + 10;
|
||||
var YPos = endPos.top - 10;
|
||||
cy.get('body').rightclick(XPos, YPos);
|
||||
});
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
/* global describe it cy beforeEach require afterEach expect*/
|
||||
/* global describe it cy require afterEach expect*/
|
||||
|
||||
var helper = require('../common/helper');
|
||||
|
||||
describe('Change table properties / layout via mobile wizard.', function() {
|
||||
beforeEach(function() {
|
||||
helper.loadTestDoc('table.odt', true);
|
||||
afterEach(function() {
|
||||
helper.afterAll();
|
||||
});
|
||||
|
||||
function before(testFile) {
|
||||
helper.loadTestDoc(testFile, true);
|
||||
|
||||
// Click on edit button
|
||||
cy.get('#mobile-edit-button').click();
|
||||
|
@ -12,13 +16,11 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
// Open insertion wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.should('not.have.class', 'disabled');
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
helper.afterAll();
|
||||
});
|
||||
}
|
||||
|
||||
it('Insert row before.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
@ -50,6 +52,8 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Insert row after.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
@ -81,11 +85,13 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Insert column before.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Insert row
|
||||
// Insert column
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#InsertColumnsBefore')
|
||||
|
@ -112,11 +118,13 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Insert column after.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Insert row
|
||||
// Insert column
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#InsertColumnsAfter')
|
||||
|
@ -143,11 +151,13 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Delete row.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Insert row
|
||||
// Delete row
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#DeleteRows')
|
||||
|
@ -174,11 +184,13 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Delete column.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Insert row
|
||||
// Delete column
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#DeleteColumns')
|
||||
|
@ -206,11 +218,13 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Delete table.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Insert row
|
||||
// Delete table
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#DeleteTable')
|
||||
|
@ -232,13 +246,15 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
});
|
||||
|
||||
it('Merge cells.', function() {
|
||||
before('table.odt');
|
||||
|
||||
cy.get('body').type('{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Insert row
|
||||
// Merge cells
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#MergeCells')
|
||||
|
@ -261,4 +277,268 @@ describe('Change table properties / layout via mobile wizard.', function() {
|
|||
cy.get('#copy-paste-container td')
|
||||
.should('have.length', 1);
|
||||
});
|
||||
|
||||
it('Change row height.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Check current row height
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#rowheight .spinfield')
|
||||
.should('have.attr', 'value', '0');
|
||||
|
||||
cy.get('#rowheight .spinfield')
|
||||
.clear()
|
||||
.type('3.4')
|
||||
.type('{enter}');
|
||||
|
||||
cy.get('#rowheight .spinfield')
|
||||
.should('have.attr', 'value', '3.4');
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.should('have.attr', 'height', '317');
|
||||
});
|
||||
|
||||
it('Change column width.', function() {
|
||||
before('table.odt');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Check current column width
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
cy.get('#columnwidth .spinfield')
|
||||
.should('have.attr', 'value', '3.462');
|
||||
|
||||
cy.get('#columnwidth .spinfield')
|
||||
.clear()
|
||||
.type('5.6')
|
||||
.type('{enter}');
|
||||
|
||||
cy.get('#columnwidth .spinfield')
|
||||
.should('have.attr', 'value', '5.6');
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.should('have.attr', 'width', '81%');
|
||||
});
|
||||
|
||||
it('Set minimal row height.', function() {
|
||||
before('table_with_text.odt');
|
||||
|
||||
cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Set minimal row height
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
|
||||
cy.get('#SetMinimalRowHeight')
|
||||
.click();
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check new row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.should('not.have.attr', 'height');
|
||||
});
|
||||
|
||||
it('Set optimal row height.', function() {
|
||||
before('table_with_text.odt');
|
||||
|
||||
cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Set optimal row height
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
|
||||
cy.get('#SetOptimalRowHeight')
|
||||
.click();
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check new row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.then(function(items) {
|
||||
expect(items).have.lengthOf(6);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (i == 0 || i == 4)
|
||||
expect(items[i]).have.attr('height', '106');
|
||||
else if (i == 2)
|
||||
expect(items[i]).have.attr('height', '107');
|
||||
else
|
||||
expect(items[i]).not.have.attr('height');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Distribute rows.', function() {
|
||||
before('table_with_text.odt');
|
||||
|
||||
cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Distribute rows
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
|
||||
cy.get('#DistributeRows')
|
||||
.click();
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check new row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.then(function(items) {
|
||||
expect(items).have.lengthOf(6);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (i == 0 || i == 4)
|
||||
expect(items[i]).have.attr('height', '106');
|
||||
else if (i == 2)
|
||||
expect(items[i]).have.attr('height', '107');
|
||||
else
|
||||
expect(items[i]).not.have.attr('height');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Set minimal column width.', function() {
|
||||
before('table_with_text.odt');
|
||||
|
||||
cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Set minimal column width
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
|
||||
cy.get('#SetMinimalColumnWidth')
|
||||
.click();
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check new row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.then(function(items) {
|
||||
expect(items).have.lengthOf(6);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
expect(items[i]).have.attr('width', '24');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Set optimal column width.', function() {
|
||||
before('table_with_text.odt');
|
||||
|
||||
cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Set optimal column width
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
|
||||
cy.get('#SetOptimalColumnWidth')
|
||||
.click();
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check new row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.then(function(items) {
|
||||
expect(items).have.lengthOf(6);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
if (i == 1 || i == 3 || i == 5)
|
||||
expect(items[i]).have.attr('width', '323');
|
||||
else
|
||||
expect(items[i]).have.attr('width', '324');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Distribute columns.', function() {
|
||||
before('table_with_text.odt');
|
||||
|
||||
cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}');
|
||||
|
||||
// Open mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
// Distribute columns
|
||||
cy.get('#TableEditPanel')
|
||||
.click();
|
||||
|
||||
cy.get('#DistributeColumns')
|
||||
.click();
|
||||
|
||||
// Close mobile wizard
|
||||
cy.get('#tb_actionbar_item_mobile_wizard')
|
||||
.click();
|
||||
|
||||
helper.copyTableToClipboard();
|
||||
|
||||
// Check new row height
|
||||
cy.get('#copy-paste-container td')
|
||||
.then(function(items) {
|
||||
expect(items).have.lengthOf(6);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
expect(items[i]).have.attr('width', '323');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue