| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { test, expect } from '@playwright/test'
- test.describe('Stats/Dashboard E2E Tests', () => {
- const username = process.env.TEST_USERNAME || 'admin'
- const password = process.env.TEST_PASSWORD || '123456'
- async function login(page: any) {
- await page.goto('/login')
- await page.getByPlaceholder('请输入用户名').fill(username)
- await page.getByPlaceholder('请输入密码').fill(password)
- await page.getByRole('button', { name: '登 录' }).click()
- await expect(page).not.toHaveURL(/\/login/, { timeout: 10000 })
- }
- test.describe('Dashboard Page', () => {
- test.skip('should display dashboard after login', async ({ page }) => {
- await login(page)
- // Default redirect should be dashboard
- await expect(page).toHaveURL(/\/dashboard/)
- })
- test.skip('should display stats cards', async ({ page }) => {
- await login(page)
- await page.goto('/dashboard')
- // Check for stat card elements
- await expect(page.locator('.el-card').first()).toBeVisible()
- })
- test.skip('should show machine statistics', async ({ page }) => {
- await login(page)
- await page.goto('/dashboard')
- // Look for machine related text
- await expect(page.getByText(/机器/)).toBeVisible()
- })
- test.skip('should show camera statistics', async ({ page }) => {
- await login(page)
- await page.goto('/dashboard')
- // Look for camera related text
- await expect(page.getByText(/摄像头/)).toBeVisible()
- })
- })
- test.describe('Navigation', () => {
- test.skip('should redirect to dashboard after login', async ({ page }) => {
- await login(page)
- await expect(page).toHaveURL(/\/dashboard/)
- })
- })
- })
|