[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DA2806PNXQRDTDPTKZHHKJ":3,"skill-same:01M7DA2806PNXQRDTDPTKZHHKJ":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":14,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":59,"updatedAt":60,"install":61,"resources":74},"01M7DA2806PNXQRDTDPTKZHHKJ","WebApp Testing with Playwright",null,"Anthropic's official web application testing skill using native Python Playwright scripts with helper utilities for server lifecycle management, browser automation, and comprehensive E2E testing workflows.","GrupoANDevelopment-m\u002Falberto-ai","GrupoANDevelopment-m","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F257455179?v=4","01M7D69X2N2KEVN0SJF6WGM6SH","Antônio  Ndombe","01M7D69X3P5JTT8H8S904N3888",0,"MIT","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fwebapp-testing\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: WebApp Testing with Playwright\ndescription: Anthropic's official web application testing skill using native Python Playwright scripts with helper utilities for server lifecycle management, browser automation, and comprehensive E2E testing workflows.\nversion: 1.0.0\nauthor: thetestingacademy\nlicense: MIT\ntags: [playwright-python, webapp-testing, e2e, anthropic, server-lifecycle, browser-automation, python]\ntestingTypes: [e2e, integration, functional]\nframeworks: [playwright]\nlanguages: [python]\ndomains: [web]\nagents: [claude-code, cursor, github-copilot, windsurf, codex, aider, continue, cline, zed, bolt]\n---\n\n# WebApp Testing with Playwright (Python)\n\nYou are an expert QA automation engineer using Anthropic's official webapp-testing skill. This skill specializes in Python-based Playwright testing with integrated server lifecycle management. When the user asks you to test web applications, write E2E tests, or manage test environments, follow these detailed instructions.\n\n## Core Principles\n\n1. **Server lifecycle integration** -- Automatically start\u002Fstop application servers for isolated test runs.\n2. **Python-native Playwright** -- Leverage Python's ecosystem with Playwright's browser automation.\n3. **Helper script utilities** -- Use provided helper scripts for common test setup tasks.\n4. **Isolated test environments** -- Each test run gets a clean server instance.\n5. **Comprehensive assertions** -- Validate both UI state and underlying data consistency.\n\n## Installation\n\n```bash\n# Install Playwright for Python\npip install playwright pytest-playwright\n\n# Install Playwright browsers\nplaywright install\n\n# Install with additional dependencies\npip install playwright pytest-playwright pytest-asyncio faker\n```\n\n## Project Structure\n\n```\ntests\u002F\n  webapp\u002F\n    test_authentication.py\n    test_dashboard.py\n    test_checkout.py\n    test_api_integration.py\n  fixtures\u002F\n    server_fixture.py\n    browser_fixture.py\n    data_fixture.py\n  helpers\u002F\n    server_manager.py\n    browser_utils.py\n    test_data.py\n  pages\u002F\n    login_page.py\n    dashboard_page.py\n    base_page.py\n  config\u002F\n    test_config.py\n    server_config.py\npytest.ini\nconftest.py\n```\n\n## Server Lifecycle Management\n\n### Server Manager Helper\n\n```python\n# helpers\u002Fserver_manager.py\nimport subprocess\nimport time\nimport requests\nfrom typing import Optional\nimport signal\nimport sys\n\nclass ServerManager:\n    \"\"\"Manage application server lifecycle for testing.\"\"\"\n\n    def __init__(\n        self,\n        command: str,\n        port: int = 3000,\n        host: str = \"localhost\",\n        startup_timeout: int = 30,\n        health_check_path: str = \"\u002F\",\n    ):\n        self.command = command\n        self.port = port\n        self.host = host\n        self.startup_timeout = startup_timeout\n        self.health_check_path = health_check_path\n        self.process: Optional[subprocess.Popen] = None\n        self.base_url = f\"http:\u002F\u002F{host}:{port}\"\n\n    def start(self) -> None:\n        \"\"\"Start the application server.\"\"\"\n        print(f\"Starting server: {self.command}\")\n\n        self.process = subprocess.Popen(\n            self.command,\n            shell=True,\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            preexec_fn=lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)\n        )\n\n        # Wait for server to be ready\n        self._wait_for_server()\n        print(f\"Server running at {self.base_url}\")\n\n    def _wait_for_server(self) -> None:\n        \"\"\"Wait for server to respond to health checks.\"\"\"\n        start_time = time.time()\n        health_url = f\"{self.base_url}{self.health_check_path}\"\n\n        while time.time() - start_time \u003C self.startup_timeout:\n            try:\n                response = requests.get(health_url, timeout=1)\n                if response.status_code \u003C 500:\n                    print(f\"Server ready (status: {response.status_code})\")\n                    return\n            except requests.exceptions.RequestException:\n                pass\n\n            time.sleep(0.5)\n\n        raise TimeoutError(\n            f\"Server did not start within {self.startup_timeout} seconds\"\n        )\n\n    def stop(self) -> None:\n        \"\"\"Stop the application server.\"\"\"\n        if self.process:\n            print(\"Stopping server...\")\n            self.process.terminate()\n            try:\n                self.process.wait(timeout=10)\n            except subprocess.TimeoutExpired:\n                print(\"Server did not stop gracefully, forcing...\")\n                self.process.kill()\n                self.process.wait()\n\n            self.process = None\n            print(\"Server stopped\")\n\n    def restart(self) -> None:\n        \"\"\"Restart the server.\"\"\"\n        self.stop()\n        time.sleep(1)\n        self.start()\n\n    def is_running(self) -> bool:\n        \"\"\"Check if server is running.\"\"\"\n        if not self.process:\n            return False\n\n        try:\n            response = requests.get(\n                f\"{self.base_url}{self.health_check_path}\",\n                timeout=1\n            )\n            return response.status_code \u003C 500\n        except requests.exceptions.RequestException:\n            return False\n\n    def __enter__(self):\n        \"\"\"Context manager entry.\"\"\"\n        self.start()\n        return self\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        \"\"\"Context manager exit.\"\"\"\n        self.stop()\n```\n\n### Server Fixture Configuration\n\n```python\n# conftest.py\nimport pytest\nfrom helpers.server_manager import ServerManager\n\n@pytest.fixture(scope=\"session\")\ndef server():\n    \"\"\"Start application server for test session.\"\"\"\n    server_manager = ServerManager(\n        command=\"npm run dev\",\n        port=3000,\n        startup_timeout=60,\n        health_check_path=\"\u002Fapi\u002Fhealth\"\n    )\n\n    server_manager.start()\n    yield server_manager\n    server_manager.stop()\n\n@pytest.fixture(scope=\"session\")\ndef base_url(server):\n    \"\"\"Provide base URL for tests.\"\"\"\n    return server.base_url\n\n@pytest.fixture(scope=\"function\")\ndef page(browser, base_url):\n    \"\"\"Create new page for each test.\"\"\"\n    context = browser.new_context(base_url=base_url)\n    page = context.new_page()\n    yield page\n    context.close()\n```\n\n## Page Object Model (Python)\n\n### Base Page Class\n\n```python\n# pages\u002Fbase_page.py\nfrom playwright.sync_api import Page, expect\nfrom typing import Optional\n\nclass BasePage:\n    \"\"\"Base class for all page objects.\"\"\"\n\n    def __init__(self, page: Page, base_url: str):\n        self.page = page\n        self.base_url = base_url\n\n    def navigate(self, path: str = \"\") -> None:\n        \"\"\"Navigate to a specific path.\"\"\"\n        url = f\"{self.base_url}{path}\"\n        self.page.goto(url)\n\n    def wait_for_load(self, state: str = \"networkidle\") -> None:\n        \"\"\"Wait for page to load.\"\"\"\n        self.page.wait_for_load_state(state)\n\n    def get_title(self) -> str:\n        \"\"\"Get page title.\"\"\"\n        return self.page.title()\n\n    def take_screenshot(self, filename: str, full_page: bool = True) -> None:\n        \"\"\"Take screenshot of page.\"\"\"\n        self.page.screenshot(path=filename, full_page=full_page)\n\n    def wait_for_selector(\n        self,\n        selector: str,\n        state: str = \"visible\",\n        timeout: int = 30000\n    ) -> None:\n        \"\"\"Wait for element to be in specific state.\"\"\"\n        self.page.wait_for_selector(selector, state=state, timeout=timeout)\n\n    def execute_script(self, script: str, *args):\n        \"\"\"Execute JavaScript in page context.\"\"\"\n        return self.page.evaluate(script, *args)\n\n    def reload(self) -> None:\n        \"\"\"Reload the page.\"\"\"\n        self.page.reload()\n\n    def go_back(self) -> None:\n        \"\"\"Navigate back.\"\"\"\n        self.page.go_back()\n\n    def go_forward(self) -> None:\n        \"\"\"Navigate forward.\"\"\"\n        self.page.go_forward()\n```\n\n### Login Page Example\n\n```python\n# pages\u002Flogin_page.py\nfrom playwright.sync_api import Page, expect\nfrom pages.base_page import BasePage\n\nclass LoginPage(BasePage):\n    \"\"\"Login page object.\"\"\"\n\n    def __init__(self, page: Page, base_url: str):\n        super().__init__(page, base_url)\n\n        # Locators\n        self.email_input = page.get_by_label(\"Email\")\n        self.password_input = page.get_by_label(\"Password\")\n        self.submit_button = page.get_by_role(\"button\", name=\"Sign in\")\n        self.error_message = page.get_by_role(\"alert\")\n        self.forgot_password_link = page.get_by_role(\"link\", name=\"Forgot password?\")\n        self.remember_me_checkbox = page.get_by_label(\"Remember me\")\n\n    def goto(self) -> None:\n        \"\"\"Navigate to login page.\"\"\"\n        self.navigate(\"\u002Flogin\")\n\n    def login(self, email: str, password: str, remember_me: bool = False) -> None:\n        \"\"\"Perform login action.\"\"\"\n        self.email_input.fill(email)\n        self.password_input.fill(password)\n\n        if remember_me:\n            self.remember_me_checkbox.check()\n\n        self.submit_button.click()\n\n    def expect_error(self, message: str) -> None:\n        \"\"\"Verify error message is displayed.\"\"\"\n        expect(self.error_message).to_be_visible()\n        expect(self.error_message).to_have_text(message)\n\n    def expect_logged_in(self) -> None:\n        \"\"\"Verify successful login.\"\"\"\n        expect(self.page).to_have_url(\"\u002Fdashboard\")\n\n    def click_forgot_password(self) -> None:\n        \"\"\"Click forgot password link.\"\"\"\n        self.forgot_password_link.click()\n        expect(self.page).to_have_url(\"\u002Fforgot-password\")\n```\n\n### Dashboard Page Example\n\n```python\n# pages\u002Fdashboard_page.py\nfrom playwright.sync_api import Page, expect\nfrom pages.base_page import BasePage\nfrom typing import List, Dict\n\nclass DashboardPage(BasePage):\n    \"\"\"Dashboard page object.\"\"\"\n\n    def __init__(self, page: Page, base_url: str):\n        super().__init__(page, base_url)\n\n        # Locators\n        self.welcome_heading = page.get_by_role(\"heading\", name=\"Welcome\")\n        self.user_menu = page.get_by_test_id(\"user-menu\")\n        self.logout_button = page.get_by_role(\"button\", name=\"Logout\")\n        self.stats_cards = page.locator(\".stat-card\")\n        self.activity_feed = page.get_by_test_id(\"activity-feed\")\n\n    def goto(self) -> None:\n        \"\"\"Navigate to dashboard.\"\"\"\n        self.navigate(\"\u002Fdashboard\")\n\n    def expect_welcome_message(self, username: str) -> None:\n        \"\"\"Verify welcome message contains username.\"\"\"\n        expect(self.welcome_heading).to_contain_text(username)\n\n    def get_stat_value(self, stat_name: str) -> str:\n        \"\"\"Get value for specific stat.\"\"\"\n        stat_card = self.page.locator(f\".stat-card[data-stat='{stat_name}']\")\n        return stat_card.locator(\".stat-value\").text_content()\n\n    def get_all_stats(self) -> Dict[str, str]:\n        \"\"\"Get all dashboard statistics.\"\"\"\n        stats = {}\n        count = self.stats_cards.count()\n\n        for i in range(count):\n            card = self.stats_cards.nth(i)\n            name = card.get_attribute(\"data-stat\")\n            value = card.locator(\".stat-value\").text_content()\n            stats[name] = value\n\n        return stats\n\n    def logout(self) -> None:\n        \"\"\"Logout user.\"\"\"\n        self.user_menu.click()\n        self.logout_button.click()\n        expect(self.page).to_have_url(\"\u002Flogin\")\n\n    def get_recent_activities(self, limit: int = 5) -> List[Dict[str, str]]:\n        \"\"\"Get recent activity items.\"\"\"\n        activities = []\n        items = self.activity_feed.locator(\".activity-item\").all()[:limit]\n\n        for item in items:\n            activities.append({\n                \"title\": item.locator(\".activity-title\").text_content(),\n                \"time\": item.locator(\".activity-time\").text_content(),\n                \"type\": item.get_attribute(\"data-type\")\n            })\n\n        return activities\n```\n\n## Writing Tests\n\n### Basic Test Structure\n\n```python\n# tests\u002Fwebapp\u002Ftest_authentication.py\nimport pytest\nfrom playwright.sync_api import Page, expect\nfrom pages.login_page import LoginPage\nfrom pages.dashboard_page import DashboardPage\n\nclass TestAuthentication:\n    \"\"\"Authentication test suite.\"\"\"\n\n    @pytest.fixture(autouse=True)\n    def setup(self, page: Page, base_url: str):\n        \"\"\"Setup for each test.\"\"\"\n        self.login_page = LoginPage(page, base_url)\n        self.dashboard_page = DashboardPage(page, base_url)\n\n    def test_successful_login(self):\n        \"\"\"Test successful login with valid credentials.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"SecurePass123!\")\n\n        self.login_page.expect_logged_in()\n        self.dashboard_page.expect_welcome_message(\"User\")\n\n    def test_login_with_invalid_password(self):\n        \"\"\"Test login fails with incorrect password.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"wrongpassword\")\n\n        self.login_page.expect_error(\"Invalid email or password\")\n\n    def test_login_with_nonexistent_email(self):\n        \"\"\"Test login fails with non-registered email.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"nonexistent@example.com\", \"SomePass123!\")\n\n        self.login_page.expect_error(\"Invalid email or password\")\n\n    @pytest.mark.parametrize(\"email,password,error\", [\n        (\"\", \"password\", \"Email is required\"),\n        (\"user@example.com\", \"\", \"Password is required\"),\n        (\"invalid-email\", \"password\", \"Please enter a valid email\"),\n        (\"user@example.com\", \"short\", \"Password must be at least 8 characters\"),\n    ])\n    def test_login_validation(self, email: str, password: str, error: str):\n        \"\"\"Test form validation errors.\"\"\"\n        self.login_page.goto()\n        self.login_page.email_input.fill(email)\n        self.login_page.password_input.fill(password)\n        self.login_page.submit_button.click()\n\n        self.login_page.expect_error(error)\n\n    def test_remember_me_functionality(self, page: Page):\n        \"\"\"Test remember me checkbox persists session.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"SecurePass123!\", remember_me=True)\n\n        self.dashboard_page.expect_welcome_message(\"User\")\n\n        # Close and reopen browser\n        page.context().close()\n        new_context = page.context().browser.new_context()\n        new_page = new_context.new_page()\n\n        # Should still be logged in\n        new_page.goto(f\"{self.login_page.base_url}\u002Fdashboard\")\n        expect(new_page).to_have_url(\"\u002Fdashboard\")\n\n        new_context.close()\n```\n\n### Advanced Test Patterns\n\n```python\n# tests\u002Fwebapp\u002Ftest_dashboard.py\nimport pytest\nfrom playwright.sync_api import Page, expect\nfrom pages.login_page import LoginPage\nfrom pages.dashboard_page import DashboardPage\n\nclass TestDashboard:\n    \"\"\"Dashboard functionality tests.\"\"\"\n\n    @pytest.fixture(autouse=True)\n    def setup(self, page: Page, base_url: str):\n        \"\"\"Setup authenticated session.\"\"\"\n        self.login_page = LoginPage(page, base_url)\n        self.dashboard_page = DashboardPage(page, base_url)\n\n        # Login before each test\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"SecurePass123!\")\n\n    def test_dashboard_loads_all_components(self):\n        \"\"\"Test all dashboard components are visible.\"\"\"\n        self.dashboard_page.goto()\n\n        expect(self.dashboard_page.welcome_heading).to_be_visible()\n        expect(self.dashboard_page.stats_cards).to_have_count(4)\n        expect(self.dashboard_page.activity_feed).to_be_visible()\n\n    def test_dashboard_statistics_accuracy(self):\n        \"\"\"Test dashboard stats match expected values.\"\"\"\n        self.dashboard_page.goto()\n\n        stats = self.dashboard_page.get_all_stats()\n\n        assert \"users\" in stats\n        assert \"revenue\" in stats\n        assert \"orders\" in stats\n        assert \"growth\" in stats\n\n        # Verify stat values are numeric\n        assert stats[\"users\"].isdigit()\n        assert \"$\" in stats[\"revenue\"]\n\n    def test_activity_feed_updates(self, page: Page):\n        \"\"\"Test activity feed shows recent actions.\"\"\"\n        self.dashboard_page.goto()\n\n        initial_activities = self.dashboard_page.get_recent_activities()\n        initial_count = len(initial_activities)\n\n        # Perform an action that generates activity\n        page.get_by_role(\"button\", name=\"Create New\").click()\n        page.get_by_label(\"Title\").fill(\"Test Item\")\n        page.get_by_role(\"button\", name=\"Save\").click()\n\n        # Wait for activity feed to update\n        page.wait_for_timeout(1000)\n        self.dashboard_page.reload()\n\n        updated_activities = self.dashboard_page.get_recent_activities()\n\n        assert len(updated_activities) > initial_count\n        assert updated_activities[0][\"title\"] == \"Created Test Item\"\n\n    def test_logout_functionality(self):\n        \"\"\"Test user can logout successfully.\"\"\"\n        self.dashboard_page.goto()\n        self.dashboard_page.logout()\n\n        expect(self.login_page.page).to_have_url(\"\u002Flogin\")\n\n        # Verify cannot access dashboard after logout\n        self.dashboard_page.goto()\n        expect(self.login_page.page).to_have_url(\"\u002Flogin\")\n```\n\n## Test Data Management\n\n### Test Data Helper\n\n```python\n# helpers\u002Ftest_data.py\nfrom faker import Faker\nfrom typing import Dict, List\nimport random\n\nfake = Faker()\n\nclass TestDataGenerator:\n    \"\"\"Generate realistic test data.\"\"\"\n\n    @staticmethod\n    def user(\n        email: str = None,\n        password: str = \"SecurePass123!\",\n        **kwargs\n    ) -> Dict[str, str]:\n        \"\"\"Generate user data.\"\"\"\n        return {\n            \"email\": email or fake.email(),\n            \"password\": password,\n            \"firstName\": kwargs.get(\"firstName\", fake.first_name()),\n            \"lastName\": kwargs.get(\"lastName\", fake.last_name()),\n            \"phone\": kwargs.get(\"phone\", fake.phone_number()),\n            \"address\": kwargs.get(\"address\", fake.address()),\n        }\n\n    @staticmethod\n    def product(**kwargs) -> Dict:\n        \"\"\"Generate product data.\"\"\"\n        return {\n            \"name\": kwargs.get(\"name\", fake.catch_phrase()),\n            \"description\": kwargs.get(\"description\", fake.text(max_nb_chars=200)),\n            \"price\": kwargs.get(\"price\", round(random.uniform(10, 1000), 2)),\n            \"category\": kwargs.get(\"category\", random.choice([\"Electronics\", \"Clothing\", \"Books\", \"Home\"])),\n            \"stock\": kwargs.get(\"stock\", random.randint(0, 100)),\n        }\n\n    @staticmethod\n    def order(user_id: str, products: List[Dict]) -> Dict:\n        \"\"\"Generate order data.\"\"\"\n        return {\n            \"userId\": user_id,\n            \"products\": products,\n            \"total\": sum(p[\"price\"] * p[\"quantity\"] for p in products),\n            \"status\": random.choice([\"pending\", \"processing\", \"shipped\", \"delivered\"]),\n            \"createdAt\": fake.date_time_this_month().isoformat(),\n        }\n```\n\n### Using Test Data in Tests\n\n```python\n# tests\u002Fwebapp\u002Ftest_checkout.py\nimport pytest\nfrom helpers.test_data import TestDataGenerator\n\nclass TestCheckout:\n    \"\"\"Checkout flow tests.\"\"\"\n\n    @pytest.fixture\n    def test_user(self):\n        \"\"\"Generate test user.\"\"\"\n        return TestDataGenerator.user()\n\n    @pytest.fixture\n    def test_products(self):\n        \"\"\"Generate test products.\"\"\"\n        return [\n            TestDataGenerator.product(name=\"Widget A\", price=29.99),\n            TestDataGenerator.product(name=\"Widget B\", price=49.99),\n        ]\n\n    def test_checkout_flow(self, page, base_url, test_user, test_products):\n        \"\"\"Test complete checkout flow.\"\"\"\n        # Navigate and login\n        page.goto(f\"{base_url}\u002Flogin\")\n        page.get_by_label(\"Email\").fill(test_user[\"email\"])\n        page.get_by_label(\"Password\").fill(test_user[\"password\"])\n        page.get_by_role(\"button\", name=\"Sign in\").click()\n\n        # Add products to cart\n        for product in test_products:\n            page.goto(f\"{base_url}\u002Fproducts\")\n            page.get_by_text(product[\"name\"]).click()\n            page.get_by_role(\"button\", name=\"Add to Cart\").click()\n\n        # Proceed to checkout\n        page.get_by_test_id(\"cart-icon\").click()\n        expect(page.get_by_test_id(\"cart-items\")).to_have_count(len(test_products))\n\n        page.get_by_role(\"button\", name=\"Checkout\").click()\n\n        # Fill shipping information\n        page.get_by_label(\"Name\").fill(f\"{test_user['firstName']} {test_user['lastName']}\")\n        page.get_by_label(\"Address\").fill(test_user[\"address\"])\n        page.get_by_label(\"Phone\").fill(test_user[\"phone\"])\n\n        # Complete order\n        page.get_by_role(\"button\", name=\"Place Order\").click()\n\n        # Verify success\n        expect(page.get_by_text(\"Order confirmed\")).to_be_visible()\n        expect(page).to_have_url(\"\u002Forders\u002Fconfirmation\")\n```\n\n## Server Lifecycle Patterns\n\n### Multiple Server Configurations\n\n```python\n# conftest.py\nimport pytest\nfrom helpers.server_manager import ServerManager\n\n@pytest.fixture(scope=\"session\", params=[\"development\", \"production\"])\ndef server(request):\n    \"\"\"Run tests against different server configurations.\"\"\"\n    config = {\n        \"development\": {\n            \"command\": \"npm run dev\",\n            \"port\": 3000,\n        },\n        \"production\": {\n            \"command\": \"npm run build && npm start\",\n            \"port\": 8080,\n        }\n    }\n\n    cfg = config[request.param]\n    server_manager = ServerManager(\n        command=cfg[\"command\"],\n        port=cfg[\"port\"]\n    )\n\n    server_manager.start()\n    yield server_manager\n    server_manager.stop()\n```\n\n### Database Seeding Integration\n\n```python\n# helpers\u002Fserver_manager.py (extended)\nclass ServerManager:\n    # ... previous methods ...\n\n    def seed_database(self, seed_script: str) -> None:\n        \"\"\"Run database seed script.\"\"\"\n        print(\"Seeding database...\")\n        result = subprocess.run(\n            seed_script,\n            shell=True,\n            capture_output=True,\n            text=True\n        )\n\n        if result.returncode != 0:\n            raise RuntimeError(f\"Database seeding failed: {result.stderr}\")\n\n        print(\"Database seeded successfully\")\n\n    def reset_database(self, reset_script: str) -> None:\n        \"\"\"Reset database to clean state.\"\"\"\n        print(\"Resetting database...\")\n        subprocess.run(reset_script, shell=True, check=True)\n        print(\"Database reset complete\")\n\n# conftest.py\n@pytest.fixture(scope=\"function\")\ndef clean_database(server):\n    \"\"\"Provide clean database for each test.\"\"\"\n    server.reset_database(\"npm run db:reset\")\n    server.seed_database(\"npm run db:seed\")\n    yield\n```\n\n## Best Practices\n\n1. **Use server fixtures** to ensure clean test environment for each run.\n2. **Implement Page Object Model** to separate test logic from page structure.\n3. **Generate test data dynamically** using Faker for realistic scenarios.\n4. **Take screenshots on failure** to aid debugging.\n5. **Use descriptive test names** that explain what is being tested.\n6. **Isolate test data** to prevent test interdependencies.\n7. **Verify server health** before running tests.\n8. **Clean up resources** in fixtures to prevent leaks.\n9. **Use parametrize** for testing multiple scenarios efficiently.\n10. **Document helper functions** for team knowledge sharing.\n\n## Anti-Patterns to Avoid\n\n1. **Not stopping servers** -- Always clean up in fixtures.\n2. **Hardcoded URLs** -- Use base_url fixture.\n3. **Shared test state** -- Each test should be independent.\n4. **Ignoring server startup failures** -- Implement proper health checks.\n5. **Not waiting for elements** -- Use Playwright's auto-waiting assertions.\n6. **Overly complex page objects** -- Keep methods focused and simple.\n7. **Skipping cleanup** -- Always reset database between tests.\n8. **Testing implementation details** -- Focus on user-facing behavior.\n9. **No error handling in helpers** -- Implement proper exception handling.\n10. **Ignoring test execution time** -- Optimize slow tests for CI\u002FCD.\n\nThis skill provides a comprehensive foundation for Python-based web application testing with Playwright, featuring integrated server lifecycle management and helper utilities optimized for Anthropic's testing workflows.\n","# WebApp Testing with Playwright (Python)\n\nYou are an expert QA automation engineer using Anthropic's official webapp-testing skill. This skill specializes in Python-based Playwright testing with integrated server lifecycle management. When the user asks you to test web applications, write E2E tests, or manage test environments, follow these detailed instructions.\n\n## Core Principles\n\n1. **Server lifecycle integration** -- Automatically start\u002Fstop application servers for isolated test runs.\n2. **Python-native Playwright** -- Leverage Python's ecosystem with Playwright's browser automation.\n3. **Helper script utilities** -- Use provided helper scripts for common test setup tasks.\n4. **Isolated test environments** -- Each test run gets a clean server instance.\n5. **Comprehensive assertions** -- Validate both UI state and underlying data consistency.\n\n## Installation\n\n```bash\n# Install Playwright for Python\npip install playwright pytest-playwright\n\n# Install Playwright browsers\nplaywright install\n\n# Install with additional dependencies\npip install playwright pytest-playwright pytest-asyncio faker\n```\n\n## Project Structure\n\n```\ntests\u002F\n  webapp\u002F\n    test_authentication.py\n    test_dashboard.py\n    test_checkout.py\n    test_api_integration.py\n  fixtures\u002F\n    server_fixture.py\n    browser_fixture.py\n    data_fixture.py\n  helpers\u002F\n    server_manager.py\n    browser_utils.py\n    test_data.py\n  pages\u002F\n    login_page.py\n    dashboard_page.py\n    base_page.py\n  config\u002F\n    test_config.py\n    server_config.py\npytest.ini\nconftest.py\n```\n\n## Server Lifecycle Management\n\n### Server Manager Helper\n\n```python\n# helpers\u002Fserver_manager.py\nimport subprocess\nimport time\nimport requests\nfrom typing import Optional\nimport signal\nimport sys\n\nclass ServerManager:\n    \"\"\"Manage application server lifecycle for testing.\"\"\"\n\n    def __init__(\n        self,\n        command: str,\n        port: int = 3000,\n        host: str = \"localhost\",\n        startup_timeout: int = 30,\n        health_check_path: str = \"\u002F\",\n    ):\n        self.command = command\n        self.port = port\n        self.host = host\n        self.startup_timeout = startup_timeout\n        self.health_check_path = health_check_path\n        self.process: Optional[subprocess.Popen] = None\n        self.base_url = f\"http:\u002F\u002F{host}:{port}\"\n\n    def start(self) -> None:\n        \"\"\"Start the application server.\"\"\"\n        print(f\"Starting server: {self.command}\")\n\n        self.process = subprocess.Popen(\n            self.command,\n            shell=True,\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            preexec_fn=lambda: signal.signal(signal.SIGINT, signal.SIG_IGN)\n        )\n\n        # Wait for server to be ready\n        self._wait_for_server()\n        print(f\"Server running at {self.base_url}\")\n\n    def _wait_for_server(self) -> None:\n        \"\"\"Wait for server to respond to health checks.\"\"\"\n        start_time = time.time()\n        health_url = f\"{self.base_url}{self.health_check_path}\"\n\n        while time.time() - start_time \u003C self.startup_timeout:\n            try:\n                response = requests.get(health_url, timeout=1)\n                if response.status_code \u003C 500:\n                    print(f\"Server ready (status: {response.status_code})\")\n                    return\n            except requests.exceptions.RequestException:\n                pass\n\n            time.sleep(0.5)\n\n        raise TimeoutError(\n            f\"Server did not start within {self.startup_timeout} seconds\"\n        )\n\n    def stop(self) -> None:\n        \"\"\"Stop the application server.\"\"\"\n        if self.process:\n            print(\"Stopping server...\")\n            self.process.terminate()\n            try:\n                self.process.wait(timeout=10)\n            except subprocess.TimeoutExpired:\n                print(\"Server did not stop gracefully, forcing...\")\n                self.process.kill()\n                self.process.wait()\n\n            self.process = None\n            print(\"Server stopped\")\n\n    def restart(self) -> None:\n        \"\"\"Restart the server.\"\"\"\n        self.stop()\n        time.sleep(1)\n        self.start()\n\n    def is_running(self) -> bool:\n        \"\"\"Check if server is running.\"\"\"\n        if not self.process:\n            return False\n\n        try:\n            response = requests.get(\n                f\"{self.base_url}{self.health_check_path}\",\n                timeout=1\n            )\n            return response.status_code \u003C 500\n        except requests.exceptions.RequestException:\n            return False\n\n    def __enter__(self):\n        \"\"\"Context manager entry.\"\"\"\n        self.start()\n        return self\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        \"\"\"Context manager exit.\"\"\"\n        self.stop()\n```\n\n### Server Fixture Configuration\n\n```python\n# conftest.py\nimport pytest\nfrom helpers.server_manager import ServerManager\n\n@pytest.fixture(scope=\"session\")\ndef server():\n    \"\"\"Start application server for test session.\"\"\"\n    server_manager = ServerManager(\n        command=\"npm run dev\",\n        port=3000,\n        startup_timeout=60,\n        health_check_path=\"\u002Fapi\u002Fhealth\"\n    )\n\n    server_manager.start()\n    yield server_manager\n    server_manager.stop()\n\n@pytest.fixture(scope=\"session\")\ndef base_url(server):\n    \"\"\"Provide base URL for tests.\"\"\"\n    return server.base_url\n\n@pytest.fixture(scope=\"function\")\ndef page(browser, base_url):\n    \"\"\"Create new page for each test.\"\"\"\n    context = browser.new_context(base_url=base_url)\n    page = context.new_page()\n    yield page\n    context.close()\n```\n\n## Page Object Model (Python)\n\n### Base Page Class\n\n```python\n# pages\u002Fbase_page.py\nfrom playwright.sync_api import Page, expect\nfrom typing import Optional\n\nclass BasePage:\n    \"\"\"Base class for all page objects.\"\"\"\n\n    def __init__(self, page: Page, base_url: str):\n        self.page = page\n        self.base_url = base_url\n\n    def navigate(self, path: str = \"\") -> None:\n        \"\"\"Navigate to a specific path.\"\"\"\n        url = f\"{self.base_url}{path}\"\n        self.page.goto(url)\n\n    def wait_for_load(self, state: str = \"networkidle\") -> None:\n        \"\"\"Wait for page to load.\"\"\"\n        self.page.wait_for_load_state(state)\n\n    def get_title(self) -> str:\n        \"\"\"Get page title.\"\"\"\n        return self.page.title()\n\n    def take_screenshot(self, filename: str, full_page: bool = True) -> None:\n        \"\"\"Take screenshot of page.\"\"\"\n        self.page.screenshot(path=filename, full_page=full_page)\n\n    def wait_for_selector(\n        self,\n        selector: str,\n        state: str = \"visible\",\n        timeout: int = 30000\n    ) -> None:\n        \"\"\"Wait for element to be in specific state.\"\"\"\n        self.page.wait_for_selector(selector, state=state, timeout=timeout)\n\n    def execute_script(self, script: str, *args):\n        \"\"\"Execute JavaScript in page context.\"\"\"\n        return self.page.evaluate(script, *args)\n\n    def reload(self) -> None:\n        \"\"\"Reload the page.\"\"\"\n        self.page.reload()\n\n    def go_back(self) -> None:\n        \"\"\"Navigate back.\"\"\"\n        self.page.go_back()\n\n    def go_forward(self) -> None:\n        \"\"\"Navigate forward.\"\"\"\n        self.page.go_forward()\n```\n\n### Login Page Example\n\n```python\n# pages\u002Flogin_page.py\nfrom playwright.sync_api import Page, expect\nfrom pages.base_page import BasePage\n\nclass LoginPage(BasePage):\n    \"\"\"Login page object.\"\"\"\n\n    def __init__(self, page: Page, base_url: str):\n        super().__init__(page, base_url)\n\n        # Locators\n        self.email_input = page.get_by_label(\"Email\")\n        self.password_input = page.get_by_label(\"Password\")\n        self.submit_button = page.get_by_role(\"button\", name=\"Sign in\")\n        self.error_message = page.get_by_role(\"alert\")\n        self.forgot_password_link = page.get_by_role(\"link\", name=\"Forgot password?\")\n        self.remember_me_checkbox = page.get_by_label(\"Remember me\")\n\n    def goto(self) -> None:\n        \"\"\"Navigate to login page.\"\"\"\n        self.navigate(\"\u002Flogin\")\n\n    def login(self, email: str, password: str, remember_me: bool = False) -> None:\n        \"\"\"Perform login action.\"\"\"\n        self.email_input.fill(email)\n        self.password_input.fill(password)\n\n        if remember_me:\n            self.remember_me_checkbox.check()\n\n        self.submit_button.click()\n\n    def expect_error(self, message: str) -> None:\n        \"\"\"Verify error message is displayed.\"\"\"\n        expect(self.error_message).to_be_visible()\n        expect(self.error_message).to_have_text(message)\n\n    def expect_logged_in(self) -> None:\n        \"\"\"Verify successful login.\"\"\"\n        expect(self.page).to_have_url(\"\u002Fdashboard\")\n\n    def click_forgot_password(self) -> None:\n        \"\"\"Click forgot password link.\"\"\"\n        self.forgot_password_link.click()\n        expect(self.page).to_have_url(\"\u002Fforgot-password\")\n```\n\n### Dashboard Page Example\n\n```python\n# pages\u002Fdashboard_page.py\nfrom playwright.sync_api import Page, expect\nfrom pages.base_page import BasePage\nfrom typing import List, Dict\n\nclass DashboardPage(BasePage):\n    \"\"\"Dashboard page object.\"\"\"\n\n    def __init__(self, page: Page, base_url: str):\n        super().__init__(page, base_url)\n\n        # Locators\n        self.welcome_heading = page.get_by_role(\"heading\", name=\"Welcome\")\n        self.user_menu = page.get_by_test_id(\"user-menu\")\n        self.logout_button = page.get_by_role(\"button\", name=\"Logout\")\n        self.stats_cards = page.locator(\".stat-card\")\n        self.activity_feed = page.get_by_test_id(\"activity-feed\")\n\n    def goto(self) -> None:\n        \"\"\"Navigate to dashboard.\"\"\"\n        self.navigate(\"\u002Fdashboard\")\n\n    def expect_welcome_message(self, username: str) -> None:\n        \"\"\"Verify welcome message contains username.\"\"\"\n        expect(self.welcome_heading).to_contain_text(username)\n\n    def get_stat_value(self, stat_name: str) -> str:\n        \"\"\"Get value for specific stat.\"\"\"\n        stat_card = self.page.locator(f\".stat-card[data-stat='{stat_name}']\")\n        return stat_card.locator(\".stat-value\").text_content()\n\n    def get_all_stats(self) -> Dict[str, str]:\n        \"\"\"Get all dashboard statistics.\"\"\"\n        stats = {}\n        count = self.stats_cards.count()\n\n        for i in range(count):\n            card = self.stats_cards.nth(i)\n            name = card.get_attribute(\"data-stat\")\n            value = card.locator(\".stat-value\").text_content()\n            stats[name] = value\n\n        return stats\n\n    def logout(self) -> None:\n        \"\"\"Logout user.\"\"\"\n        self.user_menu.click()\n        self.logout_button.click()\n        expect(self.page).to_have_url(\"\u002Flogin\")\n\n    def get_recent_activities(self, limit: int = 5) -> List[Dict[str, str]]:\n        \"\"\"Get recent activity items.\"\"\"\n        activities = []\n        items = self.activity_feed.locator(\".activity-item\").all()[:limit]\n\n        for item in items:\n            activities.append({\n                \"title\": item.locator(\".activity-title\").text_content(),\n                \"time\": item.locator(\".activity-time\").text_content(),\n                \"type\": item.get_attribute(\"data-type\")\n            })\n\n        return activities\n```\n\n## Writing Tests\n\n### Basic Test Structure\n\n```python\n# tests\u002Fwebapp\u002Ftest_authentication.py\nimport pytest\nfrom playwright.sync_api import Page, expect\nfrom pages.login_page import LoginPage\nfrom pages.dashboard_page import DashboardPage\n\nclass TestAuthentication:\n    \"\"\"Authentication test suite.\"\"\"\n\n    @pytest.fixture(autouse=True)\n    def setup(self, page: Page, base_url: str):\n        \"\"\"Setup for each test.\"\"\"\n        self.login_page = LoginPage(page, base_url)\n        self.dashboard_page = DashboardPage(page, base_url)\n\n    def test_successful_login(self):\n        \"\"\"Test successful login with valid credentials.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"SecurePass123!\")\n\n        self.login_page.expect_logged_in()\n        self.dashboard_page.expect_welcome_message(\"User\")\n\n    def test_login_with_invalid_password(self):\n        \"\"\"Test login fails with incorrect password.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"wrongpassword\")\n\n        self.login_page.expect_error(\"Invalid email or password\")\n\n    def test_login_with_nonexistent_email(self):\n        \"\"\"Test login fails with non-registered email.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"nonexistent@example.com\", \"SomePass123!\")\n\n        self.login_page.expect_error(\"Invalid email or password\")\n\n    @pytest.mark.parametrize(\"email,password,error\", [\n        (\"\", \"password\", \"Email is required\"),\n        (\"user@example.com\", \"\", \"Password is required\"),\n        (\"invalid-email\", \"password\", \"Please enter a valid email\"),\n        (\"user@example.com\", \"short\", \"Password must be at least 8 characters\"),\n    ])\n    def test_login_validation(self, email: str, password: str, error: str):\n        \"\"\"Test form validation errors.\"\"\"\n        self.login_page.goto()\n        self.login_page.email_input.fill(email)\n        self.login_page.password_input.fill(password)\n        self.login_page.submit_button.click()\n\n        self.login_page.expect_error(error)\n\n    def test_remember_me_functionality(self, page: Page):\n        \"\"\"Test remember me checkbox persists session.\"\"\"\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"SecurePass123!\", remember_me=True)\n\n        self.dashboard_page.expect_welcome_message(\"User\")\n\n        # Close and reopen browser\n        page.context().close()\n        new_context = page.context().browser.new_context()\n        new_page = new_context.new_page()\n\n        # Should still be logged in\n        new_page.goto(f\"{self.login_page.base_url}\u002Fdashboard\")\n        expect(new_page).to_have_url(\"\u002Fdashboard\")\n\n        new_context.close()\n```\n\n### Advanced Test Patterns\n\n```python\n# tests\u002Fwebapp\u002Ftest_dashboard.py\nimport pytest\nfrom playwright.sync_api import Page, expect\nfrom pages.login_page import LoginPage\nfrom pages.dashboard_page import DashboardPage\n\nclass TestDashboard:\n    \"\"\"Dashboard functionality tests.\"\"\"\n\n    @pytest.fixture(autouse=True)\n    def setup(self, page: Page, base_url: str):\n        \"\"\"Setup authenticated session.\"\"\"\n        self.login_page = LoginPage(page, base_url)\n        self.dashboard_page = DashboardPage(page, base_url)\n\n        # Login before each test\n        self.login_page.goto()\n        self.login_page.login(\"user@example.com\", \"SecurePass123!\")\n\n    def test_dashboard_loads_all_components(self):\n        \"\"\"Test all dashboard components are visible.\"\"\"\n        self.dashboard_page.goto()\n\n        expect(self.dashboard_page.welcome_heading).to_be_visible()\n        expect(self.dashboard_page.stats_cards).to_have_count(4)\n        expect(self.dashboard_page.activity_feed).to_be_visible()\n\n    def test_dashboard_statistics_accuracy(self):\n        \"\"\"Test dashboard stats match expected values.\"\"\"\n        self.dashboard_page.goto()\n\n        stats = self.dashboard_page.get_all_stats()\n\n        assert \"users\" in stats\n        assert \"revenue\" in stats\n        assert \"orders\" in stats\n        assert \"growth\" in stats\n\n        # Verify stat values are numeric\n        assert stats[\"users\"].isdigit()\n        assert \"$\" in stats[\"revenue\"]\n\n    def test_activity_feed_updates(self, page: Page):\n        \"\"\"Test activity feed shows recent actions.\"\"\"\n        self.dashboard_page.goto()\n\n        initial_activities = self.dashboard_page.get_recent_activities()\n        initial_count = len(initial_activities)\n\n        # Perform an action that generates activity\n        page.get_by_role(\"button\", name=\"Create New\").click()\n        page.get_by_label(\"Title\").fill(\"Test Item\")\n        page.get_by_role(\"button\", name=\"Save\").click()\n\n        # Wait for activity feed to update\n        page.wait_for_timeout(1000)\n        self.dashboard_page.reload()\n\n        updated_activities = self.dashboard_page.get_recent_activities()\n\n        assert len(updated_activities) > initial_count\n        assert updated_activities[0][\"title\"] == \"Created Test Item\"\n\n    def test_logout_functionality(self):\n        \"\"\"Test user can logout successfully.\"\"\"\n        self.dashboard_page.goto()\n        self.dashboard_page.logout()\n\n        expect(self.login_page.page).to_have_url(\"\u002Flogin\")\n\n        # Verify cannot access dashboard after logout\n        self.dashboard_page.goto()\n        expect(self.login_page.page).to_have_url(\"\u002Flogin\")\n```\n\n## Test Data Management\n\n### Test Data Helper\n\n```python\n# helpers\u002Ftest_data.py\nfrom faker import Faker\nfrom typing import Dict, List\nimport random\n\nfake = Faker()\n\nclass TestDataGenerator:\n    \"\"\"Generate realistic test data.\"\"\"\n\n    @staticmethod\n    def user(\n        email: str = None,\n        password: str = \"SecurePass123!\",\n        **kwargs\n    ) -> Dict[str, str]:\n        \"\"\"Generate user data.\"\"\"\n        return {\n            \"email\": email or fake.email(),\n            \"password\": password,\n            \"firstName\": kwargs.get(\"firstName\", fake.first_name()),\n            \"lastName\": kwargs.get(\"lastName\", fake.last_name()),\n            \"phone\": kwargs.get(\"phone\", fake.phone_number()),\n            \"address\": kwargs.get(\"address\", fake.address()),\n        }\n\n    @staticmethod\n    def product(**kwargs) -> Dict:\n        \"\"\"Generate product data.\"\"\"\n        return {\n            \"name\": kwargs.get(\"name\", fake.catch_phrase()),\n            \"description\": kwargs.get(\"description\", fake.text(max_nb_chars=200)),\n            \"price\": kwargs.get(\"price\", round(random.uniform(10, 1000), 2)),\n            \"category\": kwargs.get(\"category\", random.choice([\"Electronics\", \"Clothing\", \"Books\", \"Home\"])),\n            \"stock\": kwargs.get(\"stock\", random.randint(0, 100)),\n        }\n\n    @staticmethod\n    def order(user_id: str, products: List[Dict]) -> Dict:\n        \"\"\"Generate order data.\"\"\"\n        return {\n            \"userId\": user_id,\n            \"products\": products,\n            \"total\": sum(p[\"price\"] * p[\"quantity\"] for p in products),\n            \"status\": random.choice([\"pending\", \"processing\", \"shipped\", \"delivered\"]),\n            \"createdAt\": fake.date_time_this_month().isoformat(),\n        }\n```\n\n### Using Test Data in Tests\n\n```python\n# tests\u002Fwebapp\u002Ftest_checkout.py\nimport pytest\nfrom helpers.test_data import TestDataGenerator\n\nclass TestCheckout:\n    \"\"\"Checkout flow tests.\"\"\"\n\n    @pytest.fixture\n    def test_user(self):\n        \"\"\"Generate test user.\"\"\"\n        return TestDataGenerator.user()\n\n    @pytest.fixture\n    def test_products(self):\n        \"\"\"Generate test products.\"\"\"\n        return [\n            TestDataGenerator.product(name=\"Widget A\", price=29.99),\n            TestDataGenerator.product(name=\"Widget B\", price=49.99),\n        ]\n\n    def test_checkout_flow(self, page, base_url, test_user, test_products):\n        \"\"\"Test complete checkout flow.\"\"\"\n        # Navigate and login\n        page.goto(f\"{base_url}\u002Flogin\")\n        page.get_by_label(\"Email\").fill(test_user[\"email\"])\n        page.get_by_label(\"Password\").fill(test_user[\"password\"])\n        page.get_by_role(\"button\", name=\"Sign in\").click()\n\n        # Add products to cart\n        for product in test_products:\n            page.goto(f\"{base_url}\u002Fproducts\")\n            page.get_by_text(product[\"name\"]).click()\n            page.get_by_role(\"button\", name=\"Add to Cart\").click()\n\n        # Proceed to checkout\n        page.get_by_test_id(\"cart-icon\").click()\n        expect(page.get_by_test_id(\"cart-items\")).to_have_count(len(test_products))\n\n        page.get_by_role(\"button\", name=\"Checkout\").click()\n\n        # Fill shipping information\n        page.get_by_label(\"Name\").fill(f\"{test_user['firstName']} {test_user['lastName']}\")\n        page.get_by_label(\"Address\").fill(test_user[\"address\"])\n        page.get_by_label(\"Phone\").fill(test_user[\"phone\"])\n\n        # Complete order\n        page.get_by_role(\"button\", name=\"Place Order\").click()\n\n        # Verify success\n        expect(page.get_by_text(\"Order confirmed\")).to_be_visible()\n        expect(page).to_have_url(\"\u002Forders\u002Fconfirmation\")\n```\n\n## Server Lifecycle Patterns\n\n### Multiple Server Configurations\n\n```python\n# conftest.py\nimport pytest\nfrom helpers.server_manager import ServerManager\n\n@pytest.fixture(scope=\"session\", params=[\"development\", \"production\"])\ndef server(request):\n    \"\"\"Run tests against different server configurations.\"\"\"\n    config = {\n        \"development\": {\n            \"command\": \"npm run dev\",\n            \"port\": 3000,\n        },\n        \"production\": {\n            \"command\": \"npm run build && npm start\",\n            \"port\": 8080,\n        }\n    }\n\n    cfg = config[request.param]\n    server_manager = ServerManager(\n        command=cfg[\"command\"],\n        port=cfg[\"port\"]\n    )\n\n    server_manager.start()\n    yield server_manager\n    server_manager.stop()\n```\n\n### Database Seeding Integration\n\n```python\n# helpers\u002Fserver_manager.py (extended)\nclass ServerManager:\n    # ... previous methods ...\n\n    def seed_database(self, seed_script: str) -> None:\n        \"\"\"Run database seed script.\"\"\"\n        print(\"Seeding database...\")\n        result = subprocess.run(\n            seed_script,\n            shell=True,\n            capture_output=True,\n            text=True\n        )\n\n        if result.returncode != 0:\n            raise RuntimeError(f\"Database seeding failed: {result.stderr}\")\n\n        print(\"Database seeded successfully\")\n\n    def reset_database(self, reset_script: str) -> None:\n        \"\"\"Reset database to clean state.\"\"\"\n        print(\"Resetting database...\")\n        subprocess.run(reset_script, shell=True, check=True)\n        print(\"Database reset complete\")\n\n# conftest.py\n@pytest.fixture(scope=\"function\")\ndef clean_database(server):\n    \"\"\"Provide clean database for each test.\"\"\"\n    server.reset_database(\"npm run db:reset\")\n    server.seed_database(\"npm run db:seed\")\n    yield\n```\n\n## Best Practices\n\n1. **Use server fixtures** to ensure clean test environment for each run.\n2. **Implement Page Object Model** to separate test logic from page structure.\n3. **Generate test data dynamically** using Faker for realistic scenarios.\n4. **Take screenshots on failure** to aid debugging.\n5. **Use descriptive test names** that explain what is being tested.\n6. **Isolate test data** to prevent test interdependencies.\n7. **Verify server health** before running tests.\n8. **Clean up resources** in fixtures to prevent leaks.\n9. **Use parametrize** for testing multiple scenarios efficiently.\n10. **Document helper functions** for team knowledge sharing.\n\n## Anti-Patterns to Avoid\n\n1. **Not stopping servers** -- Always clean up in fixtures.\n2. **Hardcoded URLs** -- Use base_url fixture.\n3. **Shared test state** -- Each test should be independent.\n4. **Ignoring server startup failures** -- Implement proper health checks.\n5. **Not waiting for elements** -- Use Playwright's auto-waiting assertions.\n6. **Overly complex page objects** -- Keep methods focused and simple.\n7. **Skipping cleanup** -- Always reset database between tests.\n8. **Testing implementation details** -- Focus on user-facing behavior.\n9. **No error handling in helpers** -- Implement proper exception handling.\n10. **Ignoring test execution time** -- Optimize slow tests for CI\u002FCD.\n\nThis skill provides a comprehensive foundation for Python-based web application testing with Playwright, featuring integrated server lifecycle management and helper utilities optimized for Anthropic's testing workflows.\n",{"name":5,"tags":24,"agents":32,"author":43,"domains":44,"license":15,"version":46,"languages":47,"frameworks":48,"description":7,"testingTypes":50},[25,26,27,28,29,30,31],"playwright-python","webapp-testing","e2e","anthropic","server-lifecycle","browser-automation","python",[33,34,35,36,37,38,39,40,41,42],"claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","thetestingacademy",[45],"web","1.0.0",[31],[49],"playwright",[27,51,52],"integration","functional","main","eac438ea9216a7cb8a570cab803eb01eeafc6793","skills\u002Fqa\u002Fwebapp-testing","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m","https:\u002F\u002Fid-preview--d5bef06d-6c9e-4563-a3d4-a855b9d61610.lovable.app\u002F","Eu sou Antonio B. B. Ndombe \r\nEu sou um Pesquisador e desenvolvedor de sistema autonomia cognitivos, fundador de sistemas ODCs ( organismos digital conscientes)","2026-11-04 06:53:39",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"WebApp Testing with Playwright\"",{"tool":67,"command":68},"bunx","bunx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"WebApp Testing with Playwright\"",{"tool":70,"command":71},"pnpm","pnpm dlx skills add GrupoANDevelopment-m\u002Falberto-ai --skill \"WebApp Testing with Playwright\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fskills\u002Fqa\u002Fwebapp-testing\u002FSKILL.md",true,[],[76,84,91,98,105,112],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7DASC6FSCJP49JZBSK0NY1Z","nemoclaw-user-reference","Describes the NemoClaw integration layer and blueprint architecture and how they orchestrate compatible agent sandboxes. Use when looking up architecture, agent integration, plugin structure, or blueprint design. Trigger keywords - nemoclaw architecture, nemoclaw agent architecture, nemoclaw plugin blueprint structure, nemoclaw vs openshell, which cli, nemoclaw cli, openshell cli, sandbox commands, nemoclaw cli commands, nemoclaw command reference, nemoclaw network policy, sandbox egress control operator approval, nemoclaw troubleshooting, nemoclaw debug sandbox issues.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-reference\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7DAS5S79VK33XFGVAM2TFWF","nemoclaw-user-overview","Explains how OpenClaw, OpenShell, and NemoClaw form the ecosystem, NemoClaw's position in the stack, what NemoClaw adds beyond the community sandbox, and when to prefer NemoClaw versus integrating OpenShell and OpenClaw directly. Use when users ask about the relationship between OpenClaw, OpenShell, and NemoClaw, or when to use NemoClaw versus OpenShell. Trigger keywords - nemoclaw ecosystem, openclaw openshell, nemoclaw vs openshell, sandboxed openclaw, how nemoclaw works, nemoclaw sandbox lifecycle blueprint, nemoclaw overview, openclaw always-on assistants, nvidia openshell, nvidia nemotron, nemoclaw release notes, nemoclaw changelog.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-overview\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M7DAS0PQEMET5MNGZ1ABSZVS","nemoclaw-user-monitor-sandbox","Inspects sandbox health, traces agent behavior, and diagnoses problems. Use when monitoring a running sandbox, debugging agent issues, or checking sandbox logs. Trigger keywords - monitor nemoclaw sandbox, debug nemoclaw agent issues.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-monitor-sandbox\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M7DARQYGF7E9A69VH6S3CGN9","nemoclaw-user-manage-sandboxes","Explains operational tasks after the quickstart: listing sandboxes, status and health checks, logs, diagnostics, port forwards, multiple sandboxes, credential reset, rebuilds, network presets, upgrades, and uninstall. Trigger keywords - manage nemoclaw sandboxes, nemoclaw status, nemoclaw list, nemoclaw dashboard port, nemoclaw rebuild, nemoclaw upgrade sandboxes, nemoclaw uninstall, sandbox mutability, sandbox runtime configuration, sandbox rebuild, nemoclaw backup, nemoclaw restore, workspace backup, openshell sandbox download upload, nemoclaw messaging channels, nemoclaw telegram, nemoclaw discord, nemoclaw slack, nemoclaw wechat, nemoclaw whatsapp, openshell channel messaging, nemoclaw workspace files, soul.md, user.md, identity.md, agents.md, sandbox persistence.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-sandboxes\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":19},"01M7DARH8BRTG51TRCAB7YWDJ4","nemoclaw-user-manage-policy","Adds, removes, or modifies allowed endpoints in the sandbox policy. Use when customizing network policy, changing egress rules, or configuring sandbox endpoint access. Trigger keywords - customize nemoclaw network policy, sandbox egress policy configuration, nemoclaw integration policy examples, post-install policy setup, openshell approval workflow, policy preset, nemoclaw approve network requests, sandbox egress approval tui.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-manage-policy\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":80,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":19},"01M7DARAT62M2VR37590VCZ5NS","nemoclaw-user-get-started","Installs NemoClaw, launches a sandbox, and runs the first agent prompt. Use when onboarding, installing, or launching a NemoClaw sandbox for the first time. Trigger keywords - nemoclaw quickstart, install nemoclaw openclaw sandbox, nemohermes quickstart, hermes agent nemoclaw, run hermes openshell sandbox, nemoclaw prerequisites, nemoclaw supported platforms, nemoclaw hardware software, nemoclaw windows wsl2 setup, nemoclaw install windows docker desktop.","https:\u002F\u002Fgithub.com\u002FGrupoANDevelopment-m\u002Falberto-ai\u002Fblob\u002Fmain\u002Fupstream\u002Fnemoclaw\u002Fskills\u002Fnemoclaw-user-get-started\u002FSKILL.md",[],[]]