summaryrefslogtreecommitdiffstats
path: root/cypress_test/integration_tests/desktop
diff options
context:
space:
mode:
authorAttila Szűcs <attila.szucs@collabora.com>2023-05-29 18:44:48 +0200
committerSzűcs Attila <129014284+aszucs3@users.noreply.github.com>2023-05-30 14:19:01 +0200
commit46a44c743a9020d9b935b7ff6bec81de3d4c6201 (patch)
tree6c04bdeb90e5a253e626a754b025d9b0cb045766 /cypress_test/integration_tests/desktop
parentNavigator: fix view->sidebar button in compact view (diff)
downloadonline-46a44c743a9020d9b935b7ff6bec81de3d4c6201.tar.gz
online-46a44c743a9020d9b935b7ff6bec81de3d4c6201.zip
Navigator: cypress test for draw
Added Desktop tests for draw Signed-off-by: Attila Szűcs <attila.szucs@collabora.com> Change-Id: I94a5048c8bf6082059375c5742fb781263c643f4
Diffstat (limited to 'cypress_test/integration_tests/desktop')
-rw-r--r--cypress_test/integration_tests/desktop/draw/navigator_spec.js119
1 files changed, 119 insertions, 0 deletions
diff --git a/cypress_test/integration_tests/desktop/draw/navigator_spec.js b/cypress_test/integration_tests/desktop/draw/navigator_spec.js
new file mode 100644
index 0000000000..0dfd6745c5
--- /dev/null
+++ b/cypress_test/integration_tests/desktop/draw/navigator_spec.js
@@ -0,0 +1,119 @@
+/* global describe it cy require afterEach beforeEach */
+
+var helper = require('../../common/helper');
+var desktopHelper = require('../../common/desktop_helper');
+
+describe(['tagdesktop'], 'Scroll through document, insert/delete items', function() {
+ var origTestFileName = 'navigator.odg';
+ var testFileName;
+
+ beforeEach(function() {
+ testFileName = helper.beforeAll(origTestFileName, 'draw');
+
+ 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 page.
+ // 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', 'Page 2 of 4');
+
+ cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Object 2').dblclick();
+ cy.cGet('#PageStatus').should('have.text', 'Page 4 of 4');
+
+ cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 1 (Text Frame \'Title1\')').dblclick();
+ cy.cGet('#PageStatus').should('have.text', 'Page 1 of 4');
+
+ cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 5 (Image)').dblclick();
+ cy.cGet('#PageStatus').should('have.text', 'Page 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', 'Page 3 of 4');
+
+ cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Shape 1 (SVG)').dblclick();
+ cy.cGet('#PageStatus').should('have.text', 'Page 4 of 4');
+ });
+
+ it('Jump to element. Document -> Navigator', function() {
+ // Click some items in document, and check if Navigator will jump to it. (if the items row will be selected, and visible)
+ // 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);
+ 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);
+ checkIfItemSelectedAndVisible('Shape 2 (Text Frame \'Some text\')');
+ });
+
+ it('Insert/delete updated on Navigator', function() {
+ //create a new page
+ helper.clickOnIdle('#tb_presentation-toolbar_item_insertpage');
+ cy.cGet('#tree').contains('.jsdialog.sidebar.ui-treeview-cell-text', 'Page 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 1 (Shape)');
+ //delete
+ helper.typeIntoDocument('{del}');
+ checkIfItemNotExist('Shape 1 (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 1 (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 1 (Table)');
+ });
+});