I'm using cypress for unit tests. I'm doing a verification for the login and i'm sure about the logs but when i click, i am not redirected and i don't know how can i know or see where is the error.
There is my code.
describe('espace_parent is functional', () => {
it('test login parent', () => {
cy.visit('http://localhost:3000')
cy.url().then((url) => {
cy.task('log', url)
})
cy.contains('parent').click()
cy.url().then((url) => {
cy.task('log', url)
})
cy.contains('Espace Parent')
cy.get('*[class^="sc-ezbkAF dYcoMC "]').clear().type('guigui@guigui.fr')
cy.get(":input[placeholder='Mot de passe']").clear().type('guigui')
// cy.contains('Se connecter').click()
cy.get('*[class^="sc-giYglK iVKXal"]').click()
cy.url().then((url) => {
cy.task('log', url)
})
})
})
it gives me this:
espace_parent is functional http://localhost:3000/ http://localhost:3000/parent/connexion http://localhost:3000/parent/connexion ✓ test login parent (2839ms)
But normally it should give
http://localhost:3000/ http://localhost:3000/parent/connexion http://localhost:3000/parent
THe problem is in the 2 nd part of my code:
cy.get('*[class^="sc-ezbkAF dYcoMC "]').clear().type('guigui@guigui.fr')
cy.get(":input[placeholder='Mot de passe']").clear().type('guigui')
// cy.contains('Se connecter').click()
cy.get('*[class^="sc-giYglK iVKXal"]').click()
How can i know, what is wrong, and there is the html than i 'm using
<input placeholder="Adresse e-mail" type="text" class="sc-ezbkAF dYcoMC" value="test@gmail.com">
<input placeholder="Mot de passe" type="password" class="sc-ezbkAF dYcoMC" value="test56">
<div class="sc-giYglK iVKXal">
<p class="sc-iJKOTD ecZSkv">Se connecter</p>
</div>
Thansk for your help