Testing Forms and Navigation
Test form submissions, redirects, and multi-page user flows end-to-end.
Form Submission
Fill inputs and submit, then assert on the result.
await page.getByLabel("Email").fill("a@b.com");
await page.getByRole("button", { name: "Submit" }).click();
await expect(page).toHaveURL("/dashboard");Validation Errors
Test that invalid inputs produce visible error messages.
await page.getByRole("button", { name: "Submit" }).click();
await expect(page.getByText("Email required")).toBeVisible();All lessons in this course
- Playwright Setup in SvelteKit
- Writing Page Interaction Tests
- Testing Forms and Navigation
- CI Integration