create-web-e2e-test

Scaffolds Playwright browser E2E tests against a Kestrel-hosted ASP.NET Core application.

Updated Nov 19, 2020
One-click install
npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-web-e2e-test-kwojtasinski-repo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: create-web-e2e-test
Source: https://github.com/kwojtasinski-repo/ECommerceApp/tree/main/.github/skills/create-web-e2e-test
Command: npx skills add https://github.com/kwojtasinski-repo/ECommerceApp --skill create-web-e2e-test-kwojtasinski-repo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing browser-driven end-to-end tests for ECommerceApp.Web requires coordinating Playwright, a real Kestrel host, InMemory databases, and the asynchronous Outbox message dispatcher — a setup with several non-obvious pitfalls (such as accidentally creating a second TestServer-backed host) that this Skill encodes as ready-to-use templates and rules. ## Core Features & Use Cases - Test Scaffolding: Generates xUnit test classes using PlaywrightBrowserFixture and PlaywrightWebApplicationFactory with the mandatory StartKestrelHost() pattern. - Async Event Assertions: Uses OutboxDispatchWatcher to assert UI state both before and after an Outbox message is dispatched, covering the "event not yet processed" bug class. - Page Object Model Guidance: Enforces the Scenario → POM → Component composition model, including persona changes via separate BrowserContext instances. - Use Case: You need to verify that a checkout page renders correctly before and after a payment event is processed by the Outbox poller — this Skill produces the full test class with the watcher-based wait and reload assertions. ## Quick Start Ask the assistant to create a Playwright E2E test for a specific page or flow, for example the guest checkout payment flow, and it will scaffold the test class with the correct fixtures and host setup.

Frequently Asked Questions about create-web-e2e-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a Playwright E2E test for an ASP.NET Core app?

Create a test class that receives PlaywrightBrowserFixture via constructor, instantiate a PlaywrightWebApplicationFactory per test, call StartKestrelHost(), then navigate a Playwright page to the factory's ServerAddress. Each test gets its own Kestrel port and InMemory databases.

When should I use Playwright E2E tests instead of integration tests?

Use Playwright E2E tests when the flow requires real browser JavaScript execution or depends on asynchronous Outbox/broker timing. For routing, model binding, or validation checks without JS or timing concerns, use the faster AngleSharp-based Web.IntegrationTests with a synchronous broker.

How do I test a page before and after an async event is processed?

Use OutboxDispatchWatcher with a recorded UTC timestamp: assert the pre-dispatch UI state, call WaitForDispatchedAsync with the message type and a predicate, then reload the page and assert the post-dispatch state. It throws TimeoutException listing observed candidates on failure.

Why does my Playwright test see different data than my assertions?

This happens when test code touches the inherited WebApplicationFactory members like Services, CreateClient(), or Server, which lazily build a second TestServer-backed host with its own InMemory database. Only use StartKestrelHost() and ServerAddress so assertions match what the browser did.

How do I test a workflow that switches between user personas?

Create a separate BrowserContext and IPage per persona, both created and authenticated by the test or Scenario host — never let a POM manage persona changes. The guest checkout tests demonstrate this with a guest context alongside an authenticated admin context.