-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: break out smoke test goldens into directories based on flutter version #126
Conversation
This reverts commit bce22e5.
…nt/alchemist into bt/flutter-version-dirs
Great work! Two quick Qs:
|
So, I'm intentionally not adding this as a feature of Alchemist, but rather a "feature" of our test suite. This means that it won't change anything about how consumers use Alchemist (though they could totally do this themselves! I imagine the use case where this would be powerful is in a UI SDK development...You may want to ensure your SDK looks the same when built against a variety of Flutter versions). For normal "app" development, this doesn't seem as useful because (most likely) you are targeting/consuming a single Flutter version. The primary hook that is utilized here is Alchemist's
As per the above, consumers don't need to pass this, it's just for us. And yeah, I was thinking the same RE: grabbing this at runtime. AFAIK the only way to do this would be to do it via
I'll give that a try in the next few commits. Right now, I'm trying to see if I can "fix" the diff I'm seeing on flutter 3.22.x by specifying an explicit set of colors for the Let me know if you have any thoughts on ANY of the above @jeroen-meijer! Really value your input. |
jobs: | ||
build: | ||
analyze: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll analyze against the lowest version we support. This means that contributors should be using that version (fvm
is helpful here). We can/should probably add something that details that in our CONTRIBUTING.md.
strategy: | ||
fail-fast: false | ||
matrix: | ||
flutter-version: ['3.16.9', '3.19.6', '3.22.3', '3.24.3'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test against all supported versions of flutter, up to latest stable version. This will take some manual work to keep this up to date; I'll noodle on how to make this more dynamic as a follow-up.
.github/workflows/main.yaml
Outdated
- name: Run tests | ||
run: flutter test --no-pub --coverage --test-randomize-ordering-seed=random | ||
run: ALCHEMIST_FLUTTER_VERSION=${{ matrix.flutter-version }} flutter test --no-pub --coverage --test-randomize-ordering-seed=random |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gonna look at allowing us to drop this env variable and instead grab it via Process.run
. This will ensure that the version Alchemist uses for golden comparison is guaranteed to match the actual running version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Process.run
sounds good to me, but be aware that:
- If people run
fvm
, simply running aflutter
command might give incorrect output. - Instead of doing some string voodoo, you could do
import 'dart:convert';
final output = Process.run('flutter --version --machine');
final flutterData = json.decode(output);
final flutterVersion = flutterData['flutterVersion'];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh, that's way better haha. I just pushed a commit that uses that; if everything succeeds, I think this is good to merge now 👀
Also, 🎉 good news. I was able to explicitly set button colors in the interactions test which resolved the breaking changes that we were inheriting from flutter 3.22.x, meaning we don't need a separate directory for that version, everything is passing on 3.16.x and beyond 🎉
Awesome, thanks for the explanation @btrautmann. Nice work! Seems like it's working wonderfully 😄 ![]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
@jeroen-meijer as mentioned in #126 (comment), this is now ready I think 😄 I may make some updates to the contributing guide in a different PR! |
Send it~ |
Description
The goal of this PR is to allow us to maintain different versions of golden files depending on the Flutter version being used to run the tests. This is a necessity to allow for things like #123 which adds a matrix workflow to run Alchemist's smoke tests against a variety of Flutter versions. A couple smoke tests begin failing on Flutter 3.22.x with changes that seem to be outside of Alchemist's control. Using the code in this PR, we can generate new goldens just for that Flutter version and the workflow can continue to run without notifying of new failures (unless something else changes).
Note: Right now, we have one golden test that does not use Alchemist that sits outside oftest/smoke_tests
which is not supported by this code; we need to figure out a solution for this. @jeroen-meijer I'm curious if you recall why we didn't use Alchemist for that test (I'm asking this before I have looked deeply at it, so it may be that I realize the answer before you get back to me... If that's the case I'll edit below 😄 ).Edit: I realized after the fact that the diff here was due to a change in
Scaffold
background color. I set one explicitly and now all versions are passing (with re-generated goldens for 3.16.x) for all versions 🎉Note: These changes are isolated to
flutter_test_config
and therefore should not impact consumers.Type of Change