diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2020-03-16 16:27:00 -0400 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2020-03-18 10:14:53 +0100 |
commit | 6e70407ba1a24c8a83b466d4556dea37317ac502 (patch) | |
tree | 7c3b6dd32b7e9ac7ff31cc0a1df2096c7dfcd539 | |
parent | 4ff5406701fa30b264b23d687c7b83e80e1781d5 (diff) |
cypress: reuse select-all helper
Change-Id: I96a695dd96c07ab977ea0814117c642923e2f4db
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90648
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r-- | cypress_test/integration_tests/common/helper.js | 6 | ||||
-rw-r--r-- | cypress_test/integration_tests/common/impress.js | 4 | ||||
-rw-r--r-- | cypress_test/integration_tests/mobile/writer/writer_helper.js | 20 |
3 files changed, 12 insertions, 18 deletions
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 849b71cab..664e5f202 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -94,8 +94,12 @@ function selectAllText() { cy.log('Select all text'); + // Trigger select all cy.get('textarea.clipboard') - .type('{ctrl}a').wait(300); + .type('{ctrl}a'); + + cy.get('.leaflet-marker-icon') + .should('exist'); } // Clear all text by selecting all and deleting. diff --git a/cypress_test/integration_tests/common/impress.js b/cypress_test/integration_tests/common/impress.js index d6463fafc..6e1e59c55 100644 --- a/cypress_test/integration_tests/common/impress.js +++ b/cypress_test/integration_tests/common/impress.js @@ -54,6 +54,10 @@ function typeTextAndVerify(text, expected) { helper.selectAllText(); + //FIXME: Should retry the next check instead of + // an unreliable sleep, but for now this will do. + cy.wait(600); + helper.expectTextForClipboard(expected); } diff --git a/cypress_test/integration_tests/mobile/writer/writer_helper.js b/cypress_test/integration_tests/mobile/writer/writer_helper.js index a80d1e89c..e9e9ef59b 100644 --- a/cypress_test/integration_tests/mobile/writer/writer_helper.js +++ b/cypress_test/integration_tests/mobile/writer/writer_helper.js @@ -96,26 +96,12 @@ function clearMobileWizardState() { function selectAllMobile() { // Remove selection if exist + //FIXME: this also gives the focus to the Writer doc, + // which shouldn't be needed (i.e. should have focus already). cy.get('#document-container') .type('{downarrow}'); - cy.get('.leaflet-marker-icon') - .should('not.exist'); - // Enable editing if it's in read-only mode - cy.get('#mobile-edit-button') - .then(function(button) { - if (button.css('display') !== 'none') { - cy.get('#mobile-edit-button') - .click(); - } - }); - - // Trigger select all - cy.get('textarea.clipboard') - .type('{ctrl}a'); - - cy.get('.leaflet-marker-icon') - .should('exist'); + helper.selectAllText(); } module.exports.copyTextToClipboard = copyTextToClipboard; |