/** * 订阅流程 E2E 测试 */ import { test, expect } from '@playwright/test'; test.describe('Subscription Flow', () => { test.beforeEach(async ({ page }) => { // 登录 await page.goto('/login'); await page.fill('input[placeholder="邮箱"]', 'test@example.com'); await page.fill('input[placeholder="密码"]', 'Password123!'); await page.click('button:has-text("登录")'); await page.waitForURL('/workspaces'); }); test('should view subscription plans', async ({ page }) => { await page.goto('/subscription'); // 验证套餐卡片 await expect(page.locator('text=Free')).toBeVisible(); await expect(page.locator('text=Pro')).toBeVisible(); await expect(page.locator('text=Enterprise')).toBeVisible(); }); test('should start upgrade process', async ({ page }) => { await page.goto('/subscription'); // 点击升级按钮 await page.click('button:has-text("立即升级") >> nth=0'); // 验证跳转到升级页面 await expect(page).toHaveURL(/\/subscription\/upgrade\//); }); });