Add breakpoint-responsive smoke tests and overflow fixes
This commit is contained in:
@@ -27,6 +27,25 @@ Validation for this milestone:
|
|||||||
- `flutter analyze` -> pass
|
- `flutter analyze` -> pass
|
||||||
- `flutter test` -> pass
|
- `flutter test` -> pass
|
||||||
|
|
||||||
|
### Breakpoint QA follow-up
|
||||||
|
|
||||||
|
Ran targeted responsive smoke checks for:
|
||||||
|
|
||||||
|
- iPhone SE (`320x568`)
|
||||||
|
- iPhone Pro Max (`430x932`)
|
||||||
|
- iPad portrait (`768x1024`)
|
||||||
|
- Web/desktop (`1280x800`)
|
||||||
|
|
||||||
|
Follow-up fixes from QA:
|
||||||
|
|
||||||
|
- `lib/features/auth/sign_in_view.dart`
|
||||||
|
- added scroll-safe container for short-height screens to prevent vertical overflow
|
||||||
|
- `lib/features/home/app_shell.dart`
|
||||||
|
- made sidebar brand text ellipsize-safe to prevent horizontal overflow
|
||||||
|
- Added automated responsive regression suite:
|
||||||
|
- `test/features/responsive/responsive_views_smoke_test.dart`
|
||||||
|
- validates `AppShell` + all primary views across the breakpoints above
|
||||||
|
|
||||||
## Latest Milestone (2026-02-15): People Mobile Layout Fix
|
## Latest Milestone (2026-02-15): People Mobile Layout Fix
|
||||||
|
|
||||||
Fixed the `People` view so it is mobile-friendly and no longer overflows on iOS narrow screens:
|
Fixed the `People` view so it is mobile-friendly and no longer overflows on iOS narrow screens:
|
||||||
|
|||||||
@@ -39,11 +39,15 @@ class _SignInViewState extends ConsumerState<SignInView> {
|
|||||||
final bool busy = session.isLoading;
|
final bool busy = session.isLoading;
|
||||||
final Object? error = session.asError?.error;
|
final Object? error = session.asError?.error;
|
||||||
|
|
||||||
return Center(
|
return LayoutBuilder(
|
||||||
|
builder: (BuildContext context, BoxConstraints viewport) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(minHeight: viewport.maxHeight - 32),
|
||||||
|
child: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxWidth: 620),
|
constraints: const BoxConstraints(maxWidth: 620),
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(24),
|
|
||||||
child: FrostedCard(
|
child: FrostedCard(
|
||||||
child: LayoutBuilder(
|
child: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
@@ -59,9 +63,8 @@ class _SignInViewState extends ConsumerState<SignInView> {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Text(
|
Text(
|
||||||
'Your local data remains available offline. Backend unlocks sync and signals.',
|
'Your local data remains available offline. Backend unlocks sync and signals.',
|
||||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
style: Theme.of(context).textTheme.bodyLarge
|
||||||
color: AppTheme.textSecondary,
|
?.copyWith(color: AppTheme.textSecondary),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 18),
|
const SizedBox(height: 18),
|
||||||
if (compact)
|
if (compact)
|
||||||
@@ -86,7 +89,9 @@ class _SignInViewState extends ConsumerState<SignInView> {
|
|||||||
_method = value;
|
_method = value;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
decoration: const InputDecoration(labelText: 'Method'),
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Method',
|
||||||
|
),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
SegmentedButton<SignInMethod>(
|
SegmentedButton<SignInMethod>(
|
||||||
@@ -120,7 +125,9 @@ class _SignInViewState extends ConsumerState<SignInView> {
|
|||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
keyboardType: TextInputType.emailAddress,
|
keyboardType: TextInputType.emailAddress,
|
||||||
enabled: !busy,
|
enabled: !busy,
|
||||||
decoration: const InputDecoration(labelText: 'Email'),
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'Email',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (_method == SignInMethod.password)
|
if (_method == SignInMethod.password)
|
||||||
TextField(
|
TextField(
|
||||||
@@ -184,6 +191,9 @@ class _SignInViewState extends ConsumerState<SignInView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -199,9 +199,12 @@ class _Sidebar extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Text(
|
Expanded(
|
||||||
|
child: Text(
|
||||||
'Relationship Saver',
|
'Relationship Saver',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
import 'package:relationship_saver/core/auth/in_memory_token_store.dart';
|
||||||
|
import 'package:relationship_saver/core/config/app_theme.dart';
|
||||||
|
import 'package:relationship_saver/features/auth/sign_in_view.dart';
|
||||||
|
import 'package:relationship_saver/features/dashboard/dashboard_view.dart';
|
||||||
|
import 'package:relationship_saver/features/home/app_shell.dart';
|
||||||
|
import 'package:relationship_saver/features/ideas/ideas_view.dart';
|
||||||
|
import 'package:relationship_saver/features/moments/moments_view.dart';
|
||||||
|
import 'package:relationship_saver/features/people/people_view.dart';
|
||||||
|
import 'package:relationship_saver/features/reminders/reminders_view.dart';
|
||||||
|
import 'package:relationship_saver/features/settings/settings_view.dart';
|
||||||
|
import 'package:relationship_saver/features/signals/signals_view.dart';
|
||||||
|
import 'package:relationship_saver/features/sync/sync_view.dart';
|
||||||
|
import 'package:relationship_saver/integrations/backend/backend_gateway_fake.dart';
|
||||||
|
import 'package:relationship_saver/integrations/backend/backend_gateway_provider.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
final List<Breakpoint> breakpoints = <Breakpoint>[
|
||||||
|
const Breakpoint('iphone-se', Size(320, 568)),
|
||||||
|
const Breakpoint('iphone-pro-max', Size(430, 932)),
|
||||||
|
const Breakpoint('ipad-portrait', Size(768, 1024)),
|
||||||
|
const Breakpoint('web-desktop', Size(1280, 800)),
|
||||||
|
];
|
||||||
|
|
||||||
|
setUp(() {
|
||||||
|
SharedPreferences.setMockInitialValues(<String, Object>{});
|
||||||
|
});
|
||||||
|
|
||||||
|
for (final Breakpoint breakpoint in breakpoints) {
|
||||||
|
testWidgets('AppShell renders across breakpoint: ${breakpoint.name}', (
|
||||||
|
WidgetTester tester,
|
||||||
|
) async {
|
||||||
|
await pumpResponsive(
|
||||||
|
tester,
|
||||||
|
size: breakpoint.size,
|
||||||
|
child: const AppShell(),
|
||||||
|
wrapInScaffold: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(find.byType(AppShell), findsOneWidget);
|
||||||
|
assertNoFlutterExceptions(
|
||||||
|
tester,
|
||||||
|
context:
|
||||||
|
'AppShell at ${breakpoint.name} (${breakpoint.size.width}x${breakpoint.size.height})',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets(
|
||||||
|
'All primary views render across breakpoint: ${breakpoint.name}',
|
||||||
|
(WidgetTester tester) async {
|
||||||
|
final List<Widget> views = <Widget>[
|
||||||
|
const SignInView(),
|
||||||
|
const DashboardView(),
|
||||||
|
const PeopleView(),
|
||||||
|
const MomentsView(),
|
||||||
|
const IdeasView(),
|
||||||
|
const RemindersView(),
|
||||||
|
const SignalsView(),
|
||||||
|
const SyncView(),
|
||||||
|
const SettingsView(),
|
||||||
|
];
|
||||||
|
|
||||||
|
for (final Widget view in views) {
|
||||||
|
await pumpResponsive(tester, size: breakpoint.size, child: view);
|
||||||
|
assertNoFlutterExceptions(
|
||||||
|
tester,
|
||||||
|
context:
|
||||||
|
'${view.runtimeType} at ${breakpoint.name} (${breakpoint.size.width}x${breakpoint.size.height})',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Breakpoint {
|
||||||
|
const Breakpoint(this.name, this.size);
|
||||||
|
|
||||||
|
final String name;
|
||||||
|
final Size size;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pumpResponsive(
|
||||||
|
WidgetTester tester, {
|
||||||
|
required Size size,
|
||||||
|
required Widget child,
|
||||||
|
bool wrapInScaffold = true,
|
||||||
|
}) async {
|
||||||
|
await tester.binding.setSurfaceSize(size);
|
||||||
|
addTearDown(() => tester.binding.setSurfaceSize(null));
|
||||||
|
|
||||||
|
final Widget home = wrapInScaffold ? Scaffold(body: child) : child;
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
ProviderScope(
|
||||||
|
overrides: [
|
||||||
|
tokenStoreProvider.overrideWithValue(InMemoryTokenStore()),
|
||||||
|
backendGatewayProvider.overrideWithValue(BackendGatewayFake()),
|
||||||
|
],
|
||||||
|
child: MaterialApp(theme: AppTheme.light(), home: home),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||||
|
}
|
||||||
|
|
||||||
|
void assertNoFlutterExceptions(WidgetTester tester, {required String context}) {
|
||||||
|
Object? error;
|
||||||
|
final List<Object> errors = <Object>[];
|
||||||
|
while ((error = tester.takeException()) != null) {
|
||||||
|
errors.add(error!);
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(
|
||||||
|
errors,
|
||||||
|
isEmpty,
|
||||||
|
reason: 'Found Flutter exceptions for $context: $errors',
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user