Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

294
Vistas
How can I get the url in cypress?

When I click on the button, I try to check if I'm on the right page.

Here is my code:

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")

  })
})

On this code, I am on localhost3000, I click on the parent who has to redirect me to localhost3000/connexion/parent and I want to login but I don't know if it's functioning or not.

I already tried to do different things to print the URL, but none work.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You have to use the cy.url().

  1. To print the URL you can use:
cy.url().then((url) => {
  cy.log('Current URL is: ' + url)
})
  1. If you want to validate the URL you can use:
cy.url().should('include', '/connexion/parent')
about 4 years ago · Juan Pablo Isaza Denunciar

0

You can get the url with command cy.url() or cy.location().

You would use cy.url() like this:

// 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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda