Skip to content

Instantly share code, notes, and snippets.

@eai04191
Created December 31, 2023 11:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eai04191/bafff143338977d22d43d1c2b7ac3e77 to your computer and use it in GitHub Desktop.
Save eai04191/bafff143338977d22d43d1c2b7ac3e77 to your computer and use it in GitHub Desktop.
import { test, expect } from "@playwright/test";
test("screenshot all cards", async ({ page }) => {
await page.goto("http://localhost:5174/magical-patisserie/");
await page.click("#create-button");
const cards = page.locator("#out > .card");
await expect(cards).toHaveCount(41);
for (const card of await cards.all()) {
const title = await card.getAttribute("title");
await card.screenshot({
path: `screenshots/magical-patisserie/${title}.png`,
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment