cypress_test/integration_tests/mobile/calc/calc_helper.js           |   30 
+++++++++-
 cypress_test/integration_tests/mobile/calc/spellchecking_spec.js    |   15 
++---
 cypress_test/integration_tests/mobile/impress/spellchecking_spec.js |    3 +
 3 files changed, 38 insertions(+), 10 deletions(-)

New commits:
commit 3f358cbb80797991cc31a79e47e5ac015080815f
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Wed Apr 1 11:35:49 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Wed Apr 1 15:04:58 2020 +0200

    cypress: mobile: try harder to remove selection in calc spellchecking tests.
    
    It's a known issue that text selection is persistent,
    which made these tests unstable. So use a different method
    to remove the text selection.
    
    Change-Id: I46b0ba268a39bae9e79ce62686b2d1e0eab1adda
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91486
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git a/cypress_test/integration_tests/mobile/calc/calc_helper.js 
b/cypress_test/integration_tests/mobile/calc/calc_helper.js
index ce3b1608e..0fd771dad 100644
--- a/cypress_test/integration_tests/mobile/calc/calc_helper.js
+++ b/cypress_test/integration_tests/mobile/calc/calc_helper.js
@@ -15,6 +15,27 @@ function clickOnFirstCell() {
                        cy.get('body')
                                .click(XPos, YPos);
                });
+
+       cy.get('.spreadsheet-cell-resize-marker')
+               .should('exist');
+}
+
+function dblClickOnFirstCell() {
+       // Enable editing if it's in read-only mode
+       helper.enableEditingMobile();
+
+       // Use the tile's edge to find the first cell's position
+       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;
+                       cy.get('body')
+                               .dblclick(XPos, YPos);
+               });
+
+       cy.get('.leaflet-cursor.blinking-cursor')
+               .should('exist');
 }
 
 function copyContentToClipboard() {
@@ -45,7 +66,7 @@ function copyContentToClipboard() {
                .should('not.exist');
 }
 
-function selectAllMobile() {
+function removeTextSelection() {
        // TODO: select all does not work with core/master
        // if we have a column selected
        if (Cypress.env('LO_CORE_VERSION') === 'master') {
@@ -61,6 +82,11 @@ function selectAllMobile() {
                cy.get('.spreadsheet-cell-resize-marker')
                        .should('exist');
        }
+}
+
+function selectAllMobile() {
+       removeTextSelection();
+
 
        cy.get('#spreadsheet-header-corner')
                .click();
@@ -70,5 +96,7 @@ function selectAllMobile() {
 }
 
 module.exports.copyContentToClipboard = copyContentToClipboard;
+module.exports.removeTextSelection = removeTextSelection;
 module.exports.selectAllMobile = selectAllMobile;
 module.exports.clickOnFirstCell = clickOnFirstCell;
+module.exports.dblClickOnFirstCell = dblClickOnFirstCell;
diff --git a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js 
b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js
index 951e567a7..b1a564bca 100644
--- a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js
@@ -18,14 +18,11 @@ describe('Calc spell checking menu.', function() {
 
        function openContextMenu() {
                // Step into edit mode
-               calcHelper.clickOnFirstCell();
-               calcHelper.clickOnFirstCell();
-               cy.get('.leaflet-cursor.blinking-cursor')
-                       .should('exist');
+               calcHelper.dblClickOnFirstCell();
 
                // Select text content
                cy.get('textarea.clipboard')
-                       .type('{ctrl}a');
+                       .type('{ctrl}a', {force: true});
 
                // Open context menu
                cy.get('.leaflet-marker-icon')
@@ -40,10 +37,10 @@ describe('Calc spell checking menu.', function() {
                                }
 
                                // Remove selection
-                               cy.get('body')
-                                       .type('{leftarrow}');
-                               cy.get('.leaflet-marker-icon')
-                                       .should('not.exist');
+                               calcHelper.removeTextSelection();
+
+                               // Step into edit mode again
+                               calcHelper.dblClickOnFirstCell();
 
                                helper.longPressOnDocument(XPos, YPos);
                        });
commit d90aed7cf0da67e6b780a660ad45f99c6577298e
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Wed Apr 1 13:03:31 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Wed Apr 1 15:04:49 2020 +0200

    cypress: mobile: make impress spellchecking test more stable.
    
    Change-Id: I3fe512eb5da0bcdab905f023f51ce03af7e503f5
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91487
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com>

diff --git 
a/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js 
b/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js
index 1d1224db4..d4cbaa256 100644
--- a/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/spellchecking_spec.js
@@ -43,6 +43,9 @@ describe('Spell checking menu.', function() {
                                        }
                                }
 
+                               cy.get('.leaflet-cursor.blinking-cursor')
+                                       .should('exist');
+
                                // Remove selection
                                cy.get('body')
                                        .type('{leftarrow}');
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to