fix theme picker integration test; one bake for build-time facts (T-116)
test / unit + widget + golden + a11y (push) Failing after 31s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s
test / unit + widget + golden + a11y (push) Failing after 31s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m1s
The test was awaiting services.commands.execute('theme.pick') whose
Future doesn't complete until the dialog is dismissed — deadlock.
Fire-and-forget around pumpAndSettle, then tap Cancel, then await
the original future. Also tear the widget tree down before
services.dispose() so listening widgets unsubscribe first.
Pre-existing layout overflow in the welcome _StatusLine surfaced
when running the test at narrower viewports. Switched to a whole-
row FittedBox(scaleDown) — uniform shrink on narrow screens, no-op
at standard widths.
User flagged the hardcoded 'clide 2.0.0-dev' string. Replaced with
one generated lib/src/build_info.g.dart (gitignored, regenerated
by `make gen-build-info` from pubspec.yaml + git short SHA + UTC
clock). The same target re-syncs assets/licenses.yaml self.version
in place — no second source. Every make build/run/test depends on
it implicitly. Welcome status line now reads `clideVersion`. Stale
fontSize literals in welcome_view swept to typography constants;
clideFontMeta=13, clideFontDialogTitle=16, clideFontWelcomeBanner=52
added to fill gaps in the scale.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:clide/builtin/theme_picker/theme_picker.dart';
|
||||
import 'package:clide/builtin/welcome/welcome.dart';
|
||||
import 'package:clide/kernel/kernel.dart';
|
||||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
@@ -39,21 +40,39 @@ void main() {
|
||||
..register(ThemePickerExtension());
|
||||
await services.extensions.activateAll();
|
||||
|
||||
// Larger viewport so the welcome screen's _StatusLine row doesn't
|
||||
// overflow on the default ~800x600 — that overflow throws a layout
|
||||
// assertion that fails the test before we get to theme.pick.
|
||||
tester.view.physicalSize = const Size(1200, 800);
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
|
||||
await tester.pumpWidget(ClideApp(services: services));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
// Invoke the command.
|
||||
await services.commands.execute('theme.pick');
|
||||
// Fire-and-forget: theme.pick's run handler awaits
|
||||
// ctx.dialog.show(...), whose Future doesn't complete until the
|
||||
// dialog is dismissed. Awaiting here would deadlock the test
|
||||
// before the dialog ever mounts.
|
||||
final pending = services.commands.execute('theme.pick');
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text('Select theme'), findsOneWidget);
|
||||
expect(find.text('Cancel'), findsOneWidget);
|
||||
|
||||
// Dismiss via Cancel.
|
||||
// Dismiss via Cancel — this completes the pending future above.
|
||||
await tester.tap(find.text('Cancel'));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Select theme'), findsNothing);
|
||||
await pending;
|
||||
|
||||
// Tear the widget tree down BEFORE disposing services so widgets
|
||||
// that listen to kernel notifiers (KeymapService, etc.) unsubscribe
|
||||
// first. Disposing services while the tree is mounted triggers
|
||||
// "ChangeNotifier used after dispose" during teardown rebuilds.
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pumpAndSettle();
|
||||
await services.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user