-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Running tests from windows throws org.apache.commons.io.FileExistsException
#244
Comments
Linked to #140 |
org.apache.commons.io.FileExistsException
I also encountered this, on Mac, when I enabled |
We're still having there issues on code-with-the-italians/bundel on 5.12.1 unfortunately. Same error as the original report. I'll put a link to the recording of our efforts once the recording is out! Note: this was mistakenly posted on #140 first. |
@pedrovgs I have run the tests on the |
🤔 🤔 @rock3r, do you mean you've forked the project from your windows PC and got Shot working on API 29+ issues I'm sure are related to the scoped storage... but I'm happy to see I'm not crazy and we got Shot working on windows, at least for 1 project xD cc/ @Tylos Could you please check the other Looking at your Twitch stream I've noticed the line you mentioned about the message However, there is an interesting point in the video you've already noticed. The Shot Gradle plugin is actually able to pull the screenshots and when it fails, it shows a message @rock3r, now that you've got it running, could you please run some tests for me and check what's going on?
For the second experiment, you can modify private def pullFolder(
folderName: String,
device: String,
screenshotsFolder: Folder,
appId: AppId
) = {
val folderToPull = s"${baseStoragePath}/screenshots/$appId/$folderName/"
println(s"Pulling screenshots from ${folderToPull}")
try {
executeAdbCommandWithResult(s"-s $device pull $folderToPull $screenshotsFolder")
} catch {
case t: Throwable =>
println(s"Exception catch: ${t}")
println(
Console.YELLOW + s"Shot ADB warning: We could not pull screenshots from folder: ${folderToPull}"
)
}
} It will print the folders where Shot is trying to pull the images every time it tries to pull and if it fails it will print the exception found. Thank you so much @rock3r 😃 I really appreciate the time you are taking to fix this bug! P.S: Remember you can publish the artifact to your local marvel using the publishToMavenLocal task afer any shot code change. |
@mariuszmarzec you are the author of the fix we added as tentative support for windows. Could you please help us with this bug? |
Yes! Works fine. Prints some warnings about files not existing when running some ADB commands, but works fine and doesn't fail. I'll check the other instructions asap and will let you know! :) Thanks a ton for your help 🙌 |
@pedrovgs
Looks like screenshots-default is not removed after/before from some reason. I will try to fix it later. According to @rock3r 's issue, i cloned Bundel repo and trying to reproduce error as above, but got different one:
Looks like something different. Maybe it is operating system related. @rock3r Do you use Windows or Linux/MacOS? |
@mariuszmarzec I'm on Windows 11 |
@mariuszmarzec could you please confirm the emulator you used to test it and also the list of projects and sample projects you've tested? I'd love to release a version with the fix before the end of the year, but I'd like to at least ensure it works for API 28 in different projects. |
@pedrovgs I tested all shot-consumer-* project on API-28 and it works as expected. But i have open champagne to early. Looks like issue:
... stills occur on API 29 for compose test. I think this PR could be merge, but this second issue require more investigation rather as separate issue. |
Merged and released, thank you so much @mariuszmarzec 😃 Could you please guys check if 5.12.2 is working as expected, at least on API 28? |
I am facing the same issue in our project by using 5.12.2. Mac, emulator API 28. any luck to fix this? |
@zoey-juan I discovered that sometimes gradle is locking files created durin shot tasks, and to workaround it you have to run Could you try |
@mariuszmarzec hi, thanks for replying. The FileExistsException error is gone after running
|
@zoey-juan Try running it on API 27 or 26. I regularly have problems with any instrumentation tests greater than API 27. Not only for screenshot tests. It could be API 28 handles storage differently so it can't save the screenshots to your device. |
I have tried to run on API 27 and debug it. the images are actually stored in More details here
|
@zoey-juan Thanks for logs, yea shot is trying get screenshots from screenshot-compose-default and it failed because it is empty or doesn't exist. Lack of message for screenshot-default means that images are loaded but something went wrong in next stages and final screenshot are not generated. Are you able build on your local machine shot library with commented out lines: Or you can try locally fetch my branch from this PR #273 and check it if issue still occurs. |
@mariuszmarzec thanks for the suggestion, unfortunately no luck to me. I have tried both suggestions. As you can see after running
|
@zoey-juan Ok, now it is clear. Something goes wrong during processing metadata.xml file which is intermediate file. Could you try new released version 5.13.0? In new version there is no xml processing, because facebook screenshot testing used under the hood change metadata to json format. If any issue will occurs again, please share whole stacktrace (usage of --stacktrace flag will make gradle stacktrace printing). |
@mariuszmarzec hi! I have tried this PR #273 and I think it's the same as version 5.13.0. the log above was from the change. |
@zoey-juan Log is from 5.12.2 probably, because in PR #273 don't use xml parser. Probably during trying code from PR in your test project mavenLocal() repository was not defined before remote repository and 5.12.2 with old code was used. I think you can try 5.13.0 from remote maven repository. |
@mariuszmarzec logs and image output by using 3.13.0
|
@zoey-juan Thanks for effort. Looks like clue of this issue is here:
@pedrovgs i'm not experienced in scala, but for me it looks like missing dependency, not sure why is missing. It wasn't never declared in build.gradle file i think and it doesn't break tasks on my machine or CI. Is it connected with scala version? JVM implementation? |
Yep, you came to the same error that I mentioned here #274 |
@mariuszmarzec looks like there is an issue with the jackson library, like if the dependency is not included as expected or something like that. We could try updating the library we use to decode JSON. |
Could this be related to the fact of using JDK 11? |
It could be if I've deployed the artifact using java 11 for the final build, but I don't think this is the case. Anyway, our tests are executed using java 11 on linux OS images so it can be something specific to the windows JDK. |
Hi,
|
Releasing a tentative fix for this one right now. Version 5.14.1. Please, if this is still reproducible, feel free to reopen this issue after testing with the new release provided. Thanks! |
@pedrovgs As mentionned in the PR, the fix will only fix the The next run will still throw the |
version 5.14.1 still have this issue in my mac machine. and, the problem is, We are having this issue intermittently. now it constantly occurs when i record in one branch and then switched to another branch and run the tests. then this issue occured me... 😢 |
Expected behaviour
executeScreenshotTests -Precord
andexecuteScreenshotTests
should not throw FileExistsExceptionActual behaviour
Running command
executeScreenshotTests -Precord
is returningorg.apache.commons.io.FileExistsException: Destination '{myProjectPath}\features\{myFeature}\screenshots\debug\screenshots-compose-default\{packageName}testName.png already exists.
Running command
executeScreenshotTests
is returningorg.apache.commons.io.FileExistsException: Destination '{myProjectPath}\features\{myFeature}\screenshots\debug\screenshots-compose-default\metadata.json_emulator-5554 already exists.
NOTE: I deleted the screenshots directory from my module before running these commands. After these commands run and finish I see the
.png
,metadata.json-5554
and sometimes themetadata.json
files in that directory.Steps to reproduce
Create a test using compose-ui and run the commands:
gradlew.bat executeScreenshotTests -Precord
gradlew.bat executeScreenshotTests
Version of the library
5.11.0
Also I am using a machine with Windows 10 installed and Android Studio Arctic Fox 2020.3.1 RC1
The text was updated successfully, but these errors were encountered: