-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Can't read file in integration test android #94197
Comments
@ductranit |
I didn't try it yet, but I need to access the system path to load custom fonts (for golden test), load some test configs, take some screenshots & save to files. How can bundle support for that? |
Since you are saving to the files, and the same file if you add it to pubspec.yaml under |
@darshankawar So I tried to read by
But as I said, the problem is that I need to write screenshot to file which bundle can't help.
It throws exception when write file:
P/s: I had to change |
@ductranit |
As I said above, all kinds of path have exception.
If I tried with
The problem is that the root path of integration test is |
Thanks for the update. I see what you are saying. Can you provide us a minimal code sample, ie, |
@darshankawar Here is it ui_test.zip |
Thanks for the info. I verified this on Android and get same behavior / exception on latest stable and master. Keeping it open for further insights from the team. app_test.dart
main.dart
flutter doctor -v
/cc @jiahaog |
Are you running the iOS integration test on a simulator? I'm not sure if that will work on a physical device. This is probably happening because of the different filesystems used by the device. On iOS simulators, the filesystem of the simulator is the same as the host. Similarly for unit tests, the test run within the flutter tester device which runs on the host and has access to the same host filesystem. This is not the case on iOS physical devices or Android emulators or Android physical devices, which do not share the filesystem of the host. |
@jiahaog yes, I run it on ios simulator. I just try on ios device and got the same android issue. |
any update? same problem~ |
actually, it seems like golden test doesn't work in integration test |
I stumbled across the same issue. Any solutions? |
@lexxxel @00SunnyDay00 I have to put the golden images into flutter assets (define in pubspec.yaml), then copy those golden files into internal storage of simulator/device when starting app and compare goldens |
@ductranit so you can't use |
@lexxxel actually I did a trick for |
@ductranit I might found a 'better' solution. Requirement: a emulator with root access. I do use (minimal example):
to push the .png into a folder that is predictable and |
I had the same problem with this issue
So when I run integration test, the
Directory.current
is/
- this is the root dir on my mac device and it's readonly.I was trying to read json file & custom font in the test, so I have to pass the real path on my mac like:
If I run command
flutter test integration_test
on ios, it works fine, I can load custom font, json & can also take screenshot with this path.But when I run on android device, it throw file not found error with the same path when I load font, json
So my questions are:
/
as rootflutter doctor -v
The text was updated successfully, but these errors were encountered: