From ac9dc32c50c1de9b51dbf8d18eb5997ef561322a Mon Sep 17 00:00:00 2001 From: melvspace Date: Sat, 21 Dec 2024 14:15:45 +0300 Subject: [PATCH] fix(allure): handle flutter golden assertions --- .gitignore | 7 ++++++- apps/sandbox/lib/widgets/benefit/frost_benefit.dart | 4 ++-- .../sandbox/lib/widgets/benefit/rating_benefit.dart | 4 ++-- packages/allure_report/CHANGELOG.md | 4 ++++ packages/allure_report/lib/src/allure_reporter.dart | 13 ++++++++----- packages/allure_report/pubspec.yaml | 2 +- 6 files changed, 23 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 8a03fbe..0cfe447 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ /dev/integration_tests/**/xcuserdata /dev/integration_tests/**/Pods /packages/flutter/coverage/ +/test/**/failures/ version analysis_benchmark.json pubspec_overrides.yaml @@ -139,4 +140,8 @@ app.*.symbols !.vscode/settings.json allure-report/ -allure-results/ \ No newline at end of file +allure-results/ + +# Package specific +**/reports/ +**/test/**/failures/ \ No newline at end of file diff --git a/apps/sandbox/lib/widgets/benefit/frost_benefit.dart b/apps/sandbox/lib/widgets/benefit/frost_benefit.dart index 1128b85..d7b1a8f 100644 --- a/apps/sandbox/lib/widgets/benefit/frost_benefit.dart +++ b/apps/sandbox/lib/widgets/benefit/frost_benefit.dart @@ -9,8 +9,8 @@ class FrostBenefit extends StatelessWidget { Widget build(BuildContext context) { return BenefitContainer( icon: const BenefitIcon(icon: Icon(Icons.bolt)), - title: 'Заморозку', - subtitle: 'Теперь не страшно пропустить занятие', + title: '+2 frost', + subtitle: 'Dont be afraid to skip lesson', color: Theme.of(context).colorScheme.surface, ); } diff --git a/apps/sandbox/lib/widgets/benefit/rating_benefit.dart b/apps/sandbox/lib/widgets/benefit/rating_benefit.dart index ccc6dff..d91e927 100644 --- a/apps/sandbox/lib/widgets/benefit/rating_benefit.dart +++ b/apps/sandbox/lib/widgets/benefit/rating_benefit.dart @@ -9,8 +9,8 @@ class RatingBenefit extends StatelessWidget { Widget build(BuildContext context) { return BenefitContainer( icon: const BenefitIcon(icon: Icon(Icons.alternate_email_rounded)), - title: '+1 балл к рейтингу', - subtitle: 'Будут все шансы стать фаворитом недели', + title: '+1 score to rating', + subtitle: 'Will have every chance to be the favorite of the week', color: Theme.of(context).colorScheme.surface, ); } diff --git a/packages/allure_report/CHANGELOG.md b/packages/allure_report/CHANGELOG.md index 6eafb3d..f85d9e0 100644 --- a/packages/allure_report/CHANGELOG.md +++ b/packages/allure_report/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.2.5 + +- **fix:** handle flutter golden assertions + ## 1.2.4 - **fix:** handle flutter errors diff --git a/packages/allure_report/lib/src/allure_reporter.dart b/packages/allure_report/lib/src/allure_reporter.dart index 02d78c9..44b1c09 100644 --- a/packages/allure_report/lib/src/allure_reporter.dart +++ b/packages/allure_report/lib/src/allure_reporter.dart @@ -305,11 +305,14 @@ class AllureReporter implements TestReporter { /// Flutter errors are pushed to console and require additional processing. void handleFlutterError(TestMessageEvent event) { - if (event.message.contains('EXCEPTION CAUGHT')) { - final parts = event.message - .split('When the exception was thrown, this was the stack:'); + final message = event.message; + if (message.contains('EXCEPTION CAUGHT')) { + final parts = + message.split('When the exception was thrown, this was the stack:'); + + final isTestFailure = message.contains('following TestFailure was') || // + message.contains('Pixel test failed'); - final isTestFailure = event.message.contains('following TestFailure was'); final String details; final String stackTrace; @@ -324,7 +327,7 @@ class AllureReporter implements TestReporter { stackTrace = parts[1].replaceAll(RegExp(r'\n═+$'), ''); } else { - details = event.message; + details = message; stackTrace = ''; } diff --git a/packages/allure_report/pubspec.yaml b/packages/allure_report/pubspec.yaml index 4644cc4..de9ec43 100644 --- a/packages/allure_report/pubspec.yaml +++ b/packages/allure_report/pubspec.yaml @@ -1,6 +1,6 @@ name: allure_report description: Allure Report Adapter. Use it with [test_reporter](https://pub.dev/packages/test_reporter) package -version: 1.2.4 +version: 1.2.5 repository: https://github.com/rIIh/dart_test_reporter issue_tracker: https://github.com/rIIh/dart_test_reporter/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+%5Ballure_report%5D