test public and protected routes
This commit is contained in:
parent
4e3d8f74b8
commit
edcaf80b98
2 changed files with 12 additions and 1 deletions
|
|
@ -3,6 +3,7 @@ import { defineConfig } from 'cypress'
|
||||||
const frontendPort = process.env.VITE_PORT ?? '5173'
|
const frontendPort = process.env.VITE_PORT ?? '5173'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
allowCypressEnv: false,
|
||||||
e2e: {
|
e2e: {
|
||||||
baseUrl: `http://127.0.0.1:${frontendPort}`,
|
baseUrl: `http://127.0.0.1:${frontendPort}`,
|
||||||
supportFile: false,
|
supportFile: false,
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,18 @@
|
||||||
describe('guest authentication pages', () => {
|
describe('guest authentication pages', () => {
|
||||||
it('redirects the root route to login', () => {
|
it('shows a public home route to guests', () => {
|
||||||
cy.visit('/')
|
cy.visit('/')
|
||||||
|
|
||||||
|
cy.location('pathname').should('equal', '/')
|
||||||
|
cy.get('h1').should('have.text', 'Make big goals feel possible.')
|
||||||
|
cy.contains('a', 'Log in').should('have.attr', 'href', '/login')
|
||||||
|
cy.contains('a', 'Get started').should('have.attr', 'href', '/signup')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('redirects guests away from the protected dashboard', () => {
|
||||||
|
cy.visit('/dashboard')
|
||||||
|
|
||||||
cy.location('pathname').should('equal', '/login')
|
cy.location('pathname').should('equal', '/login')
|
||||||
|
cy.location('search').should('include', 'redirect=/dashboard')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('shows the login form and links to signup', () => {
|
it('shows the login form and links to signup', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue