feat(settings): 删购买/订单卡 + 归连接/外观/关于三组 + Web 链接下沉底部
购买套餐/我的订单入口已归 Account 页,设置页不再重复;设置页重组为 「连接」(开关组)/「外观」(语言+深色)/「关于」(协议/检查更新/版本+ Web 用户中心链接下沉底部)三组,标题走 l10n settingsGroupConn/Appearance/About。 新增 settings_ia_test.dart(TDD)+ 重录 desktop_settings golden。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
// settings_ia_test.dart — 设置页 IA 结构断言:三个分组标题存在 / 购买入口不在设置页(归 Account)。
|
||||
//
|
||||
// 桌面态(windows 平台 + 宽 surface),经 HomeShell 渲染真实 DesktopShell → SettingsPage,
|
||||
// 与 account_ia_test.dart 同一套 harness。
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pangolin_vpn/bridge/vpn_bridge_mock.dart';
|
||||
import 'package:pangolin_vpn/bridge/vpn_bridge_provider.dart';
|
||||
import 'package:pangolin_vpn/l10n/app_text.dart';
|
||||
import 'package:pangolin_vpn/l10n/strings_zh.dart';
|
||||
import 'package:pangolin_vpn/pangolin_theme.dart';
|
||||
import 'package:pangolin_vpn/screens/settings_page.dart';
|
||||
import 'package:pangolin_vpn/services/token_store.dart';
|
||||
import 'package:pangolin_vpn/shell/desktop_shell.dart';
|
||||
import 'package:pangolin_vpn/shell/home_shell.dart';
|
||||
import 'package:pangolin_vpn/state/app_providers.dart';
|
||||
import 'package:pangolin_vpn/state/auth_provider.dart';
|
||||
import 'package:pangolin_vpn/state/navigation_provider.dart';
|
||||
|
||||
import '../helpers/harness.dart';
|
||||
|
||||
final AppText t = StringsZh();
|
||||
|
||||
class _NullTokenStore implements TokenStore {
|
||||
const _NullTokenStore();
|
||||
@override
|
||||
Future<void> saveTokens({required String access, required String refresh}) async {}
|
||||
@override
|
||||
Future<String?> loadAccessToken() async => null;
|
||||
@override
|
||||
Future<String?> loadRefreshToken() async => null;
|
||||
@override
|
||||
Future<void> clear() async {}
|
||||
@override
|
||||
Future<void> markOnboarded() async {}
|
||||
@override
|
||||
Future<bool> isOnboarded() async => true;
|
||||
@override
|
||||
Future<void> saveLastEmail(String email) async {}
|
||||
@override
|
||||
Future<String?> loadLastEmail() async => null;
|
||||
}
|
||||
|
||||
void main() {
|
||||
setUpAll(disableGoogleFontsFetching);
|
||||
|
||||
testWidgets('settings page IA: three group labels present / purchase entry moved out to account', (tester) async {
|
||||
debugDefaultTargetPlatformOverride = TargetPlatform.windows;
|
||||
tester.view.physicalSize = const Size(920, 1400);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
try {
|
||||
await tester.pumpWidget(ProviderScope(
|
||||
overrides: [
|
||||
tokenStoreProvider.overrideWithValue(const _NullTokenStore()),
|
||||
vpnBridgeProvider.overrideWithValue(VpnBridgeMock()),
|
||||
appTextProvider.overrideWithValue(t),
|
||||
navViewProvider.overrideWith((ref) => NavView.settings),
|
||||
],
|
||||
child: MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: PangolinTheme.light,
|
||||
home: const HomeShell(),
|
||||
),
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(DesktopShell), findsOneWidget);
|
||||
expect(find.byType(SettingsPage), findsOneWidget);
|
||||
|
||||
// 三个分组标题存在(连接/外观/关于)。
|
||||
expect(find.descendant(of: find.byType(SettingsPage), matching: find.text(t.settingsGroupConn)), findsOneWidget);
|
||||
expect(find.descendant(of: find.byType(SettingsPage), matching: find.text(t.settingsGroupAppearance)), findsOneWidget);
|
||||
expect(find.descendant(of: find.byType(SettingsPage), matching: find.text(t.settingsGroupAbout)), findsOneWidget);
|
||||
|
||||
// 购买入口不在设置页(归 Account)。
|
||||
expect(find.descendant(of: find.byType(SettingsPage), matching: find.text(t.purchaseTitle)), findsNothing);
|
||||
} finally {
|
||||
debugDefaultTargetPlatformOverride = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user