Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cypress: add tests for comment operations (mobile).
Change-Id: I9eb2dea1a600caba0bc11763838f574a1c69f0a5
- Loading branch information
Showing
3 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
160 changes: 160 additions & 0 deletions
160
cypress_test/integration_tests/mobile/writer/annotation_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* global describe it cy beforeEach require afterEach */ | ||
|
||
var helper = require('../../common/helper'); | ||
var mobileHelper = require('../../common/mobile_helper'); | ||
|
||
describe('Annotation tests.', function() { | ||
var testFileName = 'annotation.odt'; | ||
|
||
beforeEach(function() { | ||
helper.beforeAll(testFileName, 'writer'); | ||
|
||
// Click on edit button | ||
mobileHelper.enableEditingMobile(); | ||
}); | ||
|
||
afterEach(function() { | ||
helper.afterAll(testFileName); | ||
}); | ||
|
||
function insertComment() { | ||
mobileHelper.openInsertionWizard(); | ||
|
||
cy.contains('.menu-entry-with-icon', 'Comment') | ||
.click(); | ||
|
||
cy.get('.loleaflet-annotation-table') | ||
.should('exist'); | ||
|
||
cy.get('.loleaflet-annotation-textarea') | ||
.type('some text'); | ||
|
||
cy.get('.vex-dialog-button-primary') | ||
.click(); | ||
|
||
cy.get('.loleaflet-annotation') | ||
.should('exist'); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('have.text', 'some text'); | ||
} | ||
|
||
it('Saving comment.', function() { | ||
insertComment(); | ||
|
||
mobileHelper.selectHamburgerMenuItem(['File', 'Save']); | ||
|
||
helper.beforeAll(testFileName, 'writer', true); | ||
|
||
mobileHelper.enableEditingMobile(); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('have.text', 'some text'); | ||
}); | ||
|
||
it('Modifying comment.', function() { | ||
insertComment(); | ||
|
||
mobileHelper.selectAnnotationMenuItem('Modify'); | ||
|
||
cy.get('.loleaflet-annotation-table') | ||
.should('exist'); | ||
|
||
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') | ||
.should('have.text', 'some text'); | ||
|
||
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') | ||
.type('modified '); | ||
|
||
cy.get('.vex-dialog-button-primary') | ||
.click(); | ||
|
||
cy.get('.loleaflet-annotation') | ||
.should('exist'); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('have.text', 'modified some text'); | ||
}); | ||
|
||
it('Reply to comment.', function() { | ||
insertComment(); | ||
|
||
mobileHelper.selectAnnotationMenuItem('Reply'); | ||
|
||
cy.get('.loleaflet-annotation-table') | ||
.should('exist'); | ||
|
||
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') | ||
.should('have.text', ''); | ||
|
||
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') | ||
.type('reply'); | ||
|
||
cy.get('.vex-dialog-button-primary') | ||
.click(); | ||
|
||
cy.get('.loleaflet-annotation') | ||
.should('exist'); | ||
|
||
cy.get('.loleaflet-annotation:nth-of-type(2) .loleaflet-annotation-content') | ||
.should('have.text', 'some text'); | ||
|
||
cy.get('.loleaflet-annotation:nth-of-type(3) .loleaflet-annotation-content') | ||
.should('have.text', 'reply'); | ||
}); | ||
|
||
it('Remove comment.', function() { | ||
insertComment(); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('have.text', 'some text'); | ||
|
||
mobileHelper.selectAnnotationMenuItem('Remove'); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('have.text', ''); | ||
}); | ||
|
||
it('Try to insert empty comment.', function() { | ||
mobileHelper.openInsertionWizard(); | ||
|
||
cy.contains('.menu-entry-with-icon', 'Comment') | ||
.click(); | ||
|
||
cy.get('.loleaflet-annotation-table') | ||
.should('exist'); | ||
|
||
cy.get('.loleaflet-annotation-textarea') | ||
.should('have.text', ''); | ||
|
||
cy.get('.vex-dialog-button-primary') | ||
.click(); | ||
|
||
cy.get('.vex-dialog-button-secondary') | ||
.click(); | ||
|
||
cy.get('.loleaflet-annotation') | ||
.should('not.exist'); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('not.exist'); | ||
}); | ||
|
||
it('Resolve comment.', function() { | ||
// Show resolved comments | ||
mobileHelper.selectHamburgerMenuItem(['View', 'Resolved Comments']); | ||
|
||
insertComment(); | ||
|
||
cy.get('.loleaflet-annotation-content') | ||
.should('have.text', 'some text'); | ||
|
||
mobileHelper.selectAnnotationMenuItem('Resolve'); | ||
|
||
cy.get('.loleaflet-annotation-content-resolved') | ||
.should('exist'); | ||
|
||
cy.get('.loleaflet-annotation-content-resolved') | ||
.should('have.text', 'Resolved'); | ||
}); | ||
}); |