diff options
author | Gökay Şatır <gokaysatir@collabora.com> | 2023-04-26 16:25:26 +0300 |
---|---|---|
committer | Gökay ŞATIR <gokaysatir@gmail.com> | 2023-05-05 07:07:14 +0300 |
commit | 2a1db594adbebcd9af226dc06f30046ba9b0997c (patch) | |
tree | 2dddf89200ff0a74ea1561fe008655570b49f238 /cypress_test/integration_tests/desktop/writer | |
parent | Update impress desktop tests. (diff) | |
download | online-2a1db594adbebcd9af226dc06f30046ba9b0997c.tar.gz online-2a1db594adbebcd9af226dc06f30046ba9b0997c.zip |
Update writer desktop tests.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com>
Change-Id: I974bb8ee2e7d77cae29ac97b2c0f6b687e90e005
Signed-off-by: Gökay Şatır <gokaysatir@gmail.com>
Diffstat (limited to 'cypress_test/integration_tests/desktop/writer')
13 files changed, 404 insertions, 886 deletions
diff --git a/cypress_test/integration_tests/desktop/writer/copy_paste_spec.js b/cypress_test/integration_tests/desktop/writer/copy_paste_spec.js index 5602980891..c962e77134 100644 --- a/cypress_test/integration_tests/desktop/writer/copy_paste_spec.js +++ b/cypress_test/integration_tests/desktop/writer/copy_paste_spec.js @@ -18,18 +18,18 @@ describe('Clipboard operations.', function() { // Select some text helper.selectAllText(); - cy.get('.leaflet-marker-icon') + cy.cGet('.leaflet-marker-icon') .then(function(marker) { expect(marker).to.have.lengthOf(2); var XPos = (marker[0].getBoundingClientRect().right + marker[1].getBoundingClientRect().left) / 2; var YPos = marker[0].getBoundingClientRect().top - 5; - cy.get('body').rightclick(XPos, YPos); + cy.cGet('body').rightclick(XPos, YPos); }); - cy.contains('.context-menu-link', 'Copy') + cy.cGet('body').contains('.context-menu-link', 'Copy') .click(); - cy.get('#copy_paste_warning-box').should('exist'); + cy.cGet('#copy_paste_warning-box').should('exist'); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/file_properties_spec.js b/cypress_test/integration_tests/desktop/writer/file_properties_spec.js index 5a216f68ca..52314e6c7f 100644 --- a/cypress_test/integration_tests/desktop/writer/file_properties_spec.js +++ b/cypress_test/integration_tests/desktop/writer/file_properties_spec.js @@ -18,35 +18,33 @@ describe('File Property Tests', function() { it('Add File Description.', function() { writerHelper.openFileProperties(); - cy.get('#description-tab-label').click(); + cy.cGet('#description-tab-label').click(); helper.waitUntilIdle('#title.ui-edit'); - cy.get('#title.ui-edit').type('New Title'); + cy.cGet('#title.ui-edit').type('New Title'); // sometimes it doesn't finish typing helper.waitUntilIdle('#title.ui-edit'); // Fixme: type now char by char because we receive update messages // can be reverted after core update - cy.get('#comments.ui-textarea').type('N'); + cy.cGet('#comments.ui-textarea').type('N'); cy.wait(500); - cy.get('#comments.ui-textarea').type('e'); + cy.cGet('#comments.ui-textarea').type('e'); cy.wait(500); - cy.get('#comments.ui-textarea').type('w'); + cy.cGet('#comments.ui-textarea').type('w'); cy.wait(500); helper.waitUntilIdle('#comments.ui-textarea'); - - cy.get('#ok.ui-pushbutton').click(); - + cy.cGet('#ok.ui-pushbutton').click(); writerHelper.openFileProperties(); - cy.get('#description-tab-label').click(); + cy.cGet('#description-tab-label').click(); - cy.get('#title.ui-edit').should('have.value', 'New Title'); - cy.get('#comments.ui-textarea').should('have.value', 'New'); + cy.cGet('#title.ui-edit').should('have.value', 'New Title'); + cy.cGet('#comments.ui-textarea').should('have.value', 'New'); helper.clickOnIdle('#cancel.ui-pushbutton'); }); @@ -54,28 +52,27 @@ describe('File Property Tests', function() { it.skip('Add Custom Property.', function() { writerHelper.openFileProperties(); - cy.get('#customprops-tab-label').click(); - + cy.cGet('#customprops-tab-label').click(); + cy.wait(200); // Add property helper.clickOnIdle('.ui-pushbutton', 'Add Property'); helper.waitUntilIdle('#namebox'); - cy.get('#namebox select') - .select('Mailstop'); + cy.cGet('#namebox select').select('Mailstop'); helper.waitUntilIdle('#valueedit'); - cy.get('#valueedit').type('123 Address'); + cy.cGet('#valueedit').type('123 Address'); - cy.get('#ok.ui-pushbutton').click(); + cy.cGet('#ok.ui-pushbutton').click(); // Check property saved writerHelper.openFileProperties(); - cy.get('#customprops-tab-label').click(); + cy.cGet('#customprops-tab-label').click(); - cy.get('#valueedit.ui-edit').should('have.value', '123 Address'); + cy.cGet('#valueedit.ui-edit').should('have.value', '123 Address'); helper.clickOnIdle('#cancel.ui-pushbutton'); }); @@ -84,73 +81,65 @@ describe('File Property Tests', function() { writerHelper.openFileProperties(); helper.clickOnIdle('#customprops-tab-label'); - + cy.wait(200); // Add property helper.clickOnIdle('.ui-pushbutton', 'Add Property'); helper.waitUntilIdle('#namebox'); - cy.get('#namebox select') - .select('Received from'); + cy.cGet('#namebox select').select('Received from'); helper.waitUntilIdle('#typebox'); - cy.get('#typebox select') - .select('Duration'); + cy.cGet('#typebox select').select('Duration'); helper.clickOnIdle('#durationbutton'); - cy.get('#negative-input').check(); - cy.get('#years-input').type('1'); - cy.get('#days-input').type('2'); - cy.get('#seconds-input').type('3'); + cy.cGet('#negative-input').check(); + cy.cGet('#years-input').type('1'); + cy.cGet('#days-input').type('2'); + cy.cGet('#seconds-input').type('3'); // click the sub-dialog ok button - cy.get('#ok.ui-pushbutton') - .invoke('slice', 1) - .click(); - - cy.get('#ok.ui-pushbutton').click(); + cy.cGet('#ok.ui-pushbutton').invoke('slice', 1).click(); + cy.cGet('#ok.ui-pushbutton').click(); // Check property saved writerHelper.openFileProperties(); helper.clickOnIdle('#customprops-tab-label'); - cy.get('#duration.ui-edit').should('have.value', '- Y: 1 M: 0 D: 2 H: 0 M: 0 S: 3'); + cy.cGet('#duration.ui-edit').should('have.value', '- Y: 1 M: 0 D: 2 H: 0 M: 0 S: 3'); helper.clickOnIdle('#cancel.ui-pushbutton'); }); - + it.skip('Add Custom Yes/No Property.', function() { writerHelper.openFileProperties(); - cy.get('#customprops-tab-label').click(); - + cy.cGet('#customprops-tab-label').click(); + cy.wait(200); // Add property helper.clickOnIdle('.ui-pushbutton', 'Add Property'); helper.waitUntilIdle('#namebox'); - cy.get('#namebox select') - .select('Telephone number'); + cy.cGet('#namebox select').select('Telephone number'); helper.waitUntilIdle('#typebox'); - cy.get('#typebox select') - .select('Yes or no'); + cy.cGet('#typebox select').select('Yes or no'); helper.waitUntilIdle('#yes-input'); - cy.get('#yes-input').check(); + cy.cGet('#yes-input').check(); - cy.get('#ok.ui-pushbutton').click(); + cy.cGet('#ok.ui-pushbutton').click(); // Check property saved writerHelper.openFileProperties(); - cy.get('#customprops-tab-label').click(); - - cy.get('#yes-input').should('be.checked'); + cy.cGet('#customprops-tab-label').click(); + cy.cGet('#yes-input').should('be.checked'); helper.clickOnIdle('#cancel.ui-pushbutton'); }); diff --git a/cypress_test/integration_tests/desktop/writer/focus_spec.js b/cypress_test/integration_tests/desktop/writer/focus_spec.js index 72b2804b4c..f90e37a73e 100644 --- a/cypress_test/integration_tests/desktop/writer/focus_spec.js +++ b/cypress_test/integration_tests/desktop/writer/focus_spec.js @@ -21,8 +21,7 @@ describe('Focus tests', function() { it('Search for non existing word.', function() { // Move focus to the search field - cy.get('#search-input') - .click(); + cy.cGet('#search-input').click(); helper.assertFocus('id','search-input'); @@ -32,14 +31,12 @@ describe('Focus tests', function() { // Search field still has the focus. helper.assertFocus('id','search-input'); - cy.get('#search-input') - .should('have.prop', 'value', text); + cy.cGet('#search-input').should('have.prop', 'value', text); }); it('Search for existing word (with bold font).', function() { // Move focus to the search field - cy.get('#search-input') - .click(); + cy.cGet('#search-input').click(); helper.assertFocus('id','search-input'); @@ -49,14 +46,12 @@ describe('Focus tests', function() { // Search field still has the focus. helper.assertFocus('id','search-input'); - cy.get('#search-input') - .should('have.prop', 'value', text); + cy.cGet('#search-input').should('have.prop', 'value', text); }); it('Search for existing word (in table).', function() { // Move focus to the search field - cy.get('#search-input') - .click(); + cy.cGet('#search-input').click(); helper.assertFocus('id','search-input'); @@ -66,25 +61,21 @@ describe('Focus tests', function() { // Search field still has the focus. helper.assertFocus('id','search-input'); - cy.get('#search-input') - .should('have.prop', 'value', text); + cy.cGet('#search-input').should('have.prop', 'value', text); }); it('Search with fast typing.', function() { // Move focus to the search field - cy.get('#search-input') - .click(); + cy.cGet('#search-input').click(); helper.assertFocus('id','search-input'); var text = 'qqqqqqqqqqqqqqqqqqqq'; - cy.get('body') - .type(text); + cy.cGet('body').type(text); // Search field still has the focus. helper.assertFocus('id','search-input'); - cy.get('#search-input') - .should('have.prop', 'value', text); + cy.cGet('#search-input').should('have.prop', 'value', text); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/form_field_spec.js b/cypress_test/integration_tests/desktop/writer/form_field_spec.js index 805e07d23a..132cb66c0e 100644 --- a/cypress_test/integration_tests/desktop/writer/form_field_spec.js +++ b/cypress_test/integration_tests/desktop/writer/form_field_spec.js @@ -16,7 +16,7 @@ describe('Form field button tests.', function() { // Blinking cursor is not visible for some reason. helper.typeIntoDocument('x'); - cy.get('.blinking-cursor') + cy.cGet('.blinking-cursor') .should('be.visible'); } afterEach(function() { @@ -24,34 +24,24 @@ describe('Form field button tests.', function() { }); function buttonShouldNotExist() { - cy.get('.form-field-frame') - .should('not.exist'); - - cy.get('.form-field-button') - .should('not.exist'); - - cy.get('.drop-down-field-list') - .should('not.exist'); + cy.cGet('.form-field-frame').should('not.exist'); + cy.cGet('.form-field-button').should('not.exist'); + cy.cGet('.drop-down-field-list').should('not.exist'); } function buttonShouldExist() { - cy.get('.form-field-frame') - .should('exist'); - - cy.get('.form-field-button') - .should('exist'); - - cy.get('.drop-down-field-list') - .should('exist'); + cy.cGet('.form-field-frame').should('exist'); + cy.cGet('.form-field-button').should('exist'); + cy.cGet('.drop-down-field-list').should('exist'); // Check also the position relative to the blinking cursor - cy.get('.blinking-cursor') + cy.cGet('.blinking-cursor') .then(function(cursors) { // TODO: why we have two blinking cursors here? //expect(cursors).to.have.lengthOf(1); var cursorRect = cursors[0].getBoundingClientRect(); - cy.get('.form-field-frame') + cy.cGet('.form-field-frame') .should(function(frames) { expect(frames).to.have.lengthOf(1); var frameRect = frames[0].getBoundingClientRect(); @@ -98,11 +88,10 @@ describe('Form field button tests.', function() { buttonShouldExist(); - cy.get('.drop-down-field-list') - .should('not.be.visible'); + cy.cGet('.drop-down-field-list').should('not.be.visible'); // Check content of the list - cy.get('.drop-down-field-list') + cy.cGet('.drop-down-field-list') .should(function(list) { expect(list[0].children.length).to.be.equal(4); expect(list[0].children[0]).to.have.text('February'); @@ -111,25 +100,15 @@ describe('Form field button tests.', function() { expect(list[0].children[3]).to.have.text('July'); }); - cy.get('.drop-down-field-list-item.selected') - .should('have.text', 'February'); - + cy.cGet('.drop-down-field-list-item.selected').should('have.text', 'February'); // Select a new item - cy.get('.form-field-button') - .click(); - - cy.get('.drop-down-field-list') - .should('be.visible'); - - cy.contains('.drop-down-field-list-item', 'July') - .click(); + cy.cGet('.form-field-button').click(); + cy.cGet('.drop-down-field-list').should('be.visible'); + cy.cGet('body').contains('.drop-down-field-list-item', 'July').click(); // List is hidden, but have the right selected element - cy.get('.drop-down-field-list') - .should('not.be.visible'); - - cy.get('.drop-down-field-list-item.selected') - .should('have.text', 'July'); + cy.cGet('.drop-down-field-list').should('not.be.visible'); + cy.cGet('.drop-down-field-list-item.selected').should('have.text', 'July'); }); it('Test field editing', function() { @@ -139,17 +118,10 @@ describe('Form field button tests.', function() { helper.moveCursor('right'); // Select a new item - cy.get('.form-field-button') - .click(); - - cy.get('.drop-down-field-list') - .should('be.visible'); - - cy.contains('.drop-down-field-list-item', 'January') - .click(); - - cy.get('.drop-down-field-list-item.selected') - .should('have.text', 'January'); + cy.cGet('.form-field-button').click(); + cy.cGet('.drop-down-field-list').should('be.visible'); + cy.cGet('body').contains('.drop-down-field-list-item', 'January').click(); + cy.cGet('.drop-down-field-list-item.selected').should('have.text', 'January'); // Move the cursor away and back helper.moveCursor('left'); @@ -161,8 +133,7 @@ describe('Form field button tests.', function() { buttonShouldExist(); - cy.get('.drop-down-field-list-item.selected') - .should('have.text', 'January'); + cy.cGet('.drop-down-field-list-item.selected').should('have.text', 'January'); // Do the same from the right side of the field. helper.moveCursor('right'); @@ -170,17 +141,10 @@ describe('Form field button tests.', function() { buttonShouldExist(); // Select a new item - cy.get('.form-field-button') - .click(); - - cy.get('.drop-down-field-list') - .should('be.visible'); - - cy.contains('.drop-down-field-list-item', 'December') - .click(); - - cy.get('.drop-down-field-list-item.selected') - .should('have.text', 'December'); + cy.cGet('.form-field-button').click(); + cy.cGet('.drop-down-field-list').should('be.visible'); + cy.cGet('body').contains('.drop-down-field-list-item', 'December').click(); + cy.cGet('.drop-down-field-list-item.selected').should('have.text', 'December'); }); it('Multiple form field button activation.', function() { @@ -222,7 +186,7 @@ describe('Form field button tests.', function() { buttonShouldExist(); - cy.get('.drop-down-field-list-item.selected') + cy.cGet('.drop-down-field-list-item.selected') .should('not.exist'); }); @@ -234,23 +198,12 @@ describe('Form field button tests.', function() { buttonShouldExist(); - cy.get('.drop-down-field-list-item') - .should('have.text', 'No Item specified'); - - cy.get('.drop-down-field-list-item.selected') - .should('not.exist'); - - cy.get('.form-field-button') - .click(); - - cy.get('.drop-down-field-list') - .should('be.visible'); - - cy.contains('.drop-down-field-list-item', 'No Item specified') - .click(); - - cy.get('.drop-down-field-list-item.selected') - .should('not.exist'); + cy.cGet('.drop-down-field-list-item').should('have.text', 'No Item specified'); + cy.cGet('.drop-down-field-list-item.selected').should('not.exist'); + cy.cGet('.form-field-button').click(); + cy.cGet('.drop-down-field-list').should('be.visible'); + cy.cGet('body').contains('.drop-down-field-list-item', 'No Item specified').click(); + cy.cGet('.drop-down-field-list-item.selected').should('not.exist'); }); it('Test field button after zoom.', function() { @@ -290,7 +243,7 @@ describe('Form field button tests.', function() { // Get the initial font size from the style. var prevFontSize = ''; - cy.get('.drop-down-field-list-item') + cy.cGet('.drop-down-field-list-item') .should(function(item) { prevFontSize = item.css('font-size'); expect(prevFontSize).to.not.equal(''); @@ -301,14 +254,14 @@ describe('Form field button tests.', function() { buttonShouldExist(); // Check that the font size was changed - cy.get('.drop-down-field-list-item') + cy.cGet('.drop-down-field-list-item') .should(function(item) { var prevSize = parseInt(prevFontSize, 10); var currentSize = parseInt(item.css('font-size'), 10); expect(currentSize).to.be.greaterThan(prevSize); }); - cy.get('.drop-down-field-list-item') + cy.cGet('.drop-down-field-list-item') .invoke('css', 'font-size') .as('prevFontSize'); @@ -317,7 +270,7 @@ describe('Form field button tests.', function() { buttonShouldExist(); // Check that the font size was changed back - cy.get('.drop-down-field-list-item') + cy.cGet('.drop-down-field-list-item') .should(function(item) { expect(item.css('font-size')).to.be.equal(prevFontSize); }); diff --git a/cypress_test/integration_tests/desktop/writer/help_dialog_update_spec.js b/cypress_test/integration_tests/desktop/writer/help_dialog_update_spec.js index 6fab936049..a20e72b989 100644 --- a/cypress_test/integration_tests/desktop/writer/help_dialog_update_spec.js +++ b/cypress_test/integration_tests/desktop/writer/help_dialog_update_spec.js @@ -28,237 +28,137 @@ describe('Help dialog screenshot updation', function() { } it('Statusbar', function() { - helper.waitUntilIdle('#toolbar-down'); - - cy.document().then((doc) => { - const ele1 = doc.getElementById('toolbar-down'); - const ele2 = doc.getElementById('tb_actionbar_item_break8'); - const width = ele2.getBoundingClientRect().left - ele1.getBoundingClientRect().left; - cy.get('#toolbar-down').screenshot('status-bar', {clip: {x:0, y:0, height:300 , width: width}}); - cy.log(Cypress.env('SCREENSHOT_FOLDER'), Cypress.env('IMAGES_FOLDER')); - copyScreenshot('status-bar.png'); + var w1, w2; + cy.cGet('#toolbar-down').should('exist').then(el => { + w1 = el[0].getBoundingClientRect().left; + cy.cGet('#tb_actionbar_item_break8').should('exist').then(el => { + w2 = el[0].getBoundingClientRect().left; + var width = w2 - w1; + cy.log('w1 w2 ' + w1 + ' ' + w2); + cy.cGet('#toolbar-down').screenshot('status-bar', { clip: { x: 0, y: 0, height: 300, width: width } }); + cy.log(Cypress.env('SCREENSHOT_FOLDER'), Cypress.env('IMAGES_FOLDER')); + copyScreenshot('status-bar.png'); + }); }); }); it('Infobar', function() { - helper.waitUntilIdle('#toolbar-down'); - - cy.document().then((doc) => { - const ele1 = doc.getElementById('toolbar-down'); - const ele2 = doc.getElementById('tb_actionbar_item_break8'); - const width = ele1.getBoundingClientRect().right - ele2.getBoundingClientRect().right + 10; - cy.get('#toolbar-down').screenshot('information-bar', {clip: {x:ele2.getBoundingClientRect().right, y:0, height:300, width:width}}); - copyScreenshot('information-bar.png'); + var w1, w2; + cy.cGet('#toolbar-down').should('exist').then(el => { + w1 = el[0].getBoundingClientRect().right; + cy.cGet('#tb_actionbar_item_break8').should('exist').then(el => { + w2 = el[0].getBoundingClientRect().right; + var width = w1 - w2 + 10; + cy.cGet('#toolbar-down').screenshot('information-bar', { clip: { x: w2, y: 0, height: 300, width: width} }); + copyScreenshot('information-bar.png'); + }); }); }); it('Document repair', function() { - cy.get('#toolbar-up > .w2ui-scroll-right').click(); + cy.cGet('#toolbar-up > .w2ui-scroll-right').click(); //insert - cy.get('#tb_editbar_item_insertshapes') - .click() - .get('.col.w2ui-icon.symbolshapes') - .click(); - - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') - .should('exist'); - - cy.wait(1000); - - cy.get('#menu-editmenu').click() - .get('#menu-repair').click(); - - cy.get('.jsdialog-container.lokdialog_container') - .should('exist'); - - helper.waitUntilIdle('.jsdialog-container.lokdialog_container'); - - cy.get('.jsdialog-container.lokdialog_container') - .screenshot('repair-document'); - + cy.cGet('#tb_editbar_item_insertshapes').click(); + cy.cGet('.col.w2ui-icon.symbolshapes').click(); + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive').should('exist'); + cy.cGet('#menu-editmenu').click(); + cy.cGet('#menu-repair').click(); + cy.cGet('.jsdialog-container.lokdialog_container').should('exist'); + cy.cGet('.jsdialog-container.lokdialog_container').screenshot('repair-document'); copyScreenshot('repair-document.png'); }); - it('Comment', function() { + it.skip('Comment', function() { hideSidebar(); - cy.get('#toolbar-up > .w2ui-scroll-right').click(); - - cy.get('#tb_editbar_item_insertannotation') - .click(); - - cy.get('#input-modal-input').type('comment added'); - - cy.get('.vex-dialog-buttons .button-primary').click(); // save button - + cy.cGet('#toolbar-up > .w2ui-scroll-right').click(); + cy.cGet('#tb_editbar_item_insertannotation').click(); + cy.cGet('#input-modal-input').type('comment added'); + cy.cGet('.vex-dialog-buttons .button-primary').click(); // save button cy.wait(1000); - - cy.get('.jsdialog-container.cool-annotation-collapsed').click(); - + cy.cGet('.jsdialog-container.cool-annotation-collapsed').click(); cy.wait(1000); - - cy.get('.cool-annotation-content-wrapper').should('exist'); - - cy.get('#comment .cool-annotation').screenshot('comment'); + cy.cGet('.cool-annotation-content-wrapper').should('exist'); + cy.cGet('#comment .cool-annotation').screenshot('comment'); copyScreenshot('comment.png'); }); it('Style formatting', function() { - cy.get('#menu-editmenu') - .click(); - - cy.contains('#menu-editmenu li a', 'Edit Style...') - .click(); - - cy.wait(1000) - .get('.lokdialog_canvas') - .should('exist'); - - helper.waitUntilIdle('.lokdialog_canvas'); - - cy.get('.lokdialog_canvas').then(items => { - var Xpos = items[0].getBoundingClientRect().left + 80; - var Ypos = items[0].getBoundingClientRect().top + 10; - - cy.wrap(items[0]) - .click(Xpos, Ypos); - }); - - helper.waitUntilIdle('.lokdialog_container'); - - cy.get('.lokdialog_container') - .screenshot('paragraph-dialog'); - + cy.cGet('#menu-editmenu').click(); + cy.cGet('body').contains('#menu-editmenu li a', 'Edit Style...').click(); + cy.cGet('#TemplateDialog2').should('exist'); + cy.cGet('#TemplateDialog2').screenshot('paragraph-dialog'); copyScreenshot('paragraph-dialog.png'); }); it('Table', function() { hideSidebar(); - cy.get('#toolbar-up > .w2ui-scroll-right') - .click(); - - cy.get('#tb_editbar_item_inserttable') - .click(); - - cy.get('.inserttable-grid > :nth-child(4) > :nth-child(4)') - .trigger('mouseover'); + cy.cGet('#toolbar-up > .w2ui-scroll-right').click(); + cy.cGet('#tb_editbar_item_inserttable').click(); + cy.cGet('.inserttable-grid > :nth-child(4) > :nth-child(4)').trigger('mouseover'); helper.waitUntilIdle('#inserttable-popup'); - - cy.get('#inserttable-popup') - .screenshot('insert-table', {padding: 30}); + cy.cGet('#inserttable-popup').screenshot('insert-table', {padding: 30}); copyScreenshot('insert-table.png'); }); it('Word count', function() { - cy.get('#menu-tools') - .click(); - - cy.contains('#menu-tools li a', 'Word Count...') - .click(); - + cy.cGet('#menu-tools').click(); + cy.cGet('body').contains('#menu-tools li a', 'Word Count...').click(); helper.waitUntilIdle('.lokdialog_container'); - - cy.get('.lokdialog_container') - .screenshot('word-count'); - + cy.cGet('.lokdialog_container').screenshot('word-count'); copyScreenshot('word-count.png'); }); it('Insert special', function() { - cy.get('#toolbar-up > .w2ui-scroll-right') - .click(); - - cy.get('#tb_editbar_item_insertsymbol') - .click(); - - cy.wait(1000); - - cy.get('.lokdialog_canvas') - .should('exist'); - - helper.waitUntilIdle('.lokdialog_container'); - - cy.get('.lokdialog_container') - .screenshot('special-character'); - + cy.cGet('#toolbar-up > .w2ui-scroll-right').click(); + cy.cGet('#tb_editbar_item_insertsymbol').click(); + cy.cGet('#SpecialCharactersDialog').should('exist'); + cy.cGet('#SpecialCharactersDialog').screenshot('special-character'); copyScreenshot('special-character.png'); }); it('Manage changes', function() { - cy.get('#menu-editmenu') - .click() - .get('#menu-changesmenu') - .click() - .contains('Record') - .click(); + cy.cGet('#menu-editmenu').click(); + cy.cGet('#menu-changesmenu').click(); + cy.cGet('#menu-changesmenu').contains('Record').click(); helper.typeIntoDocument('Hello World'); - cy.get('#toolbar-up > .w2ui-scroll-right').click(); + cy.cGet('#toolbar-up > .w2ui-scroll-right').click(); //insert - cy.get('#tb_editbar_item_insertshapes') - .click() - .get('.col.w2ui-icon.symbolshapes') - .click(); - - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') - .should('exist'); - - cy.wait(1000); - - cy.get('#menu-editmenu') - .click() - .get('#menu-changesmenu') - .click() - .contains('Manage...') - .click(); - - cy.get('.lokdialog_canvas') - .should('exist'); - - helper.waitUntilIdle('.lokdialog_container'); + cy.cGet('#tb_editbar_item_insertshapes').click(); + cy.cGet('.col.w2ui-icon.symbolshapes').click(); - cy.get('.lokdialog_container') - .screenshot('manage-changes'); + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive').should('exist'); + cy.cGet('#menu-editmenu').click(); + cy.cGet('#menu-changesmenu').click(); + cy.cGet('#menu-changesmenu').contains('Manage...').click(); + cy.cGet('.lokdialog_canvas').should('exist'); + cy.wait(1000); // For dialog's height to be calculated. + cy.cGet('.lokdialog_container').should('exist').screenshot('manage-changes'); copyScreenshot('manage-changes.png'); }); it('Page styles', function() { - cy.get('#menu-format') - .click(); - - cy.contains('#menu-format li a', 'Page Style...') - .click(); - - cy.wait(1000); - - cy.get('.lokdialog_canvas') - .should('exist'); - - helper.waitUntilIdle('.lokdialog_container'); - - cy.get('.lokdialog_container') - .screenshot('page-style'); - + cy.cGet('#menu-format').click(); + cy.cGet('body').contains('#menu-format li a', 'Page Style...').click(); + cy.cGet('#TemplateDialog8').should('exist'); + cy.cGet('#TemplateDialog8').screenshot('page-style'); copyScreenshot('page-style.png'); }); it('Insert chart', function() { hideSidebar(); - cy.get('#menu-insert') - .click() - .contains('Chart...') - .click(); - + cy.cGet('#menu-insert').click(); + cy.cGet('#menu-insert').contains('Chart...').click(); cy.wait(1000); - - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive') .should('exist').screenshot('chart', {padding: 10}); copyScreenshot('chart.png'); diff --git a/cypress_test/integration_tests/desktop/writer/image_operation_spec.js b/cypress_test/integration_tests/desktop/writer/image_operation_spec.js index 2b8b010e8c..229fa56c43 100644 --- a/cypress_test/integration_tests/desktop/writer/image_operation_spec.js +++ b/cypress_test/integration_tests/desktop/writer/image_operation_spec.js @@ -19,7 +19,7 @@ describe('Image Operation Tests', function() { insertImage(); //make sure that image is in focus - cy.get('.leaflet-pane.leaflet-overlay-pane svg g.leaflet-control-buttons-disabled') + cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g.leaflet-control-buttons-disabled') .should('exist'); deleteImage(); @@ -34,12 +34,12 @@ describe('Image Operation Tests', function() { helper.waitUntilIdle('#selectwidth input'); - cy.get('#selectwidth input').clear({force:true}) + cy.cGet('#selectwidth input').clear({force:true}) .type('3{enter}', {force:true}); helper.waitUntilIdle('#selectheight input'); - cy.get('#selectheight input').clear({force:true}) + cy.cGet('#selectheight input').clear({force:true}) .type('2{enter}', {force:true}); cy.wait(1000); @@ -47,11 +47,11 @@ describe('Image Operation Tests', function() { assertImageSize(139, 93); //Keep ratio checked - cy.get('#ratio input').check(); + cy.cGet('#ratio input').check(); helper.waitUntilIdle('#selectheight input'); - cy.get('#selectheight input').clear({force:true}) + cy.cGet('#selectheight input').clear({force:true}) .type('5{enter}', {force:true}); cy.wait(1000); diff --git a/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js b/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js index f3478d42d4..a79639eb55 100644 --- a/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js +++ b/cypress_test/integration_tests/desktop/writer/open_different_file_types_spec.js @@ -23,42 +23,26 @@ describe('Open different file types', function() { //assert text and its properties var container = '#copy-paste-container'; - cy.get(container + ' p font') - .should('have.attr', 'size', '6'); - - cy.get(container + ' p font b') - .should('exist'); - - cy.get(container + ' p font b') - .should('exist').and('have.text', 'LibreOffice'); - + cy.cGet(container + ' p font').should('have.attr', 'size', '6'); + cy.cGet(container + ' p font b').should('exist'); + cy.cGet(container + ' p font b').should('exist').and('have.text', 'LibreOffice'); //assert table cells helper.typeIntoDocument('{home}{downarrow}'); - helper.typeIntoDocument('{shift}{rightarrow}{rightarrow}{rightarrow}{rightarrow}'); - - cy.get(container + ' table') - .should('exist'); - - cy.get('#copy-paste-container colgroup').find('col') - .should('have.length', 4); - - cy.get('#copy-paste-container tbody').find('tr') - .should('have.length', 1); - + cy.cGet(container + ' table').should('exist'); + cy.cGet('#copy-paste-container colgroup').find('col').should('have.length', 4); + cy.cGet('#copy-paste-container tbody').find('tr').should('have.length', 1); helper.typeIntoDocument('{downarrow}'); - helper.waitUntilIdle('.leaflet-cursor.blinking-cursor'); // Click right to the blinking cursor position. - cy.get('.leaflet-cursor.blinking-cursor') + cy.cGet('.leaflet-cursor.blinking-cursor') .then(function(cursor) { var boundRect = cursor[0].getBoundingClientRect(); var XPos = boundRect.right + 10; var YPos = (boundRect.top + boundRect.bottom) / 2; - cy.get('body') - .click(XPos, YPos); + cy.cGet('body').click(XPos, YPos); }); //assert image @@ -67,25 +51,21 @@ describe('Open different file types', function() { it('Open doc file', function() { before('testfile.doc'); - assertData(); }); it('Open docx file', function() { before('testfile.docx'); - assertData(); }); it('Open docm file', function() { before('testfile.docm'); - assertData(); }); it('Open fodt file', function() { before('testfile.fodt'); - assertData(); }); diff --git a/cypress_test/integration_tests/desktop/writer/scrolling_spec.js b/cypress_test/integration_tests/desktop/writer/scrolling_spec.js index 4c30613b48..21e09aca71 100644 --- a/cypress_test/integration_tests/desktop/writer/scrolling_spec.js +++ b/cypress_test/integration_tests/desktop/writer/scrolling_spec.js @@ -9,11 +9,8 @@ describe('Scroll through document', function() { beforeEach(function() { helper.beforeAll(testFileName, 'writer'); - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); - - cy.get('#tb_editbar_item_sidebar') - .click(); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); + cy.cGet('#tb_editbar_item_sidebar').click(); }); afterEach(function() { @@ -21,59 +18,34 @@ describe('Scroll through document', function() { }); it('Scrolling to bottom/top', function() { - desktopHelper.selectZoomLevel('40'); - helper.typeIntoDocument('{ctrl}{home}'); - //scroll to bottom - cy.get('#StatePageNumber').should('have.text', 'Page 1 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 4'); desktopHelper.pressKey(2, 'pagedown'); - - cy.get('#StatePageNumber').should('have.text', 'Page 2 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 2 of 4'); desktopHelper.pressKey(1, 'pagedown'); - - cy.get('#StatePageNumber').should('have.text', 'Page 3 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 3 of 4'); desktopHelper.pressKey(1, 'pagedown'); - - cy.get('#StatePageNumber').should('have.text', 'Page 4 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 4 of 4'); //scroll to top desktopHelper.pressKey(1, 'pageup'); - - cy.get('#StatePageNumber').should('have.text', 'Page 3 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 3 of 4'); desktopHelper.pressKey(1, 'pageup'); - - cy.get('#StatePageNumber').should('have.text', 'Page 2 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 2 of 4'); desktopHelper.pressKey(2, 'pageup'); - - cy.get('#StatePageNumber').should('have.text', 'Page 1 of 4'); - + cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 4'); }); it.skip('Scrolling to left/right', function() { - cy.get('#toolbar-down').click(); - + cy.cGet('#toolbar-down').click(); desktopHelper.selectZoomLevel('200'); - //show horizontal scrollbar - cy.get('.leaflet-layer') - .click('bottom'); - + cy.cGet('.leaflet-layer').click('bottom'); cy.wait(500); - helper.typeIntoDocument('{home}{end}{home}'); - - cy.get('#test-div-horizontal-scrollbar') - .should('have.text', '0'); - + cy.cGet('#test-div-horizontal-scrollbar').should('have.text', '0'); helper.typeIntoDocument('{end}{home}{end}'); - desktopHelper.assertScrollbarPosition('horizontal', 570, 653); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/searchbar_spec.js b/cypress_test/integration_tests/desktop/writer/searchbar_spec.js index 4323027299..51c0387e91 100644 --- a/cypress_test/integration_tests/desktop/writer/searchbar_spec.js +++ b/cypress_test/integration_tests/desktop/writer/searchbar_spec.js @@ -27,84 +27,44 @@ describe('Searching via search bar' ,function() { it('Search not existing word.', function() { writerHelper.selectAllTextOfDoc(); - - cy.get('input#search-input') - .clear() - .type('q'); - - cy.get('input#search-input') - .should('have.prop', 'value', 'q'); - - cy.get('#tb_actionbar_item_searchprev') - .should('have.class', 'disabled'); - - cy.get('#tb_actionbar_item_searchnext') - .should('have.class', 'disabled'); - - cy.get('#tb_actionbar_item_cancelsearch') - .should('not.be.visible'); - + cy.cGet('input#search-input').clear().type('q'); + cy.cGet('input#search-input').should('have.prop', 'value', 'q'); + cy.cGet('#tb_actionbar_item_searchprev').should('have.class', 'disabled'); + cy.cGet('#tb_actionbar_item_searchnext').should('have.class', 'disabled'); + cy.cGet('#tb_actionbar_item_cancelsearch').should('not.be.visible'); helper.textSelectionShouldNotExist(); }); it('Search next / prev instance.', function() { searchHelper.typeIntoSearchFieldDesktop('a'); - helper.textSelectionShouldExist(); - helper.expectTextForClipboard('a'); - - cy.get('#copy-paste-container p b') - .should('not.exist'); - + cy.cGet('#copy-paste-container p b').should('not.exist'); //search next instance searchHelper.searchNextDesktop(); - - cy.get('#copy-paste-container p b') - .should('exist'); - + cy.cGet('#copy-paste-container p b').should('exist'); helper.textSelectionShouldExist(); - helper.expectTextForClipboard('a'); - // Search prev instance searchHelper.searchPrevDesktop(); - - cy.get('#copy-paste-container p b') - .should('not.exist'); - + cy.cGet('#copy-paste-container p b').should('not.exist'); helper.textSelectionShouldExist(); - helper.expectTextForClipboard('a'); }); it('Search wrap at document end.', function() { searchHelper.typeIntoSearchFieldDesktop('a'); - helper.textSelectionShouldExist(); - helper.expectTextForClipboard('a'); - - cy.get('#copy-paste-container p b') - .should('not.exist'); - + cy.cGet('#copy-paste-container p b').should('not.exist'); // Search next instance searchHelper.searchNextDesktop(); - - cy.get('#copy-paste-container p b') - .should('exist'); - + cy.cGet('#copy-paste-container p b').should('exist'); helper.textSelectionShouldExist(); - helper.expectTextForClipboard('a'); - // Search next instance, which is in the beginning of the document. searchHelper.searchNextDesktop(); - - cy.get('#copy-paste-container p b') - .should('not.exist'); - + cy.cGet('#copy-paste-container p b').should('not.exist'); helper.textSelectionShouldExist(); - helper.expectTextForClipboard('a'); }); @@ -121,7 +81,6 @@ describe('Searching via search bar' ,function() { helper.textSelectionShouldNotExist(); - cy.get('input#search-input') - .should('be.visible'); + cy.cGet('input#search-input').should('be.visible'); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/statusbar_spec.js b/cypress_test/integration_tests/desktop/writer/statusbar_spec.js index 6747518c8e..e0179fa452 100644 --- a/cypress_test/integration_tests/desktop/writer/statusbar_spec.js +++ b/cypress_test/integration_tests/desktop/writer/statusbar_spec.js @@ -20,77 +20,43 @@ describe('Statubar tests.', function() { }); it('Text selection.', function() { - cy.get('#StateWordCount') - .should('have.text', '2 words, 9 characters'); - + cy.cGet('body').contains('#tb_actionbar_item_StateWordCount', '2 words, 9 characters'); helper.moveCursor('right', 'shift'); - - cy.get('#StateWordCount') - .should('have.text', 'Selected: 1 word, 1 character'); + cy.cGet('body').contains('#tb_actionbar_item_StateWordCount', 'Selected: 1 word, 1 character'); }); it('Switching page.', function() { - cy.get('#StatePageNumber') - .should('have.text', 'Page 1 of 1'); - - cy.get('#menu-insert') - .click(); - - cy.contains('#menu-insert li a', 'Page Break') - .click(); - - cy.get('#StatePageNumber') - .should('have.text', 'Pages 1 and 2 of 2'); - - cy.get('#tb_actionbar_item_prev') - .click(); - - cy.get('#StatePageNumber') - .should('have.text', 'Page 1 of 2'); - - cy.get('#tb_actionbar_item_next') - .click(); - - cy.get('#StatePageNumber') - .should('have.text', 'Pages 1 and 2 of 2'); + cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 1'); + cy.cGet('#menu-insert').click(); + cy.cGet('body').contains('#menu-insert li a', 'Page Break').click(); + cy.cGet('#StatePageNumber').should('have.text', 'Pages 1 and 2 of 2'); + cy.cGet('#tb_actionbar_item_prev').click(); + cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 2'); + cy.cGet('#tb_actionbar_item_next').click(); + cy.cGet('#StatePageNumber').should('have.text', 'Pages 1 and 2 of 2'); }); it('Text entering mode.', function() { - cy.get('#InsertMode') - .should('have.text', 'Insert'); - + cy.cGet('#InsertMode').should('have.text', 'Insert'); helper.typeIntoDocument('{insert}'); - - cy.get('#InsertMode') - .should('have.text', 'Overwrite'); - + cy.cGet('#InsertMode').should('have.text', 'Overwrite'); helper.typeIntoDocument('{insert}'); - - cy.get('#InsertMode') - .should('have.text', 'Insert'); + cy.cGet('#InsertMode').should('have.text', 'Insert'); }); it('Change zoom level.', function() { desktopHelper.resetZoomLevel(); - desktopHelper.shouldHaveZoomLevel('100'); - desktopHelper.zoomIn(); - desktopHelper.shouldHaveZoomLevel('120'); - desktopHelper.zoomOut(); - desktopHelper.shouldHaveZoomLevel('100'); }); it('Select zoom level.', function() { desktopHelper.resetZoomLevel(); - desktopHelper.shouldHaveZoomLevel('100'); - desktopHelper.selectZoomLevel('280'); - desktopHelper.shouldHaveZoomLevel('280'); }); }); diff --git a/cypress_test/integration_tests/desktop/writer/table_operation_spec.js b/cypress_test/integration_tests/desktop/writer/table_operation_spec.js index b968da5565..92ebfb0092 100644 --- a/cypress_test/integration_tests/desktop/writer/table_operation_spec.js +++ b/cypress_test/integration_tests/desktop/writer/table_operation_spec.js @@ -22,63 +22,52 @@ describe('Table operations', function() { helper.typeIntoDocument('{ctrl}{a}'); - cy.get('#copy-paste-container table') - .should('exist'); + cy.cGet('#copy-paste-container table').should('exist'); } it('Insert row before.', function() { - helper.clickOnIdle('#insert .unoInsertRowsBefore'); - - cy.get('.leaflet-marker-icon.table-row-resize-marker') - .should('have.length', 4); + cy.cGet('.leaflet-marker-icon.table-row-resize-marker').should('have.length', 4); selectFullTable(); // Check rows / columns - cy.get('#copy-paste-container tr') + cy.cGet('#copy-paste-container tr') .should(function(rows) { expect(rows).to.have.lengthOf(4); expect(rows[0].textContent).to.not.have.string('text'); expect(rows[1].textContent).to.have.string('text'); }); - cy.get('#copy-paste-container td') - .should('have.length', 8); + cy.cGet('#copy-paste-container td').should('have.length', 8); }); it('Insert row after.', function() { - helper.clickOnIdle('#insert .unoInsertRowsAfter'); - - cy.get('.leaflet-marker-icon.table-row-resize-marker') - .should('have.length', 4); + cy.cGet('.leaflet-marker-icon.table-row-resize-marker').should('have.length', 4); selectFullTable(); // Check rows / columns - cy.get('#copy-paste-container tr') + cy.cGet('#copy-paste-container tr') .should(function(rows) { expect(rows).to.have.lengthOf(4); expect(rows[0].textContent).to.have.string('text'); expect(rows[1].textContent).to.not.have.string('text'); }); - cy.get('#copy-paste-container td') - .should('have.length', 8); + cy.cGet('#copy-paste-container td').should('have.length', 8); }); it('Insert column before.', function() { helper.clickOnIdle('#insert .unoInsertColumnsBefore'); - cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('have.length', 4); + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('have.length', 4); selectFullTable(); // Check rows / columns - cy.get('#copy-paste-container tr') - .should('have.length', 3); - cy.get('#copy-paste-container td') + cy.cGet('#copy-paste-container tr').should('have.length', 3); + cy.cGet('#copy-paste-container td') .should(function(columns) { expect(columns).to.have.lengthOf(9); expect(columns[0].textContent).to.not.have.string('text'); @@ -90,15 +79,13 @@ describe('Table operations', function() { it('Insert column after.', function() { helper.clickOnIdle('#insert .unoInsertColumnsAfter'); - cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('have.length', 4); + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('have.length', 4); selectFullTable(); // Check rows / columns - cy.get('#copy-paste-container tr') - .should('have.length', 3); - cy.get('#copy-paste-container td') + cy.cGet('#copy-paste-container tr').should('have.length', 3); + cy.cGet('#copy-paste-container td') .should(function(columns) { expect(columns).to.have.lengthOf(9); expect(columns[0].textContent).to.have.string('text'); @@ -109,41 +96,35 @@ describe('Table operations', function() { it('Delete row.', function() { helper.clickOnIdle('#delete .unoDeleteRows'); - cy.get('.leaflet-marker-icon.table-row-resize-marker') - .should('have.length', 2); + cy.cGet('.leaflet-marker-icon.table-row-resize-marker').should('have.length', 2); selectFullTable(); // Check rows / columns - cy.get('#copy-paste-container tr') + cy.cGet('#copy-paste-container tr') .should(function(rows) { expect(rows).to.have.lengthOf(2); expect(rows[0].textContent).to.not.have.string('text'); expect(rows[1].textContent).to.not.have.string('text'); }); - cy.get('#copy-paste-container td') - .should('have.length', 4); + cy.cGet('#copy-paste-container td').should('have.length', 4); }); it('Delete column.', function() { // Insert column first helper.clickOnIdle('#insert .unoInsertColumnsBefore'); - cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('have.length', 4); + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('have.length', 4); // Then delete it helper.clickOnIdle('#delete .unoDeleteColumns'); - - cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('have.length', 3); + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('have.length', 3); }); it('Delete table.', function() { helper.clickOnIdle('#delete .unoDeleteTable'); - cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('not.exist'); + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('not.exist'); }); it('Merge cells.', function() { @@ -155,13 +136,12 @@ describe('Table operations', function() { // We use cursor position as the indicator of layout change. helper.getCursorPos('top', 'origCursorPos'); - helper.clickOnIdle('#split_merge .unoMergeCells'); - // Cursor was in the second row originally. // With merging two rows, the cursor is moved into the first row. cy.get('@origCursorPos') .then(function(origCursorPos) { - cy.get('.blinking-cursor') + helper.clickOnIdle('#split_merge .unoMergeCells'); + cy.cGet('.blinking-cursor') .should(function(cursor) { expect(cursor.offset().top).to.be.lessThan(origCursorPos); }); @@ -170,25 +150,18 @@ describe('Table operations', function() { selectFullTable(); // Check rows / columns - cy.get('#copy-paste-container tr') - .should('have.length', 2); - cy.get('#copy-paste-container td') - .should('have.length', 3); + cy.cGet('#copy-paste-container tr').should('have.length', 2); + cy.cGet('#copy-paste-container td').should('have.length', 3); }); //Fixme: bug in notebookbar cannot change the rowheight when the table already exist in document it('Change row height.', function() { if (mode === 'classic') { - cy.get('#rowheight .spinfield') - .should('have.value', '0'); - + cy.cGet('#rowheight .spinfield').should('have.value', '0'); helper.typeIntoInputField('#rowheight .spinfield', '1.4', true, false); - selectFullTable(); - // Check row height - cy.get('#copy-paste-container td') - .should('have.attr', 'height', '134'); + cy.cGet('#copy-paste-container td').should('have.attr', 'height', '134'); } }); @@ -196,12 +169,9 @@ describe('Table operations', function() { it('Change column width.', function() { if (mode === 'classic') { helper.typeIntoInputField('#columnwidth .spinfield', '1.6', true, false); - selectFullTable(); - // Check column width - cy.get('#copy-paste-container td') - .should('have.attr', 'width', '23%'); + cy.cGet('#copy-paste-container td').should('have.attr', 'width', '23%'); } }); @@ -217,23 +187,19 @@ describe('Table operations', function() { selectFullTable(); // Check new row height - cy.get('#copy-paste-container td') - .should('not.have.attr', 'height'); + cy.cGet('#copy-paste-container td').should('not.have.attr', 'height'); }); it('Set optimal row height.', function() { - // Select full table (3x2) helper.moveCursor('down', 'shift'); helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); - helper.clickOnIdle('#rowsizing .unoSetOptimalRowHeight'); - selectFullTable(); // Check new row height - cy.get('#copy-paste-container td') + cy.cGet('#copy-paste-container td') .should(function(items) { expect(items).to.have.lengthOf(6); for (var i = 0; i < items.length; i++) { @@ -256,7 +222,7 @@ describe('Table operations', function() { selectFullTable(); // Check new row height - cy.get('#copy-paste-container td') + cy.cGet('#copy-paste-container td') .should(function(items) { expect(items).have.lengthOf(6); for (var i = 0; i < items.length; i++) { @@ -278,8 +244,7 @@ describe('Table operations', function() { selectFullTable(); - cy.get('#copy-paste-container td') - .should('have.attr', 'width', '25'); + cy.cGet('#copy-paste-container td').should('have.attr', 'width', '25'); }); it('Set optimal column width.', function() { @@ -292,10 +257,8 @@ describe('Table operations', function() { selectFullTable(); - cy.get('#copy-paste-container td:nth-of-type(1n)') - .should('have.attr', 'width', '90%'); - cy.get('#copy-paste-container td:nth-of-type(2n)') - .should('have.attr', 'width', '10%'); + cy.cGet('#copy-paste-container td:nth-of-type(1n)').should('have.attr', 'width', '90%'); + cy.cGet('#copy-paste-container td:nth-of-type(2n)').should('have.attr', 'width', '10%'); }); it('Distribute columns.', function() { @@ -308,8 +271,7 @@ describe('Table operations', function() { selectFullTable(); - cy.get('#copy-paste-container td') - .should('have.attr', 'width', '50%'); + cy.cGet('#copy-paste-container td').should('have.attr', 'width', '50%'); }); it('Split Cells', function() { @@ -319,33 +281,20 @@ describe('Table operations', function() { helper.waitUntilIdle('#copy-paste-container'); - cy.get('#copy-paste-container colgroup').find('col') - .should('have.length', 2); - - cy.get('#copy-paste-container tbody').find('tr') - .should('have.length', 3); - + cy.cGet('#copy-paste-container colgroup').find('col').should('have.length', 2); + cy.cGet('#copy-paste-container tbody').find('tr').should('have.length', 3); helper.typeIntoDocument('{leftarrow}'); - - cy.get('.unospan-split_merge.unoSplitCell') - .click(); - - cy.get('.lokdialog.ui-dialog-content.ui-widget-content').should('exist'); - - cy.get('.lokdialog.ui-dialog-content.ui-widget-content').click(); - - cy.get('#ok.ui-pushbutton.jsdialog').should('exist'); - - cy.get('#ok.ui-pushbutton.jsdialog').click(); + cy.cGet('.unospan-split_merge.unoSplitCell').click(); + cy.cGet('.lokdialog.ui-dialog-content.ui-widget-content').should('exist'); + cy.cGet('.lokdialog.ui-dialog-content.ui-widget-content').click(); + cy.cGet('#ok.ui-pushbutton.jsdialog').should('exist'); + cy.cGet('#ok.ui-pushbutton.jsdialog').click(); helper.typeIntoDocument('{ctrl}{a}'); helper.waitUntilIdle('#copy-paste-container'); - cy.get('#copy-paste-container colgroup').find('col') - .should('have.length', 2); - - cy.get('#copy-paste-container tbody').find('tr') - .should('have.length', 4); + cy.cGet('#copy-paste-container colgroup').find('col').should('have.length', 2); + cy.cGet('#copy-paste-container tbody').find('tr').should('have.length', 4); }); }); 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 d6a661d37d..4cc4570654 100644 --- a/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js +++ b/cypress_test/integration_tests/desktop/writer/top_toolbar_spec.js @@ -29,255 +29,192 @@ describe('Top toolbar tests.', function() { } it('Apply highlight color.', function() { - desktopHelper.actionOnSelector('backColor', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('backColor', (selector) => { cy.cGet(selector).click(); }); desktopHelper.selectColorFromPalette('FFF2CC'); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p font span') + cy.cGet('#copy-paste-container p font span') .should('have.attr', 'style', 'background: #fff2cc'); }); it('Apply font color.', function() { - desktopHelper.actionOnSelector('fontColor', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('fontColor', (selector) => { cy.cGet(selector).click(); }); desktopHelper.selectColorFromPalette('8E7CC3'); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p font') - .should('have.attr', 'color', '#8e7cc3'); + cy.cGet('#copy-paste-container p font').should('have.attr', 'color', '#8e7cc3'); }); it('Apply style.', function() { if (mode === 'notebookbar') { - cy.get('.notebookbar.ui-iconview-entry img[title=Title]') - .click({force: true}); + cy.cGet('.notebookbar.ui-iconview-entry img[title=Title]').click({force: true}); } else { - cy.get('#tb_editbar_item_styles') - .click(); - + cy.cGet('#tb_editbar_item_styles').click(); desktopHelper.selectFromListbox('Title'); } refreshCopyPasteContainer(); - cy.get('#copy-paste-container p font font') - .should('have.attr', 'style', 'font-size: 28pt'); + cy.cGet('#copy-paste-container p font font').should('have.attr', 'style', 'font-size: 28pt'); }); it('Apply font name.', function() { - desktopHelper.actionOnSelector('fontName', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('fontName', (selector) => { cy.cGet(selector).click(); }); desktopHelper.selectFromListbox('Alef'); - refreshCopyPasteContainer(); - - cy.get('#copy-paste-container p font') - .should('have.attr', 'face', 'Alef, sans-serif'); + cy.cGet('#copy-paste-container p font').should('have.attr', 'face', 'Alef, sans-serif'); }); - it('Apply bold font.', function() { - desktopHelper.actionOnSelector('bold', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('bold', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p b') - .should('exist'); + cy.cGet('#copy-paste-container p b').should('exist'); }); it('Apply italic font.', function() { - desktopHelper.actionOnSelector('italic', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('italic', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p i') - .should('exist'); + cy.cGet('#copy-paste-container p i').should('exist'); }); it('Apply underline.', function() { - desktopHelper.actionOnSelector('underline', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('underline', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p u') - .should('exist'); + cy.cGet('#copy-paste-container p u').should('exist'); }); it('Apply strikethrough.', function() { - desktopHelper.actionOnSelector('strikeout', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('strikeout', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p strike') - .should('exist'); + cy.cGet('#copy-paste-container p strike').should('exist'); }); it('Apply font size', function() { - desktopHelper.actionOnSelector('fontSize', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('fontSize', (selector) => { cy.cGet(selector).click(); }); desktopHelper.selectFromListbox('72'); - refreshCopyPasteContainer(); - - cy.get('#copy-paste-container p font') - .should('have.attr', 'style', 'font-size: 72pt'); + cy.cGet('#copy-paste-container p font').should('have.attr', 'style', 'font-size: 72pt'); }); it('Clear direct formatting', function() { - desktopHelper.actionOnSelector('bold', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('bold', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p b') - .should('exist'); - - desktopHelper.actionOnSelector('clearFormat', (selector) => { cy.get(selector).click(); }); - + cy.cGet('#copy-paste-container p b').should('exist'); + desktopHelper.actionOnSelector('clearFormat', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p b') - .should('not.exist'); + cy.cGet('#copy-paste-container p b').should('not.exist'); }); it('Apply left/right alignment.', function() { - desktopHelper.actionOnSelector('rightPara', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('rightPara', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p') - .should('have.attr', 'align', 'right'); - - desktopHelper.actionOnSelector('leftPara', (selector) => { cy.get(selector).click(); }); - + cy.cGet('#copy-paste-container p').should('have.attr', 'align', 'right'); + desktopHelper.actionOnSelector('leftPara', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p') - .should('have.attr', 'align', 'left'); + cy.cGet('#copy-paste-container p').should('have.attr', 'align', 'left'); }); it('Apply center alignment.', function() { - desktopHelper.actionOnSelector('centerPara', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('centerPara', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p') - .should('have.attr', 'align', 'center'); + cy.cGet('#copy-paste-container p').should('have.attr', 'align', 'center'); }); it('Apply justified.', function() { - desktopHelper.actionOnSelector('justifyPara', (selector) => { cy.get(selector).click(); }); - + desktopHelper.actionOnSelector('justifyPara', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p') - .should('have.attr', 'align', 'justify'); + cy.cGet('#copy-paste-container p').should('have.attr', 'align', 'justify'); }); it('Apply Line spacing: 1 and 1.5', function() { - desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.get(selector).click(); }); - - cy.contains('.menu-text', 'Line Spacing: 1.5') - .click(); - + desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.cGet(selector).click(); }); + cy.cGet('body').contains('.menu-text', 'Line Spacing: 1.5').click(); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p') - .should('have.attr', 'style') - .should('contain', 'line-height: 150%'); - - desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.get(selector).click(); }); - - cy.contains('.menu-text', 'Line Spacing: 1') - .click(); - + cy.cGet('#copy-paste-container p').should('have.attr', 'style').should('contain', 'line-height: 150%'); + desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.cGet(selector).click(); }); + cy.cGet('body').contains('.menu-text', 'Line Spacing: 1').click(); writerHelper.selectAllTextOfDoc(); - - cy.get('#copy-paste-container p') - .should('have.attr', 'style') - .should('contain', 'line-height: 100%'); + cy.cGet('#copy-paste-container p').should('have.attr', 'style').should('contain', 'line-height: 100%'); }); it('Apply Line spacing: 2', function() { - desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.cGet(selector).click(); }); - cy.contains('.menu-text', 'Line Spacing: 2') - .click(); + cy.cGet('body').contains('.menu-text', 'Line Spacing: 2').click(); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p') - .should('have.attr', 'style') - .should('contain', 'line-height: 200%'); + cy.cGet('#copy-paste-container p').should('have.attr', 'style').should('contain', 'line-height: 200%'); }); it('Increase/Decrease Paragraph spacing', function() { - desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.cGet(selector).click(); }); - cy.contains('.menu-text', 'Increase Paragraph Spacing') + cy.cGet('body').contains('.menu-text', 'Increase Paragraph Spacing') .click(); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p') - .should('have.attr', 'style') + cy.cGet('#copy-paste-container p').should('have.attr', 'style') .should('contain', 'margin-top: 0.04in'); writerHelper.selectAllTextOfDoc(); //Decrease Paragraph Spacing - desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('lineSpacing', (selector) => { cy.cGet(selector).click(); }); - cy.contains('.menu-text', 'Decrease Paragraph Spacing') + cy.cGet('body').contains('.menu-text', 'Decrease Paragraph Spacing') .click(); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p') + cy.cGet('#copy-paste-container p') .should('have.attr', 'style') .should('not.contain', 'margin-top: 0.04in'); }); it('Toggle numbered list.', function() { - desktopHelper.actionOnSelector('numberedList', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('numberedList', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container ol') + cy.cGet('#copy-paste-container ol') .should('exist'); }); it('Toggle bulleted list.', function() { - mode !== 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; + mode !== 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; - desktopHelper.actionOnSelector('bulletList', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('bulletList', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container ul') + cy.cGet('#copy-paste-container ul') .should('exist'); }); it('Increase/Decrease Indent.', function() { - mode !== 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; + mode !== 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; //Increase indent - desktopHelper.actionOnSelector('incrementIndent', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('incrementIndent', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p') + cy.cGet('#copy-paste-container p') .should('have.attr', 'style') .should('contain', 'margin-left: 0.49in'); //Decrease indent - desktopHelper.actionOnSelector('decrementIndent', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('decrementIndent', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p') + cy.cGet('#copy-paste-container p') .should('have.attr', 'style') .should('not.contain', 'margin-left: 0.49in'); }); @@ -285,126 +222,104 @@ describe('Top toolbar tests.', function() { it('Insert comment.', function() { desktopHelper.insertMultipleComment('writer', 1, false); - cy.get('.cool-annotation-content-wrapper').should('exist'); + cy.cGet('.cool-annotation-content-wrapper').should('exist'); - cy.get('#annotation-content-area-1').should('contain','some text0'); + cy.cGet('#annotation-content-area-1').should('contain','some text0'); }); it('Insert/delete table.', function() { - cy.get('#toolbar-up .w2ui-scroll-right') + cy.cGet('#toolbar-up .w2ui-scroll-right') .click(); - mode === 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; + mode === 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; cy.wait(500); - desktopHelper.actionOnSelector('insertTable', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('insertTable', (selector) => { cy.cGet(selector).click(); }); - cy.get('.inserttable-grid > .row > .col').eq(3) - .click(); + cy.cGet('.inserttable-grid > .row > .col').eq(3).click(); helper.typeIntoDocument('{ctrl}a'); - cy.get('#copy-paste-container table') - .should('exist'); + cy.cGet('#copy-paste-container table').should('exist'); helper.typeIntoDocument('{ctrl}a'); helper.typeIntoDocument('{shift}{del}'); - cy.get('.leaflet-marker-icon.table-column-resize-marker') - .should('not.exist'); + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('not.exist'); }); it('Insert image.', function() { - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); - mode === 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; + mode === 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; - desktopHelper.actionOnSelector('insertGraphic', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('insertGraphic', (selector) => { cy.cGet(selector).click(); }); - cy.get('#insertgraphic[type=file]') - .attachFile('/desktop/writer/image_to_insert.png'); - - cy.get('.leaflet-pane.leaflet-overlay-pane svg g.Graphic') - .should('exist'); + cy.cGet('#insertgraphic[type=file]').attachFile('/desktop/writer/image_to_insert.png'); + cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g.Graphic').should('exist'); }); it('Insert hyperlink.', function() { helper.expectTextForClipboard('text text1'); - mode === 'notebookbar' ? cy.get('#Insert-tab-label').click() : ''; + mode === 'notebookbar' ? cy.cGet('#Insert-tab-label').click() : ''; - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); - - desktopHelper.actionOnSelector('hyperLink', (selector) => { cy.get(selector).click(); }); - - cy.get('#hyperlink-link-box') - .should('exist'); - - cy.get('#hyperlink-text-box') - .type('link'); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); - cy.get('#hyperlink-link-box') - .type('www.something.com'); + desktopHelper.actionOnSelector('hyperLink', (selector) => { cy.cGet(selector).click(); }); - cy.get('#response-ok') - .click(); + cy.cGet('#hyperlink-link-box').should('exist'); + cy.cGet('#hyperlink-text-box').type('link'); + cy.cGet('#hyperlink-link-box').type('www.something.com'); + cy.cGet('#response-ok').click(); writerHelper.selectAllTextOfDoc(); helper.expectTextForClipboard('text text1link'); - cy.get('#copy-paste-container p a') + cy.cGet('#copy-paste-container p a') .should('have.attr', 'href', 'http://www.something.com/'); }); it('Insert/delete shape.', function() { - mode === 'notebookbar' ? cy.get('#Insert-tab-label').click() : ''; + mode === 'notebookbar' ? cy.cGet('#Insert-tab-label').click() : ''; - cy.get('#toolbar-up .w2ui-scroll-right') + cy.cGet('#toolbar-up .w2ui-scroll-right') .click(); - desktopHelper.actionOnSelector('insertShape', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('insertShape', (selector) => { cy.cGet(selector).click(); }); - cy.get('.col.w2ui-icon.basicshapes_octagon') - .click(); - - cy.get('.leaflet-pane.leaflet-overlay-pane svg g') - .should('exist'); + cy.cGet('.col.w2ui-icon.basicshapes_octagon').click(); + cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g').should('exist'); //delete helper.typeIntoDocument('{del}'); - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive') .should('not.exist'); }); it('Insert/delete chart.', function() { - mode === 'notebookbar' ? cy.get('#Insert-tab-label').click() : ''; - - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); + mode === 'notebookbar' ? cy.cGet('#Insert-tab-label').click() : ''; - desktopHelper.actionOnSelector('insertChart', (selector) => { cy.get(selector).click(); }); - - cy.get('.leaflet-pane.leaflet-overlay-pane svg g') - .should('exist'); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); + desktopHelper.actionOnSelector('insertChart', (selector) => { cy.cGet(selector).click(); }); + cy.cGet('.leaflet-pane.leaflet-overlay-pane svg g').should('exist'); //delete helper.typeIntoDocument('{del}'); - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive') .should('not.exist'); }); it.skip('Save.', function() { - desktopHelper.actionOnSelector('bold', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('bold', (selector) => { cy.cGet(selector).click(); }); - desktopHelper.actionOnSelector('save', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('save', (selector) => { cy.cGet(selector).click(); }); helper.reload(testFileName, 'writer', true); @@ -414,8 +329,7 @@ describe('Top toolbar tests.', function() { cy.wait(2000); - cy.get('#copy-paste-container p b') - .should('exist'); + cy.cGet('#copy-paste-container p b').should('exist'); }); it('Print', function() { @@ -425,9 +339,9 @@ describe('Top toolbar tests.', function() { cy.stub(win, 'open'); }); - mode === 'notebookbar' ? cy.get('#File-tab-label').click() : ''; + mode === 'notebookbar' ? cy.cGet('#File-tab-label').click() : ''; - desktopHelper.actionOnSelector('print', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('print', (selector) => { cy.cGet(selector).click(); }); helper.getCoolFrameWindow() .then(function(win) { @@ -436,81 +350,65 @@ describe('Top toolbar tests.', function() { }); it('Apply Undo/Redo.', function() { - desktopHelper.actionOnSelector('italic', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('italic', (selector) => { cy.cGet(selector).click(); }); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p i') - .should('exist'); + cy.cGet('#copy-paste-container p i').should('exist'); //Undo desktopHelper.actionOnSelector('undo', (selector) => { - cy.get(selector) - .should('not.have.class', 'disabled') - .click(); + cy.cGet(selector).should('not.have.class', 'disabled').click(); }); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p i') - .should('not.exist'); + cy.cGet('#copy-paste-container p i').should('not.exist'); //Redo desktopHelper.actionOnSelector('redo', (selector) => { - cy.get(selector) - .should('not.have.class', 'disabled') - .click(); + cy.cGet(selector).should('not.have.class', 'disabled').click(); }); - writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p i') - .should('exist'); + cy.cGet('#copy-paste-container p i').should('exist'); }); it('Show/Hide sidebar.', function() { //hide sidebar - mode !== 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; - - cy.get('#sidebar-dock-wrapper') - .should('be.visible'); - - desktopHelper.actionOnSelector('sidebar', (selector) => { cy.get(selector).click(); }); + mode !== 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; - cy.get('#sidebar-dock-wrapper') - .should('not.be.visible'); + cy.cGet('#sidebar-dock-wrapper').should('be.visible'); + desktopHelper.actionOnSelector('sidebar', (selector) => { cy.cGet(selector).click(); }); + cy.cGet('#sidebar-dock-wrapper').should('not.be.visible'); - mode !== 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-left').click() : ''; + mode !== 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-left').click() : ''; //show sidebar - mode !== 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; + mode !== 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; - cy.get('#sidebar-dock-wrapper') - .should('not.be.visible'); + cy.cGet('#sidebar-dock-wrapper').should('not.be.visible'); - desktopHelper.actionOnSelector('sidebar', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('sidebar', (selector) => { cy.cGet(selector).click(); }); - cy.get('#sidebar-dock-wrapper') - .should('be.visible'); + cy.cGet('#sidebar-dock-wrapper').should('be.visible'); }); it('Insert Special Character.', function() { - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); - mode === 'notebookbar' ? cy.get('#toolbar-up .w2ui-scroll-right').click() : ''; + mode === 'notebookbar' ? cy.cGet('#toolbar-up .w2ui-scroll-right').click() : ''; cy.wait(500); - desktopHelper.actionOnSelector('insertSymbol', (selector) => { cy.get(selector).click(); }); - - cy.get('.jsdialog-container.ui-dialog.ui-widget-content.lokdialog_container').should('be.visible'); + desktopHelper.actionOnSelector('insertSymbol', (selector) => { cy.cGet(selector).click(); }); - cy.get('.ui-dialog-title').should('have.text', 'Special Characters'); + cy.cGet('.jsdialog-container.ui-dialog.ui-widget-content.lokdialog_container').should('be.visible'); + cy.cGet('.ui-dialog-title').should('have.text', 'Special Characters'); helper.clickOnIdle('#favchar1'); @@ -521,25 +419,16 @@ describe('Top toolbar tests.', function() { it('Hide/show menu bar.', function() { if (mode !== 'notebookbar') { - cy.get('#main-menu') - .should('be.visible'); - - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); + cy.cGet('#main-menu').should('be.visible'); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); // Hide the menu first. - cy.get('#tb_editbar_item_fold') - .click(); - - cy.get('#main-menu') - .should('not.be.visible'); + cy.cGet('#tb_editbar_item_fold').click(); + cy.cGet('#main-menu').should('not.be.visible'); // Show it again. - cy.get('#tb_editbar_item_fold') - .click(); - - cy.get('#main-menu') - .should('be.visible'); + cy.cGet('#tb_editbar_item_fold').click(); + cy.cGet('#main-menu').should('be.visible'); } }); @@ -554,31 +443,29 @@ describe('Top toolbar tests.', function() { helper.textSelectionShouldExist(); // Apply bold and try to clone it to the whole word. - desktopHelper.actionOnSelector('bold', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('bold', (selector) => { cy.cGet(selector).click(); }); - desktopHelper.actionOnSelector('formatBrush', (selector) => { cy.get(selector).click(); }); + desktopHelper.actionOnSelector('formatBrush', (selector) => { cy.cGet(selector).click(); }); // Click at the blinking cursor position. - cy.get('.leaflet-cursor.blinking-cursor') + cy.cGet('.leaflet-cursor.blinking-cursor') .then(function(cursor) { var boundRect = cursor[0].getBoundingClientRect(); var XPos = boundRect.left; var YPos = (boundRect.top + boundRect.bottom) / 2; - cy.get('body') + cy.cGet('body') .click(XPos, YPos); }); writerHelper.selectAllTextOfDoc(); // Full word should have bold font. - cy.get('#copy-paste-container p b') - .should('contain', 'text'); + cy.cGet('#copy-paste-container p b').should('contain', 'text'); }); it('Insert Page Break', function() { - cy.get('#StatePageNumber') - .should('have.text', 'Page 1 of 1'); + cy.cGet('#StatePageNumber').should('have.text', 'Page 1 of 1'); helper.selectAllText(); @@ -589,19 +476,15 @@ describe('Top toolbar tests.', function() { helper.typeIntoDocument('{ctrl}{leftarrow}'); if (mode === 'notebookbar') { - cy.get('#Insert-tab-label').click(); + cy.cGet('#Insert-tab-label').click(); - cy.get('.unospan-Insert.unoInsertPagebreak') - .click(); + cy.cGet('.unospan-Insert.unoInsertPagebreak').click(); } else { - cy.get('#menu-insert').click(); - - cy.contains('[role=menuitem]', 'Page Break') - .click(); + cy.cGet('#menu-insert').click(); + cy.cGet('body').contains('[role=menuitem]', 'Page Break').click(); } - cy.get('#StatePageNumber') - .should('have.text', 'Pages 1 and 2 of 2'); + cy.cGet('#StatePageNumber').should('have.text', 'Pages 1 and 2 of 2'); helper.selectAllText(); @@ -610,7 +493,7 @@ describe('Top toolbar tests.', function() { helper.waitUntilIdle('#copy-paste-container'); - cy.get('#copy-paste-container').find('p').each($el => { + cy.cGet('#copy-paste-container').find('p').each($el => { cy.wrap($el) .invoke('text') .then(text => { @@ -634,38 +517,34 @@ describe('Top toolbar tests.', function() { writerHelper.selectAllTextOfDoc(); if (mode == 'notebookbar') { - cy.get('.unospan-Home.unoSuperScript') - .click(); + cy.cGet('.unospan-Home.unoSuperScript').click(); } else { // classic mode doesnot have superscript button helper.typeIntoDocument('{ctrl}{shift}p'); } - cy.get('.leaflet-layer').click('center'); + cy.cGet('.leaflet-layer').click('center'); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p sup') - .should('exist'); + cy.cGet('#copy-paste-container p sup').should('exist'); }); it('Apply subscript.', function() { writerHelper.selectAllTextOfDoc(); if (mode == 'notebookbar') { - cy.get('.unospan-Home.unoSubScript') - .click(); + cy.cGet('.unospan-Home.unoSubScript').click(); } else { // classic mode doesnot have subscript button helper.typeIntoDocument('{ctrl}{shift}b'); } - cy.get('.leaflet-layer').click('center'); + cy.cGet('.leaflet-layer').click('center'); writerHelper.selectAllTextOfDoc(); - cy.get('#copy-paste-container p sub') - .should('exist'); + cy.cGet('#copy-paste-container p sub').should('exist'); }); it('Delete Text', function() { @@ -685,33 +564,23 @@ describe('Top toolbar tests.', function() { if (mode == 'notebookbar') { - cy.get('#Insert-tab-label') - .click(); - - cy.get('#toolbar-up .w2ui-scroll-right') - .click(); - - cy.get('.unospan-Insert.unoFontworkGalleryFloater') - .click(); + cy.cGet('#Insert-tab-label').click(); + cy.cGet('#toolbar-up .w2ui-scroll-right').click(); + cy.cGet('.unospan-Insert.unoFontworkGalleryFloater').click(); } else { - cy.get('#menu-insert') - .click() - .contains('a','Fontwork...') - .click(); + cy.cGet('#menu-insert').click(); + cy.cGet('#menu-insert').contains('a','Fontwork...').click(); } - cy.get('#ok') - .click(); + cy.cGet('#ok').click(); - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') - .should('exist'); + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive').should('exist'); //delete helper.typeIntoDocument('{del}'); - cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') - .should('not.exist'); + cy.cGet('.leaflet-control-buttons-disabled path.leaflet-interactive').should('not.exist'); }); }); 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 c4188ce816..3a4dbf3a06 100644 --- a/cypress_test/integration_tests/desktop/writer/track_changes_spec.js +++ b/cypress_test/integration_tests/desktop/writer/track_changes_spec.js @@ -15,36 +15,26 @@ describe('Track Changes', function () { }); function confirmChange(action) { - cy.get('#menu-editmenu') - .click() - .get('#menu-changesmenu') - .click() - .contains(action) - .click(); + cy.cGet('#menu-editmenu').click(); + cy.cGet('#menu-changesmenu').click(); + cy.cGet('#menu-changesmenu').contains(action).click(); } //enable record for track changes function enableRecord() { - cy.get('#menu-editmenu') - .click() - .get('#menu-changesmenu') - .click() - .contains('Record') - .click(); + cy.cGet('#menu-editmenu').click(); + cy.cGet('#menu-changesmenu').click(); + cy.cGet('#menu-changesmenu').contains('Record').click(); //if we don't wait , the test will fail in CLI cy.wait(200); - cy.get('#menu-editmenu') - .click() - .get('#menu-changesmenu') - .click() - .contains('Record') - .should('have.class', 'lo-menu-item-checked'); + cy.cGet('#menu-editmenu').click(); + cy.cGet('#menu-changesmenu').click(); + cy.cGet('#menu-changesmenu').contains('Record').should('have.class', 'lo-menu-item-checked'); //to close - cy.get('#menu-changesmenu') - .click(); + cy.cGet('#menu-changesmenu').click(); } it('Accept All', function () { @@ -85,7 +75,7 @@ describe('Track Changes', function () { cy.wait(200); - cy.get('.leaflet-layer').click(); + cy.cGet('.leaflet-layer').click(); helper.selectAllText(); |