Skip to content

Commit

Permalink
Add cypress tests for shortcut to save comments
Browse files Browse the repository at this point in the history
Using Ctrl+Enter in calc and writer.

See dce4671

Signed-off-by: Méven Car <[email protected]>
Change-Id: Ic7e947623aac6345e4ad9c92a9454dfb5b2a4c2e
  • Loading branch information
meven committed Jan 7, 2025
1 parent 03f9cf4 commit a5e125f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cypress_test/integration_tests/desktop/calc/annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,33 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
cy.cGet('#comment-container-1').should('exist');
});

it('Modify and Save using shortcut Ctrl+Enter',function() {
// Given an open comment edit dialog
desktopHelper.insertComment();
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('contain','some text');
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, ');

// When Ctrl+Enter is hit
cy.cGet('annotation-modify-textarea-1').type('{ctrl}{enter}');

// Then, the dialog is closed and the comment content is updated
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('contain','some other text, some text');
cy.cGet('#comment-container-1').should('exist');
});

it('Reply should not be possible', function() {
desktopHelper.insertComment();

Expand Down
17 changes: 17 additions & 0 deletions cypress_test/integration_tests/desktop/writer/annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,23 @@ describe(['tagdesktop'], 'Annotation Tests', function() {
cy.cGet('#annotation-content-area-1').should('contain','some text0, some other text');
});

it('Modify and Save using shortcut Ctrl+Enter',function() {
// Given an open comment edit dialog
desktopHelper.insertComment();
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','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, ');

// When Ctrl+Enter is hit
cy.cGet('annotation-modify-textarea-1').type('{ctrl}{enter}');

// Then, the dialog is closed and the comment content is updated
cy.cGet('.cool-annotation-content-wrapper').should('exist');
cy.cGet('#annotation-content-area-1').should('contain','some other text, some text0');
});

it('Reply', function() {
desktopHelper.insertComment();

Expand Down

0 comments on commit a5e125f

Please sign in to comment.