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

172
Views
Cómo actualizar un alias en cypress

No estoy seguro si estoy usando esto correctamente en ciprés. Lo que quiero hacer es actualizar mi alias @priceValue para poder usar el alias actualizado más adelante.

Esto es lo que quiero decir lógicamente:

1: Tome el texto y asígnele un alias de priceValue 2: Verifique el valor del precio para asegurarse de que contiene una cadena y luego (y aquí está el problema) -> el alias se actualiza a una fracción mediante la conversión. cadena a una fracción

¿Cómo actualizo el alias para que ahora sea la fracción convertida?

 priceElements.priceButton().first().invoke("text").as("priceValue"); cy.get("@priceValue").then((priceValue) => { expect(priceValue).contains("/"); math.fraction(priceValue); })
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

También puede simplemente cambiarlo, no es necesario un nuevo alias

 priceElements.priceButton().first().invoke("text") .should('contain', '/') .as("priceValue") cy.get("@priceValue") .then(priceValue => math.fraction(priceValue)) // modify .as("priceValue") // re-save cy.get("@priceValue") .invoke('toString') .should('not.contain', '/') // different value
about 4 years ago · Juan Pablo Isaza Report

0

Puede consultar este blog, analiza en detalle cómo actualizar un alias: https://ronvalstar.nl/updating-a-cypress-alias .

Una forma más fácil sería ajustar el valor y crear un nuevo alias.

 priceElements.priceButton().first().invoke("text").as("priceValue") cy.get("@priceValue").then((priceValue) => { expect(priceValue).contains("/") cy.wrap(math.fraction(priceValue)).as("newPriceValue") }) cy.get("@newPriceValue").then((newPriceValue) => { cy.log(newPriceValue) })
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!