diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2023-06-25 19:07:17 +0200 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2023-06-29 13:43:13 +0200 |
commit | 226a758594bd2827260ca50b0b294c2f356fc38c (patch) | |
tree | 89d191f79ee2d34a07cf4bcf6752ef8a95807604 /cypress_test/integration_tests/desktop/writer | |
parent | cypress: expectTextForClipboard helper function never fails (diff) | |
download | online-226a758594bd2827260ca50b0b294c2f356fc38c.tar.gz online-226a758594bd2827260ca50b0b294c2f356fc38c.zip |
cypress tests when editing with a11y disabled
Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: I54ae4515ba1b59711cfbd719db777d02f4735d7a
Diffstat (limited to 'cypress_test/integration_tests/desktop/writer')
-rw-r--r-- | cypress_test/integration_tests/desktop/writer/editable_area_spec.js | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/cypress_test/integration_tests/desktop/writer/editable_area_spec.js b/cypress_test/integration_tests/desktop/writer/editable_area_spec.js index d6c37912e8..c8fe7e7975 100644 --- a/cypress_test/integration_tests/desktop/writer/editable_area_spec.js +++ b/cypress_test/integration_tests/desktop/writer/editable_area_spec.js @@ -4,6 +4,128 @@ var helper = require('../../common/helper'); var ceHelper = require('../../common/contenteditable_helper'); // var repairHelper = require('../../common/repair_document_helper'); +describe(['taga11ydisabled'], 'Editable area [a11y disabled] - Empty paragraph', function() { + var testFileName = 'undo_redo.odt'; + + beforeEach(function () { + helper.beforeAll(testFileName, 'writer'); + cy.cGet('div.clipboard').as('clipboard'); + }); + + afterEach(function () { + helper.afterAll(testFileName, this.currentTest.state); + }); + + it('Typing in an empty paragraph', function () { + // initial position + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + ceHelper.type('H'); + ceHelper.checkHTMLContent('H'); + ceHelper.checkCaretPosition(1); + }); + + it('Typing <backspace> in an empty paragraph', function () { + // initial position + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + // typing + ceHelper.type('{backspace}'); + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + }); + + it('Typing <delete> in an empty paragraph', function () { + // initial position + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + // typing + ceHelper.type('{del}'); + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + }); +}); + +describe(['taga11ydisabled'], 'Editable area [a11y disabled] - Basic typing', function() { + var testFileName = 'undo_redo.odt'; + + beforeEach(function () { + helper.beforeAll(testFileName, 'writer'); + cy.cGet('div.clipboard').as('clipboard'); + }); + + afterEach(function () { + helper.afterAll(testFileName, this.currentTest.state); + }); + + it('Typing at paragraph beginning', function () { + ceHelper.type('Hello World'); + ceHelper.checkPlainContent('Hello World'); + ceHelper.checkCaretPosition(11); + ceHelper.moveCaret('home'); + ceHelper.checkCaretPosition(0); + ceHelper.type('k'); + ceHelper.checkHTMLContent('k'); + ceHelper.checkCaretPosition(1); + }); + + it('Typing <delete> at paragraph beginning', function () { + ceHelper.type('Hello World'); + ceHelper.checkPlainContent('Hello World'); + ceHelper.moveCaret('home'); + ceHelper.checkCaretPosition(0); + ceHelper.type('{del}'); + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + }); + + it('Typing <enter>', function () { + // typing 4 paragraphs + ceHelper.type('Hello World'); + ceHelper.checkPlainContent('Hello World'); + ceHelper.type('{enter}'); + ceHelper.checkPlainContent(''); + ceHelper.type('{enter}'); + ceHelper.checkPlainContent(''); + ceHelper.type('{enter}'); + ceHelper.type('green red'); + ceHelper.checkPlainContent('green red'); + }); + + it('Typing <backspace>', function () { + ceHelper.type('Hello World'); + ceHelper.checkPlainContent('Hello World'); + ceHelper.type('{backspace}'); + ceHelper.checkPlainContent('Hello Worl'); + ceHelper.checkCaretPosition(10); + // clipboard becomes empty + ceHelper.moveCaret('home'); + ceHelper.type('{backspace}'); + ceHelper.checkHTMLContent(''); + ceHelper.checkCaretPosition(0); + // type after <backspace> at paragraph begin + ceHelper.type('k'); + ceHelper.checkHTMLContent('k'); + ceHelper.checkCaretPosition(1); + }); + + it('Preserving spaces', function () { + ceHelper.type('Hello World '); + ceHelper.checkPlainContent('Hello World '); + ceHelper.type('{enter}'); + ceHelper.type(' '); + ceHelper.checkPlainContent(' '); + }); + + it('Preserving <tab>s', function () { + ceHelper.type('Hello\t\tWorld\t\t'); + ceHelper.checkPlainContent('Hello\t\tWorld\t\t'); + ceHelper.type('{enter}'); + ceHelper.type('\t\t'); + ceHelper.checkPlainContent('\t\t'); + }); +}); + describe(['taga11yenabled'], 'Editable area - Empty paragraph', function() { var testFileName = 'undo_redo.odt'; @@ -1095,3 +1217,131 @@ describe(['taga11yenabled'], 'Editable area - Unordered lists', function() { }); }); + +describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Editing - Basic typing', function() { + var testFileName = 'undo_redo.odt'; + + beforeEach(function () { + helper.beforeAll(testFileName, 'writer'); + cy.cGet('div.clipboard').as('clipboard'); + }); + + afterEach(function () { + helper.afterAll(testFileName, this.currentTest.state); + }); + + function selectAndCheckText(upTo, expectedText) { + var backTo = upTo === 'home' ? 'end' : 'home'; + ceHelper.moveCaret(upTo, 'shift'); + cy.wait(500); + helper.expectTextForClipboard(expectedText); + ceHelper.moveCaret(backTo); + helper.textSelectionShouldNotExist(); + } + + it('Typing', function () { + // typing paragraph 1 + ceHelper.type('Hello World'); + selectAndCheckText('home', 'Hello World'); + // paragraph 2 (empty) + ceHelper.type('{enter}'); + // paragraph 3 (empty) + ceHelper.type('{enter}'); + // typing paragraph 4 + ceHelper.type('{enter}'); + ceHelper.type('green red'); + selectAndCheckText('home', 'green red'); + // move up to paragraph 1 + ceHelper.moveCaret('up', '', 3); + ceHelper.moveCaret('end'); + selectAndCheckText('home', 'Hello World'); + }); + + it('Typing <delete> at paragraph beginning', function () { + ceHelper.type('Hello World'); + ceHelper.moveCaret('home'); + ceHelper.type('{del}'); + selectAndCheckText('end', 'ello World'); + }); + + it('Typing <enter>', function () { + // typing 4 paragraphs + ceHelper.type('Hello World'); + ceHelper.type('{enter}'); + ceHelper.type('green red'); + // move current paragraph one line below + ceHelper.moveCaret('home'); + ceHelper.type('{enter}'); + selectAndCheckText('end', 'green red'); + // move to first paragraph + ceHelper.moveCaret('up', '', 2); + // split paragraph + ceHelper.moveCaret('right', '', 5); + ceHelper.type('{enter}'); + selectAndCheckText('end', ' World'); + ceHelper.moveCaret('up'); + selectAndCheckText('end', 'Hello'); + }); + + it('Typing <backspace>', function () { + ceHelper.type('Hello World'); + ceHelper.moveCaret('left','',5); + ceHelper.type('{backspace}'); + ceHelper.moveCaret('home'); + selectAndCheckText('end', 'HelloWorld'); + ceHelper.moveCaret('right','',5); + ceHelper.type(' '); + ceHelper.moveCaret('home'); + selectAndCheckText('end', 'Hello World'); + ceHelper.moveCaret('end'); + // delete empty paragraph + ceHelper.type('{enter}'); + ceHelper.type('{backspace}'); + selectAndCheckText('home', 'Hello World'); + // type new paragraph + ceHelper.type('{enter}'); + ceHelper.type('green red'); + // merge with above paragraph + ceHelper.moveCaret('home'); + ceHelper.type('{backspace}'); + ceHelper.moveCaret('home'); + selectAndCheckText('end', 'Hello Worldgreen red'); + // try to delete beyond first paragraph begin + ceHelper.type('{backspace}'); + selectAndCheckText('end', 'Hello Worldgreen red'); + // type after <backspace> at paragraph begin + ceHelper.type('k'); + ceHelper.moveCaret('left'); + selectAndCheckText('end', 'kHello Worldgreen red'); + }); + + it('Typing <delete>', function () { + ceHelper.type('Hello World'); + ceHelper.moveCaret('left','',6); + ceHelper.type('{del}'); + ceHelper.moveCaret('home'); + selectAndCheckText('end', 'HelloWorld'); + ceHelper.moveCaret('right','',5); + ceHelper.type(' '); + ceHelper.moveCaret('home'); + selectAndCheckText('end', 'Hello World'); + ceHelper.moveCaret('end'); + // type new paragraph + ceHelper.type('{enter}'); + ceHelper.type('green red'); + // merge with above paragraph + ceHelper.moveCaret('up'); + ceHelper.moveCaret('end'); + ceHelper.type('{del}'); + ceHelper.moveCaret('home'); + selectAndCheckText('end', 'Hello Worldgreen red'); + // try to delete beyond paragraph end + ceHelper.moveCaret('end'); + ceHelper.type('{del}'); + selectAndCheckText('home', 'Hello Worldgreen red'); + // type after <delete> at paragraph end + ceHelper.type('k'); + ceHelper.moveCaret('right'); + selectAndCheckText('home', 'Hello Worldgreen redk'); + }); +}); |