Skip to content

Commit

Permalink
final fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Grodien committed Oct 14, 2024
1 parent e880abe commit ea819f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 150 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/flutter_browserstack_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
flutter-version: '3.24.3'
- name: Prepare Flutter Build
env:
ANDROID_KEYSTORE_STRING: ${{ secrets.ANDROID_KEYSTORE }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flutter_browserstack_ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.2'
flutter-version: '3.24.3'
- run: flutter pub get
- run: flutter pub run build_runner build --delete-conflicting-outputs
- shell: bash
Expand Down
150 changes: 2 additions & 148 deletions das_client/integration_test/app_test.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:das_client/flavor.dart';
import 'package:das_client/main.dart';
import 'package:design_system_flutter/design_system_flutter.dart';
import 'package:fimber/fimber.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

Expand All @@ -14,152 +12,8 @@ void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Fimber.plantTree(DebugTree());

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);
});
});

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);
});
});

//FahrbildTests.main();
//NavigationTests.main();
FahrbildTests.main();
NavigationTests.main();
}

Future<void> prepareAndStartApp(WidgetTester tester) async {
Expand Down

0 comments on commit ea819f8

Please sign in to comment.