isonic1 / flick

A CLI with helpful QA tools for Android (Devices & Emulators) and iOS (Devices).
MIT License
101 stars 26 forks source link

How I can stop recording without saving the video? #13

Closed albka1986 closed 7 years ago

albka1986 commented 7 years ago

How can I stop recording without saving the video?

I want to set 2 options:

  1. if tests are failed - saving
  2. if tests are "OK" - cancel recording
testableapple commented 7 years ago

Not sure, that you can do it via flick. Mb, somethink like this will help you: killall flick

isonic1 commented 7 years ago

@albka1986 Yeah, @alter-al is right. You can just do a kill of the flick process or you can write some code to delete the video after the tests complete if there was not a failure.

Although, what your asking is not a bad feature to add but I'm not sure when I'd get around to adding it. I'll mark this as enhancement and will implement it at some point.

albka1986 commented 7 years ago

@alter-al, @isonic1, Thanks for the answers!

And I'he another questions: How can I stop and save recording in Java? I have tried this code: Runtime.getRuntime().exec("flick video -stop -p android -o \users\oleh); But it doesn't work. I have no error and don't have any videos in the folder. When I run start and stop commands only via terminal it's working normal.

Have you any example?

isonic1 commented 7 years ago

@albka1986 hmm, I'm not a java programmer so I'm not sure. Looks like you're missing a quote in ...exec("flick video -stop -p android -o \users\oleh), though.

However, if I was trying to debug this in my language I'd look for expected output so you know it's working. E.g. write or print the output of Runtime.getRuntime().exec("ls -lstr"); You should see the directory files your test runs from if that in-fact is the correct function to run system calls. If that is working then flick should run with that function too.

You can see if flick is running by doing a ps -ax | grep flick while your tests are running.

testableapple commented 7 years ago

@albka1986, u can use the ProcessExecutor (such as gradle/maven dependency: org.zeroturnaround:zt-exec) For example: List<String> commands = Arrays.asList("path/to/your/flick", "video", "-a", "stop", "-p", "android", "-n", "test");

new ProcessExecutor().command(commands).readOutput(true).execute().outputUTF8();

isonic1 commented 7 years ago

thanks for answering @alter-al!

albka1986 commented 7 years ago

@alter-al, @isonic1 It's working, thanks! But, the movie is not always saving correctly. It records 2 or 3 seconds of the test suite, while the test suite itself often lasts more than 3 minutes.

What parameter should I set if I want to record a full movie of the test?

isonic1 commented 7 years ago

@albka1986 it depends what platform you're saving and when you invoke the start and stop flick commands. You should set the flick start in your setup block/function/method and the flick stop in your teardown block/function/method. If you're testing android emulator or real iOS device by default it will not be the full test time but only unique images from the test run. You can override this by passing -q false in the flick stop command.