-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact-form.spec.ts
More file actions
33 lines (28 loc) · 1.13 KB
/
contact-form.spec.ts
File metadata and controls
33 lines (28 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { test, expect } from '../../fixtures/test-base';
import { VALID_CONTACT } from '../../data/contact.data';
test.describe('Contact Form @smoke', () => {
test.beforeEach(async ({ contactPage }) => {
await contactPage.goto();
});
test('Submit contact form with valid data', async ({ contactPage }) => {
await test.step('Fill all form fields with valid data', async () => {
await contactPage.submitContactForm(VALID_CONTACT);
});
await test.step('Verify success message is displayed', async () => {
await expect(
contactPage.page.getByText(/thank you|message.*sent|successfully/i),
).toBeVisible();
});
});
test('Validation errors on empty required fields', async ({ contactPage }) => {
await test.step('Click submit without filling any fields', async () => {
await contactPage.submitButton.click();
});
await test.step('Verify validation errors are displayed', async () => {
// The form should show validation feedback for required fields
await expect(
contactPage.page.getByText(/required|fill|enter/i).first(),
).toBeVisible();
});
});
});