[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2-4' - cypress_test/integration_tests

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 8 18:46:14 UTC 2020


 cypress_test/integration_tests/desktop/writer/form_field_spec.js |   73 ++++------
 1 file changed, 31 insertions(+), 42 deletions(-)

New commits:
commit c04996b659a7ceb6afc4e7f68be56d1126e8a639
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon Jun 1 11:20:46 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jun 8 20:45:51 2020 +0200

    cypress: fix false failure of form field tests.
    
    The cypress test framework checks if an item is covered
    by an other item while we try to interact with it and
    fails with an error in this case.
    Since the form field button is above the document layer,
    cypress correctly identifies that the document layer is
    covered (partly) with this button frame. To avoid this
    failure we can use force : true option.
    
    Change-Id: I5d9f665e3afe1ae1ff3744a563dd32de52b76bb3
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95266
    Tested-by: Jenkins
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/95748
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

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 2bf7df7f3..2b17e3049 100644
--- a/cypress_test/integration_tests/desktop/writer/form_field_spec.js
+++ b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
@@ -57,6 +57,16 @@ describe('Form field button tests.', function() {
 			});
 	}
 
+	function moveCursor(direction = 'left') {
+		if (direction == 'left') {
+			cy.get('textarea.clipboard')
+				.type('{leftArrow}', {force : true});
+		} else {
+			cy.get('textarea.clipboard')
+				.type('{rightArrow}', {force : true});
+		}
+	}
+
 	function doZoom(zoomIn) {
 		helper.initAliasToEmptyString('prevZoom');
 
@@ -91,26 +101,22 @@ describe('Form field button tests.', function() {
 		buttonShouldNotExist();
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
 		// Move the cursor again to the other side of the field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
 		// Move the cursor away
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldNotExist();
 
 		// Move the cursor back next to the field
-		cy.get('textarea.clipboard')
-			.type('{leftArrow}');
+		moveCursor('left');
 
 		buttonShouldExist();
 	});
@@ -119,8 +125,7 @@ describe('Form field button tests.', function() {
 		before('form_field.odt');
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
@@ -162,8 +167,7 @@ describe('Form field button tests.', function() {
 		before('form_field.odt');
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		// Select a new item
 		cy.get('.form-field-button')
@@ -177,13 +181,12 @@ describe('Form field button tests.', function() {
 
 		// Move the cursor away and back
 		cy.get('textarea.clipboard')
-			.type('{leftArrow}');
+			.type('{home}', {force : true});
 
 		buttonShouldNotExist();
 
 		// Move the cursor back next to the field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
@@ -191,8 +194,7 @@ describe('Form field button tests.', function() {
 			.should('have.text', 'January');
 
 		// Do the same from the right side of the field.
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
@@ -206,14 +208,12 @@ describe('Form field button tests.', function() {
 		cy.contains('.drop-down-field-list-item', 'December')
 			.click();
 
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldNotExist();
 
 		// Move the cursor back next to the field
-		cy.get('textarea.clipboard')
-			.type('{leftArrow}');
+		moveCursor('left');
 
 		buttonShouldExist();
 
@@ -228,32 +228,26 @@ describe('Form field button tests.', function() {
 		buttonShouldNotExist();
 
 		// Move the cursor next to the first form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
 		// Move the cursor to the other side of the field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
 		// Move the cursor to the second form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
 		// Move the cursor to the other side of the second field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
-		// Move the cursor away of the second field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldNotExist();
 	});
@@ -262,8 +256,7 @@ describe('Form field button tests.', function() {
 		before('drop_down_form_field_noselection.odt');
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
@@ -275,8 +268,7 @@ describe('Form field button tests.', function() {
 		before('drop_down_form_field_noitem.odt');
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
@@ -303,8 +295,7 @@ describe('Form field button tests.', function() {
 		before('form_field.odt');
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 
@@ -322,8 +313,7 @@ describe('Form field button tests.', function() {
 		// anything stupid after the button is removed.
 
 		// Move the cursor away from the field
-		cy.get('textarea.clipboard')
-			.type('{leftArrow}');
+		moveCursor('left');
 
 		buttonShouldNotExist();
 
@@ -335,8 +325,7 @@ describe('Form field button tests.', function() {
 		before('form_field.odt');
 
 		// Move the cursor next to the form field
-		cy.get('textarea.clipboard')
-			.type('{rightArrow}');
+		moveCursor('right');
 
 		buttonShouldExist();
 


More information about the Libreoffice-commits mailing list