import { test, expect } from '@playwright/test'; import { ContactPage } from '../../test-framework/shared/pages'; import { formData } from '../../test-framework/shared/config/test-data'; test.describe('联系页面测试', () => { test('应该能够填写联系表单', async ({ page }) => { const contactPage = new ContactPage(page); await contactPage.navigate(); await contactPage.fillContactForm(formData.valid); const name = await page.locator('#name').inputValue(); expect(name).toBe(formData.valid.name); }); test('应该显示成功消息', async ({ page }) => { const contactPage = new ContactPage(page); await contactPage.navigate(); await contactPage.fillContactForm(formData.valid); await contactPage.submitForm(); await expect(page.locator('.success-message')).toBeVisible({ timeout: 5000 }); }); });