Skip to content

Commit

Permalink
chore: refactored test file structure (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
rawi-coding authored Dec 20, 2024
1 parent c4f83eb commit b99b9fe
Show file tree
Hide file tree
Showing 56 changed files with 165 additions and 420 deletions.
32 changes: 16 additions & 16 deletions das_client/integration_test/test/train_journey_table_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '4816');
await _loadTrainJourney(tester, trainNumber: 'T6');

final breakingSeriesHeaderCell = find.byKey(TrainJourney.breakingSeriesHeaderKey);
expect(breakingSeriesHeaderCell, findsOneWidget);
Expand Down Expand Up @@ -84,7 +84,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '7839');
await _loadTrainJourney(tester, trainNumber: 'T4');

// Open break series bottom sheet
await tapElement(tester, find.byKey(TrainJourney.breakingSeriesHeaderKey));
Expand Down Expand Up @@ -164,7 +164,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '9999');
await _loadTrainJourney(tester, trainNumber: 'T9999');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down Expand Up @@ -203,7 +203,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '500');
await _loadTrainJourney(tester, trainNumber: 'T2');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down Expand Up @@ -232,7 +232,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '500');
await _loadTrainJourney(tester, trainNumber: 'T2');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down Expand Up @@ -266,7 +266,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '4816');
await _loadTrainJourney(tester, trainNumber: 'T6');

// List of expected column headers
final List<String> expectedHeaders = [
Expand All @@ -287,7 +287,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '9999');
await _loadTrainJourney(tester, trainNumber: 'T9999');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down Expand Up @@ -322,7 +322,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '513');
await _loadTrainJourney(tester, trainNumber: 'T3');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down Expand Up @@ -387,7 +387,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '4816');
await _loadTrainJourney(tester, trainNumber: 'T6');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand All @@ -403,7 +403,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '4816');
await _loadTrainJourney(tester, trainNumber: 'T6');

// check first train station
expect(find.text('Zürich HB'), findsOneWidget);
Expand All @@ -425,7 +425,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '4816');
await _loadTrainJourney(tester, trainNumber: 'T6');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand All @@ -440,7 +440,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '9999');
await _loadTrainJourney(tester, trainNumber: 'T9999');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down Expand Up @@ -469,7 +469,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '9999');
await _loadTrainJourney(tester, trainNumber: 'T9999');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand All @@ -494,7 +494,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '4816');
await _loadTrainJourney(tester, trainNumber: 'T6');

final glanzenbergText = find
.byWidgetPredicate((it) => it is Text && it.data == 'Glanzenberg' && it.style?.fontStyle == FontStyle.italic);
Expand All @@ -509,7 +509,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '9999');
await _loadTrainJourney(tester, trainNumber: 'T9999');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand All @@ -532,7 +532,7 @@ void main() {
await prepareAndStartApp(tester);

// load train journey by filling out train selection page
await _loadTrainJourney(tester, trainNumber: '9999');
await _loadTrainJourney(tester, trainNumber: 'T9999');

final scrollableFinder = find.byType(ListView);
expect(scrollableFinder, findsOneWidget);
Expand Down
8 changes: 4 additions & 4 deletions das_client/integration_test/test/train_journey_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import '../util/test_utils.dart';

void main() {
group('home screen test', () {
testWidgets('load train journey company=1085, train=7839', (tester) async {
testWidgets('load train journey company=1085, train=T9999', (tester) async {
// Load app widget.
await prepareAndStartApp(tester);

// Verify we have trainnumber with 7839.
expect(find.text('7839'), findsOneWidget);
// Verify we have trainnumber with T9999.
expect(find.text('T9999'), findsOneWidget);

// Verify we have ru SBB.
expect(find.text(l10n.c_ru_sbb_p), findsOneWidget);
Expand Down Expand Up @@ -41,7 +41,7 @@ void main() {
final trainNumberText = findTextFieldByLabel(l10n.p_train_selection_trainnumber_description);
expect(trainNumberText, findsOneWidget);

await enterText(tester, trainNumberText, '4816');
await enterText(tester, trainNumberText, 'T6');

final primaryButton = find.byWidgetPredicate((widget) => widget is SBBPrimaryButton).first;
await tester.tap(primaryButton);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class _TrainSelectionState extends State<TrainSelection> {
@override
void initState() {
super.initState();
_trainNumberController = TextEditingController(text: '7839');
_trainNumberController = TextEditingController(text: 'T9999');
_dateController = TextEditingController();

context.trainJourneyCubit.updateTrainNumber(_trainNumberController.text);
Expand Down
Loading

0 comments on commit b99b9fe

Please sign in to comment.