| name | feishu-e2e-test |
| description | Local E2E debug and test framework for clawd-feishu plugin development. Use when debugging message flow, testing bot responses, verifying Feishu web UI interactions, or performing end-to-end validation of the OpenClaw-Feishu integration during development. |
| allowed-tools | Bash(agent-browser:*) |
Feishu E2E Test Framework
Local development testing using agent-browser CLI to interact with Feishu web app.
Prerequisites
- Feishu web logged in at
https://feishu.cn/next/messenger
agent-browser CLI available
- OpenClaw locally installed
- Feishu bot appid/secret given in chat or in .env
- User given bot name which will display in Feishu web UI
Important Notes
Every time you modify extension code, you MUST restart OpenClaw Gateway for changes to take effect.
openclaw gateway restart
ps aux | grep openclaw
tail -f ~/.openclaw/logs/gateway.log
agent-browser Usage
Always use --headed mode so user can see the browser and help with login:
agent-browser --headed --session feishu-test open "https://feishu.cn/next/messenger"
Feishu Web UI Tips
Feishu web has complex UI that makes direct clicking unreliable. Use these strategies:
1. Use Search (Cmd+K) Instead of Clicking
Clicking on chat list items often misses or selects wrong item. Use global search:
agent-browser --session feishu-test press "Meta+k"
agent-browser --session feishu-test press "o"
agent-browser --session feishu-test press "p"
agent-browser --session feishu-test press "e"
agent-browser --session feishu-test press "n"
agent-browser --session feishu-test press "Enter"
2. Focus Input with "/" Key
After entering a chat, press "/" to focus the message input:
agent-browser --session feishu-test press "/"
agent-browser --session feishu-test press "Backspace"
3. Type Characters One by One
The type command often fails with special characters. Use press for each character:
agent-browser --session feishu-test press "p"
agent-browser --session feishu-test press "i"
agent-browser --session feishu-test press "n"
agent-browser --session feishu-test press "g"
4. Chinese Characters Do NOT Work
Chinese characters cannot be typed with press command. Use English only:
for char in $(echo "读取文档" | grep -o .); do
agent-browser --session feishu-test press "$char"
done
for char in r e a d " " d o c; do
agent-browser --session feishu-test press "$char"
done
5. Typing Spaces
Spaces must be quoted as " ":
for char in r e a d " " d o c; do
agent-browser --session feishu-test press "$char"
done
6. Typing Long Strings Efficiently
Use a for loop to type URLs or long text:
url="https://feishu.cn/docx/YOUR_DOC_TOKEN"
for char in $(echo "$url" | grep -o .); do
agent-browser --session feishu-test press "$char" 2>/dev/null || true
done
7. Avoid JS eval on Feishu
Do NOT use eval to set input values - it can break the page:
agent-browser eval "document.activeElement.innerText = 'text'"
agent-browser press "t" && agent-browser press "e" ...
8. Full URLs Work Better Than IDs
When testing document tools, send full URLs rather than just document IDs:
"https://feishu.cn/docx/YOUR_DOC_TOKEN"
"read YOUR_DOC_TOKEN"
Verifying Tool Calls
Log Patterns
Monitor gateway logs to verify tool execution:
tail -f ~/.openclaw/logs/gateway.log
Key log entries:
[feishu] received message from ... - incoming message
[feishu] dispatching to agent - sent to agent
[feishu] added typing indicator reaction - bot is processing
[feishu] deliver called: text=... - agent response
[feishu] dispatch complete - response sent
Verify Tool Usage
Ask bot explicitly to confirm tool usage:
use feishu_doc tool to read YOUR_DOC_TOKEN
Look for confirmation in response like:
"我已经用 Feishu Doc Tool 读过了这个文档"
Common Errors
Permission Error (99991672)
Access denied. One of the following scopes is required: [contact:contact.base:readonly...]
This means bot lacks contact permission. Doesn't affect core messaging but prevents resolving sender names.
Other Log Locations
tail -f ~/.openclaw/logs/gateway.err.log
ls -la ~/.openclaw/logs/
ls ~/.openclaw/agents/main/sessions/
cat ~/.openclaw/agents/main/sessions/<session-id>.json
Test Workflow
- Start browser:
agent-browser --headed --session feishu-test open "https://feishu.cn/next/messenger"
- User scans QR to login
- Search for bot:
Cmd+K → type bot name → Enter
- Focus input: press
/ then Backspace
- Type message (English only, letter by letter)
- Press
Enter to send
- Wait 10-20 seconds for response
- Take screenshot and check logs to verify
Testing feishu_doc Tool
agent-browser --session feishu-test press "/" && \
agent-browser --session feishu-test press "Backspace"
url="https://feishu.cn/docx/YOUR_DOC_ID"
for char in $(echo "$url" | grep -o .); do
agent-browser --session feishu-test press "$char" 2>/dev/null || true
done
agent-browser --session feishu-test press "Enter"
sleep 15 && tail -30 ~/.openclaw/logs/gateway.log