import { test, expect } from '@playwright/test'; import { LoginPage } from './pages/LoginPage'; test('调试:检查系统配置页面', async ({ page }) => { const loginPage = new LoginPage(page); await test.step('管理员登录', async () => { await loginPage.goto(); await loginPage.login('admin', 'admin123'); await expect(page).toHaveURL(/.*dashboard/); console.log('登录成功,当前URL:', page.url()); }); await test.step('导航到系统配置页面', async () => { await page.goto('/sys/config'); await page.waitForLoadState('networkidle'); console.log('导航到系统配置页面,当前URL:', page.url()); // 等待一段时间让页面完全加载 await page.waitForTimeout(3000); }); await test.step('检查页面内容', async () => { // 截图查看页面状态 await page.screenshot({ path: 'debug-config-page.png' }); // 检查页面标题 const pageTitle = await page.title(); console.log('页面标题:', pageTitle); // 检查页面内容 const bodyText = await page.textContent('body'); console.log('页面内容片段:', bodyText.substring(0, 500)); // 检查是否有表格 const tableExists = await page.locator('.el-table').count(); console.log('表格数量:', tableExists); // 检查是否有卡片 const cardExists = await page.locator('.el-card').count(); console.log('卡片数量:', cardExists); // 检查是否有加载状态 const loadingExists = await page.locator('.el-loading-mask').count(); console.log('加载遮罩数量:', loadingExists); // 检查页面是否有错误信息 const errorElements = await page.locator('.el-message--error').count(); console.log('错误消息数量:', errorElements); }); });