Comments (7)
Thanks for the detailed report @AngeloAvv
- Write your UI tests asserting the image will be there
- Run your tests (with or without the --flavor param)
- Tests are failing: Unable to load asset
Since you are trying to run flutter test
, according to #132985, the use case you are trying to achieve currently supports flutter run
and flutter build
only, so it may not be applicable to flutter test
that you can check.
Also, /cc @andrewkolos for thoughts on the issue report.
from flutter.
Thanks for filing this (and thanks for tagging me)!
I think it's fair to call this a bug (or surprising behavior at the very least). If --flavor
is supported in flutter test
, then flavor-conditional asset bundling should work for it as well. I'll try to patch this.
from flutter.
I looked at the code that builds and writes the asset bundle for flutter test
, and it looks like we already pass along the flavor. I got confused, because I originally thought I was able to repro this, but I must have made a mistake when setting up my test project. I attempted to repro again using a fresh project, and I was unable to.
@darshankawar would you mind trying to repro this?
from flutter.
Ok, @andrewkolos this looks weird. I was trying to share with you a repo to reproduce the code, so that's what I did.
- I ran the tests one more time, they were failing both with or without the flavor arg
- Init a .git repo
- Run the tests again: for some reason this time "flutter test" did a pub get under the hood which also cleaned something, tests were working fine with both parameters
I wasn't able to reproduce the bug anymore!
So here's what I did.
- I ran flutter clean
- Run flutter test without flavor param, tests failed
- Run flutter test with flavor param, tests are failing again
But if you do the opposite
- I ran flutter clean
- Run flutter test with flavor param, tests pass
- Run flutter test without flavor param, tests are passing
Looks like the assets files are not updated or something like that every time you switch from one run to another.
Here's a repo with a Flutter project I created for you where I'm able to reproduce the bug
from flutter.
Ah okay, this could be a caching bug. I will take a second look.
from flutter.
Yeah, it looks like we don't take --flavor
into account when invalidating the asset bundle used in tests. We only look at the asset files and pubspec:
from flutter.
Here's a repo with a Flutter project I created for you where I'm able to reproduce the bug
Using this repo and running the test, it throws the reported error log.
stable, master flutter doctor -v
[!] Flutter (Channel stable, 3.22.2, on macOS 12.2.1 21D62 darwin-x64, locale
en-GB)
• Flutter version 3.22.2 on channel stable at
/Users/dhs/documents/fluttersdk/flutter
! Warning: `flutter` on your path resolves to
/Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
your current Flutter SDK checkout at
/Users/dhs/documents/fluttersdk/flutter. Consider adding
/Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
! Warning: `dart` on your path resolves to
/Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 761747bfc5 (33 hours ago), 2024-06-05 22:15:13 +0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3
• If those were intentional, you can disregard the above warnings; however
it is recommended to use "git" directly to perform update checks and
upgrades.
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] VS Code (version 1.62.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.21.0
[✓] Connected device (5 available)
• SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30)
• Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 •
ios • iOS 14.4.1 18D61
• iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 •
ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
• macOS (desktop) • macos •
darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 98.0.4758.80
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
[!] Flutter (Channel master, 3.23.0-13.0.pre.262, on macOS 12.2.1 21D62
darwin-x64, locale en-GB)
• Flutter version 3.23.0-13.0.pre.262 on channel master at
/Users/dhs/documents/fluttersdk/flutter
! Warning: `flutter` on your path resolves to
/Users/dhs/Documents/Fluttersdk/flutter/bin/flutter, which is not inside
your current Flutter SDK checkout at
/Users/dhs/documents/fluttersdk/flutter. Consider adding
/Users/dhs/documents/fluttersdk/flutter/bin to the front of your path.
! Warning: `dart` on your path resolves to
/Users/dhs/Documents/Fluttersdk/flutter/bin/dart, which is not inside your
current Flutter SDK checkout at /Users/dhs/documents/fluttersdk/flutter.
Consider adding /Users/dhs/documents/fluttersdk/flutter/bin to the front
of your path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 6a8f70f11e (2 hours ago), 2024-06-18 00:12:10 -0400
• Engine revision 78fdd06af5
• Dart version 3.5.0 (build 3.5.0-272.0.dev)
• DevTools version 2.36.0
• If those were intentional, you can disregard the above warnings; however
it is recommended to use "git" directly to perform update checks and
upgrades.
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/dhs/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for
more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 13C100
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 65.1.4
• Dart plugin version 213.7228
[✓] VS Code (version 1.62.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.29.0
[✓] Connected device (3 available)
• Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 • ios
• iOS 15.3.1 19D52
• macOS (desktop) • macos •
darwin-x64 • macOS 12.2.1 21D62 darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 109.0.5414.119
[✓] Network resources
• All expected network resources are available.
! Doctor found issues in 1 category.
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] VS Code (version 1.62.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.21.0
[✓] Connected device (5 available)
• SM G975F (mobile) • RZ8M802WY0X • android-arm64 • Android 11 (API 30)
• Darshan's iphone (mobile) • 21150b119064aecc249dfcfe05e259197461ce23 •
ios • iOS 14.4.1 18D61
• iPhone 12 Pro Max (mobile) • A5473606-0213-4FD8-BA16-553433949729 •
ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
• macOS (desktop) • macos •
darwin-x64 • Mac OS X 10.15.4 19E2269 darwin-x64
• Chrome (web) • chrome •
web-javascript • Google Chrome 98.0.4758.80
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
from flutter.
Related Issues (20)
- Mac_x64 build_tests_4_4 is 2.00% flaky
- [go_router] Clarification on Route Ordering with Multiple Matches: Follow-Up to Issue #106851 HOT 1
- Difficulty getting flutter to work HOT 10
- Linux build_tests_1_3 is 2.00% flaky
- ram comsumtion is to high after flutter update in linux HOT 1
- Gradient `withOpacity` method HOT 5
- [Flutter WASM] RuntimeError: memory access out of bounds HOT 7
- Some Chinese characters showed very bad on flutter view in windows desktop HOT 1
- Widget Test can't tap RadioListTile after upgrading to flutter 3.22
- Add `primaryScroll` options on Navigator.
- Add ability to customize `TabBar` indicator animation
- ReferenceError: `Can't find variable: WebAssembly` and `Can't find variable: _flutter` HOT 7
- flutter_plugin_android_lifecycle NOT COMPATIBLE WITH ANDROID GRADLE PLUGIN 8.5.0 HOT 1
- Flutter crash when intensively redrawing CustomPainter HOT 2
- Build error in `sync_switch.cc` on Clang-16 with GCC 14 stdlib. HOT 1
- Flutter web app is not working in mobile browser HOT 2
- s.g.dart';
- Canvas.drawPoints with round caps has weird squares HOT 1
- [iOS] Textfield loses focus after 'Shake to undo' system dialog, despite keyboard reappears. HOT 1
- Flutter web hangs when downloading file on Chrome HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter.