-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adding navigation drawer (#299)
- Loading branch information
Showing
31 changed files
with
542 additions
and
97 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"flutterSdkVersion": "3.22.2", | ||
"flutterSdkVersion": "3.24.3", | ||
"flavors": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import '../app_test.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
group('home screen test', () { | ||
testWidgets('load fahrbild company=1088, train=9232', (tester) async { | ||
// Load app widget. | ||
await prepareAndStartApp(tester); | ||
|
||
await tester.pump(const Duration(seconds: 1)); | ||
|
||
// Verify we have trainnumber with 9232. | ||
expect(find.text('9232'), findsOneWidget); | ||
|
||
// Verify we have company with 1088. | ||
expect(find.text('1088'), findsOneWidget); | ||
|
||
// check that the primary button is enabled | ||
var primaryButton = find.byWidgetPredicate((widget) => widget is SBBPrimaryButton).first; | ||
expect(tester.widget<SBBPrimaryButton>(primaryButton).onPressed, isNotNull); | ||
|
||
// press load Fahrordnung button | ||
await tester.tap(primaryButton); | ||
|
||
// wait for fahrbild to load | ||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// check if station is present | ||
expect(find.text('MEER-GRENS'), findsOneWidget); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
import 'package:design_system_flutter/design_system_flutter.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
|
||
import '../app_test.dart'; | ||
|
||
void main() { | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
||
group('navigation drawer tests', () { | ||
testWidgets('should show navigation drawer', (tester) async { | ||
// Load app widget. | ||
await prepareAndStartApp(tester); | ||
|
||
await tester.pump(const Duration(seconds: 1)); | ||
|
||
// check that there is a drawer | ||
var scaffold = find.byWidgetPredicate((widget) => widget is Scaffold).first; | ||
expect(tester.widget<Scaffold>(scaffold).drawer, isNotNull); | ||
|
||
// check that drawer is not shown | ||
expect(find.text('Fahrtinfo'), findsNothing); | ||
expect(find.text('Links'), findsNothing); | ||
expect(find.text('Einstellungen'), findsNothing); | ||
expect(find.text('Profil'), findsNothing); | ||
|
||
// open drawer | ||
final ScaffoldState scaffoldState = tester.firstState(find.byType(Scaffold)); | ||
scaffoldState.openDrawer(); | ||
|
||
// wait for drawer to open | ||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// check if navigation elements are present | ||
expect(find.text('Fahrtinfo'), findsOneWidget); | ||
expect(find.text('Links'), findsOneWidget); | ||
expect(find.text('Einstellungen'), findsOneWidget); | ||
expect(find.text('Profil'), findsOneWidget); | ||
}); | ||
|
||
testWidgets('test navigate to links', (tester) async { | ||
// Load app widget. | ||
await prepareAndStartApp(tester); | ||
|
||
await tester.pump(const Duration(seconds: 1)); | ||
|
||
// open drawer | ||
final ScaffoldState scaffoldState = tester.firstState(find.byType(Scaffold)); | ||
scaffoldState.openDrawer(); | ||
|
||
// wait for drawer to open | ||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// check if navigation elements are present | ||
expect(find.text('Links'), findsOneWidget); | ||
|
||
var gestureDetector = find.ancestor(of: find.text('Links'), matching: find.byType(GestureDetector)).first; | ||
await tester.tap(gestureDetector); | ||
|
||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// Check drawer is closed | ||
expect(find.text('Einstellungen'), findsNothing); | ||
expect(find.text('Profil'), findsNothing); | ||
|
||
expect(find.text('Links'), findsOneWidget); | ||
}); | ||
|
||
testWidgets('test navigate to settings', (tester) async { | ||
// Load app widget. | ||
await prepareAndStartApp(tester); | ||
|
||
await tester.pump(const Duration(seconds: 1)); | ||
|
||
// open drawer | ||
final ScaffoldState scaffoldState = tester.firstState(find.byType(Scaffold)); | ||
scaffoldState.openDrawer(); | ||
|
||
// wait for drawer to open | ||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// check if navigation elements are present | ||
expect(find.text('Einstellungen'), findsOneWidget); | ||
|
||
var gestureDetector = find.ancestor(of: find.text('Einstellungen'), matching: find.byType(GestureDetector)).first; | ||
await tester.tap(gestureDetector); | ||
|
||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// Check drawer is closed | ||
expect(find.text('Link'), findsNothing); | ||
expect(find.text('Profil'), findsNothing); | ||
|
||
expect(find.text('Einstellungen'), findsOneWidget); | ||
}); | ||
|
||
testWidgets('test navigate to profile', (tester) async { | ||
// Load app widget. | ||
await prepareAndStartApp(tester); | ||
|
||
await tester.pump(const Duration(seconds: 1)); | ||
|
||
// open drawer | ||
final ScaffoldState scaffoldState = tester.firstState(find.byType(Scaffold)); | ||
scaffoldState.openDrawer(); | ||
|
||
// wait for drawer to open | ||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// check if navigation elements are present | ||
expect(find.text('Profil'), findsOneWidget); | ||
|
||
var gestureDetector = find.ancestor(of: find.text('Profil'), matching: find.byType(GestureDetector)).first; | ||
await tester.tap(gestureDetector); | ||
|
||
await tester.pumpAndSettle(const Duration(seconds: 1)); | ||
|
||
// Check drawer is closed | ||
expect(find.text('Link'), findsNothing); | ||
expect(find.text('Einstellungen'), findsNothing); | ||
|
||
expect(find.text('Profil'), findsOneWidget); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.