Skip to content

Commit 8f3eb5f

Browse files
check tests failing
1 parent df8195c commit 8f3eb5f

File tree

1 file changed

+4
-36
lines changed

1 file changed

+4
-36
lines changed

tests/form.spec.ts

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,3 @@
1-
// import { test, expect } from '@playwright/test';
2-
3-
// test('Form submission works correctly', async ({ page }) => {
4-
// await page.goto('/form');
5-
6-
// // Ensure form elements are present
7-
// await expect(page.locator('input[placeholder="Enter your name"]')).toBeVisible();
8-
// await expect(page.locator('input[placeholder="Enter your email"]')).toBeVisible();
9-
// await expect(page.locator('button[type="submit"]')).toHaveText('Submit');
10-
11-
// // Fill out the form
12-
// await page.fill('input[placeholder="Enter your name"]', 'John Doe');
13-
// await page.fill('input[placeholder="Enter your email"]', '[email protected]');
14-
15-
// // Submit the form
16-
// await page.click('button[type="submit"]');
17-
18-
// // Wait for success message
19-
// await expect(page.locator('p')).toHaveText('Thank you, John Doe!');
20-
// });
21-
22-
// test('Shows validation error if fields are missing', async ({ page }) => {
23-
// await page.goto('/form');
24-
25-
// // Try to submit without filling anything
26-
// await page.click('button[type="submit"]');
27-
28-
// // Expect an error message
29-
// await expect(page.locator('p')).toHaveText('Submission failed. Please try again.');
30-
// });
31-
321
import { test, expect } from '@playwright/test';
332

343
test.describe('Form Submission Tests', () => {
@@ -44,11 +13,8 @@ test.describe('Form Submission Tests', () => {
4413
await page.fill('input[name="name"]', 'John Doe');
4514
await page.fill('input[name="email"]', '[email protected]');
4615

47-
// Submit the form
48-
await page.click('button[type="submit"]');
49-
50-
// Expect success message
51-
await expect(page.locator('#message')).toHaveText(`Hello John Doe, your form has been submitted successfully!`);
16+
// Intentionally fail this expectation
17+
await expect(page.locator('#message')).toHaveText(`This message does not exist`);
5218
});
5319

5420
test('❌ Shows validation error if fields are missing', async ({ page }) => {
@@ -91,3 +57,5 @@ test.describe('Form Submission Tests', () => {
9157
await expect(page.locator('input[name="email"]')).toHaveValue('');
9258
});
9359
});
60+
61+

0 commit comments

Comments
 (0)