Skip to content

Commit

Permalink
Make printing returned value on test
Browse files Browse the repository at this point in the history
  • Loading branch information
natsuk4ze committed Jul 31, 2023
1 parent 76019ee commit 5244eaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion example/integration_test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import 'dart:io' show Platform;

import 'package:flutter/material.dart' show Key;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';

Expand Down Expand Up @@ -40,6 +40,9 @@ void execute(String key) => testWidgets(key, (tester) async {

await tester.tap(button);
await tester.pumpAndSettle();

debugPrint('$key returned: ${app.logger.value}');

if (app.logger.error == null) return;
fail(
"${app.logger.error.runtimeType}: ${app.logger.error}\nStackTrace: ${app.logger.stackTrace}");
Expand Down
3 changes: 2 additions & 1 deletion example/integration_test/test_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _AppState extends State<App> {
logger = Logger();
setState(() => isTesting = true);
try {
await onPressed();
logger.value = await onPressed();
} catch (e, st) {
logger.error = e;
logger.stackTrace = e is GalException ? e.stackTrace : st;
Expand All @@ -105,6 +105,7 @@ class _AppState extends State<App> {
}

class Logger {
dynamic value;
Object? error;
StackTrace? stackTrace;
}

0 comments on commit 5244eaf

Please sign in to comment.