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

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 17 17:23:29 UTC 2020


 cypress_test/Makefile.am                                         |    1 
 cypress_test/data/mobile/calc/spellchecking.ods                  |binary
 cypress_test/integration_tests/mobile/calc/spellchecking_spec.js |  152 ++++++++++
 3 files changed, 153 insertions(+)

New commits:
commit 29aa5e15d2364dc283fd98bee7caf7cfc136ebf8
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Mar 17 12:22:32 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Tue Mar 17 18:23:10 2020 +0100

    cypress: calc-mobile: add tests for spellchecking menu.
    
    Change-Id: If0c1af21c69b49452ccdc24e3c908396a045e03d
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90615
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index f3ad18904..d712c5296 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -34,6 +34,7 @@ MOBILE_TEST_FILES= \
 	calc/apply_font_spec.js \
 	calc/focus_spec.js \
 	calc/insertion_wizard_spec.js \
+	calc/spellchecking_spec.js \
 	impress/impress_focus_spec.js \
 	writer/apply_font_spec.js \
 	writer/apply_paragraph_properties_spec.js \
diff --git a/cypress_test/data/mobile/calc/spellchecking.ods b/cypress_test/data/mobile/calc/spellchecking.ods
new file mode 100644
index 000000000..431abff4e
Binary files /dev/null and b/cypress_test/data/mobile/calc/spellchecking.ods differ
diff --git a/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js
new file mode 100644
index 000000000..6d8f5930e
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/calc/spellchecking_spec.js
@@ -0,0 +1,152 @@
+/* global describe it cy beforeEach require afterEach expect*/
+
+var helper = require('../../common/helper');
+var calcHelper = require('./calc_helper');
+
+describe('Calc spell checking menu.', function() {
+	beforeEach(function() {
+		helper.beforeAllMobile('spellchecking.ods', 'calc');
+
+		// Click on edit button
+		cy.get('#mobile-edit-button')
+			.click();
+	});
+
+	afterEach(function() {
+		helper.afterAll('spellchecking.ods');
+	});
+
+	function openContextMenu() {
+		// Step into edit mode
+		calcHelper.clickOnFirstCell();
+		calcHelper.clickOnFirstCell();
+
+		// Select text content
+		cy.get('textarea.clipboard')
+			.type('{ctrl}a');
+
+		// Open context menu
+		cy.get('.leaflet-marker-icon')
+			.then(function(markers) {
+				expect(markers.length).to.have.greaterThan(1);
+				for (var i = 0; i < markers.length; i++) {
+					if (markers[i].classList.contains('leaflet-selection-marker-start')) {
+						var startPos = markers[i].getBoundingClientRect();
+					} else if (markers[i].classList.contains('leaflet-selection-marker-end')) {
+						var endPos = markers[i].getBoundingClientRect();
+					}
+				}
+
+				// Remove selection
+				cy.get('textarea.clipboard')
+					.type('{leftarrow}');
+				cy.get('.leaflet-marker-icon')
+					.should('not.exist');
+
+				var XPos = startPos.right + 10;
+				var YPos = endPos.top - 10;
+				helper.longPressOnDocument(XPos, YPos);
+			});
+
+		cy.get('#mobile-wizard-content')
+			.should('be.visible');
+	}
+
+	it('Apply suggestion.', function() {
+		openContextMenu();
+
+		cy.get('.context-menu-link')
+			.contains('hello')
+			.click();
+
+		// Click outside of the cell
+		cy.get('.leaflet-marker-icon')
+			.then(function(items) {
+				expect(items).to.have.length(2);
+				var XPos = items[0].getBoundingClientRect().right;
+				var YPos = items[0].getBoundingClientRect().bottom + 10;
+				cy.get('body')
+					.click(XPos, YPos);
+			});
+
+		calcHelper.copyContentToClipboard();
+
+		cy.get('#copy-paste-container table td')
+			.then(function(item) {
+				expect(item).to.have.lengthOf(1);
+				expect(item[0].innerText).to.have.string('hello');
+			});
+	});
+
+	it('Ignore all.', function() {
+		openContextMenu();
+
+		cy.get('.context-menu-link')
+			.contains('Ignore All')
+			.click();
+
+		// Click outside of the cell
+		cy.get('.leaflet-marker-icon')
+			.then(function(items) {
+				expect(items).to.have.length(2);
+				var XPos = items[0].getBoundingClientRect().right;
+				var YPos = items[0].getBoundingClientRect().bottom + 10;
+				cy.get('body')
+					.click(XPos, YPos);
+			});
+
+		openContextMenu();
+
+		// We don't get the spell check context menu any more
+		cy.get('.context-menu-link')
+			.contains('Paste');
+	});
+
+	it('Apply language for word.', function() {
+		openContextMenu();
+
+		cy.get('.context-menu-link')
+			.contains('Word is Finnish')
+			.click();
+
+		// Click outside of the cell
+		cy.get('.leaflet-marker-icon')
+			.then(function(items) {
+				expect(items).to.have.length(2);
+				var XPos = items[0].getBoundingClientRect().right;
+				var YPos = items[0].getBoundingClientRect().bottom + 10;
+				cy.get('body')
+					.click(XPos, YPos);
+			});
+
+		openContextMenu();
+
+		// We don't get the spell check context menu any more
+		cy.get('.context-menu-link')
+			.contains('Paste');
+	});
+
+	it('Apply language for paragraph.', function() {
+		openContextMenu();
+
+		cy.get('.context-menu-link')
+			.contains('Paragraph is Finnish')
+			.click();
+
+		// Click outside of the cell
+		cy.get('.leaflet-marker-icon')
+			.then(function(items) {
+				expect(items).to.have.length(2);
+				var XPos = items[0].getBoundingClientRect().right;
+				var YPos = items[0].getBoundingClientRect().bottom + 10;
+				cy.get('body')
+					.click(XPos, YPos);
+			});
+
+		openContextMenu();
+
+		// We don't get the spell check context menu any more
+		cy.get('.context-menu-link')
+			.contains('Paste');
+	});
+});


More information about the Libreoffice-commits mailing list