Fix VPN internet connectivity and simplify client setup

Initialize Android physical interfaces and preserve macOS scoped routes. Add redacted diagnostics, default DNS, ordered auto-save, simplified controls, scanner rotation settings, and native regression coverage. Restore vendored build sources and document validation and stability checks.
This commit is contained in:
shen
2026-10-12 06:51:25 -07:00
parent 2f185f914d
commit c7cc2aa865
41 changed files with 2841 additions and 247 deletions
+40 -3
View File
@@ -3,6 +3,36 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:meshport_lab/features/lab_screen.dart';
void main() {
testWidgets('connection explains missing node and clears stale errors', (
tester,
) async {
await tester.pumpWidget(
const MaterialApp(home: LabScreen(initializeNative: false)),
);
await tester.tap(find.text('代理').last);
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('连接').last);
await tester.tap(find.text('连接').last);
await tester.pumpAndSettle();
expect(find.textContaining('请先添加代理节点'), findsOneWidget);
await tester.ensureVisible(find.text('诊断与日志'));
await tester.tap(find.text('诊断与日志'));
await tester.pumpAndSettle();
expect(find.textContaining('[校验代理配置] 失败'), findsOneWidget);
expect(find.textContaining('入口=unified_vpn'), findsOneWidget);
await tester.pageBack();
await tester.pumpAndSettle();
await tester.ensureVisible(find.text('全局代理').last);
await tester.tap(find.text('全局代理').last);
await tester.pumpAndSettle();
await tester.tap(find.text('直连').last);
await tester.pumpAndSettle();
expect(find.textContaining('请先添加代理节点'), findsNothing);
expect(tester.takeException(), isNull);
});
testWidgets('China bypass can be selected and switched to global', (
tester,
) async {
@@ -14,7 +44,7 @@ void main() {
final mode = find.byWidgetPredicate(
(w) =>
w is DropdownButtonFormField<String> &&
w.decoration.labelText == '普通互联网流量模式',
w.decoration.labelText == '上网模式',
);
await tester.ensureVisible(mode);
await tester.tap(mode);
@@ -52,7 +82,7 @@ void main() {
);
await tester.tap(find.text('代理').last);
await tester.pumpAndSettle();
expect(find.text('普通互联网流量模式'), findsOneWidget);
expect(find.text('上网模式'), findsOneWidget);
await tester.ensureVisible(find.text('导入与预览'));
await tester.tap(find.text('导入与预览'));
await tester.pumpAndSettle();
@@ -67,6 +97,13 @@ void main() {
await tester.tap(find.text('确认导入'));
await tester.pumpAndSettle();
expect(find.text('Preview'), findsOneWidget);
expect(find.text('安全保存配置'), findsOneWidget);
expect(find.byIcon(Icons.radio_button_checked), findsOneWidget);
expect(find.text('网络入口'), findsNothing);
expect(find.text('编辑 DNS'), findsNothing);
await tester.ensureVisible(find.text('高级设置'));
await tester.tap(find.text('高级设置'));
await tester.pumpAndSettle();
expect(find.text('网络入口'), findsOneWidget);
expect(find.text('编辑 DNS'), findsOneWidget);
});
}