Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda