.claude/skills/playwright/SKILL.md
Playwright E2E testing for Luxia e-commerce platform. Builds tests for checkout flows, cart operations, authentication, CMS pages, and multilingual routing. Use when: Writing E2E tests, debugging test failures, testing payment flows, checkout sessions, cart operations, user authentication, or admin panel functionality.
npx skillsauth add kaxuna1/ecomsite playwrightInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
E2E testing framework for the Luxia e-commerce platform. Tests critical user journeys including product browsing, cart management, checkout flows, user authentication, and admin operations. All tests run against the full stack (Vite frontend + Express backend + PostgreSQL).
// e2e/checkout.spec.ts
import { test, expect } from '@playwright/test';
test.describe('Checkout Flow', () => {
test('completes checkout as guest', async ({ page }) => {
await page.goto('/en/products');
await page.click('[data-testid="product-card"]');
await page.click('[data-testid="add-to-cart"]');
await page.goto('/en/cart');
await page.click('[data-testid="checkout-button"]');
await page.fill('[name="email"]', '[email protected]');
await page.fill('[name="name"]', 'Test User');
await page.click('[data-testid="submit-order"]');
await expect(page.locator('[data-testid="order-confirmation"]')).toBeVisible();
});
});
// e2e/pages/CartPage.ts
import { Page, Locator } from '@playwright/test';
export class CartPage {
readonly page: Page;
readonly cartItems: Locator;
readonly checkoutButton: Locator;
readonly emptyCartMessage: Locator;
constructor(page: Page) {
this.page = page;
this.cartItems = page.locator('[data-testid="cart-item"]');
this.checkoutButton = page.locator('[data-testid="checkout-button"]');
this.emptyCartMessage = page.locator('[data-testid="empty-cart"]');
}
async goto(lang = 'en') {
await this.page.goto(`/${lang}/cart`);
}
async getItemCount(): Promise<number> {
return this.cartItems.count();
}
async proceedToCheckout() {
await this.checkoutButton.click();
}
}
| Concept | Usage | Example |
|---------|-------|---------|
| Language routing | All public routes use /:lang/ prefix | page.goto('/en/products') |
| Data attributes | Use data-testid for stable selectors | [data-testid="add-to-cart"] |
| Auth state | Admin and customer use separate JWT flows | storageState for session reuse |
| API mocking | Mock payment/external APIs in tests | page.route('/api/orders', ...) |
| Visual testing | Snapshot comparisons for CMS pages | expect(page).toHaveScreenshot() |
// e2e/auth.setup.ts
import { test as setup } from '@playwright/test';
setup('authenticate customer', async ({ page }) => {
await page.goto('/en/login');
await page.fill('[name="email"]', '[email protected]');
await page.fill('[name="password"]', 'TestPassword123');
await page.click('[type="submit"]');
await page.waitForURL('/en/');
await page.context().storageState({ path: 'e2e/.auth/customer.json' });
});
test('displays content in Georgian', async ({ page }) => {
await page.goto('/ka/products');
const heading = page.locator('h1');
// Verify Georgian text renders correctly
await expect(heading).toContainText('პროდუქტები');
});
tools
Zustand lightweight state management with persistence and middleware. Use when: managing client-side state (cart, auth, UI preferences), replacing React Context with simpler API, accessing state outside React components, implementing localStorage persistence
development
Zod schema validation and TypeScript integration for runtime type safety. Use when: Validating API payloads, form inputs, environment variables, or any external data boundaries where TypeScript types alone cannot guarantee safety.
tools
Configures Vite 5.x build tool, dev server, and frontend asset optimization for the Luxia e-commerce platform. Use when: configuring builds, adding environment variables, optimizing bundle size, setting up testing, debugging HMR issues, or adding Vite plugins.
development
Enforces strict TypeScript types across frontend and backend codebases. Use when: Writing new services, DTOs, interfaces, type guards, debugging type errors, or ensuring type safety at API boundaries.