test(e2e): add Cypress scaffold + CI job

This commit is contained in:
Riya
2026-02-07 16:01:13 +00:00
parent d4e5e86a20
commit 94dd8e439d
6 changed files with 1632 additions and 2 deletions

View File

@@ -83,3 +83,32 @@ jobs:
path: |
backend/coverage.xml
frontend/coverage/**
e2e:
runs-on: ubuntu-latest
needs: [check]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: frontend
install-command: npm ci
build: npm run build
start: npm start
wait-on: http://localhost:3000
command: npm run e2e
env:
NEXT_TELEMETRY_DISABLED: "1"
# Force Clerk disabled in E2E to keep tests secretless/deterministic.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY: ""

View File

@@ -0,0 +1,11 @@
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
baseUrl: "http://localhost:3000",
video: false,
screenshotOnRunFailure: true,
specPattern: "cypress/e2e/**/*.cy.{ts,tsx,js,jsx}",
supportFile: "cypress/support/e2e.ts",
},
});

View File

@@ -0,0 +1,7 @@
describe("/activity page", () => {
it("loads without crashing", () => {
cy.visit("/activity");
// In secretless/unsigned state, UI should render the signed-out prompt.
cy.contains(/sign in to view the feed/i).should("be.visible");
});
});

View File

@@ -0,0 +1,2 @@
// Cypress support file.
// Place global hooks/commands here.

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,9 @@
"test": "vitest run --passWithNoTests --coverage",
"test:watch": "vitest",
"dev:lan": "next dev --hostname 0.0.0.0 --port 3000",
"api:gen": "orval --config ./orval.config.ts"
"api:gen": "orval --config ./orval.config.ts",
"e2e": "cypress run",
"e2e:open": "cypress open"
},
"dependencies": {
"@clerk/nextjs": "^6.37.1",
@@ -52,6 +54,7 @@
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"typescript": "^5",
"vitest": "^2.1.8"
"vitest": "^2.1.8",
"cypress": "^14.0.0"
}
}