From edcaf80b981a98aab7db17441a0aee7ddedcfc01 Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Fri, 31 Jul 2026 09:51:12 +0300 Subject: [PATCH] test public and protected routes --- frontend/website/cypress.config.ts | 1 + frontend/website/cypress/e2e/guest-auth.cy.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frontend/website/cypress.config.ts b/frontend/website/cypress.config.ts index a99e605..2697f45 100644 --- a/frontend/website/cypress.config.ts +++ b/frontend/website/cypress.config.ts @@ -3,6 +3,7 @@ import { defineConfig } from 'cypress' const frontendPort = process.env.VITE_PORT ?? '5173' export default defineConfig({ + allowCypressEnv: false, e2e: { baseUrl: `http://127.0.0.1:${frontendPort}`, supportFile: false, diff --git a/frontend/website/cypress/e2e/guest-auth.cy.ts b/frontend/website/cypress/e2e/guest-auth.cy.ts index e6ac7af..f4c1ba8 100644 --- a/frontend/website/cypress/e2e/guest-auth.cy.ts +++ b/frontend/website/cypress/e2e/guest-auth.cy.ts @@ -1,8 +1,18 @@ describe('guest authentication pages', () => { - it('redirects the root route to login', () => { + it('shows a public home route to guests', () => { 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('search').should('include', 'redirect=/dashboard') }) it('shows the login form and links to signup', () => {