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

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

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

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