textarea-size.spec.ts 698 B

12345678910111213141516
  1. import { test, expect } from '@playwright/test';
  2. test('textarea 高度足够大', async ({ page }) => {
  3. await page.goto('http://localhost:5173/#/pages/book-generator/create', { waitUntil: 'networkidle' });
  4. await page.waitForSelector('.form-textarea', { timeout: 10000 });
  5. await page.waitForTimeout(500);
  6. const info = await page.locator('.form-textarea').first().evaluate((el: any) => {
  7. const rect = el.getBoundingClientRect();
  8. return { width: rect.width, height: rect.height };
  9. });
  10. console.log('textarea 实际尺寸:', info);
  11. // 期望高度 > 200px(约 420rpx 在常见屏上)
  12. expect(info.height).toBeGreaterThan(200);
  13. expect(info.width).toBeGreaterThan(300);
  14. });