0Pricing
Sveltejs Academy · Lesson

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

  1. Playwright Setup in SvelteKit
  2. Writing Page Interaction Tests
  3. Testing Forms and Navigation
  4. CI Integration
← Back to Sveltejs Academy