diff options
author | Rash419 <rashesh.padia@collabora.com> | 2021-11-01 12:37:19 +0530 |
---|---|---|
committer | Pranam Lashkari <plashkari628@gmail.com> | 2021-12-01 11:57:00 +0530 |
commit | 265c275a816fe9d1a624e30c859c4540db4d6459 (patch) | |
tree | fcf0c30e8607914c1b0cef7a3f6235de81b3a4d7 /cypress_test/integration_tests | |
parent | kit: removed back compatibility of textinput message (diff) | |
download | online-265c275a816fe9d1a624e30c859c4540db4d6459.tar.gz online-265c275a816fe9d1a624e30c859c4540db4d6459.zip |
cypress: update help dialog screenshot automatically
Signed-off-by: Rash419 <rashesh.padia@collabora.com>
Change-Id: I9f3e3c9cc7838f89d5a66a25c1f6dd0ef8f8a946
Diffstat (limited to 'cypress_test/integration_tests')
-rw-r--r-- | cypress_test/integration_tests/desktop/calc/help_dialog_update_spec.js | 50 | ||||
-rw-r--r-- | cypress_test/integration_tests/desktop/writer/help_dialog_update_spec.js | 266 |
2 files changed, 316 insertions, 0 deletions
diff --git a/cypress_test/integration_tests/desktop/calc/help_dialog_update_spec.js b/cypress_test/integration_tests/desktop/calc/help_dialog_update_spec.js new file mode 100644 index 0000000000..23a18eac89 --- /dev/null +++ b/cypress_test/integration_tests/desktop/calc/help_dialog_update_spec.js @@ -0,0 +1,50 @@ +// This spec file doesnot test anything and it is use to update +// help dialog screenshots. You can run this spec using: +// make UPDATE_SCREENSHOT=true check-desktop spec=calc/help_dialog_update_spec.js +// UPDATE_SCREENSHOT needs to be true otherwise cypress will not run the spec file and +// update the screenshot + +/* global describe it cy require Cypress afterEach beforeEach */ +var helper = require('../../common/helper'); +var calcHelper = require('../../common/calc_helper'); + +describe('Help dialog update', function() { + var testFileName = 'help_dialog.ods'; + + beforeEach(function() { + helper.beforeAll(testFileName, 'calc'); + }); + + afterEach(function() { + helper.afterAll(testFileName, this.currentTest.state); + }); + + it('Chart selected sidebar open', function() { + calcHelper.selectFirstColumn(); + + cy.get('#menu-insert') + .click() + .contains('Chart...') + .click(); + + helper.waitUntilIdle('.lokdialog_container'); + + cy.get('.lokdialog_container') + .click(); + + helper.typeIntoDocument('{shift}{enter}'); + + cy.get('#btnEditChart').click(); + + cy.wait(1000); + + cy.get('#main-document-content').screenshot('chart-wizard'); + + cy.task('copyFile', { + sourceDir: Cypress.env('SCREENSHOT_FOLDER')+ '/calc/help_dialog_update_spec.js/', + destDir: Cypress.env('IMAGES_FOLDER'), + fileName: 'chart-wizard.png', + }); + }); + +}); 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 new file mode 100644 index 0000000000..c082ca4b6f --- /dev/null +++ b/cypress_test/integration_tests/desktop/writer/help_dialog_update_spec.js @@ -0,0 +1,266 @@ +// This spec file doesnot test anything and it is use to update +// help dialog screenshots. You can run this spec using: +// make UPDATE_SCREENSHOT=true check-desktop spec=writer/help_dialog_update_spec.js +// UPDATE_SCREENSHOT needs to be true otherwise cypress will not run the spec file and +// update the screenshot + +/* global describe it cy require afterEach beforeEach Cypress*/ + +const { hideSidebar } = require('../../common/desktop_helper'); +var helper = require('../../common/helper'); +describe('Help dialog screenshot updation', function() { + var testFileName = 'help_dialog.odt'; + + beforeEach(function() { + helper.beforeAll(testFileName, 'writer'); + }); + + afterEach(function() { + helper.afterAll(testFileName, this.currentTest.state); + }); + + function copyScreenshot(fileName) { + cy.task('copyFile', { + sourceDir: Cypress.env('SCREENSHOT_FOLDER')+ '/writer/help_dialog_update_spec.js/', + destDir: Cypress.env('IMAGES_FOLDER'), + fileName: fileName, + }); + } + + 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'); + }); + }); + + 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'); + }); + }); + + it('Document repair', function() { + cy.get('#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('.leaflet-popup-content-wrapper') + .should('exist'); + + helper.waitUntilIdle('.leaflet-popup-content-wrapper'); + + cy.get('.leaflet-popup-content-wrapper') + .screenshot('repair-document'); + + copyScreenshot('repair-document.png'); + }); + + it('Comment', function() { + hideSidebar(); + + cy.get('#toolbar-up > .w2ui-scroll-right').click(); + + cy.get('#tb_editbar_item_insertannotation') + .click(); + + cy.get('#new-mobile-comment-input-area').type('comment added'); + + cy.get('.vex-dialog-button-primary').click(); + + cy.wait(1000); + + cy.get('.cool-annotation-collapsed').click(); + + cy.wait(1000); + + cy.get('.cool-annotation-content-wrapper').should('exist'); + + cy.get('#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'); + + 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'); + + helper.waitUntilIdle('#inserttable-popup'); + + cy.get('#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(); + + helper.waitUntilIdle('.lokdialog_container'); + + cy.get('.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'); + + copyScreenshot('special-character.png'); + }); + + it('manage changes', function() { + cy.get('#menu-editmenu') + .click() + .get('#menu-changesmenu') + .click() + .contains('Record') + .click(); + + helper.typeIntoDocument('Hello World'); + + cy.get('#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.get('.lokdialog_container') + .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'); + + copyScreenshot('page-style.png'); + }); + + it('Insert chart', function() { + hideSidebar(); + + cy.get('#menu-insert') + .click() + .contains('Chart...') + .click(); + + cy.wait(1000); + + cy.get('.leaflet-control-buttons-disabled path.leaflet-interactive') + .should('exist').screenshot('chart', {padding: 10}); + + copyScreenshot('chart.png'); + }); +}); |