feat(app): configure and safely switch multi-address servers

This commit is contained in:
2026-10-24 03:04:53 +01:00
parent 47cfb31e7d
commit b499da304d
38 changed files with 1764 additions and 65 deletions
@@ -4,6 +4,76 @@ import 'package:pipelines_app/core/session/server_session.dart';
import 'package:pipelines_app/features/onboarding/onboarding_flow.dart';
void main() {
testWidgets('sign-in uses a reachable backup within the selected server', (
tester,
) async {
final primary = Uri.parse('wss://tail.example/connect');
final backup = Uri.parse('ws://192.168.1.2:8083/connect');
final checked = <Uri>[];
final signedIn = <Uri>[];
final saved = <String>[];
await tester.pumpWidget(
MaterialApp(
home: OnboardingFlow(
initialServer: primary.toString(),
serverAddresses: [primary, backup],
check: (uri) async {
checked.add(uri);
return uri == primary
? SessionState.unreachable
: SessionState.signedOut;
},
signIn: (uri, _) async {
signedIn.add(uri);
return null;
},
saveServer: (url) async => saved.add(url),
onDone: (_) {},
),
),
);
await tester.tap(find.byKey(const Key('onboarding-next')));
await tester.pumpAndSettle();
expect(checked, [primary, backup]);
expect(saved, [backup.toString()]);
await tester.enterText(
find.byKey(const Key('onboarding-password')),
'fixture-password',
);
await tester.tap(find.byKey(const Key('onboarding-next')));
await tester.pump();
await tester.pump();
expect(signedIn, [backup]);
});
testWidgets(
'typing a different server does not try another profile backups',
(tester) async {
final primary = Uri.parse('wss://tail.example/connect');
final checked = <Uri>[];
await tester.pumpWidget(
MaterialApp(
home: OnboardingFlow(
initialServer: primary.toString(),
serverAddresses: [primary, Uri.parse('ws://192.168.1.2/connect')],
check: (uri) async {
checked.add(uri);
return SessionState.unreachable;
},
onDone: (_) {},
),
),
);
await tester.enterText(
find.byKey(const Key('onboarding-server')),
'wss://different.example/connect',
);
await tester.tap(find.byKey(const Key('onboarding-next')));
await tester.pumpAndSettle();
expect(checked, [Uri.parse('wss://different.example/connect')]);
},
);
testWidgets('server, then password; both kept, then the app opens', (
tester,
) async {