Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions .github/workflows/daily-multi-device-docs-tester.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ You are a documentation testing specialist. Your task is to comprehensively test
2. The docs folder is at: `${{ github.workspace }}/docs`
3. Use absolute paths or change directory explicitly
4. Keep token usage low by being efficient with your code and minimizing iterations
5. **Playwright is available via MCP tools only** - do NOT try to `require('playwright')` or install it via npm

## Your Mission

Expand Down Expand Up @@ -96,8 +97,29 @@ Test these device types based on input `${{ inputs.devices }}`:

## Step 3: Run Playwright Tests

For each device, use Playwright to:
- Set viewport size and navigate to http://localhost:4321
**IMPORTANT: Using Playwright in gh-aw Workflows**

Playwright is provided through an MCP server interface, **NOT** as an npm package. You must use the MCP Playwright tools:

- ✅ **Correct**: Use MCP tools like `mcp__playwright__browser_navigate`, `mcp__playwright__browser_run_code`, etc.
- ❌ **Incorrect**: Do NOT try to `require('playwright')` or create standalone Node.js scripts
- ❌ **Incorrect**: Do NOT install playwright via npm - it's already available through MCP

**Example Usage:**

```javascript
// Use browser_run_code to execute Playwright commands
mcp__playwright__browser_run_code({
code: `async (page) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('http://localhost:4321/gh-aw/');
return { url: page.url(), title: await page.title() };
}`
})
Comment on lines +112 to +118
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Playwright MCP call in this example isn’t awaited. Since these MCP tool calls are async, leaving off await can cause agents to proceed before navigation/testing completes. Update the snippet to explicitly await the mcp__playwright__browser_run_code(...) call (and close it consistently).

Suggested change
mcp__playwright__browser_run_code({
code: `async (page) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('http://localhost:4321/gh-aw/');
return { url: page.url(), title: await page.title() };
}`
})
await mcp__playwright__browser_run_code({
code: `async (page) => {
await page.setViewportSize({ width: 390, height: 844 });
await page.goto('http://localhost:4321/gh-aw/');
return { url: page.url(), title: await page.title() };
}`,
});

Copilot uses AI. Check for mistakes.
```

For each device viewport, use Playwright MCP tools to:
- Set viewport size and navigate to http://localhost:4321/gh-aw/
- Take screenshots and run accessibility audits
- Test interactions (navigation, search, buttons)
- Check for layout issues (overflow, truncation, broken layouts)
Expand Down
47 changes: 47 additions & 0 deletions docs/src/content/docs/troubleshooting/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,53 @@ tools:
allowed_domains: ["github.com", "*.github.io"]
```

### Cannot Find Module 'playwright'

**Error Message:**

```text
Error: Cannot find module 'playwright'
Require stack:
- /tmp/gh-aw/agent/script.js
```

**Cause:** The AI agent tried to use `require('playwright')` or created a standalone Node.js script expecting the playwright npm package to be installed. In gh-aw workflows, Playwright is provided through an MCP server interface, not as an npm package.

**Solution:** Use Playwright through MCP tools instead of trying to require the module:

```javascript
// ❌ INCORRECT - This won't work
const playwright = require('playwright');
const browser = await playwright.chromium.launch();

// ✅ CORRECT - Use MCP Playwright tools
// Example: Navigate and take screenshot
await mcp__playwright__browser_navigate({
url: "https://example.com"
});

await mcp__playwright__browser_snapshot();

// Example: Execute custom Playwright code
await mcp__playwright__browser_run_code({
code: `async (page) => {
await page.setViewportSize({ width: 390, height: 844 });
const title = await page.title();
return { title, url: page.url() };
}`
});
```

**Available MCP Playwright Tools:**
- `mcp__playwright__browser_navigate` - Navigate to URL
- `mcp__playwright__browser_snapshot` - Take screenshot
- `mcp__playwright__browser_run_code` - Execute custom Playwright code
- `mcp__playwright__browser_click` - Click elements
- `mcp__playwright__browser_type` - Type text
- `mcp__playwright__browser_close` - Close browser

See the [Playwright Tool documentation](/gh-aw/reference/tools/#playwright-tool-playwright) for complete details.
Copy link

Copilot AI Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link text says “complete details”, but the referenced Tools page documents Playwright configuration (tools: playwright:) and doesn’t describe the MCP tool operations (mcp__playwright__browser_*). Suggest rewording to “configuration details” and/or adding a pointer to gh aw mcp inspect for the runtime tool list and signatures.

This issue also appears in the following locations of the same file:

  • line 184
  • line 202
Suggested change
See the [Playwright Tool documentation](/gh-aw/reference/tools/#playwright-tool-playwright) for complete details.
See the [Playwright tool configuration documentation](/gh-aw/reference/tools/#playwright-tool-playwright) for configuration details. For the runtime MCP tool list and signatures, run `gh aw mcp inspect`.

Copilot uses AI. Check for mistakes.

## Permission Issues

### Write Operations Fail
Expand Down
Loading