Angular + Playwright
End-to-end tests in a real browser (Chromium). This page shows exactly what pickstack adds to a Angular project for Playwright: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework angular --modules playwright --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
@playwright/test | ^1.65.1 | dev |
@types/node | ^24.19.2 | dev |
New files
import { expect, test } from "@playwright/test";
test("the counter goes up", async ({ page }) => {
await page.goto("/");
await page.getByRole("button", { name: "+1" }).click();
await expect(page.getByText("1", { exact: true })).toBeVisible();
});
test("the about page opens from the nav", async ({ page }) => {
await page.goto("/");
await page.getByRole("link", { name: "About" }).click();
await expect(page).toHaveURL(/about/);
await expect(page.getByRole("heading", { name: "About" })).toBeVisible();
});
import process from "node:process";
import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./e2e",
testMatch: "**/*.e2e.?(c|m)[jt]s",
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
reporter: "html",
use: { baseURL: "http://localhost:4200", trace: "on-first-retry" },
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
webServer: {
command: "npm run dev",
url: "http://localhost:4200",
reuseExistingServer: !process.env.CI,
},
});
Changes to existing files
node_modules dist .angular+/test-results/+/playwright-report/+/blob-report/+/playwright/.cache/ .env .env.local .DS_Store⋯ 1 unchanged lines
<section class="page"> <h1 class="title">About</h1>+ <p class="text">Built with Angular 22, TypeScript, Playwright.</p>− <p class="text">Built with Angular 22, TypeScript.</p> </section>
Project files
.gitignoreREADME.mdangular.jsone2e/app.e2e.tspackage.jsonplaywright.config.tspublic/robots.txtsrc/app/app.config.tssrc/app/app.htmlsrc/app/app.routes.tssrc/app/app.tssrc/app/components/counter/counter.htmlsrc/app/components/counter/counter.tssrc/app/pages/about/about.htmlsrc/app/pages/about/about.tssrc/app/pages/home/home.htmlsrc/app/pages/home/home.tssrc/index.htmlsrc/main.tssrc/styles.csstsconfig.app.jsontsconfig.json