cypress_test/data/mobile/writer/table_properties.odt |binary cypress_test/integration_tests/mobile/calc/alignment_options_spec.js | 16 - cypress_test/integration_tests/mobile/calc/apply_font_spec.js | 21 - cypress_test/integration_tests/mobile/calc/calc_helper.js | 31 -- cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js | 46 ++- cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js | 6 cypress_test/integration_tests/mobile/calc/number_format_spec.js | 32 +- cypress_test/integration_tests/mobile/calc/spellchecking_spec.js | 7 cypress_test/integration_tests/mobile/impress/impress_helper.js | 26 - cypress_test/integration_tests/mobile/impress/spellchecking_spec.js | 8 cypress_test/integration_tests/mobile/writer/apply_font_spec.js | 30 +- cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js | 105 +++---- cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js | 42 +-- cypress_test/integration_tests/mobile/writer/insert_field_spec.js | 14 - cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js | 51 +-- cypress_test/integration_tests/mobile/writer/insert_object_spec.js | 6 cypress_test/integration_tests/mobile/writer/spellchecking_spec.js | 7 cypress_test/integration_tests/mobile/writer/table_properties_spec.js | 133 +++++----- cypress_test/integration_tests/mobile/writer/writer_helper.js | 48 --- dev/null |binary loleaflet/src/map/Clipboard.js | 10 21 files changed, 270 insertions(+), 369 deletions(-)
New commits: commit 49edc462b7d563bb1f7e4d41505bdc967878ccb4 Author: Tamás Zolnai <[email protected]> AuthorDate: Tue Apr 21 14:31:30 2020 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Tue Apr 21 20:31:42 2020 +0200 cypress: assign selection data to clipboard container as soon as it arrives. So we don't need to trigger a fake copying to get the content. It will make things easier. Change-Id: I0964fe697602d77078f10792355fbda23879c7c9 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92645 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Tamás Zolnai <[email protected]> diff --git a/cypress_test/data/mobile/writer/table_properties.odt b/cypress_test/data/mobile/writer/table_properties.odt index 550752605..bec92754c 100644 Binary files a/cypress_test/data/mobile/writer/table_properties.odt and b/cypress_test/data/mobile/writer/table_properties.odt differ diff --git a/cypress_test/data/mobile/writer/table_properties2.odt b/cypress_test/data/mobile/writer/table_properties2.odt deleted file mode 100644 index bec92754c..000000000 Binary files a/cypress_test/data/mobile/writer/table_properties2.odt and /dev/null differ diff --git a/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js b/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js index d88b74ac8..af9c6a449 100644 --- a/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js +++ b/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js @@ -57,7 +57,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignRight') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'align', 'right'); @@ -73,7 +73,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignLeft') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'align', 'left'); @@ -85,7 +85,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignHorizontalCenter') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'align', 'center'); @@ -98,7 +98,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignBlock') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'align', 'justify'); @@ -127,7 +127,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignTop') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'valign', 'top'); @@ -143,7 +143,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignBottom') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'valign', 'bottom'); @@ -155,7 +155,7 @@ describe('Change alignment settings.', function() { cy.get('#AlignVCenter') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'valign', 'middle'); @@ -366,7 +366,7 @@ describe('Change alignment settings.', function() { .should('have.prop', 'checked', true); // Check content - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(false); cy.get('#copy-paste-container table td') .should('have.attr', 'colspan', '1024'); diff --git a/cypress_test/integration_tests/mobile/calc/apply_font_spec.js b/cypress_test/integration_tests/mobile/calc/apply_font_spec.js index df9428258..f009f0db5 100644 --- a/cypress_test/integration_tests/mobile/calc/apply_font_spec.js +++ b/cypress_test/integration_tests/mobile/calc/apply_font_spec.js @@ -35,7 +35,7 @@ describe('Apply font changes.', function() { cy.get('#Bold') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td b') .should('exist'); @@ -45,7 +45,7 @@ describe('Apply font changes.', function() { cy.get('#Italic') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td i') .should('exist'); @@ -55,7 +55,7 @@ describe('Apply font changes.', function() { cy.get('#Underline') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td u') .should('exist'); @@ -66,7 +66,7 @@ describe('Apply font changes.', function() { cy.get('#Strikeout') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td s') .should('exist'); @@ -77,7 +77,7 @@ describe('Apply font changes.', function() { cy.get('#Shadowed') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); // TODO: Shadowed is not in the clipboard content. }); @@ -100,7 +100,7 @@ describe('Apply font changes.', function() { cy.get('#fontnamecombobox .ui-header-right .entry-value') .should('have.text', 'Linux Libertine G'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td font') .should('have.attr', 'face', 'Linux Libertine G'); @@ -128,7 +128,7 @@ describe('Apply font changes.', function() { cy.get('#fontsizecombobox .ui-header-right .entry-value') .should('have.text', '14'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td font') .should('have.attr', 'size', '4'); @@ -139,7 +139,7 @@ describe('Apply font changes.', function() { cy.get('#Grow') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td font') .should('have.attr', 'size', '3'); @@ -150,7 +150,7 @@ describe('Apply font changes.', function() { cy.get('#Shrink') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td font') .should('have.attr', 'size', '1'); @@ -167,10 +167,9 @@ describe('Apply font changes.', function() { cy.get('#mobile-wizard-back') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td font') .should('have.attr', 'color', '#00FF00'); }); }); - diff --git a/cypress_test/integration_tests/mobile/calc/calc_helper.js b/cypress_test/integration_tests/mobile/calc/calc_helper.js index 3913373ad..788267019 100644 --- a/cypress_test/integration_tests/mobile/calc/calc_helper.js +++ b/cypress_test/integration_tests/mobile/calc/calc_helper.js @@ -39,22 +39,6 @@ function dblClickOnFirstCell() { clickOnFirstCell(false, true); } -function copyContentToClipboard() { - cy.log('Copying content to clipboard - start.'); - - selectAllMobile(); - - cy.get('.leaflet-tile-container') - .then(function(items) { - expect(items).to.have.lengthOf(1); - var XPos = items[0].getBoundingClientRect().right + 10; - var YPos = items[0].getBoundingClientRect().top + 10; - mobileHelper.executeCopyFromContextMenu(XPos, YPos); - }); - - cy.log('Copying content to clipboard - end.'); -} - function removeTextSelection() { cy.log('Removing text selection - start.'); @@ -71,28 +55,29 @@ function removeTextSelection() { .click(); cy.get('.spreadsheet-cell-resize-marker') - .should('exist'); + .invoke('attr', 'style') + .should('contain', '-8px,'); } cy.log('Removing text selection - end.'); } -function selectAllMobile() { +function selectAllMobile(removeSelection = true) { cy.log('Selecting all text - start.'); - removeTextSelection(); - + if (removeSelection) + removeTextSelection(); cy.get('#spreadsheet-header-corner') .click(); - cy.get('.leaflet-marker-icon') - .should('exist'); + cy.get('.spreadsheet-cell-resize-marker') + .invoke('attr', 'style') + .should('contain', '(-9px, -8px,'); cy.log('Selecting all text - end.'); } -module.exports.copyContentToClipboard = copyContentToClipboard; module.exports.removeTextSelection = removeTextSelection; module.exports.selectAllMobile = selectAllMobile; module.exports.clickOnFirstCell = clickOnFirstCell; diff --git a/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js b/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js index 5ddb947df..0c8226dac 100644 --- a/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js +++ b/cypress_test/integration_tests/mobile/calc/cell_appearance_spec.js @@ -55,7 +55,7 @@ describe('Change cell appearance.', function() { cy.get('#BackgroundColor .color-sample-selected') .should('have.attr', 'style', 'background-color: rgb(255, 0, 0);'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'bgcolor', '#FF0000'); @@ -67,7 +67,7 @@ describe('Change cell appearance.', function() { cy.get('#border-2') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-left: 1px solid #000000'); @@ -80,7 +80,7 @@ describe('Change cell appearance.', function() { cy.get('#border-2') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-left: 1px solid #000000'); @@ -91,7 +91,7 @@ describe('Change cell appearance.', function() { cy.get('#border-1') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('not.have.attr', 'style'); @@ -103,7 +103,7 @@ describe('Change cell appearance.', function() { cy.get('#border-3') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-right: 1px solid #000000'); @@ -115,7 +115,7 @@ describe('Change cell appearance.', function() { cy.get('#border-4') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-left: 1px solid #000000; border-right: 1px solid #000000'); @@ -127,7 +127,7 @@ describe('Change cell appearance.', function() { cy.get('#border-5') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-top: 1px solid #000000'); @@ -139,7 +139,7 @@ describe('Change cell appearance.', function() { cy.get('#border-6') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-bottom: 1px solid #000000'); @@ -151,7 +151,7 @@ describe('Change cell appearance.', function() { cy.get('#border-7') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000'); @@ -163,7 +163,7 @@ describe('Change cell appearance.', function() { cy.get('#border-8') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000'); @@ -175,7 +175,11 @@ describe('Change cell appearance.', function() { cy.get('#border-9') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); + + cy.get('#copy-paste-container table td') + .should('have.length', 4) + .should('have.attr', 'style'); cy.get('#copy-paste-container table td') .then(function(cells) { @@ -191,7 +195,11 @@ describe('Change cell appearance.', function() { cy.get('#border-10') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); + + cy.get('#copy-paste-container table td') + .should('have.length', 4) + .should('have.attr', 'style'); cy.get('#copy-paste-container table td') .then(function(cells) { @@ -217,7 +225,11 @@ describe('Change cell appearance.', function() { // TODO cy.wait(200); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); + + cy.get('#copy-paste-container table td') + .should('have.length', 4) + .should('have.attr', 'style'); cy.get('#copy-paste-container table td') .then(function(cells) { @@ -240,7 +252,11 @@ describe('Change cell appearance.', function() { cy.get('#border-12') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); + + cy.get('#copy-paste-container table td') + .should('have.length', 4) + .should('have.attr', 'style'); cy.get('#copy-paste-container table td') .then(function(cells) { @@ -278,7 +294,7 @@ describe('Change cell appearance.', function() { cy.get('#FrameLineColor .color-sample-selected') .should('have.attr', 'style', 'background-color: rgb(255, 153, 0);'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'style', 'border-left: 1px solid #ff9900'); diff --git a/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js b/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js index 36b4273d6..703504dba 100644 --- a/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js +++ b/cypress_test/integration_tests/mobile/calc/insertion_wizard_spec.js @@ -61,7 +61,7 @@ describe('Calc insertion wizard.', function() { cy.get('.blinking-cursor') .should('be.visible'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td a') .contains('some text'); @@ -94,7 +94,7 @@ describe('Calc insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Date') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;MM/DD/YY'); @@ -105,7 +105,7 @@ describe('Calc insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Time') .click(); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;HH:MM:SS AM/PM'); diff --git a/cypress_test/integration_tests/mobile/calc/number_format_spec.js b/cypress_test/integration_tests/mobile/calc/number_format_spec.js index 8eaccc47d..efd7576d7 100644 --- a/cypress_test/integration_tests/mobile/calc/number_format_spec.js +++ b/cypress_test/integration_tests/mobile/calc/number_format_spec.js @@ -59,7 +59,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '1'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;0.00%'); @@ -91,7 +91,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '1'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;0.00%'); @@ -116,7 +116,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '1'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00'); @@ -148,7 +148,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '1'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00'); @@ -177,7 +177,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '1'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00'); @@ -206,7 +206,7 @@ describe('Apply number formatting.', function() { cy.get('#numberformatcombobox .ui-header-left') .should('have.text', 'Number'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.text', '1,000.00'); @@ -231,7 +231,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '0'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;MM/DD/YY'); @@ -253,7 +253,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '0'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;HH:MM:SS AM/PM'); @@ -275,7 +275,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '1'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;0.00E+00'); @@ -294,7 +294,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '0'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;# ?/?'); @@ -313,7 +313,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '0'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;BOOLEAN'); @@ -332,7 +332,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '0'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;@'); @@ -354,7 +354,7 @@ describe('Apply number formatting.', function() { cy.get('#decimalplaces input') .should('have.attr', 'value', '2'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;0.00'); @@ -376,7 +376,7 @@ describe('Apply number formatting.', function() { cy.get('#leadingzeroes input') .should('have.attr', 'value', '6'); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;000000'); @@ -397,7 +397,7 @@ describe('Apply number formatting.', function() { cy.get('#negativenumbersred input') .should('have.prop', 'checked', true); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;0;[RED]-0'); @@ -418,7 +418,7 @@ describe('Apply number formatting.', function() { cy.get('#thousandseparator input') .should('have.prop', 'checked', true); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') .should('have.attr', 'sdnum', '1033;0;#,##0'); diff --git a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js index 2b1315656..155584a3a 100644 --- a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js +++ b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js @@ -68,13 +68,10 @@ describe('Calc spell checking menu.', function() { .click(XPos, YPos); }); - calcHelper.copyContentToClipboard(); + calcHelper.selectAllMobile(); cy.get('#copy-paste-container table td') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('hello'); - }); + .should('contain.text', 'hello'); }); it('Ignore all.', function() { diff --git a/cypress_test/integration_tests/mobile/impress/impress_helper.js b/cypress_test/integration_tests/mobile/impress/impress_helper.js index fc528838d..8b1378917 100644 --- a/cypress_test/integration_tests/mobile/impress/impress_helper.js +++ b/cypress_test/integration_tests/mobile/impress/impress_helper.js @@ -1,27 +1 @@ -/* global cy require expect*/ -var helper = require('../../common/helper'); -var mobileHelper = require('../../common/mobile_helper'); - -function copyShapeContentToClipboard() { - cy.log('Copying shape content to clipboard - start.'); - - // TODO: this fails on assertHaveKeyboardInput() - // assertInTextEditMode(); - - helper.selectAllText(false); - - // Open context menu - cy.get('.leaflet-marker-icon') - .then(function(marker) { - expect(marker).to.have.lengthOf(2); - var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2; - var YPos = marker[0].getBoundingClientRect().top - 5; - mobileHelper.executeCopyFromContextMenu(XPos, YPos); - }); - - cy.log('Copying shape content to clipboard - end.'); -} - - -module.exports.copyShapeContentToClipboard = copyShapeContentToClipboard; diff --git a/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js b/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js index 8e1994f35..66bac80f5 100644 --- a/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js +++ b/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js @@ -2,7 +2,6 @@ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); -var impressHelper = require('./impress_helper'); describe('Spell checking menu.', function() { beforeEach(function() { @@ -66,13 +65,10 @@ describe('Spell checking menu.', function() { cy.contains('.context-menu-link', 'hello') .click(); - impressHelper.copyShapeContentToClipboard(); + helper.selectAllText(false); cy.get('#copy-paste-container pre') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('hello'); - }); + .should('contain.text', 'hello'); }); it('Ignore all.', function() { diff --git a/cypress_test/integration_tests/mobile/writer/apply_font_spec.js b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js index 0d9b37759..69d307d8f 100644 --- a/cypress_test/integration_tests/mobile/writer/apply_font_spec.js +++ b/cypress_test/integration_tests/mobile/writer/apply_font_spec.js @@ -64,7 +64,7 @@ describe('Apply font changes.', function() { cy.get('#fontnamecombobox .ui-header-right .entry-value') .should('have.text', 'Linux Libertine G'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'face', 'Linux Libertine G'); @@ -92,7 +92,7 @@ describe('Apply font changes.', function() { cy.get('#fontsizecombobox .ui-header-right .entry-value') .should('have.text', '36'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'style', 'font-size: 36pt'); @@ -103,7 +103,7 @@ describe('Apply font changes.', function() { cy.get('#Bold') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p b') .should('exist'); @@ -114,7 +114,7 @@ describe('Apply font changes.', function() { cy.get('#Italic') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p i') .should('exist'); @@ -125,7 +125,7 @@ describe('Apply font changes.', function() { cy.get('#Underlineimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p u') .should('exist'); @@ -136,7 +136,7 @@ describe('Apply font changes.', function() { cy.get('#Strikeoutimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p strike') .should('exist'); @@ -147,7 +147,7 @@ describe('Apply font changes.', function() { cy.get('#Shadowedimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); // TODO: Shadowed is not in the clipboard content. }); @@ -157,7 +157,7 @@ describe('Apply font changes.', function() { cy.get('#Growimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'style', 'font-size: 42pt'); @@ -168,7 +168,7 @@ describe('Apply font changes.', function() { cy.get('#Shrinkimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'style', 'font-size: 38pt'); @@ -188,7 +188,7 @@ describe('Apply font changes.', function() { cy.get('#mobile-wizard-back') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'color', '#6aa84f'); @@ -208,7 +208,7 @@ describe('Apply font changes.', function() { cy.get('#mobile-wizard-back') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font span') .should('have.attr', 'style', 'background: #93c47d'); @@ -219,7 +219,7 @@ describe('Apply font changes.', function() { cy.get('#SuperScriptimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p sup') .should('exist'); @@ -230,7 +230,7 @@ describe('Apply font changes.', function() { cy.get('#SubScriptimg') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p sub') .should('exist'); @@ -252,7 +252,7 @@ describe('Apply font changes.', function() { // Apply Title style applyStyle('Title'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'face', 'Liberation Sans, sans-serif'); @@ -262,7 +262,7 @@ describe('Apply font changes.', function() { // Clear formatting applyStyle('Clear formatting'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'style', 'margin-bottom: 0in; line-height: 100%'); diff --git a/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js index c849a3745..bbecf7264 100644 --- a/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/apply_paragraph_properties_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require expect afterEach Cypress*/ +/* global describe it cy beforeEach require afterEach Cypress*/ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -42,7 +42,7 @@ describe('Apply paragraph properties.', function() { cy.get('#LeftParaimg') .should('have.class', 'selected'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'left'); @@ -53,7 +53,7 @@ describe('Apply paragraph properties.', function() { cy.get('#CenterPara') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'center'); @@ -64,7 +64,7 @@ describe('Apply paragraph properties.', function() { cy.get('#RightPara') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'right'); @@ -75,7 +75,7 @@ describe('Apply paragraph properties.', function() { cy.get('#JustifyPara') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'justify'); @@ -86,7 +86,7 @@ describe('Apply paragraph properties.', function() { cy.get('#ParaRightToLeft') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'dir', 'rtl'); @@ -104,7 +104,7 @@ describe('Apply paragraph properties.', function() { cy.get('#ParaLeftToRight') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('not.have.attr', 'dir'); @@ -119,7 +119,7 @@ describe('Apply paragraph properties.', function() { cy.get('#DefaultBullet') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container ul li p') .should('exist'); @@ -134,7 +134,7 @@ describe('Apply paragraph properties.', function() { cy.get('#DefaultNumbering') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container ol li p') .should('exist'); @@ -159,13 +159,11 @@ describe('Apply paragraph properties.', function() { cy.get('#mobile-wizard-back') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['background']).to.be.equal('rgb(106, 168, 79)'); - }); + .should('have.attr', 'style') + .should('contain', 'background: #6aa84f'); }); it('Increase / decrease para spacing.', function() { @@ -175,14 +173,15 @@ describe('Apply paragraph properties.', function() { cy.get('#ParaspaceIncrease') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'style') + .should('contain', 'margin-top: 0.08in'); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-top']).to.be.equal('0.08in'); - expect(item[0].style['margin-bottom']).to.be.equal('0.08in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-bottom: 0.08in'); // Select text writerHelper.selectAllMobile(); @@ -197,14 +196,15 @@ describe('Apply paragraph properties.', function() { cy.get('#ParaspaceDecrease') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'style') + .should('contain', 'margin-top: 0.04in'); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-top']).to.be.equal('0.04in'); - expect(item[0].style['margin-bottom']).to.be.equal('0.04in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-bottom: 0.04in'); }); it('Change para spacing via combobox.', function() { @@ -233,14 +233,15 @@ describe('Apply paragraph properties.', function() { cy.get('#belowparaspacing .spinfield') .should('have.attr', 'value', '0.02'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); + + cy.get('#copy-paste-container p') + .should('have.attr', 'style') + .should('contain', 'margin-top: 0.06in'); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-top']).to.be.equal('0.06in'); - expect(item[0].style['margin-bottom']).to.be.equal('0.02in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-bottom: 0.02in'); }); it('Increase / decrease indent.', function() { @@ -250,13 +251,11 @@ describe('Apply paragraph properties.', function() { cy.get('#IncrementIndent') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-left']).to.be.equal('0.98in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-left: 0.98in'); // Select text writerHelper.selectAllMobile(); @@ -271,13 +270,11 @@ describe('Apply paragraph properties.', function() { cy.get('#DecrementIndent') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-left']).to.be.equal('0.49in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-left: 0.49in'); }); it('Apply before text indent.', function() { @@ -291,13 +288,11 @@ describe('Apply paragraph properties.', function() { cy.get('#beforetextindent .spinfield') .should('have.attr', 'value', '0.04'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-left']).to.be.equal('0.04in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-left: 0.04in'); }); it('Apply after text indent.', function() { @@ -311,13 +306,11 @@ describe('Apply paragraph properties.', function() { cy.get('#aftertextindent .spinfield') .should('have.attr', 'value', '0.04'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-right']).to.be.equal('0.04in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-right: 0.04in'); }); it('Apply first line indent.', function() { @@ -331,13 +324,11 @@ describe('Apply paragraph properties.', function() { cy.get('#firstlineindent .spinfield') .should('have.attr', 'value', '0.04'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['text-indent']).to.be.equal('0.04in'); - }); + .should('have.attr', 'style') + .should('contain', 'text-indent: 0.04in'); }); it('Linespacing item is hidden.', function() { diff --git a/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js index 36c2e1744..a819046e1 100644 --- a/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/writer/bottom_toolbar_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require afterEach expect*/ +/* global describe it cy beforeEach require afterEach*/ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -29,7 +29,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_bold div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p b') .should('exist'); @@ -45,7 +45,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_italic div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p i') .should('exist'); @@ -60,7 +60,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_underline div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p u') .should('exist'); @@ -76,7 +76,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_strikeout div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p strike') .should('exist'); @@ -92,7 +92,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('.w2ui-tb-image.w2ui-icon.textcolor') .should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(0, 0, 255) 0px -6px inset;'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font') .should('have.attr', 'color', '#0000ff'); @@ -108,7 +108,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('.w2ui-tb-image.w2ui-icon.backcolor') .should('have.attr', 'style', 'box-shadow: rgb(255, 255, 255) 0px -2px inset, rgb(255, 0, 255) 0px -6px inset;'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p font span') .should('have.attr', 'style', 'background: #ff00ff'); @@ -124,7 +124,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_rightpara div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'right'); @@ -138,7 +138,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_leftpara div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'left'); @@ -154,7 +154,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_centerpara div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'center'); @@ -170,7 +170,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_justifypara div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.attr', 'align', 'justify'); @@ -186,7 +186,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_defaultnumbering div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container ol li p') .should('exist'); @@ -202,7 +202,7 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_defaultbullet div table') .should('have.class', 'checked'); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container ul li p') .should('exist'); @@ -212,23 +212,19 @@ describe('Pushing bottom toolbar items.', function() { cy.get('#tb_editbar_item_incrementindent') .click().click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-left']).to.be.equal('0.98in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-left: 0.98in'); cy.get('#tb_editbar_item_decrementindent') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].style['margin-left']).to.be.equal('0.49in'); - }); + .should('have.attr', 'style') + .should('contain', 'margin-left: 0.49in'); }); }); diff --git a/cypress_test/integration_tests/mobile/writer/insert_field_spec.js b/cypress_test/integration_tests/mobile/writer/insert_field_spec.js index 95b180f38..842abfba1 100644 --- a/cypress_test/integration_tests/mobile/writer/insert_field_spec.js +++ b/cypress_test/integration_tests/mobile/writer/insert_field_spec.js @@ -30,7 +30,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Page Number') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'PAGE') @@ -42,7 +42,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Page Count') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'DOCSTAT') @@ -54,7 +54,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Date') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'DATETIME') @@ -66,7 +66,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Time') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'DATETIME') @@ -78,7 +78,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Title') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'DOCINFO') @@ -90,7 +90,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'First Author') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'DOCINFO') @@ -103,7 +103,7 @@ describe('Insert fields via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Subject') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p span sdfield') .should('have.attr', 'type', 'DOCINFO') diff --git a/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js b/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js index faa4d0d9b..3758a6b71 100644 --- a/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js +++ b/cypress_test/integration_tests/mobile/writer/insert_formatting_mark_spec.js @@ -1,4 +1,4 @@ -/* global describe it cy beforeEach require expect afterEach*/ +/* global describe it cy beforeEach require afterEach*/ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); @@ -29,90 +29,69 @@ describe('Insert formatting mark via insertion wizard.', function() { cy.contains('.menu-entry-with-icon', 'Non-breaking space') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u00a0'); - }); + .should('contain.text', '\u00a0'); }); it('Insert non-breaking hyphen.', function() { cy.contains('.menu-entry-with-icon', 'Non-breaking hyphen') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u2011'); - }); + .should('contain.text', '\u2011'); }); it('Insert soft hyphen.', function() { cy.contains('.menu-entry-with-icon', 'Soft hyphen') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u00ad'); - }); + .should('contain.text', '\u00ad'); }); it('Insert no-width optional break.', function() { cy.contains('.menu-entry-with-icon', 'No-width optional break') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u200b'); - }); + .should('contain.text', '\u200b'); }); it('Insert no-width no break.', function() { cy.contains('.menu-entry-with-icon', 'No-width no break') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u2060'); - }); + .should('contain.text', '\u2060'); }); it('Insert left-to-right mark.', function() { cy.contains('.menu-entry-with-icon', 'Left-to-right mark') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u200e'); - }); + .should('contain.text', '\u200e'); }); it('Insert right-to-left mark.', function() { cy.contains('.menu-entry-with-icon', 'Right-to-left mark') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('\u200f'); - }); + .should('contain.text', '\u200f'); }); }); diff --git a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js index a4a07dd86..a6192e0e9 100644 --- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js @@ -84,7 +84,7 @@ describe('Insert objects via insertion wizard.', function() { cy.get('.leaflet-marker-icon.table-column-resize-marker') .should('exist'); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Two rows cy.get('#copy-paste-container tr') @@ -122,7 +122,7 @@ describe('Insert objects via insertion wizard.', function() { cy.get('.leaflet-marker-icon.table-column-resize-marker') .should('exist'); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Three rows cy.get('#copy-paste-container tr') @@ -309,7 +309,7 @@ describe('Insert objects via insertion wizard.', function() { cy.get('.vex-content.hyperlink-dialog .vex-dialog-button-primary') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') .should('have.text', '\nsome text'); diff --git a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js index cb0a8d007..fb491219c 100644 --- a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js +++ b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js @@ -53,13 +53,10 @@ describe('Spell checking menu.', function() { cy.contains('.context-menu-link', 'hello') .click(); - writerHelper.copyTextToClipboard(); + writerHelper.selectAllMobile(); cy.get('#copy-paste-container p') - .then(function(item) { - expect(item).to.have.lengthOf(1); - expect(item[0].innerText).to.have.string('hello'); - }); + .should('contain.text', 'hello'); }); it('Ignore one.', function() { diff --git a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js index f252fa5a1..d709a1ac7 100644 --- a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js @@ -1,18 +1,10 @@ -/* global describe it cy require afterEach expect Cypress beforeEach*/ +/* global describe it cy require expect Cypress*/ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); var writerHelper = require('./writer_helper'); describe('Change table properties / layout via mobile wizard.', function() { - beforeEach(function() { - mobileHelper.beforeAllMobile('table_properties.odt', 'writer'); - }); - - afterEach(function() { - helper.afterAll('table_properties.odt'); - }); - function before(testFile) { helper.loadTestDoc(testFile, 'writer', true); @@ -50,7 +42,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -60,7 +52,7 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('.leaflet-marker-icon.table-row-resize-marker') .should('have.length', 4); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') @@ -71,6 +63,8 @@ describe('Change table properties / layout via mobile wizard.', function() { }); cy.get('#copy-paste-container td') .should('have.length', 8); + + helper.afterAll('table_properties.odt'); }); it('Insert row after.', function() { @@ -79,7 +73,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -89,7 +83,7 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('.leaflet-marker-icon.table-row-resize-marker') .should('have.length', 4); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') @@ -100,6 +94,8 @@ describe('Change table properties / layout via mobile wizard.', function() { }); cy.get('#copy-paste-container td') .should('have.length', 8); + + helper.afterAll('table_properties.odt'); }); it('Insert column before.', function() { @@ -108,7 +104,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -118,7 +114,7 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('.leaflet-marker-icon.table-column-resize-marker') .should('have.length', 4); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') @@ -129,6 +125,8 @@ describe('Change table properties / layout via mobile wizard.', function() { expect(columns[0].textContent).to.not.have.string('text'); expect(columns[1].textContent).to.have.string('text'); }); + + helper.afterAll('table_properties.odt'); }); it('Insert column after.', function() { @@ -137,7 +135,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -147,7 +145,7 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('.leaflet-marker-icon.table-column-resize-marker') .should('have.length', 4); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') @@ -158,6 +156,8 @@ describe('Change table properties / layout via mobile wizard.', function() { expect(columns[0].textContent).to.have.string('text'); expect(columns[1].textContent).to.not.have.string('text'); }); + + helper.afterAll('table_properties.odt'); }); it('Delete row.', function() { @@ -166,7 +166,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -176,7 +176,7 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('.leaflet-marker-icon.table-row-resize-marker') .should('have.length', 2); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') @@ -187,6 +187,8 @@ describe('Change table properties / layout via mobile wizard.', function() { }); cy.get('#copy-paste-container td') .should('have.length', 4); + + helper.afterAll('table_properties.odt'); }); it('Delete column.', function() { @@ -195,7 +197,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -205,7 +207,7 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('.leaflet-marker-icon.table-column-resize-marker') .should('not.exist'); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') @@ -217,6 +219,8 @@ describe('Change table properties / layout via mobile wizard.', function() { expect(columns[1].textContent).to.not.have.string('text'); expect(columns[2].textContent).to.not.have.string('text'); }); + + helper.afterAll('table_properties.odt'); }); it('Delete table.', function() { @@ -225,7 +229,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -246,6 +250,8 @@ describe('Change table properties / layout via mobile wizard.', function() { expect(markers).to.have.lengthOf(2); expect(markers[0].getBoundingClientRect().top).to.equal(markers[1].getBoundingClientRect().top); }); + + helper.afterAll('table_properties.odt'); }); it('Merge cells.', function() { @@ -254,7 +260,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); moveCursorToFirstCell(); @@ -267,13 +273,15 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#MergeCells') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check rows / columns cy.get('#copy-paste-container tr') .should('have.length', 2); cy.get('#copy-paste-container td') .should('have.length', 3); + + helper.afterAll('table_properties.odt'); }); it('Change row height.', function() { @@ -282,7 +290,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -297,11 +305,13 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#rowheight .spinfield') .should('have.attr', 'value', '1.4'); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check row height cy.get('#copy-paste-container td') .should('have.attr', 'height', '125'); + + helper.afterAll('table_properties.odt'); }); it('Change column width.', function() { @@ -310,7 +320,7 @@ describe('Change table properties / layout via mobile wizard.', function() { if (Cypress.env('LO_CORE_VERSION') === 'master') return; - before('table_properties2.odt'); + before('table_properties.odt'); openTablePanel(); @@ -325,11 +335,13 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#columnwidth .spinfield') .should('have.attr', 'value', '5.6'); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check row height cy.get('#copy-paste-container td') .should('have.attr', 'width', '81%'); + + helper.afterAll('table_properties.odt'); }); it('Set minimal row height.', function() { @@ -350,11 +362,13 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#SetMinimalRowHeight') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check new row height cy.get('#copy-paste-container td') .should('not.have.attr', 'height'); + + helper.afterAll('table_with_text.odt'); }); it('Set optimal row height.', function() { @@ -374,9 +388,14 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#SetOptimalRowHeight') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check new row height + cy.get('#copy-paste-container td:nth-of-type(1n)') + .should('have.attr', 'height'); + cy.get('#copy-paste-container td:nth-of-type(2n)') + .should('not.have.attr', 'height'); + cy.get('#copy-paste-container td') .then(function(items) { expect(items).have.lengthOf(6); @@ -389,6 +408,8 @@ describe('Change table properties / layout via mobile wizard.', function() { expect(items[i]).not.have.attr('height'); } }); + + helper.afterAll('table_with_text.odt'); }); it('Distribute rows.', function() { @@ -408,9 +429,14 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#DistributeRows') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); // Check new row height + cy.get('#copy-paste-container td:nth-of-type(1n)') + .should('have.attr', 'height'); + cy.get('#copy-paste-container td:nth-of-type(2n)') + .should('not.have.attr', 'height'); + cy.get('#copy-paste-container td') .then(function(items) { expect(items).have.lengthOf(6); @@ -423,6 +449,8 @@ describe('Change table properties / layout via mobile wizard.', function() { expect(items[i]).not.have.attr('height'); } }); + + helper.afterAll('table_with_text.odt'); }); it('Set minimal column width.', function() { @@ -442,16 +470,12 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#SetMinimalColumnWidth') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); - // 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'); - } - }); + .should('have.attr', 'width', '24'); + + helper.afterAll('table_with_text.odt'); }); it('Set optimal column width.', function() { @@ -471,19 +495,14 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#SetOptimalColumnWidth') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); - // 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'); - } - }); + cy.get('#copy-paste-container td:nth-of-type(1n)') + .should('have.attr', 'width', '324'); + cy.get('#copy-paste-container td:nth-of-type(2n)') + .should('have.attr', 'width', '323'); + + helper.afterAll('table_with_text.odt'); }); it('Distribute columns.', function() { @@ -503,15 +522,11 @@ describe('Change table properties / layout via mobile wizard.', function() { cy.get('#DistributeColumns') .click(); - writerHelper.copyTableToClipboard(); + writerHelper.selectAllMobile(); - // 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'); - } - }); + .should('have.attr', 'width', '323'); + + helper.afterAll('table_with_text.odt'); }); }); diff --git a/cypress_test/integration_tests/mobile/writer/writer_helper.js b/cypress_test/integration_tests/mobile/writer/writer_helper.js index 8a910aab0..f08bae837 100644 --- a/cypress_test/integration_tests/mobile/writer/writer_helper.js +++ b/cypress_test/integration_tests/mobile/writer/writer_helper.js @@ -1,51 +1,7 @@ -/* global cy expect require*/ +/* global cy require*/ var mobileHelper = require('../../common/mobile_helper'); -function copyTextToClipboard() { - cy.log('Copying text to clipboard - start.'); - - // Do a new selection - selectAllMobile(); - - // Open context menu - cy.get('.leaflet-marker-icon') - .then(function(marker) { - expect(marker).to.have.lengthOf(2); - var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2; - var YPos = marker[0].getBoundingClientRect().top - 5; - mobileHelper.executeCopyFromContextMenu(XPos, YPos); - }); - - cy.log('Copying text to clipboard - end.'); -} - -function copyTableToClipboard() { - cy.log('Copying table to clipboard - start.'); - - // 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 + 10; - var YPos = (startPos.top + endPos.top) / 2; - mobileHelper.executeCopyFromContextMenu(XPos, YPos); - }); - - cy.log('Copying table to clipboard - end.'); -} - function selectAllMobile() { cy.log('Select all via hamburger menu - start.'); @@ -71,6 +27,4 @@ function selectAllMobile() { cy.log('Select all via hamburger menu - end.'); } -module.exports.copyTextToClipboard = copyTextToClipboard; -module.exports.copyTableToClipboard = copyTableToClipboard; module.exports.selectAllMobile = selectAllMobile; diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js index 7cd87a7cb..b1dc23227 100644 --- a/loleaflet/src/map/Clipboard.js +++ b/loleaflet/src/map/Clipboard.js @@ -494,7 +494,7 @@ L.Clipboard = L.Class.extend({ }, _beforeSelectImpl: function(operation) { - if ((L.Browser.isInternetExplorer || L.Browser.cypressTest) && operation != 'paste') + if (L.Browser.isInternetExplorer && operation != 'paste') // We need populate our content into the div for // the brower to copy. this._dummyDiv.innerHTML = this._getHtmlForClipboard(); @@ -547,8 +547,7 @@ L.Clipboard = L.Class.extend({ _execOnElement: function(operation) { var serial = this._clipboardSerial; - if (!L.Browser.cypressTest) - this._resetDiv(); + this._resetDiv(); var success = false; var active = null; @@ -573,7 +572,7 @@ L.Clipboard = L.Class.extend({ var serial = this._clipboardSerial; // try a direct execCommand. - if ((L.Browser.isInternetExplorer || L.Browser.cypressTest) && operation != 'paste') + if (L.Browser.isInternetExplorer && operation != 'paste') this._beforeSelectImpl(operation); if (document.execCommand(operation) && serial !== this._clipboardSerial) { @@ -715,6 +714,9 @@ L.Clipboard = L.Class.extend({ setTextSelectionHTML: function(html) { this._selectionType = 'text'; this._selectionContent = html; + if (L.Browser.cypressTest) { + this._dummyDiv.innerHTML = html; + } }, // sets the selection to some (cell formula) text) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
