Skip to content

Commit

Permalink
assert that click on 'Run' alerts successs 'Job added'
Browse files Browse the repository at this point in the history
  • Loading branch information
schiwaa committed Jan 11, 2024
1 parent fcb8cd8 commit 49e8b3a
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions frontend-e2e/cypress/e2e/stemwebdialog.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Tests to add:
Click on RHM should reveal argument field 'Iterations'
Click on other algorithms should not show any argument fields
Click on Cancel or anywhere outside dialog closes dialog
Click on "Run" (not implemented yet, just closes dialog for now)
Click on "Run" shows a success message 'Job added' and closes dialog
*/

Expand All @@ -27,6 +27,8 @@ beforeEach(() => {

describe('Stemweb dialog should work properly', () => {
it('under construction', () => {
cy.viewport(1600, 900);

// click on button "Run Stemweb" should open Stemweb dialog
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
Expand Down Expand Up @@ -69,23 +71,36 @@ describe('Stemweb dialog should work properly', () => {
cy.get('@stemwebmodal').find('button').contains('Cancel').trigger('mouseover').click();
cy.get('@stemwebmodal').should('not.be.visible');

// Click on "Run" (not implemented yet, just closes dialog for now)
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
cy.get('@stemwebmodal').contains('Generate a Stemweb tree').should('be.visible');
cy.get('@stemwebmodal').find('button').contains('Run').its('length').then((len) => {cy.log('length:' + len)});
cy.get('@stemwebmodal').find('button').contains('Run').trigger('mouseover').click();
cy.get('@stemwebmodal').should('not.be.visible'); // fuzzy

// Click on anywhere outside dialog closes dialog
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
cy.get('@stemwebmodal').contains('Generate a Stemweb tree').should('be.visible');
cy.get('@stemwebmodal').closest("#modalDialog").then((elem) => {
cy.log("#modalDialog:", elem);
});
cy.get('@stemwebmodal').closest("#modalDialog").its('length').then((len) => {cy.log('length:' + len)}); // seems to help against fuzziness
cy.get('@stemwebmodal').closest("#modalDialog").trigger('mouseover', { 'timeout': 10000 }).click('left');
cy.get('@stemwebmodal').closest("#modalDialog").as('mdialog');
// cy.get('@mdialog').its('length').then((len) => {cy.log('length:' + len)});
cy.get('@mdialog').find('form').trigger('mouseover', { 'timeout': 10000 }).click(); // first click inside, then outside of the modal in order to close it in cypress
cy.get('@mdialog').trigger('mouseover', { 'timeout': 10000 }).click('left');
cy.get('@stemwebmodal').should('not.be.visible');

// Click on "Run" shows a success message 'Job added'
// TODO: for any algorithm
// TODO: and closes dialog
cy.contains('Run Stemweb').click();
cy.get('stemmaweb-dialog .modal-content').as('stemwebmodal');
cy.get('@stemwebmodal').contains('Generate a Stemweb tree').should('be.visible');
// cy.get('@stemwebmodal').find('button').contains('Run').its('length').then((len) => {cy.log('length:' + len)});
cy.get('@stemwebmodal').find('button').contains('Run').trigger('mouseover').click();
// cy.get('@stemwebmodal').should('not.be.visible'); // still visible in frontend-e2e cypress although not in dev
// shows 'Job added' <stemmaweb-alert>
cy.get('stemmaweb-alert').contains('Job added'); // .find('.btn-close').click();

// cy.get('@stemwebmodal').should('not.be.visible'); // still visible in frontend-e2e cypress although not in dev
// workaround -- evel
/* cy.get('@stemwebmodal').closest("#modalDialog").as('mdialog');
cy.get('@mdialog').find('form').trigger('mouseover', { 'timeout': 10000 }).click(); // first click inside, then outside of the modal in order to close it in cypress
cy.get('@mdialog').trigger('mouseover', { 'timeout': 10000 }).click('left');
cy.get('@stemwebmodal').should('not.be.visible'); */
});
});

0 comments on commit 49e8b3a

Please sign in to comment.