-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add variant
to testGoldens
#180
Conversation
@NickalasB Should we append the name of the variant to the file name ( import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
import 'package:sharezone/pages/settings/changelog_page.dart';
void main() {
group(UpdatePromptCard, () {
testGoldens(
'display card as expected',
(tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
UpdatePromptCard(),
],
),
),
),
),
);
await screenMatchesGolden(tester, 'update_prompt_card');
},
variant: TargetPlatformVariant.all(),
);
});
} |
I think in order for this to work you will need to modify the As I understand it the
|
@nilsreichardt also... for what you are trying to accomplish. Have you tried the |
I have a card that shows different text for each platform (iOS, Android, Web, macOS). I created a golden test for that where I loop over the platforms. My goal with this PR is to make advantage of Here is the code of the test (and the golden files): https://github.com/SharezoneApp/sharezone-app/blob/main/app/test_goldens/pages/settings/changelog_page_test.dart |
@nilsreichardt How about adding a test in your PR to assert that the desired behavior is working as intended, and then we can make the call as to whether it adds value? Thank you very much for helping to contribute! |
The way the PR is currently, does not work because I would need to change the file name for every variant (append the variant name as suffix). I'm going to close it for now. |
@nilsreichardt No worries. Thank you for supporting and suggesting improvements! |
Adds
variant
totestGoldens
to be able to useTestVariant
. This can be useful when you have different layout for everyTargetPlatform
. Can then useTargetPlatformVariant
in your test.Closes #179