Playwright Python E2E

Enforce Page Object Model structure and shared pytest fixtures for Playwright Python tests.

1|Updated May 2, 2026
One-click install
npx skills add https://github.com/Levironexe/architect --skill playwright-python-e2e
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Playwright Python E2E
Source: https://github.com/Levironexe/architect/tree/main/skills/patterns/playwright-python
Command: npx skills add https://github.com/Levironexe/architect --skill playwright-python-e2e

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Flaky, hard-to-maintain end-to-end tests slow down delivery and make refactoring risky because selectors and setup logic get duplicated across many test files. This pattern turns E2E automation into a structured, resilient test suite that stays readable and update-friendly as the UI evolves.

Core Features & Use Cases

  • Page Object Models (POM): Centralizes selectors and user-intention flows so tests call intention methods instead of raw locators.
  • pytest fixtures via conftest.py: Reuses shared authenticated contexts, page object factories, and environment configuration without duplication.
  • Storage-state based auth: Authenticates once and reuses the saved session for fast tests, including CI-friendly patterns like tracing and retries.

Use Case: Build a reliable checkout or login test suite for a Python web app where many tests need an authenticated browser state and should fail with actionable diagnostics when something changes.

Quick Start

Install Playwright and pytest-playwright in your project, then implement the structure with tests/ + pages/ + a root conftest.py that provides authenticated fixtures and Page Object classes.

Frequently Asked Questions about Playwright Python E2E

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

FAQPage Schema
How do I stabilize flaky Playwright Python tests in CI?

To stabilize flaky Playwright Python tests in CI, enforce a Page Object Model structure and shared pytest fixtures. Configure CI diagnostics like retries and tracing, and centralize selectors to prevent test duplication.

What is the best way to manage authenticated browser contexts in pytest E2E testing?

The best way to manage authenticated browser contexts in pytest E2E testing is using storage_state. Authenticate once and load the saved session into browser_context_args via conftest.py fixtures for fast test setups.

Do I need to use the Page Object Model for Playwright Python E2E tests?

You need to use the Page Object Model for Playwright Python E2E tests to maintain readable suites. It centralizes selectors in pages/ classes, requiring tests to avoid raw Playwright locators and call intention methods instead.

How do I set up a pytest and Playwright E2E testing project structure?

To set up a pytest and Playwright E2E testing project structure, install playwright and pytest-playwright, then create a tests/ directory, a pages/ directory, and a root conftest.py to provide authenticated fixtures.

Why should I avoid raw Playwright locators in E2E test scripts?

You should avoid raw Playwright locators in E2E test scripts because duplicating selectors makes refactoring risky. Centralizing selectors in Page Object classes keeps automation structured and resilient as the UI evolves.