Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to test floating dialog boxes in cypress?

I am fairly new to cypress and practicing its functionalities on Facebook app. I am having an issue on testing these following scenarios:

  1. When clicked on First Name, this floating dialog should be visible.
  2. Validating the text in the dialog box to be ‘What’s your name?’.
cy.get('input[name="firstname"]').focused().then(($txt)=>{
            cy.get('[data-testid="undefined"]>.uiContextualLayer uiContextualLayerLeft>._5v-0 _53im>#js_18n').should('be.visible').and('contain',"What's your name?");
        });

But this is not working
This is the pic that i am testing

Facebook sign up page

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can do something like this:

cy.get('[name="firstname"]').click()
cy.get('[name="lastname"]').click()
cy.get('[name="firstname"]').click() //triggers the error message
cy.contains('What\'s your name?').should('be.visible')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading