Skip to content

Commit

Permalink
cypress: introduce calc comment autosave tests
Browse files Browse the repository at this point in the history
Signed-off-by: Pranam Lashkari <[email protected]>
Change-Id: I9e3f406938689321ac2df9f87f308466e9d5b19b
  • Loading branch information
lpranam authored and Rash419 committed Oct 31, 2023
1 parent e71f082 commit 517f3fa
Showing 1 changed file with 178 additions and 1 deletion.
179 changes: 178 additions & 1 deletion cypress_test/integration_tests/desktop/calc/annotation_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global describe it require cy afterEach beforeEach */

var helper = require('../../common/helper');
var { insertMultipleComment } = require('../../common/desktop_helper');
var { insertMultipleComment, setupUIforCommentInsert, createComment } = require('../../common/desktop_helper');
var desktopHelper = require('../../common/desktop_helper');

describe(['tagdesktop'], 'Annotation Tests', function() {
Expand Down Expand Up @@ -84,3 +84,180 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
cy.cGet('#comment-container-1').should('not.exist');
});
});

describe(['tagdesktop'], 'Annotation Autosave Tests', function() {
var origTestFileName = 'annotation.ods';
var testFileName;

beforeEach(function() {
testFileName = helper.beforeAll(origTestFileName, 'calc');
desktopHelper.switchUIToNotebookbar();
});

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

it('Insert autosave',function() {
setupUIforCommentInsert('calc');
createComment('writer', 'Test Comment', false, '[id=insert-insert-annotation]');
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, 'calc', true, false, false, true);
cy.cGet('.cool-annotation').should('exist');
cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','Test Comment');
});

it('Insert autosave save',function() {
setupUIforCommentInsert('calc');
createComment('writer', 'Test Comment', false, '[id=insert-insert-annotation]');
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').should('exist');
cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('.cool-annotation-autosavelabel').should('be.not.visible');
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','Test Comment');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'calc', true, false, false, true);
cy.cGet('.cool-annotation').should('exist');
cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','Test Comment');
});

it('Insert autosave cancel',function() {
setupUIforCommentInsert('calc');
createComment('writer', 'Test Comment', false, '[id=insert-insert-annotation]');
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').should('not.exist');
cy.cGet('.cool-annotation-autosavelabel').should('not.exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'calc', true, false, false, true);
cy.cGet('.cool-annotation').should('not.exist');
});

it('Modify autosave',function() {
insertMultipleComment('calc', 1, false, '[id=insert-insert-annotation]');

cy.cGet('#comment-container-1').should('exist');

cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('#comment-annotation-menu-1').click();
cy.cGet('body').contains('.context-menu-item','Modify').click();
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, 'calc', true, false, false, true);
cy.cGet('.cool-annotation').should('exist');
cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some other text, some text0');
});

it('Modify autosave save',function() {
insertMultipleComment('calc', 1, false, '[id=insert-insert-annotation]');

cy.cGet('#comment-container-1').should('exist');

cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('#comment-annotation-menu-1').click();
cy.cGet('body').contains('.context-menu-item','Modify').click();
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('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#annotation-content-area-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some other text, some text0');
cy.cGet('#comment-container-1').should('exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'calc', true, false, false, true);
cy.cGet('.cool-annotation').should('exist');
cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some other text, some text0');
});

it.skip('Modify autosave cancel',function() {
insertMultipleComment('calc', 1, false, '[id=insert-insert-annotation]');

cy.cGet('#comment-container-1').should('exist');

cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('#comment-annotation-menu-1').click();
cy.cGet('body').contains('.context-menu-item','Modify').click();
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('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#annotation-content-area-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
cy.cGet('#comment-container-1').should('exist');

helper.closeDocument(testFileName, '');
helper.beforeAll(testFileName, 'calc', true, false, false, true);
cy.cGet('.cool-annotation').should('exist');
cy.cGet('#comment-container-1').then(function (element) {
element[0].style.visibility = '';
element[0].style.display = '';
});
cy.cGet('#comment-container-1').trigger('mouseover');
cy.cGet('#annotation-content-area-1').should('have.text','some text0');
});
});

0 comments on commit 517f3fa

Please sign in to comment.