Last active
October 10, 2025 01:19
-
-
Save up1/0264023cf44de41bb8d04119297b80a6 to your computer and use it in GitHub Desktop.
Playwright Agents
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 1. ติดตั้งผ่าน Claude Code | |
| $npx playwright init-agents --loop=claude | |
| Need to install the following packages: | |
| [email protected] | |
| Ok to proceed? (y) y | |
| Writing file: .claude/agents/playwright-test-generator.md | |
| Writing file: .claude/agents/playwright-test-healer.md | |
| Writing file: .claude/agents/playwright-test-planner.md | |
| Writing file: .mcp.json | |
| Writing file: seed.spec.ts | |
| # 2. ติดตั้งผ่าน VS Code | |
| $npx playwright init-agents --loop=vscode | |
| Writing file: .github/chatmodes/🎭 generator.chatmode.md | |
| Writing file: .github/chatmodes/🎭 healer.chatmode.md | |
| Writing file: .github/chatmodes/ 🎭 planner.chatmode.md | |
| Writing file: .vscode/mcp.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Planner | |
| Generate a test plan for buy 2 americano from https://seleniumbase.io/coffee/ | |
| and go to cart and checkout with name and email | |
| finally save test plan to file demo-plan.md in specs folder | |
| # Generator | |
| Generate test case from plan | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // spec: specs/demo-plan.md | |
| // seed: tests/seed.spec.ts | |
| import { test, expect } from '@playwright/test'; | |
| test.describe('Product Selection and Cart Management', () => { | |
| test('Add Single Item to Cart from Menu Page', async ({ page }) => { | |
| // Navigate to https://seleniumbase.io/coffee/ | |
| await page.goto('https://seleniumbase.io/coffee/'); | |
| // Verify the menu page displays all 9 coffee products | |
| await expect(page.getByRole('heading', { name: 'Espresso $10.00' })).toBeVisible(); | |
| // Verify Americano product is visible | |
| await expect(page.getByRole('heading', { name: 'Americano $7.00' })).toBeVisible(); | |
| // Verify cart counter shows (0) before adding item | |
| await expect(page.getByText('cart (0)')).toBeVisible(); | |
| // Click on the Americano product item | |
| await page.locator('[data-test="Americano"]').click(); | |
| // Verify cart counter updates to (1) | |
| await expect(page.getByText('cart (1)')).toBeVisible(); | |
| // Verify "Proceed to checkout" button shows "Total: $7.00" | |
| await expect(page.getByText('Total: $7.00')).toBeVisible(); | |
| // Verify Americano product remains visible on menu page | |
| await expect(page.getByRole('heading', { name: 'Americano $7.00' })).toBeVisible(); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment