复杂场景痛点
多步骤业务流(如支付+邮件通知+DB记录)需要跨系统验证。
Shortest的解决策略
- 链式生命周期控制:.before()/.after()钩子串联多个测试阶段
- 跨系统断言:示例展示了同时验证localStorage和数据库记录
- context-sensitive:page对象在测试全程保持会话状态
best practice
- 将长流程拆分为多个shortest语句,用describe组织
- 在after钩子中统一清理测试数据
- 通过page.evaluate()直接访问前端状态进行深度断言
This answer comes from the articleShortest: an AI automated testing tool that uses natural language for end-to-end testingThe