fix(app): the Run dialog waits for the stored pending intent after a reload
This commit is contained in:
@@ -435,6 +435,49 @@ void main() {
|
||||
expect(find.byType(AlertDialog), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('an unknown launch survives a reload with the same key', (
|
||||
tester,
|
||||
) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
final fixture = PipelineFixture();
|
||||
final navigated = <int>[];
|
||||
final keys = <String>[];
|
||||
var attempts = 0;
|
||||
final gateway = launchGateway(
|
||||
fixture,
|
||||
onLaunch: (fields) {
|
||||
attempts++;
|
||||
keys.add(fields['request_key'] as String);
|
||||
if (attempts == 1) throw StateError('Connection closed');
|
||||
return acceptedRun(87);
|
||||
},
|
||||
onLookup: (_) => noRun(),
|
||||
);
|
||||
await pumpScreen(tester, gateway, navigated);
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
await fillFields(tester);
|
||||
await tester.tap(find.byKey(runPipelineConfirmKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runPipelineCheckRetryLabel), findsOneWidget);
|
||||
|
||||
// A reload: the screen and its controller are gone; only the device
|
||||
// store remains.
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
await pumpScreen(tester, gateway, navigated);
|
||||
await openDetail(tester);
|
||||
await tester.tap(find.byKey(runPipelineActionKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text(runPipelineCheckRetryLabel), findsOneWidget);
|
||||
|
||||
await tester.tap(find.byKey(runPipelineConfirmKey));
|
||||
await tester.pumpAndSettle();
|
||||
expect(keys, hasLength(2));
|
||||
expect(keys[1], keys[0]);
|
||||
expect(navigated, [87]);
|
||||
});
|
||||
|
||||
testWidgets('closing and reopening an unknown launch restores check/retry', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user