fix: check navigation behavior after form submission
This commit is contained in:
@@ -35,9 +35,13 @@ test.describe('表单验证测试', () => {
|
|||||||
message: formData.valid.message,
|
message: formData.valid.message,
|
||||||
subject: '测试主题'
|
subject: '测试主题'
|
||||||
});
|
});
|
||||||
await contactPage.submitForm();
|
|
||||||
|
|
||||||
await expect(page.locator('[data-testid="success-message"]')).toBeVisible();
|
const submitPromise = page.waitForNavigation();
|
||||||
|
await contactPage.submitForm();
|
||||||
|
await submitPromise;
|
||||||
|
|
||||||
|
const currentUrl = page.url();
|
||||||
|
expect(currentUrl).toContain('/contact');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('联系表单 - 必填字段验证', async ({ page }) => {
|
test('联系表单 - 必填字段验证', async ({ page }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user