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

291
Views
¿Cómo puedo obtener la URL en Cypress?

Cuando hago clic en el botón, intento comprobar si estoy en la página correcta.

Aquí está mi código:

 describe('espace_parent is functional', () => { it('test login parent', () => { cy.visit('http://localhost:3000') cy.contains('parent').click() cy.contains('Espace Parent') cy.get(":input[placeholder='Adresse e-mail']").type('guigui@guigui.fr') cy.get(":input[placeholder='Mot de passe']").type('guigui') cy.contains('Se connecter').click() cy.log('Current URL is ') cy.contains("Accueil") }) })

En este código, estoy en localhost3000, hago clic en el padre que tiene que redirigirme a localhost3000/connexion/parent y quiero iniciar sesión pero no sé si está funcionando o no.

Ya intenté hacer diferentes cosas para imprimir la URL, pero ninguna funcionó.

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

0

Tienes que usar cy.url() .

  1. Para imprimir la URL puedes usar:
 cy.url().then((url) => { cy.log('Current URL is: ' + url) })
  1. Si quieres validar la URL puedes usar:
 cy.url().should('include', '/connexion/parent')
about 4 years ago · Juan Pablo Isaza Report

0

Puede obtener la URL con el comando cy.url() o cy.location() .

cy.url() así:

 // with should() cy.url().should('eq', 'http://localhost:3000/connexion/parent'); cy.url().should('include', '/connexion/parent'); // with then() cy.url().then(url => cy.log('Current URL is', url);
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!