用 TestSprite CLI 自动化测试 AI 生成网站
Claude Code tip: before you ship a vibe-coded site, have your agent 𝗰𝗹𝗶𝗰𝗸 𝘁𝗵𝗿𝗼𝘂𝗴…
Prompt 结构极其严谨,将测试场景、安全边界和输出格式标准化,是 AI 辅助开发工作流的优秀范例。
Claude Code tip: before you ship a vibe-coded site, have your agent 𝗰𝗹𝗶𝗰𝗸 𝘁𝗵𝗿𝗼𝘂𝗴𝗵 𝗶𝘁 𝗹𝗶𝗸𝗲 𝗮 𝗿𝗲𝗮𝗹 𝘂𝘀𝗲𝗿. Point the TestSprite CLI at your preview deploy, have it check 𝘁𝗵𝗲𝘀𝗲 𝟭𝟮 𝗳𝗹𝗼𝘄𝘀 in a real browser, then fix every failure in one pass:
Claude Code 技巧:在部署一个由 AI 生成的网站之前,让你的代理像真实用户一样 𝗰𝗹𝗶𝗰𝗸 𝘁𝗵𝗿𝗼𝘂𝗴𝗵 𝗶𝘁(点击浏览它)。将 TestSprite CLI 指向你的预览部署,让它在真实浏览器中检查 𝘁𝗵𝗲𝘀𝗲 𝟭𝟮 𝗳𝗹𝗼𝘄𝘀(这 12 个流程),然后在一次操作中修复所有失败项:
Accounts → Sign up with a fresh email, log out, log back in. Is your data still there? → Wrong password, empty form, an email that's already taken: does each one show a clear error? → Log in as user B and try to open user A's data. You should see nothing
账户 → 使用新邮箱注册,注销,然后重新登录。你的数据还在吗? → 密码错误、表单为空、邮箱已被占用:每种情况是否都显示了清晰的错误提示? → 以用户 B 身份登录并尝试打开用户 A 的数据。你应该什么也看不到
Cart and checkout → Add, change the quantity, remove. Does the total update every single time? → Reload in the middle of checkout. Is the cart still there? → Apply a promo code where it shouldn't work. Does the total stay the same?
购物车和结账 → 添加商品、更改数量、移除商品。总价是否在每次操作后都更新? → 在结账过程中刷新页面。购物车内容还在吗? → 在不支持的地方应用促销代码。总价是否保持不变?
Forms and email → Submit every form with bad input: blanks, very long text, the wrong format → Use the unsubscribe link while logged out. Does one click actually do it?
表单和邮件 → 使用无效输入提交每个表单:空白、超长文本、格式错误 → 在未登录状态下使用退订链接。一次点击真的能完成退订吗?
The boring stuff that breaks first → Every nav link, on desktop and mobile width → Empty states: no items, no results, no notes yet → Back button after an action. Does the page still make sense? → Anything you changed in this PR, plus the flows next to it
最容易出错的枯燥部分 → 所有导航链接,包括桌面端和移动端宽度 → 空状态:无商品、无结果、暂无笔记 → 执行操作后的返回按钮。页面逻辑依然合理吗? → 你在本次 PR 中修改的任何内容,以及与之相邻的流程
Setup: npm install -g @testsprite/testsprite-cli testsprite setup
设置: npm install -g @testsprite/testsprite-cli testsprite setup
It writes the tests itself from the preview URL, and every failure comes back with a replay, the cause and a fix prompt your agent can apply.
它会从预览 URL 自动生成测试,并且每个失败项都会附带回放视频、原因分析以及你的代理可以应用的修复提示。
The default medium effort is enough. Accounts are the most expensive group to get wrong, so raise effort to high when fixing those.
默认的中等工作量就足够了。账户是最容易出错且修复成本最高的组,因此在修复账户相关问题时将工作量提升至高。
Send this whole post to Claude Code. If you need to, add this line at the end 👇 "Test my preview deploy, after checking it isn't on the production database. If it is, or there's no preview, use my local dev server on a test database (TestSprite's --local). If neither works, stop and tell me. If the preview needs a Vercel login, tell me how to create a Protection Bypass for Automation secret, then add the secret I send to the URL as x-vercel-protection-bypass, with x-vercel-set-bypass-cookie=true. Create two already-confirmed test accounts (A and B), and prefix everything you create with testsprite-. Send email only to my test inbox, and use test mode for payments. Keep the API key and bypass secret out of git and anything you show me. Run the phone-width checks (390×844) and any sign-up with an email code yourself in Playwright, and ask me for the code. List each failure with its replay and cause, counting a pass that skipped a step as a failure. Reproduce each one yourself with Playwright, then wait for my OK. Fix the ones that reproduced in one pass, list the rest as unconfirmed, rerun them once, and give me a pass/fail/n/a table for all 12 flows. Finally, delete only the testsprite- accounts and data, and remind me to revoke the bypass secret."
将此完整帖子发送给 Claude Code。如果需要,在末尾添加以下行 👇 “测试我的预览部署,先确认它未使用生产数据库。如果是,或者没有预览环境,则在我的本地开发服务器上针对测试数据库运行(TestSprite 的 --local)。如果两者都不可用,请停止并告知我。如果预览需要 Vercel 登录,请告诉我如何为 Automation secret 创建 Protection Bypass,然后将我发送的 secret 作为 x-vercel-protection-bypass 添加到 URL 中,并附带 x-vercel-set-bypass-cookie=true。创建两个已确认的测试账户(A 和 B),并将你创建的所有内容以 testsprite- 为前缀。仅将邮件发送至我的测试收件箱,并在支付时使用测试模式。确保 API key 和 bypass secret 不出现在 git 中,也不要向我展示它们。在 Playwright 中自行执行手机宽度检查(390×844)以及任何通过邮箱验证码的注册流程,并向我要验证码。列出每次失败及其回放和原因,将跳过某步骤的通过视为失败。在 Playwright 中自行复现每个失败案例,然后等待我的确认。一次性修复那些成功复现的案例,将其余未确认的案例重新运行一次,并为所有 12 个流程提供一份通过/失败/不适用的表格。最后,仅删除 testsprite- 相关的账户和数据,并提醒我撤销该 bypass secret。”
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力