add playwright tests
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { expect } from "@playwright/test";
|
||||
import { test } from "../fixtures";
|
||||
import { registerAndLogin } from "../helpers";
|
||||
|
||||
test("a user can create a meal", async ({ page }) => {
|
||||
await registerAndLogin(page, "alice@example.com");
|
||||
|
||||
await page.goto("/meals/new");
|
||||
await page.fill("#meal-name", "Spaghetti Bolognese");
|
||||
await page.fill("#meal-description", "## Ingredients\n\nA classic weeknight dinner.");
|
||||
await page.click('button:has-text("Save meal")');
|
||||
|
||||
// Lands on the meal detail page and renders the markdown description.
|
||||
await expect(page).toHaveURL(/\/meals\/\d+/);
|
||||
await expect(page.locator("h1")).toContainText("Spaghetti Bolognese");
|
||||
await expect(page.locator(".markdown h2")).toContainText("Ingredients");
|
||||
|
||||
// The meal appears on the meals index.
|
||||
await page.goto("/meals");
|
||||
await expect(page.locator(".list-card")).toContainText("Spaghetti Bolognese");
|
||||
});
|
||||
Reference in New Issue
Block a user