feat: implement ERP authentication service

Implement ErpAuthService with TDD approach:
- Add login(), close(), getSession(), isActive() methods
- Use Playwright chromium with headless:false for debugging
- Manage browser lifecycle and session state
- Handle authentication flow with ERP_LOCATORS
- Add integration tests for login scenarios
- Add unit tests for session management
- Fix dotenv config path in test setup

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-03-01 12:34:54 +08:00
parent 87f6229d49
commit f045d66b65
4 changed files with 195 additions and 2 deletions

View File

@@ -1,8 +1,9 @@
import { beforeAll, afterAll } from 'vitest';
import dotenv from 'dotenv';
import path from 'path';
// Load environment variables
dotenv.config({ path: '.env' });
// Load environment variables from project root
dotenv.config({ path: path.resolve(process.cwd(), '.env') });
beforeAll(async () => {
// Global test setup