[Libreoffice-commits] online.git: cypress_test/data cypress_test/integration_tests
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Fri Feb 14 15:24:08 UTC 2020
cypress_test/data/mobile/writer/spellcheck.odt |binary
cypress_test/integration_tests/mobile/writer/spellchecking_spec.js | 152 ++++++++++
2 files changed, 152 insertions(+)
New commits:
commit 466eedabb04a6222d45286151ae15fe0dd0a28d1
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Fri Feb 14 15:36:31 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 14 16:23:49 2020 +0100
cypress: mobile: Add some basic tests for spellchecking context menu.
Change-Id: I9ff2ce361670e407e8823f08c253e60bde3e8657
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88719
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
diff --git a/cypress_test/data/mobile/writer/spellcheck.odt b/cypress_test/data/mobile/writer/spellcheck.odt
new file mode 100644
index 000000000..31ec2347e
Binary files /dev/null and b/cypress_test/data/mobile/writer/spellcheck.odt differ
diff --git a/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
new file mode 100644
index 000000000..a23105b44
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/writer/spellchecking_spec.js
@@ -0,0 +1,152 @@
+/* global describe it cy beforeEach require afterEach expect*/
+
+var helper = require('../../common/helper');
+
+describe('Spell checking menu.', function() {
+ beforeEach(function() {
+ helper.beforeAllMobile('spellcheck.odt', 'writer');
+
+ // Click on edit button
+ cy.get('#mobile-edit-button').click();
+ });
+
+ afterEach(function() {
+ helper.afterAll();
+ });
+
+ function openContextMenu() {
+ // Do a new selection
+ helper.selectAllMobile();
+
+ // 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('#document-container')
+ .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();
+
+ helper.copyTextToClipboard();
+
+ cy.get('#copy-paste-container p')
+ .then(function(item) {
+ expect(item).to.have.lengthOf(1);
+ expect(item[0].innerText).to.have.string('hello');
+ });
+ });
+
+ it('Ignore one.', function() {
+ openContextMenu();
+
+ cy.get('.context-menu-link')
+ .contains('Ignore')
+ .click();
+
+ openContextMenu();
+
+ // We don't get the spell check context menu any more
+ cy.get('.context-menu-link')
+ .contains('Paste');
+ });
+
+ it('Ignore all.', function() {
+ openContextMenu();
+
+ // TODO: Why we have a non-breaking space here?
+ cy.get('.context-menu-link')
+ .contains('Ignore\u00a0All')
+ .click();
+
+ openContextMenu();
+
+ // We don't get the spell check context menu any more
+ cy.get('.context-menu-link')
+ .contains('Paste');
+ });
+
+ it('Check language status for selection.', function() {
+ openContextMenu();
+
+ cy.get('.sub-menu-title')
+ .contains('Set Language for Selection')
+ .click();
+
+ // English is selected
+ cy.get('.menu-entry-checked')
+ .contains('English\u00a0(USA)');
+ });
+
+ it('Set None Language for selection.', function() {
+ openContextMenu();
+
+ cy.get('.sub-menu-title')
+ .contains('Set Language for Selection')
+ .click();
+
+ // English is selected
+ cy.get('.menu-entry-checked')
+ .contains('English\u00a0(USA)');
+
+ openContextMenu();
+
+ // We don't get the spell check context menu any more
+ cy.get('.context-menu-link')
+ .contains('None\u00a0(Do not check spelling)');
+ });
+
+ it('Check language status for paragraph.', function() {
+ openContextMenu();
+
+ cy.get('.sub-menu-title')
+ .contains('Set Language for Paragraph')
+ .click();
+
+ // English is selected
+ cy.get('.menu-entry-checked')
+ .contains('English\u00a0(USA)');
+ });
+
+ it('Set None Language for paragraph.', function() {
+ openContextMenu();
+
+ cy.get('.sub-menu-title')
+ .contains('Set Language for Paragraph')
+ .click();
+
+ // English is selected
+ cy.get('.menu-entry-checked')
+ .contains('English\u00a0(USA)');
+
+ openContextMenu();
+
+ // We don't get the spell check context menu any more
+ cy.get('.context-menu-link')
+ .contains('None\u00a0(Do not check spelling)');
+ });
+});
More information about the Libreoffice-commits
mailing list