diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2023-06-25 19:06:05 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2023-06-29 13:43:13 +0200 |
commit | 2cf2a1e891a228c743060afb8dcf41e56f94fe70 (patch) | |
tree | b07e8e2d6a4f33a17b62109195ae75e3efdc69cb | |
parent | a cypress env var for enable/disable a11y on testing + a a11y tags (diff) | |
download | online-2cf2a1e891a228c743060afb8dcf41e56f94fe70.tar.gz online-2cf2a1e891a228c743060afb8dcf41e56f94fe70.zip |
cypress: expectTextForClipboard helper function never fails
expectTextForClipboard(expectedText) never fails for any passed
expectedText string
The value returned by the function passed to `then` cypress construct
must not be regarded as an implicit assertion.
I don't see anymore the '\n TEXT" case. It seems that comparing for
equality against the selected plain content is enough.
Fixed some cypress test that was failing after modifying
expectTextForClipboard.
Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I64ce31fa2127efcc70bbc3da3ac45fe456e66803
3 files changed, 10 insertions, 14 deletions
diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index fe14cdc7ea..e3016f4ab8 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -450,22 +450,14 @@ function clearAllText() { function expectTextForClipboard(expectedPlainText) { cy.log('Text:' + expectedPlainText); doIfInWriter(function() { - // for backward compatibility allow '/nTEXT' and 'TEXT' - const expectedRegex = RegExp('/^(\n' + expectedPlainText + ')|(' + expectedPlainText + ')$/'); cy.cGet('#copy-paste-container p') .then(function(pItem) { if (pItem.children('font').length !== 0) { cy.cGet('#copy-paste-container p font') - .invoke('text') - .then(function(value) { - return expectedRegex.test(value); - }); + .should('have.text', expectedPlainText); } else { cy.cGet('#copy-paste-container p') - .invoke('text') - .then(function(value) { - return expectedRegex.test(value); - }); + .should('have.text', expectedPlainText); } }); }); diff --git a/cypress_test/integration_tests/desktop/writer/track_changes_spec.js b/cypress_test/integration_tests/desktop/writer/track_changes_spec.js index 92ad3daa5e..aa4d301183 100644 --- a/cypress_test/integration_tests/desktop/writer/track_changes_spec.js +++ b/cypress_test/integration_tests/desktop/writer/track_changes_spec.js @@ -45,8 +45,10 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Track Changes', function ( enableRecord(); helper.clearAllText(); helper.selectAllText(); + cy.wait(500); confirmChange('Accept All'); helper.typeIntoDocument('{ctrl}a'); + cy.wait(500); helper.textSelectionShouldNotExist(); }); @@ -55,9 +57,11 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Track Changes', function ( enableRecord(); helper.clearAllText(); helper.selectAllText(); + cy.wait(500); confirmChange('Reject All'); cy.cGet('#document-container').click(); helper.selectAllText(); + cy.wait(500); helper.expectTextForClipboard('Hello World'); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/undo_redo_spec.js b/cypress_test/integration_tests/desktop/writer/undo_redo_spec.js index 0c91d676aa..8d2d2a7085 100644 --- a/cypress_test/integration_tests/desktop/writer/undo_redo_spec.js +++ b/cypress_test/integration_tests/desktop/writer/undo_redo_spec.js @@ -1,4 +1,4 @@ -/* global describe it beforeEach require afterEach*/ +/* global cy describe it beforeEach require afterEach*/ var helper = require('../../common/helper'); var repairHelper = require('../../common/repair_document_helper'); @@ -23,7 +23,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Editing Operations', funct helper.selectAllText(); - helper.expectTextForClipboard('Hello \n'); + helper.expectTextForClipboard('Hello '); } it('Undo', function() { @@ -36,7 +36,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Editing Operations', funct helper.typeIntoDocument('{ctrl}y'); helper.selectAllText(); - + cy.wait(500); helper.expectTextForClipboard('Hello World'); }); @@ -47,6 +47,6 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Editing Operations', funct helper.selectAllText(); - helper.expectTextForClipboard('Hello \n'); + helper.expectTextForClipboard('Hello '); }); }); |