Reusable end-to-end test runner and Agent Skill for Feishu/Lark apps. It uses
the official lark-cli to send real messages, poll bot replies, run optional
application-specific checks, and save a machine-readable report.
The runner is application-agnostic. Test messages, expected replies, and local or remote state assertions live in a small configuration module.
- Node.js 20 or newer.
- The official
lark-cli. - A ready user identity from
lark-cli auth status --json --verify. - A running Lark app or bot that the authorized user can message.
npx skills add github.com/kairan0/lark-app-e2e -g -yThe repository can also be cloned and run directly.
Create a config based on examples/basic.config.mjs, then list its cases
without accessing Lark:
node scripts/run.mjs --config examples/basic.config.mjs --listSet an exact bot name or P2P chat ID and run one case:
export LARK_E2E_BOT_NAME="My Test Bot"
node scripts/run.mjs \
--config examples/basic.config.mjs \
--case health-checkReports default to data/lark-e2e/latest.json and are ignored by Git.
export default {
name: "example-app",
identity: "user",
chat: {
id: process.env.LARK_E2E_CHAT_ID || null,
name: process.env.LARK_E2E_BOT_NAME || null,
},
cases: [
{
id: "health-check",
risk: "read-only",
message: "status",
expect: {
minimumBotReplies: 1,
replyIncludes: ["ready"],
},
},
],
};Optional beforeCase(context) and verifyCase(context) hooks can inspect
application logs, databases, APIs, or Base state. The context provides
runCli, testCase, sourceMessageId, replies, before, and env.
scripts/lark-cli.mjs also exports countBaseRecords() for Base before/after
assertions without exposing record contents.
- Cases default to
risk: "read-only". - Cases marked
risk: "write"are blocked unless the caller explicitly passes--allow-writeafter obtaining user confirmation. - The runner invokes
lark-cliwith argv arrays, not shell interpolation. - Update and Skill notifications are disabled for stable JSON parsing.
- Secrets, copied chat histories, and generated reports must remain outside Git.
- Do not use
keychain-downgradeto work around sandboxed macOS Keychain access.
npm test
npm run checkThis project takes inspiration from the real-message workflow in
feishu-e2e-test,
while replacing browser automation with the official CLI and keeping app checks
configurable.
MIT