为什么优惠流程会悄悄出错
- 邮件迟到。 优惠邮件常通过营销工具按计划发送,在注册几分钟后才发出,变成一小时也没人发现。
- 优惠码可用次数过多。 一次性优惠码被接受两次,或过期后仍被接受,每次都在亏钱。
- 一人多号。 以
name+promo1@重新注册,很多应用会再给一次欢迎优惠。参见欢迎优惠滥用。 - 细节有误。 邮件写 20%,结账却只给 10%,或者邮件根本没写优惠何时结束。“周日结束”和“仅限今天”也算截止日期,从邮件到达当天算起。
Proxy Mail QA 如何帮忙
- 用新地址在 staging 网站上注册领取优惠。
- 在账号页面和收件箱中查看优惠码:带 Copy 按钮的优惠码、折扣(“减 20%”)、截止日期,以及地址创建后多久收到。过期后显示“Expired”,但仍可复制,方便你测试结账是否拒绝它。
- 用测试支付在结账时使用,然后在收件箱中记录结果:Accepted、Rejected 或错误,并附上应用显示的消息。
- 查看判定。 优惠码在截止日期后被接受、一次性优惠码被接受两次,或同一人已领过的优惠再次被接受,都判为失败。错误给出警告。
要检查什么
- 优惠码在你承诺的时间内到达,比如注册后 5 分钟内。
- 结账时的折扣与邮件一致。
- 一次性优惠码第二次使用时被拒绝,并有清楚的提示。
- 过期优惠码被拒绝。
- 邮件写明优惠何时结束,并有退订链接:优惠属于营销邮件。
在测试中
const submitted = new Date();await page.getByRole('button', { name: 'Get 20% off' }).click();
// Offers often take minutes: this waits up to 10.const coupon = await qa.waitForCode(address, { type: 'coupon', since: submitted, timeout: 600 });expect(coupon.discount).toBe('20% off');expect(coupon.after_seconds).toBeLessThan(300);
await page.getByLabel('Promo code').fill(coupon.value);await page.getByRole('button', { name: 'Apply' }).click();const first = await qa.recordCouponResult(address, 'accepted', { oneTime: true });expect(first.check?.status).toBe('pass');
// The same code again should be refused.await page.getByLabel('Promo code').fill(coupon.value);await page.getByRole('button', { name: 'Apply' }).click();const again = await qa.recordCouponResult(address, 'rejected', { message: await page.getByRole('alert').innerText() });expect(again.check?.status).not.toBe('fail');连接到 MCP server 的智能体可以用 wait_for_code(kind coupon)和 record_coupon_result 实现同样的功能,test_coupon_checkout 提示词会带它在 staging 上走完整个流程。