add failing e2e test for admin login page
This commit is contained in:
parent
73f24e7132
commit
f0da523ae4
1 changed files with 39 additions and 0 deletions
39
frontend/rabbi_gerzi/cypress/e2e/login.cy.ts
Normal file
39
frontend/rabbi_gerzi/cypress/e2e/login.cy.ts
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
describe('admin login page', () => {
|
||||||
|
it('renders the login form with email, password, and submit button', () => {
|
||||||
|
cy.visit('/login')
|
||||||
|
|
||||||
|
cy.get('[data-cy="login-email"]').should('be.visible')
|
||||||
|
cy.get('[data-cy="login-password"]').should('be.visible')
|
||||||
|
cy.get('[data-cy="login-submit"]').should('be.visible')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('is not linked from the home page', () => {
|
||||||
|
cy.visit('/')
|
||||||
|
|
||||||
|
cy.contains('login').should('not.exist')
|
||||||
|
cy.contains('Login').should('not.exist')
|
||||||
|
cy.contains('admin').should('not.exist')
|
||||||
|
cy.contains('Admin').should('not.exist')
|
||||||
|
cy.get('a[href="/login"]').should('not.exist')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('shows an error on failed login', () => {
|
||||||
|
cy.visit('/login')
|
||||||
|
|
||||||
|
cy.get('[data-cy="login-email"]').type('bad@example.com')
|
||||||
|
cy.get('[data-cy="login-password"]').type('wrongpassword')
|
||||||
|
cy.get('[data-cy="login-submit"]').click()
|
||||||
|
|
||||||
|
cy.get('[data-cy="login-error"]').should('be.visible')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('redirects to home on successful login', () => {
|
||||||
|
cy.visit('/login')
|
||||||
|
|
||||||
|
cy.get('[data-cy="login-email"]').type('admin@example.com')
|
||||||
|
cy.get('[data-cy="login-password"]').type('password123')
|
||||||
|
cy.get('[data-cy="login-submit"]').click()
|
||||||
|
|
||||||
|
cy.url().should('eq', Cypress.config().baseUrl + '/')
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue