feat(client/purchase): 全员优惠月付特殊卡片(¥6/$1,随渠道显价)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,13 @@ const _items = [
|
||||
PayCatalogItem(sku: 'pro_year', plan: 'pro', days: 366, priceMinor: 19999, currency: 'CNY', priceUsdtMicro: 34990000),
|
||||
];
|
||||
|
||||
const _itemsWithPromo = [
|
||||
PayCatalogItem(
|
||||
sku: 'pro_month_promo', plan: 'pro', days: 31, priceMinor: 600, currency: 'CNY',
|
||||
priceUsdtMicro: 1000000, promo: true),
|
||||
..._items,
|
||||
];
|
||||
|
||||
/// 轮询生命周期测试专用假 API:记 orderStatus / cancel 调用次数,其余按最小实现返回。
|
||||
class _PollingFakePaymentApi implements PaymentApi {
|
||||
int statusCalls = 0;
|
||||
@@ -80,6 +87,29 @@ void main() {
|
||||
expect(find.text('¥199.99'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('购买页:全员优惠月付特殊卡片(随渠道显价 + 原价划线)', (tester) async {
|
||||
tester.view.physicalSize = const Size(800, 2400);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(wrapThemed(
|
||||
PurchaseScreen(t: t, embedded: true),
|
||||
overrides: [payCatalogProvider.overrideWith((ref) async => _itemsWithPromo)],
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
// 普通 3 档照旧渲染 + 1 张特殊卡片(非 PlanCard)。
|
||||
expect(find.byType(PlanCard), findsNWidgets(3));
|
||||
expect(find.text(t.promoBadge), findsOneWidget);
|
||||
// 默认 USDT → 现价 \$1.00;原价(pro_month)\$4.99 同时出现在划线原价 + 下方普通
|
||||
// pro_month PlanCard(两处同值,断言 2 处)。
|
||||
expect(find.text('\$1.00'), findsOneWidget);
|
||||
expect(find.text('\$4.99'), findsNWidgets(2));
|
||||
// 切到人民币 → 现价 ¥6.00;原价 ¥29.99 同理 2 处。
|
||||
await tester.tap(find.text(t.payChannelCny));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('¥6.00'), findsOneWidget);
|
||||
expect(find.text('¥29.99'), findsNWidgets(2));
|
||||
});
|
||||
|
||||
testWidgets('支付页 crypto_address:地址/金额/复制,金额用 mono', (tester) async {
|
||||
final flow = PaymentFlowState(
|
||||
phase: PaymentPhase.awaitingPayment,
|
||||
|
||||
Reference in New Issue
Block a user