refactor(erp-auth): implement precise login result detection with three outcomes

- 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
This commit is contained in:
test
2026-03-07 14:07:08 +08:00
parent 1ee33672dd
commit 6f19890a84
5 changed files with 82 additions and 13 deletions

View File

@@ -61,6 +61,7 @@
"@vitejs/plugin-react": "^5.1.1",
"@vitest/coverage-v8": "^4.0.18",
"autoprefixer": "^10.4.27",
"dotenv": "^17.3.1",
"electron": "^39.2.6",
"electron-builder": "^26.0.12",
"electron-vite": "^5.0.0",
@@ -74,9 +75,9 @@
"react": "^19.2.1",
"react-dom": "^19.2.1",
"tailwindcss": "^4.2.1",
"tsx": "^4.19.3",
"typescript": "^5.9.3",
"vite": "^7.2.6",
"vitest": "^4.0.18",
"tsx": "^4.19.3"
"vitest": "^4.0.18"
}
}