[Libreoffice-commits] online.git: cypress_test/integration_tests
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Mon May 25 09:42:32 UTC 2020
cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js | 178 ++++++++++
1 file changed, 178 insertions(+)
New commits:
commit 15581bb362b0b243be735f5b1c2f5847e900ee9f
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Mon May 25 11:07:35 2020 +0200
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Mon May 25 11:42:13 2020 +0200
cypress: add tests for insertion of text fields in impress (mobile)
A bug here, that the text fields are inserted at the corner
of the slide and so they are hanging out of the slide.
Change-Id: I5bc895d1c73338cf41e5c896cbdb4ea5cfd5ddd0
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94776
Tested-by: Jenkins
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/impress/insertion_wizard_spec.js b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
index fce6c0df8..0911a01f8 100644
--- a/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
+++ b/cypress_test/integration_tests/mobile/impress/insertion_wizard_spec.js
@@ -16,6 +16,43 @@ describe('Impress insertion wizard.', function() {
helper.afterAll('insertion_wizard.odp');
});
+ function selectTextOfShape() {
+ // Double click onto the selected shape
+ cy.get('svg g .leaflet-interactive')
+ .then(function(items) {
+ expect(items).to.have.length(1);
+ var XPos = (items[0].getBoundingClientRect().left + items[0].getBoundingClientRect().right) / 2;
+ var YPos = (items[0].getBoundingClientRect().top + items[0].getBoundingClientRect().bottom) / 2;
+ cy.get('body')
+ .dblclick(XPos, YPos);
+ });
+
+ cy.get('.leaflet-cursor.blinking-cursor')
+ .should('exist');
+
+ helper.selectAllText(false);
+ }
+
+ function selectionShouldBeTextShape() {
+ // Check that the shape is there
+ cy.get('.leaflet-pane.leaflet-overlay-pane svg')
+ .should(function(svg) {
+ expect(svg[0].getBBox().width).to.be.greaterThan(0);
+ expect(svg[0].getBBox().height).to.be.greaterThan(0);
+ });
+
+ cy.get('.leaflet-pane.leaflet-overlay-pane g.Page g')
+ .should('have.class', 'com.sun.star.drawing.TextShape');
+
+ // Check also that the shape is fully visible
+ // TODO: shapes are hungs out of the slide after insertion
+ /*cy.get('svg g .leaflet-interactive')
+ .should(function(items) {
+ expect(items.offset().top).to.be.greaterThan(0);
+ expect(items.offset().left).to.be.greaterThan(0);
+ });*/
+ }
+
it('Check existence of image insertion items.', function() {
cy.contains('.menu-entry-with-icon', 'Local Image...')
.should('be.visible');
@@ -140,4 +177,145 @@ describe('Impress insertion wizard.', function() {
expect(svg[0].getBBox().height).to.be.greaterThan(0);
});
});
+
+ it('Insert text box.', function() {
+ cy.contains('.menu-entry-with-icon', 'Text Box')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ helper.expectTextForClipboard('Tap to edit text');
+ });
+
+ it('Insert date field (fixed).', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Date (fixed)')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ // Check that we have a date in MM/DD/YY format
+ var regex = /\d{1,2}[/]\d{1,2}[/]\d{1,2}/;
+ cy.get('#copy-paste-container pre')
+ .invoke('text')
+ .should('match', regex);
+ });
+
+ it('Insert date field (variable).', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Date (variable)')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ // Check that we have a date in MM/DD/YY format
+ var regex = /\d{1,2}[/]\d{1,2}[/]\d{1,2}/;
+ cy.get('#copy-paste-container pre')
+ .invoke('text')
+ .should('match', regex);
+ });
+
+ it('Insert time field (fixed).', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Time (fixed)')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ // Check that we have a time in HH/MM/SS format
+ var regex = /\d{1,2}[:]\d{1,2}[:]\d{1,2}/;
+ cy.get('#copy-paste-container pre')
+ .invoke('text')
+ .should('match', regex);
+ });
+
+ it('Insert time field (variable).', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Time (variable)')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ // Check that we have a time in HH/MM/SS format
+ var regex = /\d{1,2}[:]\d{1,2}[:]\d{1,2}/;
+ cy.get('#copy-paste-container pre')
+ .invoke('text')
+ .should('match', regex);
+ });
+
+ it('Insert slide number.', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Slide Number')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ helper.expectTextForClipboard('1');
+ });
+
+ it('Insert slide title.', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Slide Title')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ helper.expectTextForClipboard('Slide 1');
+ });
+
+ it('Insert slide count.', function() {
+ cy.contains('.menu-entry-with-icon', 'More Fields...')
+ .click();
+
+ cy.contains('.menu-entry-with-icon', 'Slide Count')
+ .click();
+
+ // Check that the shape is there
+ selectionShouldBeTextShape();
+
+ // Check the text
+ selectTextOfShape();
+
+ helper.expectTextForClipboard('1');
+ });
});
More information about the Libreoffice-commits
mailing list