- Add waitForLoginResult() method using Promise.race to detect:
- Success: .nc-workbench-icon element visible
- Failure: '名称或密码错误' error text visible
- Force login: click confirm button and re-detect
- Extract timeout constants (PAGE_LOAD_TIMEOUT, LOGIN_RESULT_TIMEOUT, FORCE_LOGIN_TIMEOUT)
- Improve error handling with clear error messages
- Add unit tests for class structure verification
- Fix test setup for Electron app mock
Fixes: ERP login success/failure detection was ambiguous
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>