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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Mon May 18 10:45:22 UTC 2020


 cypress_test/integration_tests/desktop/writer/form_field_spec.js |   52 ++++++++++
 1 file changed, 52 insertions(+)

New commits:
commit 82f96b40f8b8ae714f9c86ce47cde1652f8db8d5
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon May 18 11:50:24 2020 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon May 18 12:45:05 2020 +0200

    cypress: add zooming test for form fields.
    
    Make sure the text cursor is inside the form field
    button's frame.
    
    Change-Id: Ib8a6fe50c14d01b5d3864f04e9668b9b1844b50e
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94408
    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/desktop/writer/form_field_spec.js b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
index def301989..9ae817ec7 100644
--- a/cypress_test/integration_tests/desktop/writer/form_field_spec.js
+++ b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
@@ -28,6 +28,24 @@ describe('Form field button tests.', function() {
 
 		cy.get('.drop-down-field-list')
 			.should('exist');
+
+		// Check also the position relative to the blinking cursor
+		cy.get('.blinking-cursor')
+			.then(function(cursors) {
+				// TODO: why we have two blinking cursors here?
+				//expect(cursors).to.have.lengthOf(1);
+
+				var cursorRect = cursors[0].getBoundingClientRect();
+				cy.get('.form-field-frame')
+					.should(function(frames) {
+						expect(frames).to.have.lengthOf(1);
+						var frameRect = frames[0].getBoundingClientRect();
+						expect(frameRect.top).to.be.lessThan(cursorRect.top);
+						expect(frameRect.bottom).to.be.greaterThan(cursorRect.bottom);
+						expect(frameRect.left).to.be.lessThan(cursorRect.left);
+						expect(frameRect.right).to.be.greaterThan(cursorRect.right);
+					});
+			});
 	}
 
 	it('Activate and deactivate form field button.', function() {
@@ -244,5 +262,39 @@ describe('Form field button tests.', function() {
 		cy.get('.drop-down-field-list-item.selected')
 			.should('not.exist');
 	});
+
+	it('Test field button after zoom.', function() {
+		helper.loadTestDoc('form_field.odt', 'writer');
+
+		// Move the cursor next to the form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Do a zoom in
+		cy.get('#tb_actionbar_item_zoom')
+			.click();
+
+		cy.contains('.menu-text', '120')
+			.click();
+
+		cy.contains('#tb_actionbar_item_zoom', '120')
+			.should('exist');
+
+		buttonShouldExist();
+
+		// Do a zoom out
+		cy.get('#tb_actionbar_item_zoom')
+			.click();
+
+		cy.contains('.menu-text', '85')
+			.click();
+
+		cy.contains('#tb_actionbar_item_zoom', '85')
+			.should('exist');
+
+		buttonShouldExist();
+	});
 });
 


More information about the Libreoffice-commits mailing list