cypress_test/data/mobile/table.odt |binary cypress_test/integration_tests/common/helper.js | 36 + cypress_test/integration_tests/mobile/insert_object_spec.js | 26 cypress_test/integration_tests/mobile/styles_spec.js | 4 cypress_test/integration_tests/mobile/table_properties_spec.js | 264 ++++++++++ loleaflet/src/control/Control.MobileWizard.js | 3 6 files changed, 325 insertions(+), 8 deletions(-)
New commits: commit 26bcd86640fcd23b9dd786a6a0e082cde71a7d12 Author: Tamás Zolnai <[email protected]> AuthorDate: Tue Feb 4 15:33:04 2020 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Tue Feb 4 15:44:22 2020 +0100 cypress: mobile: Make this test more stable. Change-Id: I8eb8381696c79c1e7a04b1cf88cab12c4c14de92 diff --git a/cypress_test/integration_tests/mobile/styles_spec.js b/cypress_test/integration_tests/mobile/styles_spec.js index b2671650e..213f1a99d 100644 --- a/cypress_test/integration_tests/mobile/styles_spec.js +++ b/cypress_test/integration_tests/mobile/styles_spec.js @@ -108,6 +108,10 @@ describe('Apply/modify styles.', function() { cy.get('#Italic') .click(); + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + helper.copyTextToClipboard(); cy.get('#copy-paste-container p i') commit 18b48ca02214a63c2462fd395e53063f8674b319 Author: Tamás Zolnai <[email protected]> AuthorDate: Tue Feb 4 13:46:41 2020 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Tue Feb 4 15:33:49 2020 +0100 cypress: mobile: Add tests for changing table layout. Change-Id: If819b8cc7341eb8d82219458edfecddd7b4d7c2b diff --git a/cypress_test/data/mobile/table.odt b/cypress_test/data/mobile/table.odt new file mode 100644 index 000000000..bec92754c Binary files /dev/null and b/cypress_test/data/mobile/table.odt differ diff --git a/cypress_test/integration_tests/mobile/table_properties_spec.js b/cypress_test/integration_tests/mobile/table_properties_spec.js new file mode 100644 index 000000000..04710914c --- /dev/null +++ b/cypress_test/integration_tests/mobile/table_properties_spec.js @@ -0,0 +1,264 @@ +/* global describe it cy beforeEach require afterEach expect*/ + +var helper = require('../common/helper'); + +describe('Change table properties / layout via mobile wizard.', function() { + beforeEach(function() { + helper.loadTestDoc('table.odt', true); + + // Click on edit button + cy.get('#mobile-edit-button').click(); + + // Open insertion wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .should('not.have.class', 'disabled'); + }); + + afterEach(function() { + helper.afterAll(); + }); + + it('Insert row before.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#InsertRowsBefore') + .click(); + + cy.get('.leaflet-marker-icon.table-row-resize-marker') + .should('have.length', 4); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 4) + .then(function(rows) { + expect(rows[0].textContent).to.not.have.string('text'); + expect(rows[1].textContent).to.have.string('text'); + }); + cy.get('#copy-paste-container td') + .should('have.length', 8); + }); + + it('Insert row after.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#InsertRowsAfter') + .click(); + + cy.get('.leaflet-marker-icon.table-row-resize-marker') + .should('have.length', 4); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 4) + .then(function(rows) { + expect(rows[0].textContent).to.have.string('text'); + expect(rows[1].textContent).to.not.have.string('text'); + }); + cy.get('#copy-paste-container td') + .should('have.length', 8); + }); + + it('Insert column before.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#InsertColumnsBefore') + .click(); + + cy.get('.leaflet-marker-icon.table-column-resize-marker') + .should('have.length', 4); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 3); + cy.get('#copy-paste-container td') + .should('have.length', 9) + .then(function(columns) { + expect(columns[0].textContent).to.not.have.string('text'); + expect(columns[1].textContent).to.have.string('text'); + }); + }); + + it('Insert column after.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#InsertColumnsAfter') + .click(); + + cy.get('.leaflet-marker-icon.table-column-resize-marker') + .should('have.length', 4); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 3); + cy.get('#copy-paste-container td') + .should('have.length', 9) + .then(function(columns) { + expect(columns[0].textContent).to.have.string('text'); + expect(columns[1].textContent).to.not.have.string('text'); + }); + }); + + it('Delete row.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#DeleteRows') + .click(); + + cy.get('.leaflet-marker-icon.table-row-resize-marker') + .should('have.length', 2); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 2) + .then(function(columns) { + expect(columns[0].textContent).to.not.have.string('text'); + expect(columns[1].textContent).to.not.have.string('text'); + }); + cy.get('#copy-paste-container td') + .should('have.length', 4); + }); + + it('Delete column.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#DeleteColumns') + .click(); + + cy.get('.leaflet-marker-icon.table-column-resize-marker') + .should('not.exist'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 3); + cy.get('#copy-paste-container td') + .should('have.length', 3) + .then(function(columns) { + expect(columns[0].textContent).to.not.have.string('text'); + expect(columns[1].textContent).to.not.have.string('text'); + expect(columns[2].textContent).to.not.have.string('text'); + }); + }); + + it('Delete table.', function() { + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#DeleteTable') + .click(); + + cy.get('.leaflet-marker-icon.table-column-resize-marker') + .should('not.exist'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + cy.get('#copy-paste-container title') + .should('exist'); + cy.get('#copy-paste-container table') + .should('not.exist'); + }); + + it('Merge cells.', function() { + cy.get('body').type('{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); + + // Open mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + // Insert row + cy.get('#TableEditPanel') + .click(); + cy.get('#MergeCells') + .scrollIntoView(); + cy.get('#MergeCells') + .click(); + + cy.get('.leaflet-marker-icon.table-column-resize-marker') + .should('not.exist'); + + // Close mobile wizard + cy.get('#tb_actionbar_item_mobile_wizard') + .click(); + + helper.copyTableToClipboard(); + + // Check rows / columns + cy.get('#copy-paste-container tr') + .should('have.length', 1); + cy.get('#copy-paste-container td') + .should('have.length', 1); + }); +}); commit f7404745fbc4459d9bf204c8a3c20034b4ff3400 Author: Tamás Zolnai <[email protected]> AuthorDate: Tue Feb 4 13:19:45 2020 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Tue Feb 4 15:33:49 2020 +0100 mobile: Don't refresh the sidebar state, when a different wizard is opened. Caught by a cypress test. Hamburger menu was opened, by it got the sidebar content instead. Change-Id: I3130e7e1d44f76c8ba656121d96704fb4d5b8932 diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js index 249a33421..1cc8dc2b7 100644 --- a/loleaflet/src/control/Control.MobileWizard.js +++ b/loleaflet/src/control/Control.MobileWizard.js @@ -278,6 +278,9 @@ L.Control.MobileWizard = L.Control.extend({ if (this.map.showSidebar == false) return; } + if (isSidebar && !this.map.showSidebar) { + return; + } this._isActive = true; var currentPath = null; commit 14ce7ab9377a30863a65b2d80e20d2577bf93454 Author: Tamás Zolnai <[email protected]> AuthorDate: Tue Feb 4 12:37:50 2020 +0100 Commit: Tamás Zolnai <[email protected]> CommitDate: Tue Feb 4 15:33:49 2020 +0100 cypress: mobile: Introduce copyTableToClipboard() method. And use it to check insert table's properties. Change-Id: I7b188ddd139db2f6de5e2872277dce022073171d diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index e9cc62328..e7989aed9 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -83,6 +83,41 @@ function copyTextToClipboard() { .should('not.exist'); } +function copyTableToClipboard() { + // Do a new selection + selectAllMobile(); + + // Open context menu + cy.get('.leaflet-marker-icon') + .then(function(markers) { + expect(markers.length).to.have.greaterThan(1); + for (var i = 0; i < markers.length; i++) { + if (markers[i].classList.contains('leaflet-selection-marker-start')) { + var startPos = markers[i].getBoundingClientRect(); + } else if (markers[i].classList.contains('leaflet-selection-marker-end')) { + var endPos = markers[i].getBoundingClientRect(); + } + } + + var XPos = startPos.right + 30; + var YPos = endPos.top - 10; + cy.get('body').rightclick(XPos, YPos); + }); + + // Execute copy + cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link') + .contains('Copy') + .click(); + + // Close warning about clipboard operations + cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first') + .click(); + + // Wait until it's closed + cy.get('.vex-overlay') + .should('not.exist'); +} + function afterAll() { // Make sure that the document is closed cy.visit('http://admin:admin@localhost:9980/loleaflet/dist/admin/admin.html'); @@ -95,4 +130,5 @@ function afterAll() { module.exports.loadTestDoc = loadTestDoc; module.exports.selectAllMobile = selectAllMobile; module.exports.copyTextToClipboard = copyTextToClipboard; +module.exports.copyTableToClipboard = copyTableToClipboard; module.exports.afterAll = afterAll; diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js index 19200f48c..70f800b78 100644 --- a/cypress_test/integration_tests/mobile/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/insert_object_spec.js @@ -55,11 +55,16 @@ describe('Insert objects via insertion wizard.', function() { // Table is inserted with the markers shown cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('exist') - .should('have.length', 3); - cy.get('.leaflet-marker-icon.table-row-resize-marker') - .should('exist') + .should('exist'); + + helper.copyTableToClipboard(); + + // Two rows + cy.get('#copy-paste-container tr') .should('have.length', 2); + // Four cells + cy.get('#copy-paste-container td') + .should('have.length', 4); }); it('Insert custom table.', function() { @@ -83,11 +88,16 @@ describe('Insert objects via insertion wizard.', function() { // Table is inserted with the markers shown cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('exist') - .should('have.length', 4); - cy.get('.leaflet-marker-icon.table-row-resize-marker') - .should('exist') + .should('exist'); + + helper.copyTableToClipboard(); + + // Three rows + cy.get('#copy-paste-container tr') .should('have.length', 3); + // Nine cells + cy.get('#copy-paste-container td') + .should('have.length', 9); }); it('Insert header.', function() { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
