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 do test the title is showing in full length and not displaying with a dotted line with cypress?

I am new to working with cypress. I want to test the title text with any length is showing completely with full length and not dotted. I tested the title like below but still, I do not know how to check if the title with long length is displaying with dotted or not!! Thank you for any help.

cy.get(selectors.Content)   
  .find(selectors.dataComponent('title'))     
  .should('be.visible')     
  .and('not.be.empty')

>Solution :

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

If you want to test that there is no ellipsis, try

cy.get(selectors.Content)    
  .find(selectors.dataComponent('title'))      
  .should('be.visible')      
  .and('not.be.empty')  

cy.get(selectors.Content)    
  .find(selectors.dataComponent('title'))      
  .invoke('text')
  .should('not.contain', '...')

Or more strict,

cy.get(selectors.Content)    
  .find(selectors.dataComponent('title'))      
  .invoke('text')
  .should(title => expect(title.endsWith('...')).to.eq(false))
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