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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Wed Jan 29 14:48:14 UTC 2020


 cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js |  504 ++++++++++
 cypress_test/integration_tests/mobile/insert_field_spec.js               |  181 +++
 cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js     |  194 +++
 cypress_test/integration_tests/mobile/insert_object_spec.js              |   95 +
 loleaflet/src/map/Map.js                                                 |    2 
 5 files changed, 944 insertions(+), 32 deletions(-)

New commits:
commit 5f7239054f2db98dc024d99f5239674386642574
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 29 15:24:01 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 29 15:33:44 2020 +0100

    cypress: mobile: Add some more insertion tests.
    
    Change-Id: Ie918fa1c386e25b767340afc9ec2fc61d8038ced

diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js
index 6b9001894..3fdbeffa9 100644
--- a/cypress_test/integration_tests/mobile/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/insert_object_spec.js
@@ -41,7 +41,7 @@ describe('Insert objects via insertion wizard.', function() {
 			.click();
 	});
 
-	it('Insert table.', function() {
+	it('Insert default table.', function() {
 		// Open Table submenu
 		cy.get('.menu-entry-with-icon.flex-fullwidth')
 			.contains('Table')
@@ -66,6 +66,37 @@ describe('Insert objects via insertion wizard.', function() {
 			.should('have.length', 2);
 	});
 
+	it('Insert custom table.', function() {
+		// Open Table submenu
+		cy.get('.menu-entry-with-icon.flex-fullwidth')
+			.contains('Table')
+			.click();
+		cy.get('.mobile-wizard.ui-text')
+			.should('be.visible');
+
+		// Scroll to the bottom
+		cy.get('#mobile-wizard-content').scrollTo(0, 1000);
+
+		// Change rows and columns
+		cy.get('.inserttablecontrols #rows .sinfieldcontrols .plus')
+			.click();
+		cy.get('.inserttablecontrols #cols .sinfieldcontrols .plus')
+			.click();
+
+		// Push insert table button
+		cy.get('.inserttablecontrols button')
+			.should('be.visible')
+			.click();
+
+		// Table is inserted with the markers shown
+		cy.get('.leaflet-marker-icon.table-column-resize-marker')
+			.should('exist')
+			.should('have.length', 4);
+		cy.get('.leaflet-marker-icon.table-row-resize-marker')
+			.should('exist')
+			.should('have.length', 3);
+	});
+
 	it('Insert header.', function() {
 		// Get the blinking cursor pos
 		cy.get('#document-container').type('xxxx');
@@ -103,6 +134,43 @@ describe('Insert objects via insertion wizard.', function() {
 			});
 	});
 
+	it.only('Insert footer.', function() {
+		// Get the blinking cursor pos
+		cy.get('#document-container').type('xxxx');
+		var cursorOrigTop = 0;
+		cy.get('.blinking-cursor')
+			.then(function(cursor) {
+				expect(cursor).to.have.lengthOf(1) ;
+				cursorOrigTop = cursor[0].getBoundingClientRect().top;
+			});
+
+		// Open header/footer submenu
+		cy.get('.sub-menu-title')
+			.contains('Header and Footer')
+			.click();
+		cy.get('.ui-header.level-1.mobile-wizard.ui-widget')
+			.should('be.visible');
+
+		// Open footer submenu
+		cy.get('.ui-header.level-1.mobile-wizard.ui-widget .sub-menu-title')
+			.contains('Footer')
+			.click();
+
+		// Insert footer for All
+		cy.get('.ui-content.level-1.mobile-wizard[title~="Footer"] .ui-header.level-2.mobile-wizard.ui-widget .menu-entry-no-icon')
+			.contains('All')
+			.click();
+
+		cy.wait(100);
+
+		// Check that the cursor was moved
+		cy.get('.blinking-cursor')
+			.then(function(cursor) {
+				expect(cursor).to.have.lengthOf(1);
+				expect(cursor[0].getBoundingClientRect().top).to.be.greaterThan(cursorOrigTop);
+			});
+	});
+
 	it('Insert footnote.', function() {
 		// Get the blinking cursor pos
 		cy.get('#document-container').type('xxxx');
commit 434f89b10c46c32db02f4ef89c5c59a4c4e6925b
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 29 14:46:30 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 29 15:33:31 2020 +0100

    cypress: mobile: Test applying paragraph properties.
    
    Change-Id: Icee81a71dcbdd7888f77e8cd53d7f0b9234ea94c

diff --git a/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js b/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js
new file mode 100644
index 000000000..1660bec7e
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/apply_paragraph_properties_spec.js
@@ -0,0 +1,504 @@
+/* global describe it cy beforeEach require expect afterEach*/
+
+var helper = require('../common/helper');
+
+describe('Apply paragraph properties.', function() {
+	beforeEach(function() {
+		helper.loadTestDoc('simple.odt', true);
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Open mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+
+		// Open paragraph properties
+		cy.get('#Paragraph')
+			.click();
+	});
+
+	afterEach(function() {
+		cy.get('.closemobile').click();
+		cy.wait(200); // wait some time to actually release the document
+	});
+
+	function generateTextHTML() {
+		// Do a new selection
+		cy.get('#document-container').click();
+		cy.get('.leaflet-marker-icon')
+			.should('not.exist');
+
+		cy.wait(200);
+
+		cy.get('body').type('{shift}{home}');
+		cy.get('.leaflet-marker-icon');
+
+		cy.wait(200);
+
+		// Open context menu
+		cy.get('.leaflet-marker-icon')
+			.then(function(marker) {
+				expect(marker).to.have.lengthOf(2);
+				var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2;
+				var YPos = marker[0].getBoundingClientRect().top - 5;
+				cy.get('body').rightclick(XPos, YPos);
+			});
+
+		// Execute copy
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link')
+			.contains('Copy')
+			.click();
+
+		// Close warning about clipboard operations
+		cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
+			.click();
+	}
+
+	it('Apply left alignment.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change alignment
+		cy.get('#CenterPara')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('have.attr', 'align', 'center');
+
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Open mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// Open paragraph properties
+		cy.get('#Paragraph')
+			.click();
+
+		// Change alignment
+		cy.get('#LeftPara')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('have.attr', 'align', 'left');
+	});
+
+	it('Apply center alignment.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change alignment
+		cy.get('#CenterPara')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('have.attr', 'align', 'center');
+	});
+
+	it('Apply right alignment.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change alignment
+		cy.get('#RightPara')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('have.attr', 'align', 'right');
+	});
+
+	it('Apply justify alignment.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change alignment
+		cy.get('#JustifyPara')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('have.attr', 'align', 'justify');
+	});
+
+	it('Change writing direction.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change writing mode
+		cy.get('#ParaRightToLeft')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('have.attr', 'dir', 'rtl');
+
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Open mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// Open paragraph properties
+		cy.get('#Paragraph')
+			.click();
+
+		// Change writing mode
+		cy.get('#ParaLeftToRight')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.should('not.have.attr', 'dir');
+	});
+
+	it('Apply default bulleting.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		cy.get('#DefaultBullet')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container ul li p')
+			.should('exist');
+	});
+
+	it('Apply default numbering.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		cy.get('#DefaultNumbering')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container ol li p')
+			.should('exist');
+	});
+
+	it('Apply background color.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change background color
+		cy.get('#BackgroundColor')
+			.click();
+
+		cy.get('#color-picker-2-basic-color-5')
+			.click();
+
+		cy.get('#color-picker-2-tint-3')
+			.click();
+
+		cy.get('#mobile-wizard-back')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['background']).to.be.equal('rgb(0, 255, 0)');
+			});
+	});
+
+	it('Increase / decrease para spacing.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Increase para spacing
+		cy.get('#ParaspaceIncrease')
+			.click();
+		cy.get('#ParaspaceIncrease')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-top']).to.be.equal('0.08in');
+				expect(item[0].style['margin-bottom']).to.be.equal('0.08in');
+			});
+
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Open mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// Open paragraph properties
+		cy.get('#Paragraph')
+			.click();
+
+		// Decrease para spacing
+		cy.get('#ParaspaceDecrease')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-top']).to.be.equal('0.04in');
+				expect(item[0].style['margin-bottom']).to.be.equal('0.04in');
+			});
+	});
+
+	it('Change para spacing via combobox.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Check para spacing current value
+		cy.get('#aboveparaspacing .spinfield')
+			.should('have.attr', 'value', '0.0');
+		cy.get('#belowparaspacing .spinfield')
+			.should('have.attr', 'value', '0.0');
+
+		// Change spacing
+		cy.get('#aboveparaspacing .sinfieldcontrols .plus')
+			.click();
+		cy.get('#aboveparaspacing .spinfield')
+			.should('have.attr', 'value', '0.02');
+		cy.get('#aboveparaspacing .sinfieldcontrols .plus')
+			.click();
+		cy.get('#aboveparaspacing .spinfield')
+			.should('have.attr', 'value', '0.04');
+		cy.get('#aboveparaspacing .sinfieldcontrols .plus')
+			.click();
+		cy.get('#aboveparaspacing .spinfield')
+			.should('have.attr', 'value', '0.06');
+
+		cy.get('#belowparaspacing .sinfieldcontrols .plus')
+			.click();
+		cy.get('#belowparaspacing .spinfield')
+			.should('have.attr', 'value', '0.02');
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-top']).to.be.equal('0.06in');
+				expect(item[0].style['margin-bottom']).to.be.equal('0.02in');
+			});
+	});
+
+	it('Increase / decrease indent.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Increase indent
+		cy.get('#IncrementIndent')
+			.click();
+		cy.get('#IncrementIndent')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-left']).to.be.equal('0.98in');
+			});
+
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Open mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		// Open paragraph properties
+		cy.get('#Paragraph')
+			.click();
+
+		// Decrease indent
+		cy.get('#DecrementIndent')
+			.click();
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-left']).to.be.equal('0.49in');
+			});
+	});
+
+	it('Apply before text indent.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change indent
+		cy.get('#beforetextindent .sinfieldcontrols .plus')
+			.click();
+		cy.get('#beforetextindent .spinfield')
+			.should('have.attr', 'value', '0.02');
+		cy.get('#beforetextindent .sinfieldcontrols .plus')
+			.click();
+		cy.get('#beforetextindent .spinfield')
+			.should('have.attr', 'value', '0.04');
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-left']).to.be.equal('0.04in');
+			});
+	});
+
+	it('Apply after text indent.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Change indent
+		cy.get('#aftertextindent .sinfieldcontrols .plus')
+			.click();
+		cy.get('#aftertextindent .spinfield')
+			.should('have.attr', 'value', '0.02');
+		cy.get('#aftertextindent .sinfieldcontrols .plus')
+			.click();
+		cy.get('#aftertextindent .spinfield')
+			.should('have.attr', 'value', '0.04');
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['margin-right']).to.be.equal('0.04in');
+			});
+	});
+
+	it('Apply first line indent.', function() {
+		// Select text
+		cy.get('#document-container').dblclick();
+		cy.get('.leaflet-marker-icon');
+
+		// Increase firstline indent
+		cy.get('#firstlineindent .sinfieldcontrols .plus')
+			.click();
+		cy.get('#firstlineindent .spinfield')
+			.should('have.attr', 'value', '0.02');
+		cy.get('#firstlineindent .sinfieldcontrols .plus')
+			.click();
+		cy.get('#firstlineindent .spinfield')
+			.should('have.attr', 'value', '0.04');
+
+		// Close mobile wizard
+		cy.get('#tb_actionbar_item_mobile_wizard')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].style['text-indent']).to.be.equal('0.04in');
+			});
+	});
+});
commit fb892794e7c4969403f33bf80266cb492437a402
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 29 12:57:54 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 29 15:33:20 2020 +0100

    cypress: mobile: Test formatting mark insertion.
    
    Change-Id: Ib3619e6830f25d7c78e369d714e0c4de6a47244b

diff --git a/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js b/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js
new file mode 100644
index 000000000..76a68f62e
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/insert_formatting_mark_spec.js
@@ -0,0 +1,194 @@
+/* global describe it cy beforeEach require expect afterEach*/
+
+var helper = require('../common/helper');
+
+describe('Insert formatting mark via insertion wizard.', function() {
+	beforeEach(function() {
+		helper.loadTestDoc('simple.odt', true);
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Open insertion wizard
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+	});
+
+	afterEach(function() {
+		cy.get('.closemobile').click();
+		cy.wait(200); // wait some time to actually release the document
+	});
+
+	function generateTextHTML() {
+		// Do a new selection
+		cy.get('#document-container').click();
+		cy.get('.leaflet-marker-icon')
+			.should('not.exist');
+
+		cy.wait(200);
+
+		cy.get('body').type('{shift}{home}');
+		cy.get('.leaflet-marker-icon');
+
+		cy.wait(200);
+
+		// Open context menu
+		cy.get('.leaflet-marker-icon')
+			.then(function(marker) {
+				expect(marker).to.have.lengthOf(2);
+				var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2;
+				var YPos = marker[0].getBoundingClientRect().top;
+				cy.get('body').rightclick(XPos, YPos);
+			});
+
+		// Execute copy
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link')
+			.contains('Copy')
+			.click();
+
+		// Close warning about clipboard operations
+		cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
+			.click();
+	}
+
+	it('Insert non-breaking space.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('Non-breaking space')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u00a0');
+			});
+	});
+
+	it('Insert non-breaking hyphen.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('Non-breaking hyphen')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u2011');
+			});
+	});
+
+	it('Insert soft hyphen.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('Soft hyphen')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u00ad');
+			});
+	});
+
+	it('Insert no-width optional break.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('No-width optional break')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u200b');
+			});
+	});
+
+	it('Insert no-width no break.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('No-width no break')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u2060');
+			});
+	});
+
+	it('Insert left-to-right mark.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('Left-to-right mark')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u200e');
+			});
+	});
+
+	it('Insert right-to-left mark.', function() {
+		// Open formatting marks
+		cy.get('.sub-menu-title')
+			.contains('Formatting Mark')
+			.click();
+
+		// Do the insertion
+		cy.get('.menu-entry-no-icon')
+			.contains('Right-to-left mark')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('\u200f');
+			});
+	});
+});
diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js
index 2754fbd00..6b9001894 100644
--- a/cypress_test/integration_tests/mobile/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/insert_object_spec.js
@@ -238,23 +238,4 @@ describe('Insert objects via insertion wizard.', function() {
 				expect(svg[0].getBBox().height).to.be.greaterThan(0);
 			});
 	});
-
-	it('Insert formatting mark.', function() {
-		// Open formatting marks
-		cy.get('.sub-menu-title')
-			.contains('Formatting Mark')
-			.click();
-
-		// Do the insertion
-		cy.get('.menu-entry-no-icon')
-			.contains('Non-breaking space')
-			.should('be.visible')
-			.click();
-
-		// Do a selection to see something is inserted
-		cy.get('body').type('{shift}{leftarrow}');
-		cy.get('.leaflet-marker-icon')
-			.should('exist')
-			.should('have.length', 2);
-	});
 });
commit d679f93c03a1a2a86a83a096bfd69fa56e1742ac
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jan 29 12:57:39 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 29 15:33:08 2020 +0100

    cypress: mobile: Test field insertion.
    
    Change-Id: Ie7618436c57a30ef4282c042ff04262f55e0b17c

diff --git a/cypress_test/integration_tests/mobile/insert_field_spec.js b/cypress_test/integration_tests/mobile/insert_field_spec.js
new file mode 100644
index 000000000..65e4b732f
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/insert_field_spec.js
@@ -0,0 +1,181 @@
+/* global describe it cy beforeEach require expect afterEach*/
+
+var helper = require('../common/helper');
+
+describe('Insert fields via insertion wizard.', function() {
+	beforeEach(function() {
+		helper.loadTestDoc('simple.odt', true);
+
+		// Click on edit button
+		cy.get('#mobile-edit-button').click();
+
+		// Open insertion wizard
+		cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+			.should('not.have.class', 'disabled')
+			.click();
+	});
+
+	afterEach(function() {
+		cy.get('.closemobile').click();
+		cy.wait(200); // wait some time to actually release the document
+	});
+
+	function generateTextHTML() {
+		// Do a new selection
+		cy.get('#document-container').click();
+		cy.get('.leaflet-marker-icon')
+			.should('not.exist');
+
+		cy.wait(200);
+
+		cy.get('body').type('{shift}{home}');
+		cy.get('.leaflet-marker-icon');
+
+		cy.wait(200);
+
+		// Open context menu
+		cy.get('.leaflet-marker-icon')
+			.then(function(marker) {
+				expect(marker).to.have.lengthOf(2);
+				var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2;
+				var YPos = marker[0].getBoundingClientRect().top;
+				cy.get('body').rightclick(XPos, YPos);
+			});
+
+		// Execute copy
+		cy.get('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon .context-menu-link')
+			.contains('Copy')
+			.click();
+
+		// Close warning about clipboard operations
+		cy.get('.vex-dialog-button-primary.vex-dialog-button.vex-first')
+			.click();
+	}
+
+	it('Insert page number field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('Page Number')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'PAGE')
+			.contains('1');
+	});
+
+	it('Insert page count field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('Page Count')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'DOCSTAT')
+			.contains('1');
+	});
+
+	it('Insert date field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('Date')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'DATETIME')
+			.should('have.attr', 'sdnum', '1033;1033;MM/DD/YY');
+	});
+
+	it('Insert time field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('Time')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'DATETIME')
+			.should('have.attr', 'sdnum', '1033;1033;HH:MM:SS AM/PM');
+	});
+
+	it('Insert title field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('Title')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'DOCINFO')
+			.should('have.attr', 'subtype', 'TITLE');
+	});
+
+	it('Insert author field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('First Author')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'DOCINFO')
+			.should('have.attr', 'subtype', 'CREATE')
+			.should('have.attr', 'format', 'AUTHOR');
+	});
+
+	it('Insert subject field.', function() {
+		// Open fields submenu
+		cy.get('.sub-menu-title')
+			.contains('More Fields...')
+			.click();
+
+		// Insert field
+		cy.get('.menu-entry-with-icon')
+			.contains('Subject')
+			.click();
+
+		generateTextHTML();
+
+		cy.get('#copy-paste-container p span sdfield')
+			.should('have.attr', 'type', 'DOCINFO')
+			.should('have.attr', 'subtype', 'THEME');
+	});
+});
diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js
index 7de023130..2754fbd00 100644
--- a/cypress_test/integration_tests/mobile/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/insert_object_spec.js
@@ -66,22 +66,6 @@ describe('Insert objects via insertion wizard.', function() {
 			.should('have.length', 2);
 	});
 
-	it('Insert field.', function() {
-		// Open fields submenu
-		cy.get('.sub-menu-title')
-			.contains('More Fields...')
-			.click();
-		cy.get('.menu-entry-with-icon')
-			.contains('Page Number')
-			.click();
-
-		// Do a selection to see something is inserted
-		cy.get('body').type('{shift}{leftarrow}');
-		cy.get('.leaflet-marker-icon')
-			.should('exist')
-			.should('have.length', 2);
-	});
-
 	it('Insert header.', function() {
 		// Get the blinking cursor pos
 		cy.get('#document-container').type('xxxx');
commit 9adc9e33f478f4ba322fe7cb04efe7510b251aed
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 28 19:33:14 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 29 15:29:16 2020 +0100

    cypress: mobile: Fix cypress tests after recent focus changes.
    
    By now, we only emulate mobile layout, but we are using
    simple mouse events (click, rightclick), not touch events.
    Later it might worth to investigate, how to emulate touch
    events.
    
    Change-Id: Ib7d032933c50221173bbc749f0653d7d777884b1

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 4ee77558e..863e2a4f4 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -909,7 +909,7 @@ L.Map = L.Evented.extend({
 	// accept key input, and show the virtual keyboard.
 	focus: function (acceptInput) {
 		this._textInput.focus();
-		if (window.mode.isMobile() && acceptInput !== true)
+		if (window.mode.isMobile() && acceptInput !== true && !L.Browser.cypressTest)
 			this.blur();
 	},
 
commit ab0ff320c1f3cf782b99d1606f6adffea9ce0736
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Jan 28 19:23:37 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Wed Jan 29 15:29:03 2020 +0100

    cypress: mobile: Update table insertion test.
    
    The HTML structure was changed.
    
    Change-Id: I0b7ada0933ab6d5b13aa6b7f60fa17a07ac84951

diff --git a/cypress_test/integration_tests/mobile/insert_object_spec.js b/cypress_test/integration_tests/mobile/insert_object_spec.js
index 562b7ad57..7de023130 100644
--- a/cypress_test/integration_tests/mobile/insert_object_spec.js
+++ b/cypress_test/integration_tests/mobile/insert_object_spec.js
@@ -43,7 +43,7 @@ describe('Insert objects via insertion wizard.', function() {
 
 	it('Insert table.', function() {
 		// Open Table submenu
-		cy.get('.sub-menu-title')
+		cy.get('.menu-entry-with-icon.flex-fullwidth')
 			.contains('Table')
 			.click();
 		cy.get('.mobile-wizard.ui-text')


More information about the Libreoffice-commits mailing list