From e88e656dae29d4ac9a4c4cd86b8b8bc6dacc5c8b Mon Sep 17 00:00:00 2001 From: Ezinne Nnamani Date: Fri, 16 Oct 2020 10:45:05 +0100 Subject: [PATCH] Created the cypress test for the underline attribute in desktop writer Change-Id: I5d9fd7655380d6926ca1f64b03128098fbb15270 --- cypress_test/integration_tests/common/helper.js | 17 +++++++++++++++++ .../desktop/writer/top_toolbar_spec.js | 9 +++++++++ 2 files changed, 26 insertions(+) diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index c26342dc5..2567e553e 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -358,6 +358,22 @@ function selectAllText(assertFocus = true) { .should('exist'); } +function reselectAllText() { + + cy.log('Unselect all texts'); + + typeIntoDocument('{downarrow}'); + + cy.get('.leaflet-marker-icon') + .should('not.exist'); + + typeIntoDocument('{ctrl}a'); + + cy.get('.leaflet-marker-icon') + .should('exist'); + cy.log('Reselect all texts'); +} + // Clear all text by selecting all and deleting. function clearAllText() { assertCursorAndFocus(); @@ -872,6 +888,7 @@ module.exports.assertCursorAndFocus = assertCursorAndFocus; module.exports.assertNoKeyboardInput = assertNoKeyboardInput; module.exports.assertHaveKeyboardInput = assertHaveKeyboardInput; module.exports.selectAllText = selectAllText; +module.exports.reselectAllText = reselectAllText; module.exports.clearAllText = clearAllText; module.exports.expectTextForClipboard = expectTextForClipboard; module.exports.matchClipboardText = matchClipboardText; diff --git a/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js b/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js index 0eb9beea9..4c4ee903b 100644 --- a/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js +++ b/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js @@ -35,6 +35,15 @@ describe('Top toolbar tests.', function() { .should('exist'); }); + it('Apply underline.', function() { + cy.get('#tb_editbar_item_underline') + .click(); + helper.reselectAllText(); + + cy.get('#copy-paste-container p u') + .should('exist'); + }); + it('Apply left alignment.', function() { cy.get('#tb_editbar_item_centerpara') .click();