-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This replaces the `AlphaVersionBanner` with `DevelopmentStageBanner` so that a banner is always shown if the user uses a non-stable version of Sharezone. This is useful for #1290 (new "preview" stage for preview builds in PRs). Currently the banner is only shown in alpha, not in beta. This will show a banner in alpha and beta. ![grafik](https://github.com/SharezoneApp/sharezone-app/assets/29028262/44bcbfa5-8137-4fe2-81f0-a0cc7db2e9d1) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a Development Stage Banner to inform users about the current development stage of the app. - **Refactor** - Improved the flexibility of testing by allowing the development stage variable to be overridden. - Enhanced the Development Stage Banner to dynamically display the app's development stage. - **Tests** - Added tests to ensure the Development Stage Banner accurately reflects the app's current stage. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
1 parent
c42ca59
commit a38bed9
Showing
5 changed files
with
109 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
85 changes: 85 additions & 0 deletions
85
app/test_goldens/widgets/development_stage_banner_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) | ||
// Licensed under the EUPL-1.2-or-later. | ||
// | ||
// You may obtain a copy of the Licence at: | ||
// https://joinup.ec.europa.eu/software/page/eupl | ||
// | ||
// SPDX-License-Identifier: EUPL-1.2 | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:golden_toolkit/golden_toolkit.dart'; | ||
import 'package:sharezone/main/constants.dart'; | ||
import 'package:sharezone/widgets/development_stage_banner.dart'; | ||
|
||
void main() { | ||
group('$DevelopmentStageBanner', () { | ||
testGoldens( | ||
'displays the banner at the correct position', | ||
(tester) async { | ||
kDevelopmentStageOrNull = 'alpha'; | ||
|
||
await tester.pumpWidgetBuilder( | ||
const DevelopmentStageBanner( | ||
child: MaterialApp( | ||
debugShowCheckedModeBanner: false, | ||
home: Scaffold( | ||
body: Text("Text"), | ||
), | ||
), | ||
), | ||
); | ||
|
||
await screenMatchesGolden(tester, 'alpha_version_banner'); | ||
}, | ||
); | ||
|
||
testWidgets("does display the banner if stage is alpha, beta or preview", | ||
(tester) async { | ||
for (var stage in ['alpha', 'beta', 'preview']) { | ||
kDevelopmentStageOrNull = stage; | ||
|
||
await tester.pumpWidget( | ||
const Directionality( | ||
textDirection: TextDirection.ltr, | ||
child: DevelopmentStageBanner( | ||
child: MaterialApp( | ||
debugShowCheckedModeBanner: false, | ||
home: Scaffold( | ||
body: Text("Text"), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
|
||
expect(find.byType(Banner), findsOneWidget, | ||
reason: 'Stage "$stage" should display the banner'); | ||
} | ||
}); | ||
|
||
testWidgets("does not display the banner if stage is 'stable' or null", | ||
(tester) async { | ||
for (var stage in ['stable', null]) { | ||
kDevelopmentStageOrNull = stage; | ||
|
||
await tester.pumpWidget( | ||
const Directionality( | ||
textDirection: TextDirection.ltr, | ||
child: DevelopmentStageBanner( | ||
child: MaterialApp( | ||
debugShowCheckedModeBanner: false, | ||
home: Scaffold( | ||
body: Text("Text"), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
|
||
expect(find.byType(Banner), findsNothing, | ||
reason: 'Stage "$stage" should not display the banner'); | ||
} | ||
}); | ||
}); | ||
} |