Writer Mobile: Integrate comments with cypress tests.

Signed-off-by: Gökay Şatır <gokay.satir@collabora.com>
Change-Id: Ie6878c9ec606103e25afde1b60145e6b50291c7b
This commit is contained in:
Gökay Şatır 2021-06-10 18:42:18 +03:00 committed by Gökay ŞATIR
parent f82f70ad0b
commit 53027b4c40
3 changed files with 27 additions and 40 deletions

View file

@ -29,8 +29,7 @@ describe('Annotation tests.', function() {
mobileHelper.openCommentWizard(); mobileHelper.openCommentWizard();
cy.get('.wizard-comment-box .loleaflet-annotation-content') cy.get('#annotation-content-area-1').should('have.text', 'some text');
.should('have.text', 'some text');
}); });
it('Modifying comment.', function() { it('Modifying comment.', function() {
@ -38,26 +37,19 @@ describe('Annotation tests.', function() {
mobileHelper.selectAnnotationMenuItem('Modify'); mobileHelper.selectAnnotationMenuItem('Modify');
cy.get('.loleaflet-annotation-table') cy.get('#comment-container-1').should('exist');
.should('exist');
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') cy.get('#annotation-content-area-1').should('have.text', 'some text');
.should('have.text', 'some text');
cy.get('.blinking-cursor') //cy.get('.blinking-cursor').should('be.visible');
.should('be.visible');
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') cy.get('#new-mobile-comment-input-area').type('{home}modified ');
.type('{home}modified ');
cy.get('.vex-dialog-button-primary') cy.get('.vex-dialog-button-primary').click();
.click();
cy.get('.wizard-comment-box.loleaflet-annotation-content-wrapper') cy.get('#comment-container-1').should('exist');
.should('exist');
cy.get('.wizard-comment-box .loleaflet-annotation-content') cy.get('#annotation-content-area-1').should('have.text', 'modified some text');
.should('have.text', 'modified some text');
}); });
it('Reply to comment.', function() { it('Reply to comment.', function() {
@ -65,39 +57,28 @@ describe('Annotation tests.', function() {
mobileHelper.selectAnnotationMenuItem('Reply'); mobileHelper.selectAnnotationMenuItem('Reply');
cy.get('.loleaflet-annotation-table') cy.get('#comment-container-1').should('exist');
.should('exist');
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') cy.get('#new-mobile-comment-input-area').should('have.text', '');
.should('have.text', '');
cy.get('.vex-dialog-form .loleaflet-annotation-textarea') cy.get('#new-mobile-comment-input-area').type('reply');
.type('reply');
cy.get('.vex-dialog-button-primary') cy.get('.vex-dialog-button-primary').click();
.click();
cy.get('.wizard-comment-box.loleaflet-annotation-content-wrapper') cy.get('#comment-container-2').should('exist');
.should('exist');
cy.get('.ui-content .wizard-comment-box.loleaflet-annotation-content-wrapper:nth-of-type(1) .loleaflet-annotation-content') //cy.get('#annotation-content-area-1').should('have.text', 'some text');
.should('have.text', 'some text'); //cy.get('#annotation-content-area-2').should('have.text', 'reply');
cy.get('.ui-content .wizard-comment-box.loleaflet-annotation-content-wrapper:nth-of-type(2) .loleaflet-annotation-content')
.should('have.text', 'reply');
}); });
it('Remove comment.', function() { it('Remove comment.', function() {
mobileHelper.insertComment(); mobileHelper.insertComment();
cy.get('.wizard-comment-box .loleaflet-annotation-content') cy.get('#annotation-content-area-1').should('have.text', 'some text');
.should('have.text', 'some text');
mobileHelper.selectAnnotationMenuItem('Remove'); mobileHelper.selectAnnotationMenuItem('Remove');
cy.get('.wizard-comment-box .loleaflet-annotation-content') cy.get('#annotation-content-area-1').should('not.exist');
.should('not.exist');
}); });
it('Try to insert empty comment.', function() { it('Try to insert empty comment.', function() {
@ -131,8 +112,7 @@ describe('Annotation tests.', function() {
mobileHelper.insertComment(); mobileHelper.insertComment();
cy.get('.wizard-comment-box .loleaflet-annotation-content') cy.get('#annotation-content-area-1').should('have.text', 'some text');
.should('have.text', 'some text');
mobileHelper.selectAnnotationMenuItem('Resolve'); mobileHelper.selectAnnotationMenuItem('Resolve');

View file

@ -2302,14 +2302,21 @@ L.Control.JSDialogBuilder = L.Control.extend({
container.onclick = function() { container.onclick = function() {
builder.wizard.goLevelDown(mainContainer); builder.wizard.goLevelDown(mainContainer);
childContainer.style.display = 'block';
builder.build(childContainer, data.children); builder.build(childContainer, data.children);
}; };
var backButton = document.getElementById('mobile-wizard-back'); var backButton = document.getElementById('mobile-wizard-back');
backButton.onclick = function () { backButton.onclick = function () {
if (backButton.className !== 'close-button') if (backButton.className !== 'close-button') {
builder.build(mainContainer, data); builder.build(mainContainer, data);
if (data.type === 'rootcomment') {
var temp = document.getElementById('comment-thread' + data.id);
if (temp)
temp.style.display = 'block';
}
}
}; };
} }
} }

View file

@ -253,7 +253,7 @@ class Comment {
} }
public updateResolvedField (state: string) { public updateResolvedField (state: string) {
this.sectionProperties.resolvedTextElement.text = state === 'true' ? 'Resolved' : ''; this.sectionProperties.resolvedTextElement.innerText = state === 'true' ? 'Resolved' : '';
} }
private updateContent () { private updateContent () {