Skip to content

Commit

Permalink
cypress: introduce impress comment autosave tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pranam Lashkari <[email protected]>
Change-Id: I40b2dac1e87ca465ca92bbf64b2a6ee556c23c7f
  • Loading branch information
lpranam authored and Rash419 committed Oct 31, 2023
1 parent 517f3fa commit 82e76d8
Showing 1 changed file with 191 additions and 1 deletion.
192 changes: 191 additions & 1 deletion cypress_test/integration_tests/desktop/impress/annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var desktopHelper = require('../../common/desktop_helper');
var helper = require('../../common/helper');
var { addSlide, changeSlide } = require('../../common/impress_helper');
var { insertMultipleComment } = require('../../common/desktop_helper');
var { insertMultipleComment, setupUIforCommentInsert, createComment } = require('../../common/desktop_helper');

describe(['tagdesktop'], 'Annotation Tests', function() {
var origTestFileName = 'comment_switching.odp';
Expand Down Expand Up @@ -183,3 +183,193 @@ describe(['tagdesktop'], 'Comment Scrolling',function() {
cy.cGet('#PageStatus').should('contain','Slide 2 of 3');
});
});

describe.skip(['tagdesktop'], 'Annotation Autosave Tests', function() {
var origTestFileName = 'comment_switching.odp';
var testFileName;

beforeEach(function() {
cy.viewport(1500, 600);
testFileName = helper.beforeAll(origTestFileName, 'impress');
desktopHelper.switchUIToNotebookbar();

if (Cypress.env('INTEGRATION') === 'nextcloud') {
desktopHelper.hideSidebarIfVisible();
}

cy.cGet('#options-modify-page').click();
desktopHelper.selectZoomLevel('50');
});

afterEach(function() {
helper.afterAll(testFileName, this.currentTest.state);
});

it('Insert autosave', function() {
setupUIforCommentInsert('impress');
createComment('impress', 'Test Comment', false, '#insert-insert-annotation-button');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.visible');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('have.text','Test Comment');
});

it('Insert autosave save', function() {
setupUIforCommentInsert('impress');
createComment('impress', 'Test Comment', false, '#insert-insert-annotation-button');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.visible');
cy.cGet('#annotation-save-new').click();
cy.cGet('.cool-annotation-autosavelabel').should('be.not.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.not.visible');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('have.text','Test Comment');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('have.text','Test Comment');
});

it('Insert autosave cancel', function() {
setupUIforCommentInsert('impress');
createComment('impress', 'Test Comment', false, '#insert-insert-annotation-button');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.visible');
cy.cGet('#annotation-cancel-new').click();
cy.cGet('.cool-annotation-autosavelabel').should('be.not.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.not.visible');
cy.cGet('.leaflet-marker-icon').should('not.exist');
cy.cGet('.cool-annotation-content > div').should('not.exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.leaflet-marker-icon').should('not.exist');
cy.cGet('.cool-annotation-content > div').should('not.exist');
});

it('Modify autosave', function() {
insertMultipleComment('impress', 1, false, '#insert-insert-annotation-button');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('.cool-annotation-content-wrapper:visible .cool-annotation-menu').click();
cy.cGet('body').contains('.context-menu-item','Modify').click();
cy.cGet('#annotation-modify-textarea-1').type('{home}');
cy.cGet('#annotation-modify-textarea-1').type('some other text, ');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.visible');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('have.text','some other text, some text0');
});

it('Modify autosave save', function() {
insertMultipleComment('impress', 1, false, '#insert-insert-annotation-button');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('.cool-annotation-content-wrapper:visible .cool-annotation-menu').click();
cy.cGet('body').contains('.context-menu-item','Modify').click();
cy.cGet('#annotation-modify-textarea-1').type('{home}');
cy.cGet('#annotation-modify-textarea-1').type('some other text, ');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.visible');
cy.cGet('#annotation-save-1').click();
cy.cGet('#annotation-content-area-1').should('have.text','some other text, some text0');
cy.cGet('.leaflet-marker-icon').should('exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('have.text','some other text, some text0');
});

it('Modify autosave cancel', function() {
insertMultipleComment('impress', 1, false, '#insert-insert-annotation-button');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('.cool-annotation-content-wrapper:visible .cool-annotation-menu').click();
cy.cGet('body').contains('.context-menu-item','Modify').click();
cy.cGet('#annotation-modify-textarea-1').type('{home}');
cy.cGet('#annotation-modify-textarea-1').type('some other text, ');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.modify-annotation').should('be.visible');
cy.cGet('#annotation-cancel-1').click();
cy.cGet('#annotation-content-area-1').should('not.exist');
cy.cGet('.leaflet-marker-icon').should('not.exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.leaflet-marker-icon').should('not.exist');
cy.cGet('.cool-annotation-content > div').should('not.exist');
});

it('Reply autosave',function() {
insertMultipleComment('impress', 1, false, '#insert-insert-annotation-button');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('contain','some text0');
cy.cGet('.cool-annotation-content-wrapper:visible .cool-annotation-menu').click();
cy.cGet('body').contains('.context-menu-item','Reply').click();
cy.cGet('#annotation-reply-textarea-1').type('some reply text');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.reply-annotation').should('be.visible');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.cool-annotation-edit.reply-annotation').should('be.not.visible');
cy.cGet('.cool-annotation-content > div').should('include.text','some reply text');
});

it('Reply autosave save',function() {
insertMultipleComment('impress', 1, false, '#insert-insert-annotation-button');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('contain','some text0');
cy.cGet('.cool-annotation-content-wrapper:visible .cool-annotation-menu').click();
cy.cGet('body').contains('.context-menu-item','Reply').click();
cy.cGet('#annotation-reply-textarea-1').type('some reply text');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.reply-annotation').should('be.visible');
cy.cGet('#annotation-reply-1').click();
cy.cGet('.cool-annotation-autosavelabel').should('be.not.visible');
cy.cGet('.cool-annotation-edit.reply-annotation').should('be.not.visible');
cy.cGet('.cool-annotation-content > div').should('include.text','some reply text');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.cool-annotation-edit.reply-annotation').should('be.not.visible');
cy.cGet('.cool-annotation-content > div').should('include.text','some reply text');
});

it('Reply autosave cancel',function() {
insertMultipleComment('impress', 1, false, '#insert-insert-annotation-button');
cy.cGet('.leaflet-marker-icon').should('exist');
cy.cGet('.cool-annotation-content > div').should('contain','some text0');
cy.cGet('.cool-annotation-content-wrapper:visible .cool-annotation-menu').click();
cy.cGet('body').contains('.context-menu-item','Reply').click();
cy.cGet('#annotation-reply-textarea-1').type('some reply text');
cy.cGet('#map').focus();
cy.cGet('.cool-annotation-autosavelabel').should('be.visible');
cy.cGet('.cool-annotation-edit.reply-annotation').should('be.visible');
cy.cGet('#annotation-cancel-reply-1').click();
cy.cGet('.cool-annotation-autosavelabel').should('not.exist');
cy.cGet('.cool-annotation-edit.reply-annotation').should('not.exist');
cy.cGet('.cool-annotation-content > div').should('not.exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'impress', true, false, false, true);
cy.cGet('.cool-annotation-edit.reply-annotation').should('not.exist');
cy.cGet('.cool-annotation-content > div').should('not.exist');
});
});

0 comments on commit 82e76d8

Please sign in to comment.