cypress_test/integration_tests/common/helper.js | 20 ++-- cypress_test/integration_tests/common/impress_helper.js | 3 cypress_test/integration_tests/desktop/calc/focus_spec.js | 14 +-- cypress_test/integration_tests/desktop/writer/form_field_spec.js | 42 ++++----- cypress_test/integration_tests/mobile/calc/alignment_options_spec.js | 3 cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js | 3 cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js | 36 ++------ cypress_test/integration_tests/mobile/calc/focus_spec.js | 20 ++-- cypress_test/integration_tests/mobile/calc/spellchecking_spec.js | 3 cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js | 9 -- cypress_test/integration_tests/mobile/impress/impress_focus_spec.js | 9 -- cypress_test/integration_tests/mobile/impress/spellchecking_spec.js | 3 cypress_test/integration_tests/mobile/writer/focus_spec.js | 9 -- cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js | 30 ++---- cypress_test/integration_tests/mobile/writer/insert_object_spec.js | 17 +-- cypress_test/integration_tests/mobile/writer/shape_properties_spec.js | 9 +- cypress_test/integration_tests/mobile/writer/spellchecking_spec.js | 3 cypress_test/integration_tests/mobile/writer/table_properties_spec.js | 45 +--------- cypress_test/integration_tests/mobile/writer/toolbar_spec.js | 4 cypress_test/integration_tests/mobile/writer/writer_mobile_helper.js | 6 - 20 files changed, 107 insertions(+), 181 deletions(-)
New commits: commit dbe8502a5815e16198ac1de3f66eedb071fcbaa4 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Wed Aug 12 05:23:25 2020 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Wed Aug 12 14:59:30 2020 +0200 cypress: introduce typeIntoDocument helper method. It was not consistent what we used to type into the document (e.g. 'body', 'textarea.clipboard' or '#document-container'). Also we need to use force parameter because 'textarea.clipboard' has no actual area which makes cypress fail with: '`cy.type()` failed because the center of this element is hidden from view'. Change-Id: I04e0a82ed8450d583e407715fde1855197cae109 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100574 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 7cfce8f9f..9853b7174 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -114,8 +114,7 @@ function selectAllText(assertFocus = true) { cy.log('Select all text'); // Trigger select all - cy.get('textarea.clipboard') - .type('{ctrl}a'); + typeIntoDocument('{ctrl}a'); cy.get('.leaflet-marker-icon') .should('exist'); @@ -128,15 +127,13 @@ function clearAllText() { cy.log('Clear all text'); // Trigger select all - cy.get('textarea.clipboard') - .type('{ctrl}a'); + typeIntoDocument('{ctrl}a'); cy.get('.leaflet-marker-icon') .should('exist'); // Then remove - cy.get('textarea.clipboard') - .type('{del}'); + typeIntoDocument('{del}'); cy.get('.leaflet-marker-icon') .should('not.exist'); @@ -427,10 +424,9 @@ function doIfOnDesktop(callback) { }); } -function moveCursor(direction, forceType = false) { +function moveCursor(direction) { cy.log('Moving text cursor - start.'); cy.log('Param - direction: ' + direction); - cy.log('Param - forceType: ' + forceType); initAliasToNegative('origCursorPos'); @@ -462,8 +458,7 @@ function moveCursor(direction, forceType = false) { } else if (direction === 'right') { key = '{rightarrow}'; } - cy.get('textarea.clipboard') - .type(key, {force : forceType}); + typeIntoDocument(key); cy.get('@origCursorPos') .then(function(origCursorPos) { @@ -484,6 +479,10 @@ function moveCursor(direction, forceType = false) { cy.log('Moving text cursor - end.'); } +function typeIntoDocument(text) { + cy.get('textarea.clipboard') + .type(text, {force: true}); +} module.exports.loadTestDoc = loadTestDoc; module.exports.assertCursorAndFocus = assertCursorAndFocus; @@ -509,3 +508,4 @@ module.exports.waitUntilIdle = waitUntilIdle; module.exports.doIfOnMobile = doIfOnMobile; module.exports.doIfOnDesktop = doIfOnDesktop; module.exports.moveCursor = moveCursor; +module.exports.typeIntoDocument = typeIntoDocument; diff --git a/cypress_test/integration_tests/common/impress_helper.js b/cypress_test/integration_tests/common/impress_helper.js index dc350492c..4a6c8aed0 100644 --- a/cypress_test/integration_tests/common/impress_helper.js +++ b/cypress_test/integration_tests/common/impress_helper.js @@ -46,8 +46,7 @@ function typeTextAndVerify(text, expected) { assertInTextEditMode(); // Type some text. - cy.get('#document-container') - .type(text); + helper.typeIntoDocument(text); // Still in edit mode. assertInTextEditMode(); diff --git a/cypress_test/integration_tests/desktop/calc/focus_spec.js b/cypress_test/integration_tests/desktop/calc/focus_spec.js index 2d9cd623b..fb0dab547 100644 --- a/cypress_test/integration_tests/desktop/calc/focus_spec.js +++ b/cypress_test/integration_tests/desktop/calc/focus_spec.js @@ -30,17 +30,17 @@ describe('Calc focus tests', function() { // Type some text. var text1 = 'Hello from Calc'; helper.typeText('textarea.clipboard', text1); - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument('{enter}'); // Select the first cell to edit the same one. calcHelper.clickOnFirstCell(); calcHelper.clickFormulaBar(); helper.assertCursorAndFocus(); // Validate. - cy.get('textarea.clipboard').type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); helper.expectTextForClipboard(text1); // End editing. - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument('{enter}'); // Type some more text, at the end. cy.log('Appending text at the end.'); @@ -50,10 +50,10 @@ describe('Calc focus tests', function() { var text2 = ', this is a test.'; helper.typeText('textarea.clipboard', text2); // Validate. - cy.get('textarea.clipboard').type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); helper.expectTextForClipboard(text1 + text2); // End editing. - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument('{enter}'); // Type some more text, in the middle. cy.log('Inserting text in the middle.'); @@ -62,14 +62,14 @@ describe('Calc focus tests', function() { helper.assertCursorAndFocus(); // Move cursor inside text2 - cy.get('textarea.clipboard').type('{end}'); + helper.typeIntoDocument('{end}'); for (var i = 0; i < 6; i++) helper.moveCursor('left'); var text3 = ' BAZINGA'; helper.typeText('textarea.clipboard', text3); // Validate. - cy.get('textarea.clipboard').type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); //NOTE: If this fails, it's probably because we clicked // at a different point in the text. helper.expectTextForClipboard(text1 + ', this is a' + text3 + ' test.'); diff --git a/cypress_test/integration_tests/desktop/writer/form_field_spec.js b/cypress_test/integration_tests/desktop/writer/form_field_spec.js index b507a28f7..7ac66ff11 100644 --- a/cypress_test/integration_tests/desktop/writer/form_field_spec.js +++ b/cypress_test/integration_tests/desktop/writer/form_field_spec.js @@ -60,10 +60,6 @@ describe('Form field button tests.', function() { }); } - function moveCursor(direction = 'left') { - helper.moveCursor(direction, true); - } - function doZoom(zoomIn) { helper.initAliasToEmptyString('prevZoom'); @@ -98,22 +94,22 @@ describe('Form field button tests.', function() { buttonShouldNotExist(); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); // Move the cursor again to the other side of the field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); // Move the cursor away - moveCursor('right'); + helper.moveCursor('right'); buttonShouldNotExist(); // Move the cursor back next to the field - moveCursor('left'); + helper.moveCursor('left'); buttonShouldExist(); }); @@ -122,7 +118,7 @@ describe('Form field button tests.', function() { before('form_field.odt'); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); @@ -164,7 +160,7 @@ describe('Form field button tests.', function() { before('form_field.odt'); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); // Select a new item cy.get('.form-field-button') @@ -180,12 +176,12 @@ describe('Form field button tests.', function() { .should('have.text', 'January'); // Move the cursor away and back - moveCursor('left'); + helper.moveCursor('left'); buttonShouldNotExist(); // Move the cursor back next to the field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); @@ -193,7 +189,7 @@ describe('Form field button tests.', function() { .should('have.text', 'January'); // Do the same from the right side of the field. - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); @@ -218,26 +214,26 @@ describe('Form field button tests.', function() { buttonShouldNotExist(); // Move the cursor next to the first form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); // Move the cursor to the other side of the field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); // Move the cursor to the second form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); // Move the cursor to the other side of the second field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); - moveCursor('right'); + helper.moveCursor('right'); buttonShouldNotExist(); }); @@ -246,7 +242,7 @@ describe('Form field button tests.', function() { before('drop_down_form_field_noselection.odt'); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); @@ -258,7 +254,7 @@ describe('Form field button tests.', function() { before('drop_down_form_field_noitem.odt'); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); @@ -285,7 +281,7 @@ describe('Form field button tests.', function() { before('form_field.odt'); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); @@ -303,7 +299,7 @@ describe('Form field button tests.', function() { // anything stupid after the button is removed. // Move the cursor away from the field - moveCursor('left'); + helper.moveCursor('left'); buttonShouldNotExist(); @@ -315,7 +311,7 @@ describe('Form field button tests.', function() { before('form_field.odt'); // Move the cursor next to the form field - moveCursor('right'); + helper.moveCursor('right'); buttonShouldExist(); 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 3d7343485..e90368bf0 100644 --- a/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js +++ b/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js @@ -23,8 +23,7 @@ describe('Change alignment settings.', function() { calcHelper.dblClickOnFirstCell(); // Select text content - cy.get('textarea.clipboard') - .type('{ctrl}a', {force: true}); + helper.typeIntoDocument('{ctrl}a'); helper.initAliasToNegative('currentTextPos'); diff --git a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js index e2dfe5f8f..a94993ed6 100644 --- a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js @@ -28,8 +28,7 @@ describe('Interact with bottom toolbar.', function() { calcHelper.dblClickOnFirstCell(); // Select text content - cy.get('textarea.clipboard') - .type('{ctrl}a', {force: true}); + helper.typeIntoDocument('{ctrl}a'); helper.initAliasToNegative('currentTextPos'); diff --git a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js index e26a84a95..dde072665 100644 --- a/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js +++ b/cypress_test/integration_tests/mobile/calc/calc_mobile_helper.js @@ -1,31 +1,19 @@ -/* global cy expect require */ - -var helper = require('../../common/helper'); +/* global cy expect */ function removeTextSelection() { cy.log('Removing text selection - start.'); - // TODO: select all does not work with core/master - // if we have a column selected - if (helper.getLOVersion() === 'master') { - cy.get('body') - .type('{enter}'); - - cy.get('.leaflet-marker-icon') - .should('exist'); - } else { - cy.get('.spreadsheet-header-columns') - .click(); - - cy.get('.spreadsheet-cell-resize-marker') - .invoke('attr', 'style') - .should('contain', '-8px,'); - - var regex = /[A-Z]1:[A-Z]1048576/; - cy.get('input#addressInput') - .should('have.prop', 'value') - .should('match', regex); - } + cy.get('.spreadsheet-header-columns') + .click(); + + cy.get('.spreadsheet-cell-resize-marker') + .invoke('attr', 'style') + .should('contain', '-8px,'); + + var regex = /[A-Z]1:[A-Z]1048576/; + cy.get('input#addressInput') + .should('have.prop', 'value') + .should('match', regex); cy.log('Removing text selection - end.'); } diff --git a/cypress_test/integration_tests/mobile/calc/focus_spec.js b/cypress_test/integration_tests/mobile/calc/focus_spec.js index b9d4dd341..19adb1fdb 100644 --- a/cypress_test/integration_tests/mobile/calc/focus_spec.js +++ b/cypress_test/integration_tests/mobile/calc/focus_spec.js @@ -100,8 +100,8 @@ describe('Calc focus tests', function() { // Type some text. var text1 = 'Hello from Calc'; - cy.get('textarea.clipboard').type(text1); - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument(text1); + helper.typeIntoDocument('{enter}'); helper.assertNoKeyboardInput(); @@ -111,11 +111,11 @@ describe('Calc focus tests', function() { // Check the text we typed. calcHelper.clickFormulaBar(); helper.assertCursorAndFocus(); - cy.get('textarea.clipboard').type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); helper.expectTextForClipboard(text1); // Accept changes. - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument('{enter}'); helper.assertNoKeyboardInput(); // Type some more text, at the end. @@ -124,12 +124,12 @@ describe('Calc focus tests', function() { calcHelper.clickFormulaBar(); helper.assertCursorAndFocus(); var text2 = ', this is a test.'; - cy.get('textarea.clipboard').type(text2); + helper.typeIntoDocument(text2); // Validate. - cy.get('textarea.clipboard').type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); helper.expectTextForClipboard(text1 + text2); // End editing. - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument('{enter}'); helper.assertNoKeyboardInput(); // Type some more text, in the middle. @@ -139,17 +139,17 @@ describe('Calc focus tests', function() { helper.assertCursorAndFocus(); // Move cursor before text2 - cy.get('textarea.clipboard').type('{end}'); + helper.typeIntoDocument('{end}'); for (var i = 0; i < text2.length; i++) helper.moveCursor('left'); var text3 = ', BAZINGA'; helper.typeText('textarea.clipboard', text3); // Validate. - cy.get('textarea.clipboard').type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); helper.expectTextForClipboard(text1 + text3 + text2); // End editing. - cy.get('textarea.clipboard').type('{enter}'); + helper.typeIntoDocument('{enter}'); helper.assertNoKeyboardInput(); }); }); diff --git a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js index 7edff4719..b24136f5d 100644 --- a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js +++ b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js @@ -24,8 +24,7 @@ describe('Calc spell checking menu.', function() { calcHelper.dblClickOnFirstCell(); // Select text content - cy.get('textarea.clipboard') - .type('{ctrl}a', {force: true}); + helper.typeIntoDocument('{ctrl}a'); // Open context menu cy.get('.leaflet-selection-marker-start,.leaflet-selection-marker-end') diff --git a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js index 446375fdf..73c58ee13 100644 --- a/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js +++ b/cypress_test/integration_tests/mobile/impress/hamburger_menu_spec.js @@ -142,8 +142,7 @@ describe('Trigger hamburger menu options.', function() { // Type a new character dblclickOnShape(); - cy.get('textarea.clipboard') - .type('q'); + helper.typeIntoDocument('q'); impressMobileHelper.triggerNewSVGForShapeInTheCenter(); @@ -190,8 +189,7 @@ describe('Trigger hamburger menu options.', function() { // Type a new character dblclickOnShape(); - cy.get('textarea.clipboard') - .type('q'); + helper.typeIntoDocument('q'); impressMobileHelper.triggerNewSVGForShapeInTheCenter(); @@ -453,8 +451,7 @@ describe('Trigger hamburger menu options.', function() { // Type a new character dblclickOnShape(); - cy.get('textarea.clipboard') - .type('qqqqqq'); + helper.typeIntoDocument('qqqqqq'); impressMobileHelper.triggerNewSVGForShapeInTheCenter(); diff --git a/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js b/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js index ed7cab2ac..4fa3e97be 100644 --- a/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js +++ b/cypress_test/integration_tests/mobile/impress/impress_focus_spec.js @@ -65,8 +65,7 @@ describe('Impress focus tests', function() { impressHelper.typeTextAndVerify('Hello Impress'); // End editing. - cy.get('#document-container') - .type('{esc}'); + helper.typeIntoDocument('{esc}'); impressHelper.assertNotInTextEditMode(); @@ -102,8 +101,7 @@ describe('Impress focus tests', function() { impressHelper.typeTextAndVerify('Hello Impress'); // End editing. - cy.get('#document-container') - .type('{esc}'); + helper.typeIntoDocument('{esc}'); impressHelper.assertNotInTextEditMode(); @@ -123,8 +121,7 @@ describe('Impress focus tests', function() { impressHelper.typeTextAndVerify('Bazinga Impress'); // End editing. - cy.get('#document-container') - .type('{esc}'); + helper.typeIntoDocument('{esc}'); impressHelper.assertNotInTextEditMode(); }); diff --git a/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js b/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js index 65f9a92be..01e9dd360 100644 --- a/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js +++ b/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js @@ -28,8 +28,7 @@ describe('Spell checking menu.', function() { .dblclick(XPos, YPos); }); - cy.get('textarea.clipboard') - .type('{leftArrow}'); + helper.typeIntoDocument('{leftArrow}'); cy.get('.leaflet-marker-icon') .should('not.exist'); diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js index 7fc8c9181..c6f8fe33f 100644 --- a/cypress_test/integration_tests/mobile/writer/focus_spec.js +++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js @@ -247,8 +247,7 @@ describe('Focus tests', function() { mobileHelper.enableEditingMobile(); // Grab focus to the document - cy.get('#document-container') - .type('x'); + helper.typeIntoDocument('x'); helper.selectAllText(); @@ -271,8 +270,7 @@ describe('Focus tests', function() { mobileHelper.enableEditingMobile(); // Grab focus to the document - cy.get('#document-container') - .type('x'); + helper.typeIntoDocument('x'); helper.selectAllText(); @@ -295,8 +293,7 @@ describe('Focus tests', function() { mobileHelper.enableEditingMobile(); // Grab focus to the document - cy.get('#document-container') - .type('x'); + helper.typeIntoDocument('x'); helper.selectAllText(); diff --git a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js index 160b6668f..3c23f9163 100644 --- a/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js +++ b/cypress_test/integration_tests/mobile/writer/hamburger_menu_spec.js @@ -174,8 +174,7 @@ describe('Trigger hamburger menu options.', function() { it('Undo/redo.', function() { // Type a new character - cy.get('textarea.clipboard') - .type('{q}'); + helper.typeIntoDocument('q'); writerMobileHelper.selectAllMobile(); @@ -213,12 +212,10 @@ describe('Trigger hamburger menu options.', function() { it('Repair.', function() { // First change - cy.get('textarea.clipboard') - .type('{q}'); + helper.typeIntoDocument('q'); // Second change - cy.get('textarea.clipboard') - .type('{w}'); + helper.typeIntoDocument('w'); writerMobileHelper.selectAllMobile(); @@ -408,8 +405,7 @@ describe('Trigger hamburger menu options.', function() { .click(); // Insert some text and check whether it's tracked. - cy.get('textarea.clipboard') - .type('{q}'); + helper.typeIntoDocument('q'); mobileHelper.openHamburgerMenu(); @@ -435,8 +431,7 @@ describe('Trigger hamburger menu options.', function() { cy.contains('.menu-entry-with-icon', 'Record') .click(); - cy.get('textarea.clipboard') - .type('{rightArrow}w'); + helper.typeIntoDocument('{rightArrow}w'); mobileHelper.openHamburgerMenu(); @@ -492,8 +487,7 @@ describe('Trigger hamburger menu options.', function() { }); // Remove text selection. - cy.get('textarea.clipboard') - .type('{leftArrow}'); + helper.typeIntoDocument('{leftArrow}'); // Hide track changes. mobileHelper.openHamburgerMenu(); @@ -505,8 +499,7 @@ describe('Trigger hamburger menu options.', function() { .click(); // Trigger select all - cy.get('textarea.clipboard') - .type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); // Both selection markers should be in the same line cy.get('.leaflet-marker-icon:nth-of-type(1)') @@ -545,8 +538,7 @@ describe('Trigger hamburger menu options.', function() { .click(); // Check that we dont have the removed content - cy.get('textarea.clipboard') - .type('{ctrl}a'); + helper.typeIntoDocument('{ctrl}a'); cy.wait(1000); @@ -604,12 +596,10 @@ describe('Trigger hamburger menu options.', function() { .click(); // First change - cy.get('textarea.clipboard') - .type('q'); + helper.typeIntoDocument('q'); // Second change - cy.get('textarea.clipboard') - .type('{rightArrow}w'); + helper.typeIntoDocument('{rightArrow}w'); // Find second change using prev. mobileHelper.openHamburgerMenu(); 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 988d6174c..b9ffa6294 100644 --- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js +++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js @@ -135,7 +135,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert header.', function() { // Get the blinking cursor pos - cy.get('#document-container').type('xxxx'); + helper.typeIntoDocument('xxxx'); getCursorPos('left', 'cursorOrigLeft'); @@ -166,8 +166,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert footer.', function() { // Get the blinking cursor pos - cy.get('#document-container') - .type('xxxx'); + helper.typeIntoDocument('xxxx'); getCursorPos('top', 'cursorOrigTop'); @@ -199,8 +198,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert footnote.', function() { // Get the blinking cursor pos - cy.get('#document-container') - .type('xxxx'); + helper.typeIntoDocument('xxxx'); getCursorPos('top', 'cursorOrigTop'); @@ -222,8 +220,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert endnote.', function() { // Get the blinking cursor pos - cy.get('#document-container') - .type('xxxx'); + helper.typeIntoDocument('xxxx'); getCursorPos('top', 'cursorOrigTop'); @@ -245,8 +242,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert page break.', function() { // Get the blinking cursor pos - cy.get('#document-container') - .type('xxxx'); + helper.typeIntoDocument('xxxx'); getCursorPos('top', 'cursorOrigTop'); @@ -268,8 +264,7 @@ describe('Insert objects via insertion wizard.', function() { it('Insert column break.', function() { // Get the blinking cursor pos - cy.get('#document-container') - .type('xxxx'); + helper.typeIntoDocument('xxxx'); getCursorPos('top', 'cursorOrigTop'); diff --git a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js index 3497191e4..9cf50d0bb 100644 --- a/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/shape_properties_spec.js @@ -2,7 +2,6 @@ var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); -var writerMobileHelper = require('./writer_mobile_helper'); describe('Change shape properties via mobile wizard.', function() { var defaultGeometry = 'M 1965,4863 L 7957,10855 1965,10855 1965,4863 1965,4863 Z'; @@ -14,10 +13,12 @@ describe('Change shape properties via mobile wizard.', function() { // Click on edit button mobileHelper.enableEditingMobile(); - writerMobileHelper.selectAllMobile(); + helper.typeIntoDocument('{end}'); - cy.get('#document-container') - .type('{home}'); + cy.get('.blinking-cursor') + .should('be.visible'); + + helper.typeIntoDocument('{home}'); cy.get('.blinking-cursor') .should('be.visible'); diff --git a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js index 0534824f4..10a64f2b3 100644 --- a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js +++ b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js @@ -35,8 +35,7 @@ describe('Spell checking menu.', function() { } // Remove selection - cy.get('#document-container') - .type('{leftarrow}'); + helper.typeIntoDocument('{downarrow}'); cy.get('.leaflet-marker-icon') .should('not.exist'); 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 f789f0d4c..3da94fcb5 100644 --- a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js @@ -28,22 +28,8 @@ describe('Change table properties / layout via mobile wizard.', function() { .should('be.visible'); } - function moveCursorToFirstCell() { - writerMobileHelper.selectAllMobile(); - - cy.get('.blinking-cursor') - .then(function(cursor) { - expect(cursor).to.have.lengthOf(1) ; - var posX = cursor[0].getBoundingClientRect().right + 10; - var posY = cursor[0].getBoundingClientRect().top + 10; - cy.get('body') - .click(posX, posY); - }); - } - function selectFullTable() { - cy.get('textarea.clipboard') - .type('{downarrow}{downarrow}{downarrow}{downarrow}'); + helper.typeIntoDocument('{downarrow}{downarrow}{downarrow}{downarrow}'); writerMobileHelper.selectAllMobile(); } @@ -210,9 +196,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Merge cells.', function() { before('table_properties.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{shift}{downarrow}{rightarrow}'); + helper.typeIntoDocument('{shift}{downarrow}{rightarrow}'); openTablePanel(); @@ -273,10 +257,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set minimal row height.', function() { before('table_with_text.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); - + helper.typeIntoDocument('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); openTablePanel(); @@ -292,9 +273,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set optimal row height.', function() { before('table_with_text.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); + helper.typeIntoDocument('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); openTablePanel(); @@ -320,9 +299,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Distribute rows.', function() { before('table_with_text.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); + helper.typeIntoDocument('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); openTablePanel(); @@ -348,9 +325,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set minimal column width.', function() { before('table_with_text.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); + helper.typeIntoDocument('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); openTablePanel(); @@ -365,9 +340,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Set optimal column width.', function() { before('table_with_text.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); + helper.typeIntoDocument('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); openTablePanel(); @@ -384,9 +357,7 @@ describe('Change table properties / layout via mobile wizard.', function() { it('Distribute columns.', function() { before('table_with_text.odt'); - moveCursorToFirstCell(); - - cy.get('body').type('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); + helper.typeIntoDocument('{leftarrow}{shift}{downarrow}{downarrow}{downarrow}{rightarrow}'); openTablePanel(); diff --git a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js index 8c34016ab..b8e2dd598 100644 --- a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js @@ -66,7 +66,7 @@ describe('Toolbar tests', function() { .should('have.class', 'disabled'); // Type something in the document - cy.get('#document-container').type('x'); + helper.typeIntoDocument('x'); // Button should become enabled cy.get('#tb_actionbar_item_undo') @@ -86,7 +86,7 @@ describe('Toolbar tests', function() { .should('have.class', 'disabled'); // Type something in the document - cy.get('#document-container').type('x'); + helper.typeIntoDocument('x'); // Button should be still disabled cy.get('#tb_actionbar_item_redo') diff --git a/cypress_test/integration_tests/mobile/writer/writer_mobile_helper.js b/cypress_test/integration_tests/mobile/writer/writer_mobile_helper.js index f08bae837..860905051 100644 --- a/cypress_test/integration_tests/mobile/writer/writer_mobile_helper.js +++ b/cypress_test/integration_tests/mobile/writer/writer_mobile_helper.js @@ -1,14 +1,14 @@ /* global cy require*/ +var helper = require('../../common/helper'); var mobileHelper = require('../../common/mobile_helper'); function selectAllMobile() { cy.log('Select all via hamburger menu - start.'); // Remove selection if exist - cy.get('#document-container') - .type('{downarrow}'); - cy.get('.leaflet-marker-icon') + helper.typeIntoDocument('{downarrow}'); + cy.get('.leaflet-selection-marker-start') .should('not.exist'); // Open hamburger menu _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits