test(admin): sync page tests with component changes (BUG-007)
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Fix 6 page test files to match actual component output: - Login: cookie-based auth login(account), brand text updates - Config/Logs/Prompts: remove stale description text assertions - ModelServices: check for actual table buttons instead of title - Usage: update description text to match PageHeader All 132 tests pass (17/17 files).
This commit is contained in:
@@ -111,7 +111,7 @@ describe('Login page', () => {
|
||||
it('renders the login form with username and password fields', () => {
|
||||
renderLogin()
|
||||
|
||||
expect(screen.getByText('登录到 ZCLAW')).toBeInTheDocument()
|
||||
expect(screen.getByText('登录')).toBeInTheDocument()
|
||||
expect(screen.getByPlaceholderText('请输入用户名')).toBeInTheDocument()
|
||||
expect(screen.getByPlaceholderText('请输入密码')).toBeInTheDocument()
|
||||
const submitButton = getSubmitButton()
|
||||
@@ -121,8 +121,10 @@ describe('Login page', () => {
|
||||
it('shows the ZCLAW brand logo', () => {
|
||||
renderLogin()
|
||||
|
||||
expect(screen.getByText('Z')).toBeInTheDocument()
|
||||
expect(screen.getByText(/ZCLAW Admin/)).toBeInTheDocument()
|
||||
// "Z" logo appears in both desktop brand panel and mobile-only logo
|
||||
const zElements = screen.getAllByText('Z')
|
||||
expect(zElements.length).toBeGreaterThanOrEqual(1)
|
||||
expect(screen.getByText('AI Agent 管理平台')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('successful login calls authStore.login and navigates to /', async () => {
|
||||
@@ -136,11 +138,7 @@ describe('Login page', () => {
|
||||
await user.click(getSubmitButton())
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockLogin).toHaveBeenCalledWith(
|
||||
'jwt-token-123',
|
||||
'refresh-token-456',
|
||||
mockAccount,
|
||||
)
|
||||
expect(mockLogin).toHaveBeenCalledWith(mockAccount)
|
||||
})
|
||||
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/', { replace: true })
|
||||
|
||||
Reference in New Issue
Block a user