-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathmulti-device-docs-tester.md
More file actions
267 lines (202 loc) Β· 7.55 KB
/
Copy pathmulti-device-docs-tester.md
File metadata and controls
267 lines (202 loc) Β· 7.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
---
name: Multi-Device Docs Tester
description: Tests a documentation site for responsive layout issues, accessibility problems, and broken interactions across mobile, tablet, and desktop device form factors
on:
schedule: daily
workflow_dispatch:
inputs:
devices:
description: 'Device types to test (comma-separated: mobile,tablet,desktop)'
required: false
default: 'mobile,tablet,desktop'
docs_dir:
description: 'Directory containing the documentation site (relative to repository root)'
required: false
default: 'docs'
build_command:
description: 'Command to build the documentation site'
required: false
default: 'npm run build'
serve_command:
description: 'Command to serve the built documentation site'
required: false
default: 'npm run preview'
server_port:
description: 'Port the documentation server listens on'
required: false
default: '4321'
permissions:
contents: read
issues: read
pull-requests: read
tracker-id: multi-device-docs-tester
engine:
id: claude
max-turns: 30
timeout-minutes: 30
network:
allowed:
- defaults
- node
- playwright
tools:
playwright:
mode: cli
bash:
- "npm install*"
- "npm run build*"
- "npm run preview*"
- "npm run start*"
- "npm run serve*"
- "playwright-cli *"
- "curl*"
- "kill*"
- "lsof*"
- "ls*"
- "pwd*"
- "cat*"
- "echo*"
- "sleep*"
safe-outputs:
upload-asset:
create-issue:
expires: 2d
labels: [documentation, testing]
imports:
- shared/reporting.md
---
# Multi-Device Documentation Testing
You are a documentation testing specialist. Your task is to build the project's documentation site and test it across multiple device form factors to catch responsive design issues, accessibility problems, and broken interactions before they reach users.
## Context
- **Repository**: ${{ github.repository }}
- **Run ID**: ${{ github.run_id }}
- **Triggered by**: @${{ github.actor }}
- **Devices to test** (DEVICES): ${{ inputs.devices }} (default: 'mobile,tablet,desktop')
- **Docs directory** (DOCS_DIR): ${{ inputs.docs_dir }} (default: 'docs' )
- **Build command** (BUILD_COMMAND): ${{ inputs.build_command }} (default 'npm run build' )
- **Serve command** (SERVE_COMMAND): ${{ inputs.serve_command }} (default 'npm run preview')
- **Server port** (SERVER_PORT): ${{ inputs.server_port }} (default '4321')
- **Working directory**: ${{ github.workspace }}
## Step 1: Verify the Documentation Site Exists
Check that the documentation directory exists and has a package.json:
```bash
ls -la ${{ github.workspace }}/DOCS_DIR/
cat ${{ github.workspace }}/DOCS_DIR/package.json 2>/dev/null | head -20 || echo "No package.json found"
```
If the docs directory doesn't exist or has no package.json, call the `noop` safe output explaining that this repository doesn't have a buildable documentation site and stop.
## Step 2: Build the Documentation Site
Navigate to the docs directory and build the site:
```bash
cd ${{ github.workspace }}/DOCS_DIR
npm install
BUILD_COMMAND
```
If the build fails, create a GitHub issue titled "π± Multi-Device Docs Test Failed - Build Error" with the error details and stop.
## Step 3: Start the Preview Server
Start the preview server in the background and wait for it to be ready:
```bash
mkdir -p /tmp/gh-aw/agent
cd ${{ github.workspace }}/DOCS_DIR
SERVE_COMMAND > /tmp/gh-aw/agent/docs-preview.log 2>&1 &
echo $! > /tmp/gh-aw/agent/docs-server.pid
echo "Server started with PID: $(cat /tmp/gh-aw/agent/docs-server.pid)"
```
Wait for the server to be ready:
```bash
PORT=SERVER_PORT
for i in {1..30}; do
curl -s http://localhost:$PORT > /dev/null && echo "Server ready on port $PORT!" && break
echo "Waiting for server... ($i/30)" && sleep 2
done
curl -s http://localhost:$PORT > /dev/null || echo "WARNING: Server may not have started properly"
```
## Step 4: Device Configuration
Use these viewport sizes based on the `DEVICES` input:
**Mobile devices** (test if "mobile" in input):
- iPhone 12: 390Γ844
- Pixel 5: 393Γ851
- Galaxy S21: 360Γ800
**Tablet devices** (test if "tablet" in input):
- iPad: 768Γ1024
- iPad Pro 11": 834Γ1194
**Desktop devices** (test if "desktop" in input):
- HD: 1366Γ768
- FHD: 1920Γ1080
## Step 5: Run Playwright Tests
**IMPORTANT: Use `playwright-cli` in bash β do NOT install or require Playwright as an npm package.**
Use `playwright-cli` commands in bash to test the documentation site. Use `localhost` to reach the local dev server.
For **each device viewport** in the requested device types, perform the following checks:
```bash
# Example: resize viewport, navigate, snapshot
playwright-cli browser_resize --width 390 --height 844
playwright-cli browser_navigate --url "http://localhost:SERVER_PORT/"
playwright-cli browser_snapshot
```
For each device, check:
1. **Page loads** successfully (no 404, 500 errors)
2. **Navigation** is usable (menu accessible, links work)
3. **Content** is readable without horizontal scrolling
4. **Images** are properly sized and not overflowing
5. **Interactive elements** (search, buttons, tabs) are reachable and tappable
6. **Text** is not truncated or overlapping
7. **Accessibility** basics: headings present, alt text on images, sufficient contrast
Take screenshots on failure for evidence. Use `upload-asset` safe output to store screenshots.
## Step 6: Analyze Results
Categorize findings by severity:
- π΄ **Critical**: Blocks navigation or makes content unreadable
- π‘ **Warning**: Layout issues that degrade experience but don't block content
- π’ **Passed**: Device renders correctly
## Step 7: Stop the Preview Server
Always clean up when done:
```bash
kill $(cat /tmp/gh-aw/agent/docs-server.pid) 2>/dev/null || true
rm -f /tmp/gh-aw/agent/docs-server.pid /tmp/gh-aw/agent/docs-preview.log
echo "Server stopped"
```
## Step 8: Report Results
### If NO Issues Found
Call the `noop` safe output to log completion:
```json
{
"noop": {
"message": "Multi-device documentation testing complete. All devices tested successfully with no issues found."
}
}
```
**You MUST invoke the noop tool β do not just write this message as text.**
### If Issues ARE Found
Create a GitHub issue titled "π± Multi-Device Docs Testing Report - [Date]" with:
```markdown
### Test Summary
- Triggered by: @${{ github.actor }}
- Workflow run: [Β§${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
- Devices tested: {count}
- Test date: {date}
### Results Overview
- π’ Passed: {count}
- π‘ Warnings: {count}
- π΄ Critical: {count}
### Critical Issues
[List issues that block functionality or readability β keep visible]
<details>
<summary><b>View All Warnings</b></summary>
[Minor layout and UX issues with device names and details]
</details>
<details>
<summary><b>View Detailed Test Results by Device</b></summary>
#### Mobile Devices
[Test results per device]
#### Tablet Devices
[Test results per device]
#### Desktop Devices
[Test results per device]
</details>
### Accessibility Findings
[Key accessibility issues β keep visible as they are important]
### Recommendations
[Actionable steps to fix the issues found]
```
**Important**: If no action is needed after completing your analysis, you **MUST** call the `noop` safe-output tool with a brief explanation. Failing to call any safe-output tool is the most common cause of workflow failures.
```json
{"noop": {"message": "No action needed: [brief explanation of what was analyzed and why no action was required]"}}
```