diff options
author | Attila Szűcs <attila.szucs@collabora.com> | 2023-05-26 04:59:55 +0200 |
---|---|---|
committer | Szűcs Attila <129014284+aszucs3@users.noreply.github.com> | 2023-05-30 14:19:01 +0200 |
commit | f2d89c93a7a1904c38482fca6305592313b6bdc0 (patch) | |
tree | 81396d52f067cdf457b82b6f97e60c2971f43590 /cypress_test/integration_tests/desktop | |
parent | Navigator: cypress tests (diff) | |
download | online-f2d89c93a7a1904c38482fca6305592313b6bdc0.tar.gz online-f2d89c93a7a1904c38482fca6305592313b6bdc0.zip |
Navigator: more cypress tests
Added Desktop tests for calc and impress.
Signed-off-by: Attila Szűcs <attila.szucs@collabora.com>
Change-Id: I80616cc9e8a9dd7160e9b33fa50047db83911590
Diffstat (limited to 'cypress_test/integration_tests/desktop')
-rw-r--r-- | cypress_test/integration_tests/desktop/calc/navigator_spec.js | 86 | ||||
-rw-r--r-- | cypress_test/integration_tests/desktop/impress/navigator_spec.js | 128 |
2 files changed, 214 insertions, 0 deletions
diff --git a/cypress_test/integration_tests/desktop/calc/navigator_spec.js b/cypress_test/integration_tests/desktop/calc/navigator_spec.js new file mode 100644 index 0000000000..e15b31a3f4 --- /dev/null +++ b/cypress_test/integration_tests/desktop/calc/navigator_spec.js @@ -0,0 +1,86 @@ +/* global describe it cy beforeEach require afterEach */ + +var helper = require('../../common/helper'); +var { insertImage, deleteImage } = require('../../common/desktop_helper'); + +describe(['tagdesktop'], 'Navigator tests.', function () { + var origTestFileName = 'navigator.ods'; + var testFileName; + + beforeEach(function () { + testFileName = helper.beforeAll(origTestFileName, 'calc'); + + cy.cGet('#menu-view').click(); + cy.cGet('#menu-navigator').click(); + }); + + afterEach(function () { + helper.afterAll(testFileName, this.currentTest.state); + }); + + it('Jump to element. Navigator -> Document', function() { + // Doubleclick several items, and check if the view is jumed to there + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Comment1').dblclick(); + cy.cGet('input#addressInput').should('have.prop', 'value', 'O81'); + cy.cGet('#StatusDocPos').should('have.text', 'Sheet 3 of 24'); + + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Sheet22').dblclick(); + cy.cGet('#StatusDocPos').should('have.text', 'Sheet 22 of 24'); + + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'rName1').dblclick(); + cy.cGet('input#addressInput').should('have.prop', 'value', 'rName1'); + cy.cGet('#StatusDocPos').should('have.text', 'Sheet 2 of 24'); + + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'dRange').dblclick(); + cy.cGet('input#addressInput').should('have.prop', 'value', 'S21:T22'); + cy.cGet('#StatusDocPos').should('have.text', 'Sheet 3 of 24'); + }); + + // Clicking Document item does not select Navigator entry, not even in desktop app, so no need to test + + it('Rename sheet -> updated in Navigator', function () { + cy.cGet('.spreadsheet-tab.spreadsheet-tab-selected').rightclick(); + cy.cGet('body').contains('.context-menu-link', 'Rename Sheet...').click(); + cy.cGet('#modal-dialog-rename-calc-sheet').should('exist'); + cy.cGet('#input-modal-input').clear().type('renameSheet'); + cy.cGet('#response-ok').click(); + cy.cGet('.spreadsheet-tab.spreadsheet-tab-selected').should('have.text', 'renameSheet'); + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'renameSheet').should('exist'); + }); + + it('create items -> updated in Navigator', function () { + // Create a new Range name + cy.cGet('#menu-data').click(); + cy.cGet('#menu-data').contains('.has-submenu', 'Named Ranges and Expressions').parent().click(); + cy.cGet('#menu-data').contains('Define...').parent().click(); + cy.cGet('#DefineNameDialog').find('#edit').clear().type('rName2'); + cy.cGet('#DefineNameDialog').find('#range').clear().type('$Sheet5.$C$55:$C$56'); + cy.cGet('#DefineNameDialog').find('#add').click(); + + // Check if it exist in Navigator + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'rName2').should('exist'); + + // Check if clicking on it will move cursor there + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'rName2').dblclick(); + cy.cGet('input#addressInput').should('have.prop', 'value', 'rName2'); + cy.cGet('#StatusDocPos').should('have.text', 'Sheet 5 of 24'); + + // Insert a comment + cy.cGet('#menu-insert').click(); + cy.cGet('#menu-insertcomment').click(); + cy.cGet('#comment-container-new').type('commentNew'); + // We should click Save, but i could not check its name because clickin in ispector remove the dialog-rename-calc-sheet + // But any cind of click will result the same + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'rName2').dblclick(); + // Check if the commentNew is in the Navigator + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'commentNew').should('exist'); + + // Insert an image + insertImage('calc'); + // Check if it exist in Navigator + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Image 1').should('exist'); + // Delete the image, and check that is not in the Navigator + deleteImage(); + cy.cGet('#contentbox').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Image 1').should('not.exist'); + }); +}); diff --git a/cypress_test/integration_tests/desktop/impress/navigator_spec.js b/cypress_test/integration_tests/desktop/impress/navigator_spec.js new file mode 100644 index 0000000000..12923ca5c9 --- /dev/null +++ b/cypress_test/integration_tests/desktop/impress/navigator_spec.js @@ -0,0 +1,128 @@ +/* global describe it cy beforeEach require afterEach*/ + +var helper = require('../../common/helper'); +var desktopHelper = require('../../common/desktop_helper'); + +describe(['tagdesktop'], 'Scroll through document, insert/delete items', function() { + var origTestFileName = 'navigator.odp'; + var testFileName; + + beforeEach(function() { + testFileName = helper.beforeAll(origTestFileName, 'impress'); + + desktopHelper.selectZoomLevel('100'); + cy.cGet('#menu-view').click(); + cy.cGet('#menu-navigator').click(); + }); + + afterEach(function() { + helper.afterAll(testFileName, this.currentTest.state); + }); + + function checkIfItemNotExist(itemName) { + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', itemName).should('not.exist'); + } + + function checkIfItemSelectedAndVisible(itemName) { + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', itemName).should('be.visible'); + cy.cGet('#tree').find('.jsdialog.sidebar.ui-treeview-entry.ui-treeview-notexpandable.selected').find('.jsdialog.sidebar.ui-treeview-cell-text').should('have.text',itemName); + } + + function checkIfItemExSelectedAndVisible(itemName) { + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', itemName).should('be.visible'); + cy.cGet('#tree').find('.jsdialog.sidebar.ui-treeview-entry.ui-treeview-expandable.selected').find('.jsdialog.sidebar.ui-treeview-cell-text').should('have.text',itemName); + } + + it('Jump to element. Navigator -> Document', function() { + // Click items in navigator, and check if it goes to the right slide. + // items should be visible (scrolled right), but that is not tested yet + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 2 (Text Frame \'Text1\')').dblclick(); + cy.cGet('#PageStatus').should('have.text', 'Slide 2 of 4'); + + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Object 2').dblclick(); + cy.cGet('#PageStatus').should('have.text', 'Slide 4 of 4'); + + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 1 (Title text \'Title1\')').dblclick(); + cy.cGet('#PageStatus').should('have.text', 'Slide 1 of 4'); + + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 5 (Image)').dblclick(); + cy.cGet('#PageStatus').should('have.text', 'Slide 4 of 4'); + + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 4 (Text Frame \'T3\')').dblclick(); + cy.cGet('#PageStatus').should('have.text', 'Slide 3 of 4'); + + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 1 (SVG)').dblclick(); + cy.cGet('#PageStatus').should('have.text', 'Slide 4 of 4'); + }); + + it('Jump to element. Document -> Navigator', function() { + // Click some items in document, and check if Navigator will jump to it + // Risky: it clicks x,y coordinates, if scroll or layout change it may need to be changed + cy.cGet('#tb_actionbar_item_next').click(); + cy.cGet('body').click(600,360); + checkIfItemSelectedAndVisible('Shape 6 (Text Frame \'Text3\')'); + + cy.cGet('#tb_actionbar_item_next').click(); + cy.cGet('#tb_actionbar_item_next').click(); + cy.cGet('body').click(370,270); + checkIfItemSelectedAndVisible('Shape 1 (SVG)'); + + cy.cGet('#tb_actionbar_item_prev').click(); + cy.cGet('body').click(355,435); + // T2 is part of a group. The group will be selected in Navigator. + checkIfItemExSelectedAndVisible('Shape 3 (Group object)'); + + cy.cGet('#tb_actionbar_item_next').click(); + cy.cGet('body').click(500,520); //Object 3 + checkIfItemSelectedAndVisible('Object 3'); + + cy.cGet('#tb_actionbar_item_prev').click(); + cy.cGet('#tb_actionbar_item_prev').click(); + cy.cGet('#tb_actionbar_item_prev').click(); + cy.cGet('body').click(630,330); //Some text + checkIfItemSelectedAndVisible('Shape 2 (Text Frame \'Some text\')'); + }); + + it('Insert/delete updated on Navigator', function() { + //create a new sheet + helper.clickOnIdle('#tb_presentation-toolbar_item_insertpage'); + cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Slide 5').should('exist'); + cy.cGet('#toolbar-up > .w2ui-scroll-right').click(); + + //Insert Shape + cy.cGet('#tb_editbar_item_insertshapes').click(); + cy.cGet('.col.w2ui-icon.symbolshapes').click(); + checkIfItemSelectedAndVisible('Shape 3 (Shape)'); + //delete + helper.typeIntoDocument('{del}'); + checkIfItemNotExist('Shape 3 (Shape)'); + + //Insert Chart + cy.cGet('#tb_editbar_item_insertobjectchart').click(); + checkIfItemSelectedAndVisible('Object 4'); + //delete + helper.typeIntoDocument('{del}'); + checkIfItemNotExist('Object 4'); + + //Insert Table + cy.cGet('#menu-table').click(); + cy.cGet('body').contains('Insert Table...').click(); + cy.cGet('.lokdialog_canvas').click(); + helper.typeIntoDocument('{shift}{enter}'); + checkIfItemSelectedAndVisible('Shape 2 (Table)'); + // Table is inserted with the markers shown + cy.cGet('.leaflet-marker-icon.table-column-resize-marker').should('exist'); + cy.cGet('path.leaflet-interactive').rightclick({force:true}); + cy.cGet('body').contains('.context-menu-item', 'Delete').click(); + checkIfItemNotExist('Shape 2 (Table)'); + + //Insert Fontwork + cy.cGet('#menu-insert').click(); + cy.cGet('body').contains('a','Fontwork...').click(); + cy.cGet('#ok').click(); + checkIfItemSelectedAndVisible('Simple'); + //delete + helper.typeIntoDocument('{del}'); + checkIfItemNotExist('Simple'); + }); +}); |