[Libreoffice-commits] online.git: cypress_test/integration_tests

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri Apr 24 11:23:31 UTC 2020


 cypress_test/integration_tests/mobile/writer/insert_object_spec.js |   61 ++++++----
 1 file changed, 41 insertions(+), 20 deletions(-)

New commits:
commit d66d6bc91c70ee59ca9331c8c16f9ba63283d37a
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Apr 24 12:40:03 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Apr 24 13:23:14 2020 +0200

    cypress: mobile: restore waitUntil usage in object insertion code.
    
    Unfortunatelly, cypress does not work properly when invoke() and its()
    are chained:
    https://github.com/cypress-io/cypress/issues/7130
    
    Change-Id: I49fb9dcf9dc664495dfe8662d430df19faab00de
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92849
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

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 a6192e0e9..85f883dac 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -3,6 +3,7 @@
 var helper = require('../../common/helper');
 var mobileHelper = require('../../common/mobile_helper');
 var writerHelper = require('./writer_helper');
+require('cypress-wait-until');
 
 describe('Insert objects via insertion wizard.', function() {
 	beforeEach(function() {
@@ -156,10 +157,14 @@ describe('Insert objects via insertion wizard.', function() {
 
 		cy.get('@cursorOrigLeft')
 			.then(function(cursorOrigLeft) {
-				cy.get('.blinking-cursor')
-					.invoke('offset')
-					.its('left')
-					.should('be.lessThan', cursorOrigLeft);
+				cy.waitUntil(function() {
+					return cy.get('.blinking-cursor')
+						.invoke('offset')
+						.its('left')
+						.then(function(cursorCurrentLeft) {
+							return cursorCurrentLeft < cursorOrigLeft;
+						});
+				});
 			});
 	});
 
@@ -189,10 +194,14 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.get('.blinking-cursor')
-					.invoke('offset')
-					.its('top')
-					.should('be.greaterThan', cursorOrigTop);
+				cy.waitUntil(function() {
+					return cy.get('.blinking-cursor')
+						.invoke('offset')
+						.its('top')
+						.then(function(cursorCurrentTop) {
+							return cursorCurrentTop > cursorOrigTop;
+						});
+				});
 			});
 	});
 
@@ -212,10 +221,14 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.get('.blinking-cursor')
-					.invoke('offset')
-					.its('top')
-					.should('be.greaterThan', cursorOrigTop);
+				cy.waitUntil(function() {
+					return cy.get('.blinking-cursor')
+						.invoke('offset')
+						.its('top')
+						.then(function(cursorCurrentTop) {
+							return cursorCurrentTop > cursorOrigTop;
+						});
+				});
 			});
 	});
 
@@ -258,10 +271,14 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.get('.blinking-cursor')
-					.invoke('offset')
-					.its('top')
-					.should('be.greaterThan', cursorOrigTop);
+				cy.waitUntil(function() {
+					return cy.get('.blinking-cursor')
+						.invoke('offset')
+						.its('top')
+						.then(function(cursorCurrentTop) {
+							return cursorCurrentTop > cursorOrigTop;
+						});
+				});
 			});
 	});
 
@@ -281,10 +298,14 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.get('.blinking-cursor')
-					.invoke('offset')
-					.its('top')
-					.should('be.greaterThan', cursorOrigTop);
+				cy.waitUntil(function() {
+					return cy.get('.blinking-cursor')
+						.invoke('offset')
+						.its('top')
+						.then(function(cursorCurrentTop) {
+							return cursorCurrentTop > cursorOrigTop;
+						});
+				});
 			});
 	});
 


More information about the Libreoffice-commits mailing list