Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
Cannot get text as in GUI

I have some amounts which I need to display. The amounts needs to be hovered and then they would show.

For example an amount may be +123 456,33 but in the code it is showing as like +123NNSP456,33. Now when I write my test, I am having to put

cy.get('.total-month').should('contain.text','+123NNSP456,33') 

so that the test passed. If I test for what is being showed in the GUI like this

cy.get('.total-month').should('contain.text','+123 456,33') 

it is not identifying the amount.

This is the html:

enter image description here

What am i doing wrong?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Using a similar strategy to Jennifer's answer, you can use invoke to replace the text value.

cy.get('.total-month')
  .invoke('text')
  .invoke('replace', 'NNSP', ' ')
  .should('contains', '+123 456,33');

The tl;dr is that your character is interpreted as NNSP. Replacing that with a traditional whitespace character should solve your problem.

about 4 years ago · Juan Pablo Isaza Report

0

You can also use the replace method to replace NNSP with an empty string.

cy.get('.total-month')
  .invoke('text')
  .then((text) => {
    expect(text.trim().replace('NNSP', '')).to.equal('+123456,33')
  })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!