diff --git a/lib/screens/settings/add_jellyfin_screen.dart b/lib/screens/settings/add_jellyfin_screen.dart index ddb05ec2..24daff85 100644 --- a/lib/screens/settings/add_jellyfin_screen.dart +++ b/lib/screens/settings/add_jellyfin_screen.dart @@ -341,6 +341,7 @@ class _AddJellyfinScreenState extends State with AsyncFormSta const SizedBox(height: 16), FocusableTextFormField( controller: _urlController, + autofocus: true, keyboardType: TextInputType.url, autocorrect: false, enableSuggestions: false, diff --git a/test/screens/settings/add_jellyfin_screen_test.dart b/test/screens/settings/add_jellyfin_screen_test.dart index b1098fa1..aa008dd7 100644 --- a/test/screens/settings/add_jellyfin_screen_test.dart +++ b/test/screens/settings/add_jellyfin_screen_test.dart @@ -1,3 +1,4 @@ +import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:plezy/profiles/profile.dart'; import 'package:plezy/screens/settings/add_jellyfin_screen.dart'; @@ -11,6 +12,15 @@ Profile _profile(String id) => Profile( ); void main() { + testWidgets('autofocuses the server URL field', (tester) async { + await tester.pumpWidget(const MaterialApp(home: AddJellyfinScreen())); + await tester.pump(); + + final field = tester.widget(find.byType(TextField)); + + expect(field.autofocus, isTrue); + }); + group('Jellyfin profile binding decisions', () { test('creates a local profile only on true first-run with no profiles', () { expect(shouldCreateLocalJellyfinProfile(targetProfile: null, activeProfile: null, hasProfiles: false), isTrue);