Summary
Add Playwright E2E tests for the dapp wallet auth flow — connect, sign challenge, receive JWT, reach dashboard.
Unit tests cover Server crypto; this catches Front regressions (#11).
Setup
Directory: Front/e2e/
Tooling: @playwright/test
Mock strategy: Mock Freighter / Wallets Kit at browser level:
await page.addInitScript(() => {
window.__MOCK_WALLET__ = {
address: "GD4ELZEONXZANIWRJAED5JPBN7KJG6ZQ5AV46HRLZRTEFNKWJP3UFREL",
signMessage: async () => "mock_base64_sig",
};
});
Or use Playwright route interception on /api/auth/* with a running local API (npm run dev:server).
Test cases
| Spec |
Asserts |
auth-register.spec.ts |
/register → dashboard redirect, sessionStorage has token |
auth-guard.spec.ts |
/dashboard without session → redirect /login |
auth-logout.spec.ts |
Clear session → cannot access profile API |
CI
Add job to .github/workflows/ci.yml:
e2e:
runs-on: ubuntu-latest
services:
mysql: ...
steps:
- run: npm run dev:server & # or test server
- run: npx playwright test --prefix Front
Acceptance criteria
References
- Auth flow:
Front/components/wallet-auth-card.tsx
- API client:
Front/lib/api-client.ts
Summary
Add Playwright E2E tests for the dapp wallet auth flow — connect, sign challenge, receive JWT, reach dashboard.
Unit tests cover Server crypto; this catches Front regressions (#11).
Setup
Directory:
Front/e2e/Tooling:
@playwright/testMock strategy: Mock Freighter / Wallets Kit at browser level:
Or use Playwright route interception on
/api/auth/*with a running local API (npm run dev:server).Test cases
auth-register.spec.ts/register→ dashboard redirect,sessionStoragehas tokenauth-guard.spec.ts/dashboardwithout session → redirect/loginauth-logout.spec.tsCI
Add job to
.github/workflows/ci.yml:Acceptance criteria
npx playwright testpasses locally with Docker MySQLFront/package.jsonscripts:test:e2e,test:e2e:uiReferences
Front/components/wallet-auth-card.tsxFront/lib/api-client.ts