From 5244eaf4b74ec25cf9f376a7830fb9a8e98bf229 Mon Sep 17 00:00:00 2001 From: yuoohama Date: Mon, 31 Jul 2023 09:33:13 +0900 Subject: [PATCH] Make printing returned value on test --- example/integration_test/integration_test.dart | 5 ++++- example/integration_test/test_app.dart | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/example/integration_test/integration_test.dart b/example/integration_test/integration_test.dart index 43a2bd2a..504accc4 100644 --- a/example/integration_test/integration_test.dart +++ b/example/integration_test/integration_test.dart @@ -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'; @@ -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}"); diff --git a/example/integration_test/test_app.dart b/example/integration_test/test_app.dart index b244bb76..560ff78c 100644 --- a/example/integration_test/test_app.dart +++ b/example/integration_test/test_app.dart @@ -82,7 +82,7 @@ class _AppState extends State { 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; @@ -105,6 +105,7 @@ class _AppState extends State { } class Logger { + dynamic value; Object? error; StackTrace? stackTrace; }