mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-28 15:29:04 +01:00
Mirror test: wait for the sync cue, bounded
Some checks are pending
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Some checks are pending
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Waiting to run
Tests / test (push) Waiting to run
release-apk / release (APK) (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
Same fixed-200 ms flake as the log screen tests: under load the Sync now tick outlasted it. settle() now pumps until the expected cue appears, at most 5 s. Todo: 7808ee0a Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1190e2d079
commit
e0a4f71953
@ -2,7 +2,7 @@ name: diet_guard_app
|
|||||||
description: "Companion phone app for diet_guard: log meals on the go."
|
description: "Companion phone app for diet_guard: log meals on the go."
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.0.189+1
|
version: 1.0.190+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.12.2
|
sdk: ^3.12.2
|
||||||
|
|||||||
@ -65,13 +65,20 @@ void main() {
|
|||||||
// GitHubMirrorScreen loads its settings via a fire-and-forget Future in
|
// GitHubMirrorScreen loads its settings via a fire-and-forget Future in
|
||||||
// initState that Flutter's frame scheduler does not track -- same pitfall
|
// initState that Flutter's frame scheduler does not track -- same pitfall
|
||||||
// as HistoryScreen/LogMealScreen.
|
// as HistoryScreen/LogMealScreen.
|
||||||
Future<void> settle(WidgetTester tester) async {
|
// [until]: keep pumping (max 5 s) until it is found -- a sync tick's real
|
||||||
|
// I/O outlasts the fixed 200 ms on a loaded machine.
|
||||||
|
Future<void> settle(WidgetTester tester, {Finder? until}) async {
|
||||||
tester.view.physicalSize = const Size(800, 1400);
|
tester.view.physicalSize = const Size(800, 1400);
|
||||||
tester.view.devicePixelRatio = 1.0;
|
tester.view.devicePixelRatio = 1.0;
|
||||||
addTearDown(tester.view.resetPhysicalSize);
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
addTearDown(tester.view.resetDevicePixelRatio);
|
addTearDown(tester.view.resetDevicePixelRatio);
|
||||||
await Future<void>.delayed(const Duration(milliseconds: 200));
|
final deadline = DateTime.now().add(const Duration(seconds: 5));
|
||||||
await tester.pumpAndSettle();
|
do {
|
||||||
|
await Future<void>.delayed(const Duration(milliseconds: 200));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
} while (until != null &&
|
||||||
|
until.evaluate().isEmpty &&
|
||||||
|
DateTime.now().isBefore(deadline));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Drains the device flow's real `Future.delayed` poll (GitHubDeviceAuth
|
/// Drains the device flow's real `Future.delayed` poll (GitHubDeviceAuth
|
||||||
@ -167,7 +174,7 @@ void main() {
|
|||||||
await settle(tester);
|
await settle(tester);
|
||||||
|
|
||||||
await tester.tap(controlByLabel('Sync now'));
|
await tester.tap(controlByLabel('Sync now'));
|
||||||
await settle(tester);
|
await settle(tester, until: cueLabelled('Synced.'));
|
||||||
|
|
||||||
expect(cueLabelled('Synced.'), findsOneWidget);
|
expect(cueLabelled('Synced.'), findsOneWidget);
|
||||||
});
|
});
|
||||||
@ -197,7 +204,7 @@ void main() {
|
|||||||
await settle(tester);
|
await settle(tester);
|
||||||
|
|
||||||
await tester.tap(controlByLabel('Sync now'));
|
await tester.tap(controlByLabel('Sync now'));
|
||||||
await settle(tester);
|
await settle(tester, until: cueLabelled('Synced.'));
|
||||||
|
|
||||||
expect(cueLabelled('Synced.'), findsOneWidget);
|
expect(cueLabelled('Synced.'), findsOneWidget);
|
||||||
final status = await SyncHealth.read();
|
final status = await SyncHealth.read();
|
||||||
@ -228,7 +235,7 @@ void main() {
|
|||||||
await settle(tester);
|
await settle(tester);
|
||||||
|
|
||||||
await tester.tap(controlByLabel('Sync now'));
|
await tester.tap(controlByLabel('Sync now'));
|
||||||
await settle(tester);
|
await settle(tester, until: cueOfKind(CueKind.error));
|
||||||
|
|
||||||
expect(cueOfKind(CueKind.error), findsOneWidget);
|
expect(cueOfKind(CueKind.error), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user