Comments (3)
Did a few tests after forking the repository, the problem seems to be simple to solve, it's related to the last '\' on the path. I believe in windows it's not supposed to have the last '\'
original:
C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\screenshots\pro\debug\
how it worked on windows:
C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\screenshots\pro\debug
When i hardcoded without that last '\' the files started to save on windows, but now i'm facing a new error related to moving and comparing the screenshots. Probably also related to the last '\'.
That's the problem on Windows, but i'm finding it dificult to fix without breaking any existing code. If anyone more experienced with this code could take a look it would be a lot faster.
from shot.
Did a few more tests, and for some reason on windows you need to remove the '\' when creating a folder, but that '\' is needed when deleting the same folder. There's still one huge problem, but it's related to another issue.
Adb.scala
private def executeAdbCommand(command: String): Int = {
var newCommand = s"${adbPath} $command"
if (newCommand.endsWith("/")) newCommand = newCommand.dropRight(1)
if(newCommand.endsWith("\\"))newCommand= newCommand.dropRight(1)
s"$newCommand" ! logger
}
private def executeAdbCommandWithResult(command: String): String = {
var newCommand = s"${adbPath} $command"
if (newCommand.endsWith("/")) newCommand = newCommand.dropRight(1)
if (newCommand.endsWith("\\")) newCommand = newCommand.dropRight(1)
s"$newCommand" !! logger
}
That solved the copy problem on windows, but there's still the problem of not being able to delete "metadata.json" and "com.karumi.shotconsumercompose.MainActivityTest_activityTest_dump.json" due to them being used. When you try to run it again, it would lead to an error with metadata.json
Shot.scala
private def safeDeleteDirectory(file: File): Unit = {
var fileToDelete = file
try {
if(!fileToDelete.exists() && !fileToDelete.getAbsolutePath.endsWith("\\")) {
fileToDelete = new File(file.getAbsolutePath+"\\")
}
FileUtils.deleteDirectory(fileToDelete)
} catch {
case e: Throwable => {
println(YELLOW + s"Failed to delete directory: ${e}")
println(YELLOW + s"Failed to delete directory: ${e.getCause.getCause}")
}
}
}
Error when running safeDeleteDirectory
?? Pulling screenshots from your connected devices!
> Task :app:proDebugExecuteScreenshotTests
? Saving screenshots.
? Screenshots recorded and saved at: C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\screenshots\pro\debug\
? You can review the execution report here: C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\build\reports\shot\pro\debug\index.html
Failed to delete directory: org.apache.commons.io.IOExceptionList: C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\screenshots\pro\debug\screenshots-default
Failed to delete directory: java.nio.file.FileSystemException: C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\screenshots\pro\debug\screenshots-default\com.karumi.shotconsumercompose.MainActivityTest_activityTest_dump.json: The process cannot access the file because it is being used by another process.
Running a second time after the error
org.apache.commons.io.FileExistsException: File element in parameter 'null' already exists: 'C:\Users\gusta\Documents\GitHub\Shot\shot-consumer-compose\app\screenshots\pro\debug\screenshots-default\metadata.json_3297ed05'
from shot.
Same issue here unfortunately. Works fine on MACs, but not on Windows. And it's not only saving screenshots, it's running the tests themselves to compare and verify also suffer from the same problem ("? We couldn't find any screenshot. Did you configure Shot properly and added your tests to your project?")
from shot.
Related Issues (20)
- Generated diff image does not show all differences
- Removing the Toolbar shadow (elevation) HOT 1
- Is it possble to test screenshots for gif animated image?
- Feature Request / Question - Record Screenshots at Runtime HOT 2
- Failing to record screenshots HOT 8
- compareScreenshot to capture and verify full screen
- Support for Java 17 and AGP 8.0 HOT 1
- Failing landscape tests due to screen dimensions HOT 1
- Plugin not found issue with new plugin configuration method in gradle HOT 3
- Upgrade Scrimage to latest version
- Please consider transferring ownership to the community HOT 1
- Configuration with name 'androidTestImplementation' not found. HOT 1
- Test Run twice using version 6.0.0
- JUnit test reports?
- Is there any way to capture a snapshot of a BottomSheetDialog HOT 3
- Wrong SDCard folder on Android 5.1
- Screenshot of a Dialog in Compose shown over the app content
- [6.1.0][Api 30] NoSuchMethodException android.view.ViewRootImpl WindowAttachment.generateAttachInfo HOT 1
- Support for Gradle Kotlin DSL
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 shot.