cypress: added test for collapsed autosaved comment indication

Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: I4e6929a074e750041a1814629317baf0433eaab0
This commit is contained in:
Pranam Lashkari 2024-03-24 18:12:59 +05:30 committed by Pranam Lashkari
parent d663e4a6b3
commit 9981260b68
4 changed files with 62 additions and 8 deletions

View file

@ -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);

View file

@ -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++) {

View file

@ -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);

View file

@ -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() {