How bangsonchau/swt_web_test works
This repository combines a React login application, an Express authentication API, and an Excel-driven Playwright test system. The main user workflow runs from the login form through validation and an API request, then checks credentials, persists a JWT, and stores the returned session in the browser. The test suite separately loads Excel cases, dispatches browser actions, formats results, and writes an Excel report. Some test wiring and several server links are supported by README or source-index references rather than inspected implementation excerpts.
Main entry points: router.tsx Page router · LoginPage.tsx Login form · useLogin.tsx Login mutation · auth.repository.js User repository
Components 30
React frontend
- Application shell
client/src/app/App.tsx - Page router
client/src/app/router.tsx - User layout
client/src/shared/layouts/UserLayout.tsx - Home page
client/src/shared/pages/HomePage.tsx - Guest guard
client/src/shared/common/guards/GuestRoute.tsx - Login form
client/src/feature/auth/pages/LoginPage.tsx - Login validation
client/src/feature/auth/rule.ts - Login mutation
client/src/feature/auth/hooks/useLogin.tsx - Auth API client
client/src/feature/auth/service.ts - HTTP client
client/src/lib/axios.ts - Session store
client/src/feature/auth/store.ts
Authentication API
- Express API
server/src/app.js - API routes
server/src/routes.js - Auth route
server/src/modules/auth/auth.route.js - Auth controller
server/src/modules/auth/auth.controller.js - Credential and JWT logic
server/src/modules/auth/auth.service.js - User repository
server/src/modules/auth/auth.repository.js - User response entity
server/src/modules/auth/user.entity.js - Prisma client
server/src/config/prisma.js
Excel E2E testing
- Case runner
playwright-test/src/runner/test-case-runner.ts - Workbook loader
playwright-test/src/excel/loader.ts - Action dispatcher
playwright-test/src/runner/action-dispatcher.ts - Selector resolver
playwright-test/src/runner/selector-resolver.ts - Error formatter
playwright-test/src/errors/formatter.ts - Excel reporter
playwright-test/reporters/excel-reporter.ts - Report writer
playwright-test/src/excel/report-writer.ts
Other components
- Visitor
- PostgreSQL
- Excel test cases
- Excel results
Connections 28
- Visitor → Page router: opens pages
README.md - Application shell → Page router: mounts
client/src/app/App.tsx - Page router → User layout: renders
client/src/app/router.tsx - Page router → Home page: routes to
client/src/app/router.tsx - Page router → Guest guard: wraps login
client/src/app/router.tsx - Guest guard → Login form: renders
client/src/app/router.tsx - Login form → Login validation: validates with
client/src/feature/auth/pages/LoginPage.tsx - Login form → Login mutation: submits via
client/src/feature/auth/pages/LoginPage.tsx - Login mutation → Auth API client: calls
client/src/feature/auth/hooks/useLogin.tsx - Auth API client → HTTP client: sends request
client/src/feature/auth/service.ts - HTTP client → Express API: POST login
README.md - Login mutation → Session store: stores session
client/src/feature/auth/hooks/useLogin.tsx - Express API → API routes: mounts routes
server/src/app.js - API routes → Auth route: mounts auth
server/src/routes.js - Auth route → Auth controller: dispatches
server/src/modules/auth/auth.route.js - Auth controller → Credential and JWT logic: calls
server/src/modules/auth/auth.controller.js - Credential and JWT logic → User repository: looks up and updates
server/src/modules/auth/auth.service.js - User repository → Prisma client: queries
server/src/modules/auth/auth.repository.js - Prisma client → PostgreSQL: reads and writes
README.md - User repository → User response entity: wraps records
server/src/modules/auth/auth.repository.js - Excel test cases → Workbook loader: provides cases
README.md - Workbook loader → Case runner: supplies steps
README.md - Case runner → Action dispatcher: dispatches actions
playwright-test/src/runner/test-case-runner.ts - Action dispatcher → Selector resolver: resolves selectors
playwright-test/src/runner/action-dispatcher.ts - Action dispatcher → Error formatter: formats errors
playwright-test/src/runner/action-dispatcher.ts - Excel reporter → Report writer: writes results
playwright-test/reporters/excel-reporter.ts - Excel reporter → Excel test cases: reads source file
README.md - Report writer → Excel results: exports report
README.md