Playwright python

From tae0y/python-project-template · View interactive version

Playwright python is an AI agent skill from the GitHub repository tae0y/python-project-template. Playwright Python AI test generation instructions based on official documentation. Use when writing or reviewing Playwright tests in Python.

How to use this skill

Skill file

Playwright Python Test Generation Instructions

Test Writing Guidelines

Code Quality Standards

Test Structure

File Organization

Assertion Best Practices

Example

import re
import pytest
from playwright.sync_api import Page, expect

@pytest.fixture(scope="function", autouse=True)
def before_each_after_each(page: Page):
    # Go to the starting url before each test.
    page.goto("https://playwright.dev/")

def test_main_navigation(page: Page):
    expect(page).to_have_url("https://playwright.dev/")

def test_has_title(page: Page):
    # Expect a title "to contain" a substring.
    expect(page).to_have_title(re.compile("Playwright"))

def test_get_started_link(page: Page):
    page.get_by_role("link", name="Get started").click()

    # Expects page to have a heading with the name of Installation.
    expect(page.get_by_role("heading", name="Installation")).to_be_visible()

Test Execution Strategy

  1. Execution: Tests are run from the terminal using the pytest command.
  2. Debug Failures: Analyze test failures and identify root causes
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.