# Instructions

- Following Playwright test failed.
- Explain why, be concise, respect Playwright best practices.
- Provide a snippet of code with the fix, if possible.

# Test info

- Name: dashboard-health.spec.ts >> 健康状态Dashboard - 颜色传达状态测试 >> 趋势箭头颜色正确（绿涨红跌）
- Location: e2e/tests/dashboard-health.spec.ts:219:7

# Error details

```
Error: expect(locator).toBeVisible() failed

Locator: locator('text=综合评分').first()
Expected: visible
Timeout: 10000ms
Error: element(s) not found

Call log:
  - Expect "toBeVisible" with timeout 10000ms
  - waiting for locator('text=综合评分').first()

```

# Page snapshot

```yaml
- generic [active] [ref=e1]:
  - alert [ref=e2]
  - generic [ref=e3]:
    - complementary [ref=e4]:
      - generic [ref=e6]: GEO Platform
      - navigation [ref=e7]:
        - link "数据总览" [ref=e8] [cursor=pointer]:
          - /url: /dashboard
          - img [ref=e9]
          - text: 数据总览
        - link "品牌管理" [ref=e14] [cursor=pointer]:
          - /url: /brands
          - img [ref=e15]
          - text: 品牌管理
        - link "竞品对比" [ref=e17] [cursor=pointer]:
          - /url: /compare
          - img [ref=e18]
          - text: 竞品对比
        - link "查询管理" [ref=e23] [cursor=pointer]:
          - /url: /dashboard/queries
          - img [ref=e24]
          - text: 查询管理
        - link "引用记录" [ref=e27] [cursor=pointer]:
          - /url: /dashboard/citations
          - img [ref=e28]
          - text: 引用记录
        - link "报告导出" [ref=e31] [cursor=pointer]:
          - /url: /dashboard/reports
          - img [ref=e32]
          - text: 报告导出
        - link "设置" [ref=e36] [cursor=pointer]:
          - /url: /dashboard/settings
          - img [ref=e37]
          - text: 设置
        - link "管理后台" [ref=e40] [cursor=pointer]:
          - /url: /dashboard/admin
          - img [ref=e41]
          - text: 管理后台
    - generic [ref=e43]:
      - banner [ref=e44]:
        - heading "GEO Platform" [level=1] [ref=e45]
        - generic [ref=e46]:
          - generic [ref=e47]:
            - img [ref=e48]
            - generic [ref=e51]: 管理员
          - button "退出登录" [ref=e52] [cursor=pointer]:
            - img [ref=e53]
            - text: 退出登录
      - main [ref=e56]:
        - generic [ref=e57]:
          - paragraph [ref=e58]: Failed to fetch
          - button "重新加载" [ref=e59] [cursor=pointer]
```

# Test source

```ts
  1  | import { Page, Locator, expect } from "@playwright/test";
  2  | 
  3  | export class DashboardPage {
  4  |   readonly page: Page;
  5  |   readonly pageTitle: Locator;
  6  |   readonly healthScoreCard: Locator;
  7  |   readonly competitorStatusCard: Locator;
  8  |   readonly trendCard: Locator;
  9  |   readonly monitorPlatformCard: Locator;
  10 |   readonly platformScoreList: Locator;
  11 |   readonly actionSuggestions: Locator;
  12 | 
  13 |   constructor(page: Page) {
  14 |     this.page = page;
  15 |     // 品牌健康中心标题
  16 |     this.pageTitle = page.getByRole("heading", { name: "品牌健康中心" });
  17 |     // 概览卡片
  18 |     this.healthScoreCard = page.locator("text=综合评分").first();
  19 |     this.competitorStatusCard = page.locator("text=竞品地位").first();
  20 |     this.trendCard = page.locator("text=趋势").first();
  21 |     this.monitorPlatformCard = page.locator("text=监控平台").first();
  22 |     // 平台评分列表
  23 |     this.platformScoreList = page.locator("text=平台评分详情");
  24 |     // 行动建议
  25 |     this.actionSuggestions = page.locator("text=为您推荐的下一步行动");
  26 |   }
  27 | 
  28 |   async goto() {
  29 |     await this.page.goto("/dashboard");
  30 |   }
  31 | 
  32 |   async expectToBeVisible() {
  33 |     await expect(this.pageTitle).toBeVisible();
  34 |   }
  35 | 
  36 |   // 等待健康状态卡片加载
  37 |   async waitForHealthCards() {
> 38 |     await expect(this.healthScoreCard).toBeVisible({ timeout: 10000 });
     |                                        ^ Error: expect(locator).toBeVisible() failed
  39 |   }
  40 | 
  41 |   // 获取综合评分值
  42 |   async getOverallScore(): Promise<string | null> {
  43 |     const scoreElement = this.page.locator(".text-5xl.font-bold").first();
  44 |     if (await scoreElement.isVisible()) {
  45 |       return scoreElement.textContent();
  46 |     }
  47 |     return null;
  48 |   }
  49 | 
  50 |   // 获取健康等级标签
  51 |   async getHealthLevel(): Promise<Locator> {
  52 |     return this.page.locator(".rounded-full.px-3.py-1.text-sm.font-medium").first();
  53 |   }
  54 | 
  55 |   // 获取平台评分项数量
  56 |   async getPlatformScoreCount(): Promise<number> {
  57 |     const items = this.page.locator("text=/文心一言|Kimi|通义千问|豆包|讯飞星火|天工AI|智谱清言/");
  58 |     return items.count();
  59 |   }
  60 | 
  61 |   // 获取行动建议数量
  62 |   async getActionSuggestionCount(): Promise<number> {
  63 |     const suggestions = this.page.locator(".rounded-lg.border p-4");
  64 |     return suggestions.count();
  65 |   }
  66 | 
  67 |   // 检查危险平台是否被高亮
  68 |   async isDangerPlatformHighlighted(): Promise<boolean> {
  69 |     const dangerCard = this.page.locator(".border-red-200.bg-red-50\\/50");
  70 |     const count = await dangerCard.count();
  71 |     return count > 0;
  72 |   }
  73 | }
  74 | 
```