Skip to content

Commit 349ec71

Browse files
Add tests for navigator.0.dart (flutter#150034)
Contributes to flutter#130459 It adds a test for - `examples/api/lib/widgets/navigator/navigator.0.dart`
1 parent d802df4 commit 349ec71

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

dev/bots/check_code_samples.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ final Set<String> _knownMissingTests = <String>{
358358
'examples/api/test/rendering/scroll_direction/scroll_direction.0_test.dart',
359359
'examples/api/test/painting/star_border/star_border.0_test.dart',
360360
'examples/api/test/widgets/navigator/navigator.restorable_push_and_remove_until.0_test.dart',
361-
'examples/api/test/widgets/navigator/navigator.0_test.dart',
362361
'examples/api/test/widgets/navigator/navigator.restorable_push.0_test.dart',
363362
'examples/api/test/widgets/navigator/navigator_state.restorable_push_replacement.0_test.dart',
364363
'examples/api/test/widgets/navigator/navigator_state.restorable_push_and_remove_until.0_test.dart',
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter_api_samples/widgets/navigator/navigator.0.dart' as example;
6+
import 'package:flutter_test/flutter_test.dart';
7+
8+
void main() {
9+
testWidgets('It should show the home page', (WidgetTester tester) async {
10+
await tester.pumpWidget(
11+
const example.NavigatorExampleApp(),
12+
);
13+
14+
expect(find.text('Home Page'), findsOne);
15+
});
16+
17+
testWidgets('It should start from the sign up page and follow the flow to reach the home page', (WidgetTester tester) async {
18+
tester.platformDispatcher.defaultRouteNameTestValue = '/signup';
19+
await tester.pumpWidget(
20+
const example.NavigatorExampleApp(),
21+
);
22+
23+
expect(find.text('Collect Personal Info Page'), findsOne);
24+
25+
await tester.tap(find.text('Collect Personal Info Page'));
26+
await tester.pumpAndSettle();
27+
28+
expect(find.text('Choose Credentials Page'), findsOne);
29+
30+
await tester.tap(find.text('Choose Credentials Page'));
31+
await tester.pumpAndSettle();
32+
33+
expect(find.text('Home Page'), findsOne);
34+
});
35+
}

0 commit comments

Comments
 (0)