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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Sun Apr 26 09:09:29 UTC 2020


 cypress_test/integration_tests/mobile/writer/insert_object_spec.js |   67 +++-------
 1 file changed, 23 insertions(+), 44 deletions(-)

New commits:
commit 6f54cf0a28f3ebceba833f05aa305c1e2213e874
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Apr 26 10:41:15 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Sun Apr 26 11:09:11 2020 +0200

    cypress: mobile: cy.waitUntil() -> should(callbackFn)
    
    We don't actually need cy.waitUntil() extension here,
    becasue we can do that same check with should()'s special
    usage.
    
    Change-Id: I2b14afe84d2fa70f493aae873e3f1534540e96ea
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92917
    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 85f883dac..0c2bb2630 100644
--- a/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/insert_object_spec.js
@@ -3,7 +3,6 @@
 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() {
@@ -157,14 +156,10 @@ describe('Insert objects via insertion wizard.', function() {
 
 		cy.get('@cursorOrigLeft')
 			.then(function(cursorOrigLeft) {
-				cy.waitUntil(function() {
-					return cy.get('.blinking-cursor')
-						.invoke('offset')
-						.its('left')
-						.then(function(cursorCurrentLeft) {
-							return cursorCurrentLeft < cursorOrigLeft;
-						});
-				});
+				cy.get('.blinking-cursor')
+					.should(function(cursor) {
+						expect(cursor.offset().left).to.be.lessThan(cursorOrigLeft);
+					});
 			});
 	});
 
@@ -194,14 +189,10 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.waitUntil(function() {
-					return cy.get('.blinking-cursor')
-						.invoke('offset')
-						.its('top')
-						.then(function(cursorCurrentTop) {
-							return cursorCurrentTop > cursorOrigTop;
-						});
-				});
+				cy.get('.blinking-cursor')
+					.should(function(cursor) {
+						expect(cursor.offset().top).to.be.greaterThan(cursorOrigTop);
+					});
 			});
 	});
 
@@ -221,14 +212,10 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.waitUntil(function() {
-					return cy.get('.blinking-cursor')
-						.invoke('offset')
-						.its('top')
-						.then(function(cursorCurrentTop) {
-							return cursorCurrentTop > cursorOrigTop;
-						});
-				});
+				cy.get('.blinking-cursor')
+					.should(function(cursor) {
+						expect(cursor.offset().top).to.be.greaterThan(cursorOrigTop);
+					});
 			});
 	});
 
@@ -249,9 +236,9 @@ describe('Insert objects via insertion wizard.', function() {
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
 				cy.get('.blinking-cursor')
-					.invoke('offset')
-					.its('top')
-					.should('be.greaterThan', cursorOrigTop);
+					.should(function(cursor) {
+						expect(cursor.offset().top).to.be.greaterThan(cursorOrigTop);
+					});
 			});
 	});
 
@@ -271,14 +258,10 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.waitUntil(function() {
-					return cy.get('.blinking-cursor')
-						.invoke('offset')
-						.its('top')
-						.then(function(cursorCurrentTop) {
-							return cursorCurrentTop > cursorOrigTop;
-						});
-				});
+				cy.get('.blinking-cursor')
+					.should(function(cursor) {
+						expect(cursor.offset().top).to.be.greaterThan(cursorOrigTop);
+					});
 			});
 	});
 
@@ -298,14 +281,10 @@ describe('Insert objects via insertion wizard.', function() {
 		// Check that the cursor was moved
 		cy.get('@cursorOrigTop')
 			.then(function(cursorOrigTop) {
-				cy.waitUntil(function() {
-					return cy.get('.blinking-cursor')
-						.invoke('offset')
-						.its('top')
-						.then(function(cursorCurrentTop) {
-							return cursorCurrentTop > cursorOrigTop;
-						});
-				});
+				cy.get('.blinking-cursor')
+					.should(function(cursor) {
+						expect(cursor.offset().top).to.be.greaterThan(cursorOrigTop);
+					});
 			});
 	});
 


More information about the Libreoffice-commits mailing list