66422f92ce
ci-pangolin / Redline Scan — 脱敏 (UI 文案) (pull_request) Successful in 19s
ci-pangolin / Cleartext Scan — Android 禁明文 (pull_request) Successful in 23s
ci-pangolin / Portable SQL — 可移植性 (mysql/sqlite) (pull_request) Successful in 19s
ci-pangolin / Lint — shellcheck (pull_request) Successful in 6s
ci-pangolin / OpenAPI Sync Check (pull_request) Successful in 34s
ci-pangolin / Flutter — analyze + test (pull_request) Successful in 36s
ci-pangolin / Codegen Drift — token 生成物未漂移 (pull_request) Successful in 4s
ci-pangolin / DS-flow — 原型/跨端同源/代码色单源闸 (pull_request) Successful in 5s
ci-pangolin / Go — integration (mysql/redis testcontainers) (pull_request) Failing after 4m42s
ci-pangolin / Golden — 视觉回归 (全量:components/auth/desktop/tablet) (pull_request) Failing after 21s
ci-pangolin / E2E Smoke — L4 进程级端到端 (pull_request) Failing after 10m19s
ci-pangolin / Go — build + test (pull_request) Failing after 10m26s
- orders 详情 created 态:继续支付(主)+ 取消订单(ghost)——orders.html/ui-desktop 原型 pending 态早已登记双按钮,Flutter 侧漏实现(代码落后原型)。取消走远程 cancel, 失败(如其实已付,pay 409)不报错,统一 invalidate 刷新以最新状态为准。 - 自动连接「正在自动连接到 X」toast 缺省 3s 用户反馈偏长 → 1.5s(与「已复制」1.4s 同量级)。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
87 lines
3.7 KiB
Dart
87 lines
3.7 KiB
Dart
// orders_page_test.dart — 订单列表/详情页行为测试(不打网络,provider 注入)。
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:pangolin_vpn/l10n/strings_zh.dart';
|
|
import 'package:pangolin_vpn/models/payment.dart';
|
|
import 'package:pangolin_vpn/screens/orders_page.dart';
|
|
import 'package:pangolin_vpn/state/orders_provider.dart';
|
|
import 'package:pangolin_vpn/widgets/status_pill.dart';
|
|
|
|
import '../helpers/harness.dart';
|
|
|
|
final t = StringsZh();
|
|
|
|
final _orders = <PayOrderSummary>[
|
|
PayOrderSummary(
|
|
orderNo: 'o-year', sku: 'pro_year', plan: 'pro', days: 366, method: 'crypto',
|
|
status: 'paid', amountMinor: 34990000, currency: 'USDT',
|
|
createdAt: DateTime.utc(2026, 7, 10), paidAt: DateTime.utc(2026, 7, 10)),
|
|
PayOrderSummary(
|
|
orderNo: 'o-month', sku: 'pro_month', plan: 'pro', days: 31, method: 'alipay',
|
|
status: 'created', amountMinor: 2999, currency: 'CNY',
|
|
createdAt: DateTime.utc(2026, 7, 11)),
|
|
PayOrderSummary(
|
|
orderNo: 'o-q', sku: 'pro_quarter', plan: 'pro', days: 92, method: 'nezha',
|
|
status: 'canceled', amountMinor: 6888, currency: 'CNY',
|
|
createdAt: DateTime.utc(2026, 7, 9)),
|
|
];
|
|
|
|
void main() {
|
|
setUpAll(disableGoogleFontsFetching);
|
|
|
|
testWidgets('订单列表:三单渲染 + 结算币种金额 + 状态 pill', (tester) async {
|
|
tester.view.physicalSize = const Size(800, 2400);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
await tester.pumpWidget(wrapThemed(
|
|
OrdersScreen(t: t, embedded: true),
|
|
overrides: [ordersProvider.overrideWith((ref) async => _orders)],
|
|
));
|
|
await tester.pumpAndSettle();
|
|
|
|
// 套餐名(逐档)
|
|
expect(find.text(t.proYearly), findsOneWidget);
|
|
expect(find.text(t.proMonthly), findsOneWidget);
|
|
expect(find.text(t.proQuarterly), findsOneWidget);
|
|
// 金额按结算币种(USDT $ / CNY ¥),在「金额 · 日期」子行里
|
|
expect(find.textContaining(r'$34.99'), findsOneWidget);
|
|
expect(find.textContaining('¥29.99'), findsOneWidget);
|
|
// 状态 pill(created→等待付款 / paid→已开通 / canceled→已取消)
|
|
expect(find.byType(StatusPill), findsNWidgets(3));
|
|
expect(find.text(t.awaitingPayment), findsOneWidget);
|
|
expect(find.text(t.orderStatusPaid), findsOneWidget);
|
|
expect(find.text(t.orderStatusCanceled), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('订单空态', (tester) async {
|
|
await tester.pumpWidget(wrapThemed(
|
|
OrdersScreen(t: t, embedded: true),
|
|
overrides: [ordersProvider.overrideWith((ref) async => const <PayOrderSummary>[])],
|
|
));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text(t.ordersEmpty), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('点 created 单进详情:显订单号 + 继续支付', (tester) async {
|
|
tester.view.physicalSize = const Size(800, 2400);
|
|
tester.view.devicePixelRatio = 1.0;
|
|
addTearDown(tester.view.reset);
|
|
await tester.pumpWidget(wrapThemed(
|
|
OrdersScreen(t: t, embedded: true),
|
|
overrides: [
|
|
ordersProvider.overrideWith((ref) async => _orders),
|
|
orderDetailProvider('o-month').overrideWith((ref) async => PayOrderStatus(
|
|
orderNo: 'o-month', payStatus: 'pending', activated: false, summary: _orders[1])),
|
|
],
|
|
));
|
|
await tester.pumpAndSettle();
|
|
// 点 created 那单(月付)进详情
|
|
await tester.tap(find.text(t.proMonthly));
|
|
await tester.pumpAndSettle();
|
|
// 详情字段行 + created 态动作:继续支付(主)+ 取消订单(ghost,原型 pending 双按钮)
|
|
expect(find.text(t.cancelOrder), findsOneWidget);
|
|
expect(find.text(t.orderNoLabel), findsOneWidget);
|
|
expect(find.text(t.orderContinuePay), findsWidgets);
|
|
});
|
|
}
|