cypress_test/data/mobile/table_with_text.odt |binary cypress_test/integration_tests/common/helper.js | 2 cypress_test/integration_tests/mobile/table_properties_spec.js | 308 +++++++++- 3 files changed, 295 insertions(+), 15 deletions(-)
New commits: commit 1a8b128ac29f69f8c5775f94e400f37611461851 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Feb 5 13:31:51 2020 +0100 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Feb 5 13:44:18 2020 +0100 cypress: mobile: Add more tests for table panel of mobile wizard. Change-Id: I4a3126ccb01ed7afdefd0de6bacec11d23a7406a diff --git a/cypress_test/data/mobile/table_with_text.odt b/cypress_test/data/mobile/table_with_text.odt new file mode 100644 index 000000000..046edcce0 Binary files /dev/null and b/cypress_test/data/mobile/table_with_text.odt differ diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index e7989aed9..f414897ad 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -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); }); diff --git a/cypress_test/integration_tests/mobile/table_properties_spec.js b/cypress_test/integration_tests/mobile/table_properties_spec.js index 04710914c..e2a1996c1 100644 --- a/cypress_test/integration_tests/mobile/table_properties_spec.js +++ b/cypress_test/integration_tests/mobile/table_properties_spec.js @@ -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'); + } + }); + }); }); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits