| 12345678910111213141516171819 |
- import { test, expect } from '@playwright/test';
- // BUG-11 修复:使用 data-testid 兜底
- const TEXTAREA_LOCATOR = '[data-testid="form-textarea"], .form-textarea, textarea';
- test('textarea 高度足够大', async ({ page }) => {
- await page.goto('http://localhost:5173/#/pages/book-generator/create', { waitUntil: 'networkidle' });
- await page.waitForSelector(TEXTAREA_LOCATOR, { timeout: 15000 });
- await page.waitForTimeout(500);
- const info = await page.locator(TEXTAREA_LOCATOR).first().evaluate((el: any) => {
- const rect = el.getBoundingClientRect();
- return { width: rect.width, height: rect.height };
- });
- console.log('textarea 实际尺寸:', info);
- // 期望高度 > 200px(约 420rpx 在常见屏上)
- expect(info.height).toBeGreaterThan(200);
- expect(info.width).toBeGreaterThan(300);
- });
|