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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Sun May 10 15:19:24 UTC 2020


 cypress_test/data/desktop/writer/drop_down_form_field_noitem.odt      |binary
 cypress_test/data/desktop/writer/drop_down_form_field_noselection.odt |binary
 cypress_test/data/desktop/writer/form_field.odt                       |binary
 cypress_test/data/desktop/writer/multiple_form_fields.odt             |binary
 cypress_test/integration_tests/desktop/writer/form_field_spec.js      |  233 ++++++++++
 5 files changed, 233 insertions(+)

New commits:
commit 7d2c519d7656a66b58efe14723c63ee974680570
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu May 7 15:35:42 2020 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sun May 10 17:19:07 2020 +0200

    cypress: add tests for form field button.
    
    Change-Id: Ie297d9f10edebd857af2e2c4f9f09acd5c1519d8
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93770
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 76c4d79ffb309d658905ce123a3e0ad2c15bc3b1)
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93928
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/cypress_test/data/desktop/writer/drop_down_form_field_noitem.odt b/cypress_test/data/desktop/writer/drop_down_form_field_noitem.odt
new file mode 100644
index 000000000..c0b703320
Binary files /dev/null and b/cypress_test/data/desktop/writer/drop_down_form_field_noitem.odt differ
diff --git a/cypress_test/data/desktop/writer/drop_down_form_field_noselection.odt b/cypress_test/data/desktop/writer/drop_down_form_field_noselection.odt
new file mode 100644
index 000000000..0c433c647
Binary files /dev/null and b/cypress_test/data/desktop/writer/drop_down_form_field_noselection.odt differ
diff --git a/cypress_test/data/desktop/writer/form_field.odt b/cypress_test/data/desktop/writer/form_field.odt
new file mode 100644
index 000000000..65a1f3f42
Binary files /dev/null and b/cypress_test/data/desktop/writer/form_field.odt differ
diff --git a/cypress_test/data/desktop/writer/multiple_form_fields.odt b/cypress_test/data/desktop/writer/multiple_form_fields.odt
new file mode 100644
index 000000000..ec69d19fb
Binary files /dev/null and b/cypress_test/data/desktop/writer/multiple_form_fields.odt differ
diff --git a/cypress_test/integration_tests/desktop/writer/form_field_spec.js b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
new file mode 100644
index 000000000..8fbc268fb
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/writer/form_field_spec.js
@@ -0,0 +1,233 @@
+/* global describe it cy require afterEach expect */
+
+var helper = require('../../common/helper');
+
+describe('Form field button tests.', function() {
+
+	afterEach(function() {
+		helper.afterAll('form_field.odt', 'writer');
+	});
+
+	function buttonShouldNotExist() {
+		cy.get('.form-field-frame')
+			.should('not.exist');
+
+		cy.get('.form-field-button')
+			.should('not.exist');
+
+		cy.get('.drop-down-field-list')
+			.should('not.exist');
+	}
+
+	function buttonShouldExist() {
+		cy.get('.form-field-frame')
+			.should('exist');
+
+		cy.get('.form-field-button')
+			.should('exist');
+
+		cy.get('.drop-down-field-list')
+			.should('exist');
+	}
+
+	it('Activate and deactivate form field button.', function() {
+		helper.loadTestDoc('form_field.odt', 'writer');
+
+		// We don't have the button by default
+		buttonShouldNotExist();
+
+		// Move the cursor next to the form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Move the cursor again to the other side of the field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Move the cursor away
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldNotExist();
+
+		// Move the cursor back next to the field
+		cy.get('textarea.clipboard')
+			.type('{leftArrow}');
+
+		buttonShouldExist();
+	});
+
+	it('Check drop down list.', function() {
+		helper.loadTestDoc('form_field.odt', 'writer');
+
+		// Move the cursor next to the form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		cy.get('.drop-down-field-list')
+			.should('not.be.visible');
+
+		// Check content of the list
+		cy.get('.drop-down-field-list')
+			.should(function(list) {
+				expect(list[0].children.length).to.be.equal(4);
+				expect(list[0].children[0]).to.have.text('February');
+				expect(list[0].children[1]).to.have.text('January');
+				expect(list[0].children[2]).to.have.text('December');
+				expect(list[0].children[3]).to.have.text('July');
+			});
+
+		cy.get('.drop-down-field-list-item.selected')
+			.should('have.text', 'February');
+
+		// Select a new item
+		cy.get('.form-field-button')
+			.click();
+
+		cy.get('.drop-down-field-list')
+			.should('be.visible');
+
+		cy.contains('.drop-down-field-list-item', 'July')
+			.click();
+
+		// List is hidden, but have the right selected element
+		cy.get('.drop-down-field-list')
+			.should('not.be.visible');
+
+		cy.get('.drop-down-field-list-item.selected')
+			.should('have.text', 'July');
+	});
+
+	it('Test field editing', function() {
+		helper.loadTestDoc('form_field.odt', 'writer');
+
+		// Move the cursor next to the form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		// Select a new item
+		cy.get('.form-field-button')
+			.click();
+
+		cy.get('.drop-down-field-list')
+			.should('be.visible');
+
+		cy.contains('.drop-down-field-list-item', 'January')
+			.click();
+
+		// Move the cursor away and back
+		cy.get('textarea.clipboard')
+			.type('{leftArrow}');
+
+		buttonShouldNotExist();
+
+		// Move the cursor back next to the field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		cy.get('.drop-down-field-list-item.selected')
+			.should('have.text', 'January');
+
+		// Do the same from the right side of the field.
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Select a new item
+		cy.get('.form-field-button')
+			.click();
+
+		cy.get('.drop-down-field-list')
+			.should('be.visible');
+
+		cy.contains('.drop-down-field-list-item', 'December')
+			.click();
+
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldNotExist();
+
+		// Move the cursor back next to the field
+		cy.get('textarea.clipboard')
+			.type('{leftArrow}');
+
+		buttonShouldExist();
+
+		cy.get('.drop-down-field-list-item.selected')
+			.should('have.text', 'December');
+	});
+
+	it('Multiple form field button activation.', function() {
+		helper.loadTestDoc('multiple_form_fields.odt', 'writer');
+
+		// We don't have the button by default
+		buttonShouldNotExist();
+
+		// Move the cursor next to the first form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Move the cursor to the other side of the field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Move the cursor to the second form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Move the cursor to the other side of the second field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		// Move the cursor away of the second field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldNotExist();
+	});
+
+	it('Test drop-down field with no selection.', function() {
+		helper.loadTestDoc('drop_down_form_field_noselection.odt', 'writer');
+
+		// Move the cursor next to the form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		cy.get('.drop-down-field-list-item.selected')
+			.should('not.exist');
+	});
+
+	it('Test drop-down field with no items.', function() {
+		helper.loadTestDoc('drop_down_form_field_noitem.odt', 'writer');
+
+		// Move the cursor next to the form field
+		cy.get('textarea.clipboard')
+			.type('{rightArrow}');
+
+		buttonShouldExist();
+
+		cy.get('.drop-down-field-list-item')
+			.should('not.exist');
+	});
+});
+


More information about the Libreoffice-commits mailing list