cypress_test/integration_tests/common/helper.js                      |   17 
+++++
 cypress_test/integration_tests/mobile/calc/alignment_options_spec.js |   32 
++++++++--
 cypress_test/integration_tests/mobile/writer/insert_object_spec.js   |   12 ---
 3 files changed, 45 insertions(+), 16 deletions(-)

New commits:
commit 19821f0772b666f8cdc33793952c5108a031a487
Author:     Tamás Zolnai <tamas.zol...@collabora.com>
AuthorDate: Fri Apr 17 13:34:03 2020 +0200
Commit:     Tamás Zolnai <tamas.zol...@collabora.com>
CommitDate: Fri Apr 17 14:12:45 2020 +0200

    cypress: mobile: update calc text alignment test.
    
    Change-Id: I14893d70ffff312b897c48fe43a4e2add34bb29b
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92419
    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 61237c81a..fcb99e53c 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -160,6 +160,22 @@ function afterAll(fileName) {
        cy.log('Waiting for closing the document - end.');
 }
 
+
+function initAliasToNegative(aliasName) {
+       cy.log('Initializing alias to a negative value - start.');
+       cy.log('Param - aliasName: ' + aliasName);
+
+       cy.get('#copy-paste-container')
+               .invoke('offset')
+               .its('top')
+               .as(aliasName);
+
+       cy.get('@' + aliasName)
+               .should('be.lessThan', 0);
+
+       cy.log('Initializing alias to a negative value - end.');
+}
+
 module.exports.loadTestDoc = loadTestDoc;
 module.exports.assertCursorAndFocus = assertCursorAndFocus;
 module.exports.assertNoKeyboardInput = assertNoKeyboardInput;
@@ -169,3 +185,4 @@ module.exports.clearAllText = clearAllText;
 module.exports.getTextForClipboard = getTextForClipboard;
 module.exports.expectTextForClipboard = expectTextForClipboard;
 module.exports.afterAll = afterAll;
+module.exports.initAliasToNegative = initAliasToNegative;
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 b62f8da86..2b1995aa0 100644
--- a/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js
+++ b/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js
@@ -25,10 +25,16 @@ describe('Change alignment settings.', function() {
                cy.get('textarea.clipboard')
                        .type('{ctrl}a', {force: true});
 
+               helper.initAliasToNegative('currentTextPos');
+
                cy.get('.leaflet-selection-marker-start')
-                       .invoke('position')
+                       .invoke('offset')
+                       .its('left')
                        .as('currentTextPos');
 
+               cy.get('@currentTextPos')
+                       .should('be.greaterThan', 0);
+
                calcHelper.removeTextSelection();
        }
 
@@ -156,11 +162,16 @@ describe('Change alignment settings.', function() {
        });
 
        it('Increment / decrement text indent.', function() {
+               helper.initAliasToNegative('originalTextPos');
+
                // Get text position first
                getTextPosForFirstCell();
                cy.get('@currentTextPos')
                        .as('originalTextPos');
 
+               cy.get('@originalTextPos')
+                       .should('be.greaterThan', 0);
+
                openAlignmentPaneForFirstCell();
 
                // Increase indent
@@ -175,14 +186,19 @@ describe('Change alignment settings.', function() {
                                .then(function(currentTextPos) {
                                        cy.get('@originalTextPos')
                                                .then(function(originalTextPos) 
{
-                                                       return 
originalTextPos.left < currentTextPos.left;
+                                                       return originalTextPos 
< currentTextPos;
                                                });
                                });
                });
 
+               helper.initAliasToNegative('originalTextPos');
+
                cy.get('@currentTextPos')
                        .as('originalTextPos');
 
+               cy.get('@currentTextPos')
+                       .should('be.greaterThan', 0);
+
                // Decrease indent
                openAlignmentPaneForFirstCell();
 
@@ -197,17 +213,23 @@ describe('Change alignment settings.', function() {
                                .then(function(currentTextPos) {
                                        cy.get('@originalTextPos')
                                                .then(function(originalTextPos) 
{
-                                                       return 
originalTextPos.left > currentTextPos.left;
+                                                       return originalTextPos 
> currentTextPos;
                                                });
                                });
                });
        });
 
-       it('Change text indent via input field.', function() {
+       it.skip('Change text indent via input field.', function() {
+               // TODO: this fails, because the input field always becomes 
disabled.
+               helper.initAliasToNegative('originalTextPos');
+
                getTextPosForFirstCell();
                cy.get('@currentTextPos')
                        .as('originalTextPos');
 
+               cy.get('@currentTextPos')
+                       .should('be.greaterThan', 0);
+
                openAlignmentPaneForFirstCell();
 
                // TODO: First we need to increase indent to make the input 
enabled
@@ -239,7 +261,7 @@ describe('Change alignment settings.', function() {
                                .then(function(currentTextPos) {
                                        cy.get('@originalTextPos')
                                                .then(function(originalTextPos) 
{
-                                                       return 
originalTextPos.left < currentTextPos.left;
+                                                       return originalTextPos 
< currentTextPos;
                                                });
                                });
                });
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 f45233e9f..a4a07dd86 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -16,18 +16,8 @@ describe('Insert objects via insertion wizard.', function() {
                helper.afterAll('insert_object.odt');
        });
 
-       function initAliasToZero(aliasName) {
-               cy.get('body')
-                       .invoke('offset')
-                       .its('left')
-                       .as(aliasName);
-
-               cy.get('@' + aliasName)
-                       .should('be.equal', 0);
-       }
-
        function getCursorPos(offsetProperty, aliasName) {
-               initAliasToZero(aliasName);
+               helper.initAliasToNegative(aliasName);
 
                cy.get('.blinking-cursor')
                        .invoke('offset')
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to