From 9981260b6872beec049c52f95efa493384c8aa00 Mon Sep 17 00:00:00 2001 From: Pranam Lashkari Date: Sun, 24 Mar 2024 18:12:59 +0530 Subject: [PATCH] cypress: added test for collapsed autosaved comment indication Signed-off-by: Pranam Lashkari Change-Id: I4e6929a074e750041a1814629317baf0433eaab0 --- .../common/desktop_helper.js | 2 ++ .../common/impress_helper.js | 4 +-- .../desktop/impress/annotation_spec.js | 32 ++++++++++++++++--- .../desktop/writer/annotation_spec.js | 32 +++++++++++++++++-- 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/cypress_test/integration_tests/common/desktop_helper.js b/cypress_test/integration_tests/common/desktop_helper.js index 5e087a5ca..fda1d0e2d 100644 --- a/cypress_test/integration_tests/common/desktop_helper.js +++ b/cypress_test/integration_tests/common/desktop_helper.js @@ -330,6 +330,8 @@ function insertComment(text = 'some text0', save = true) { cy.cGet('.cool-annotation').last({log: false}).find('#annotation-modify-textarea-new').type(text); // Click outside modify area to trigger update cy.cGet('.cool-annotation').last({log: false}).find('.cool-annotation-table').click(); + // In case of small window to expand the comments + cy.cGet('.cool-annotation').last({log: false}).find('.cool-annotation-img').click(); // Check that comment exists cy.cGet('.cool-annotation').last({log: false}).find('.cool-annotation-textarea').should('contain',text); diff --git a/cypress_test/integration_tests/common/impress_helper.js b/cypress_test/integration_tests/common/impress_helper.js index 0c27838d8..f9c9d3555 100644 --- a/cypress_test/integration_tests/common/impress_helper.js +++ b/cypress_test/integration_tests/common/impress_helper.js @@ -228,9 +228,9 @@ function changeSlide(changeNum,direction) { var slideButton; if (direction === 'next') { - slideButton = cy.cGet('#toolbar-up #next'); + slideButton = cy.cGet('#next-button'); } else if (direction === 'previous') { - slideButton = cy.cGet('#toolbar-up #prev'); + slideButton = cy.cGet('#prev-button'); } if (slideButton) { for (var n = 0; n < changeNum; n++) { diff --git a/cypress_test/integration_tests/desktop/impress/annotation_spec.js b/cypress_test/integration_tests/desktop/impress/annotation_spec.js index 2c3993d6a..5e7e18aaa 100644 --- a/cypress_test/integration_tests/desktop/impress/annotation_spec.js +++ b/cypress_test/integration_tests/desktop/impress/annotation_spec.js @@ -67,11 +67,11 @@ describe(['tagdesktop'], 'Annotation Tests', function() { }); describe(['tagdesktop'], 'Collapsed Annotation Tests', function() { - var testFileName = 'comment_switching.odp'; + var origTestFileName = 'comment_switching.odp'; + var testFileName; beforeEach(function() { - cy.viewport(1500, 600); - helper.beforeAll(testFileName, 'impress'); + testFileName = helper.beforeAll(origTestFileName, 'impress'); desktopHelper.switchUIToNotebookbar(); if (Cypress.env('INTEGRATION') === 'nextcloud') { @@ -126,6 +126,30 @@ describe(['tagdesktop'], 'Collapsed Annotation Tests', function() { cy.cGet('#annotation-reply-1').click(); cy.cGet('.cool-annotation-content > div').should('include.text','some reply text'); }); + + it('Autosave Collapse', function() { + desktopHelper.insertComment(undefined, false); + cy.cGet('#map').focus(); + helper.typeIntoDocument('{home}'); + cy.cGet('.cool-annotation-info-collapsed').should('have.text','!'); + cy.cGet('.cool-annotation-info-collapsed').should('be.visible'); + cy.cGet('.cool-annotation-img').click(); + cy.cGet('.cool-annotation-autosavelabel').should('be.visible'); + cy.cGet('#annotation-save-1').click(); + cy.cGet('.cool-annotation-img').click(); + cy.cGet('#annotation-content-area-1').should('have.text','some text0'); + cy.cGet('.cool-annotation-autosavelabel').should('be.not.visible'); + cy.cGet('.cool-annotation-reply-count-collapsed').should('not.have.text','!'); + cy.cGet('#map').focus(); + cy.cGet('.cool-annotation-reply-count-collapsed').should('be.not.visible'); + + helper.closeDocument(testFileName, ''); + helper.beforeAll(testFileName, 'impress', true, false, false, true); + cy.cGet('.cool-annotation-img').click(); + cy.cGet('.cool-annotation-content-wrapper').should('exist'); + cy.cGet('#annotation-content-area-1').should('have.text','some text0'); + cy.cGet('.cool-annotation-info-collapsed').should('be.not.visible'); + }) }); describe(['tagdesktop'], 'Comment Scrolling',function() { @@ -151,7 +175,7 @@ describe(['tagdesktop'], 'Comment Scrolling',function() { cy.cGet('.leaflet-marker-icon').should('exist'); }); - it.only('omit slides without comments', function() { + it('omit slides without comments', function() { //scroll up desktopHelper.insertComment(); addSlide(2); diff --git a/cypress_test/integration_tests/desktop/writer/annotation_spec.js b/cypress_test/integration_tests/desktop/writer/annotation_spec.js index 3684ae6a8..c770ca633 100644 --- a/cypress_test/integration_tests/desktop/writer/annotation_spec.js +++ b/cypress_test/integration_tests/desktop/writer/annotation_spec.js @@ -65,10 +65,11 @@ describe(['tagdesktop'], 'Annotation Tests', function() { }); describe(['tagdesktop'], 'Collapsed Annotation Tests', function() { - var testFileName = 'annotation.odt'; + var origTestFileName = 'annotation.odt'; + var testFileName; beforeEach(function() { - helper.beforeAll(testFileName, 'writer'); + testFileName = helper.beforeAll(origTestFileName, 'writer'); desktopHelper.switchUIToNotebookbar(); cy.cGet('#optionscontainer div[id$="SidebarDeck.PropertyDeck"]').click(); // Hide sidebar. }); @@ -122,6 +123,33 @@ describe(['tagdesktop'], 'Collapsed Annotation Tests', function() { cy.cGet('.cool-annotation-content-wrapper').should('not.exist'); }); + it('Autosave Collapse', function() { + desktopHelper.insertComment(undefined, false); + cy.cGet('#map').focus(); + helper.typeIntoDocument('{home}'); + cy.cGet('.cool-annotation-reply-count-collapsed').should('have.text','!'); + cy.cGet('.cool-annotation-reply-count-collapsed').should('be.visible'); + cy.cGet('.cool-annotation-img').click(); + cy.cGet('.cool-annotation-autosavelabel').should('be.visible'); + cy.cGet('#annotation-save-1').click(); + helper.typeIntoDocument('{home}'); + cy.cGet('.cool-annotation-img').click(); + cy.cGet('#annotation-content-area-1').should('have.text','some text0'); + cy.cGet('.cool-annotation-autosavelabel').should('be.not.visible'); + cy.cGet('.cool-annotation-reply-count-collapsed').should('not.have.text','!'); + cy.cGet('#map').focus(); + helper.typeIntoDocument('{home}'); + cy.cGet('.cool-annotation-reply-count-collapsed').should('be.not.visible'); + + helper.closeDocument(testFileName, ''); + helper.beforeAll(testFileName, 'writer', true, false, false, true); + cy.cGet('#optionscontainer div[id$="SidebarDeck.PropertyDeck"]').click(); // show sidebar. + cy.cGet('.cool-annotation-img').click(); + cy.cGet('.cool-annotation-content-wrapper').should('exist'); + cy.cGet('#annotation-content-area-1').should('have.text','some text0'); + cy.cGet('.cool-annotation-info-collapsed').should('be.not.visible'); + }) + }); describe(['tagdesktop'], 'Annotation Autosave Tests', function() {