fix(tests): wait for request instead of fixed time

This commit is contained in:
kolaente 2023-03-14 13:43:12 +01:00 committed by Gitea
parent 34ad889d90
commit 24b4576c00
1 changed files with 3 additions and 1 deletions

View File

@ -1,12 +1,14 @@
import {UserFactory} from '../../factories/user'
const testAndAssertFailed = fixture => {
cy.intercept(Cypress.env('API_URL') + '/login*').as('login')
cy.visit('/login')
cy.get('input[id=username]').type(fixture.username)
cy.get('input[id=password]').type(fixture.password)
cy.get('.button').contains('Login').click()
cy.wait(5000) // It can take waaaayy too long to log the user in
cy.wait('@login')
cy.url().should('include', '/')
cy.get('div.message.danger').contains('Wrong username or password.')
}