Skip to content
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

Not able to run Allure supported tests that generate a video, screenshot or logcat output #468

Open
maciejpigulski opened this issue Dec 29, 2022 · 17 comments
Labels
bug Something isn't working

Comments

@maciejpigulski
Copy link

Describe the bug
I am trying to run the samples from the repository that demonstrate on how to use Allure interceptors. Test I am trying to run is com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest.

For me it looks like there are no permissions to create anything on the emulated sdcard but not sure why it is like this.

To Reproduce
Steps to reproduce the behavior:

  1. Go to com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest
  2. Ensure an emulator is running
  3. Run the AllureSupportTest test suite
  4. Open logcat console
  5. See errors reported by the tool

Sample error stacks.

Failing logcat report:

2022-12-29 13:09:24.738 KASPRESSO I Dump logcat buffer to /storage/emulated/0/Documents/logcat/com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest/counter/TestLogcat.txt: logcat -b default -d -t "12-29 13:08:09.648" -s "KASPRESSO","KASPRESSO_TEST" 2022-12-29 13:09:24.740 KASPRESSO E Dump logcat buffer error: java.io.FileNotFoundException: /storage/emulated/0/Documents/logcat/com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest/counter/TestLogcat.txt: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileOutputStream.<init>(FileOutputStream.java:235) at java.io.FileOutputStream.<init>(FileOutputStream.java:186) at com.kaspersky.kaspresso.device.logcat.LogcatImpl.dumpLogcat(LogcatImpl.kt:94) at com.kaspersky.kaspresso.device.logcat.Logcat$DefaultImpls.dumpLogcat$default(Logcat.kt:41) at com.kaspersky.kaspresso.device.logcat.dumper.LogcatDumperImpl.doDump(LogcatDumperImpl.kt:34) at com.kaspersky.kaspresso.device.logcat.dumper.LogcatDumperImpl.dumpAndApply(LogcatDumperImpl.kt:29) at com.kaspersky.components.alluresupport.interceptors.testrun.DumpLogcatTestInterceptor.onTestFinished(DumpLogcatTestInterceptor.kt:17) at com.kaspersky.kaspresso.interceptors.watcher.testcase.impl.composite.TestRunCompositeWatcherInterceptor.onTestFinished(TestRunCompositeWatcherInterceptor.kt:193) at com.kaspersky.kaspresso.testcases.core.TestRunner.run(TestRunner.kt:87) at com.kaspersky.kaspresso.testcases.core.sections.MainTestSection.run(MainTestSection.kt:29) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run(BaseTestCase.kt:92) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run$default(BaseTestCase.kt:87) at com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest.counter(AllureSupportTest.kt:22) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(Forwar 2022-12-29 13:09:24.742 KASPRESSO E Logcat dumping error occurred: java.io.FileNotFoundException: /storage/emulated/0/Documents/logcat/com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest/counter/TestLogcat.txt: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileInputStream.<init>(FileInputStream.java:159) at com.kaspersky.components.alluresupport.files.AttachToReportKt.attachLogcatToAllureReport(AttachToReport.kt:8) at com.kaspersky.components.alluresupport.interceptors.testrun.DumpLogcatTestInterceptor$onTestFinished$1.invoke(DumpLogcatTestInterceptor.kt:17) at com.kaspersky.components.alluresupport.interceptors.testrun.DumpLogcatTestInterceptor$onTestFinished$1.invoke(DumpLogcatTestInterceptor.kt:17) at com.kaspersky.kaspresso.device.logcat.dumper.LogcatDumperImpl.doDump(LogcatDumperImpl.kt:39) at com.kaspersky.kaspresso.device.logcat.dumper.LogcatDumperImpl.dumpAndApply(LogcatDumperImpl.kt:29) at com.kaspersky.components.alluresupport.interceptors.testrun.DumpLogcatTestInterceptor.onTestFinished(DumpLogcatTestInterceptor.kt:17) at com.kaspersky.kaspresso.interceptors.watcher.testcase.impl.composite.TestRunCompositeWatcherInterceptor.onTestFinished(TestRunCompositeWatcherInterceptor.kt:193) at com.kaspersky.kaspresso.testcases.core.TestRunner.run(TestRunner.kt:87) at com.kaspersky.kaspresso.testcases.core.sections.MainTestSection.run(MainTestSection.kt:29) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run(BaseTestCase.kt:92) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run$default(BaseTestCase.kt:87) at com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest.counter(AllureSupportTest.kt:22) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

Failed screenshot

2022-12-29 13:09:24.731 UiDevice E failed to save screen shot to file java.io.FileNotFoundException: /storage/emulated/0/Documents/screenshots/com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest/counter/AllureSupportTest_step_5.png: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileOutputStream.<init>(FileOutputStream.java:235) at java.io.FileOutputStream.<init>(FileOutputStream.java:186) at androidx.test.uiautomator.UiDevice.takeScreenshot(UiDevice.java:1028) at com.kaspersky.kaspresso.device.screenshots.screenshotmaker.ExternalScreenshotMaker.takeScreenshot(ExternalScreenshotMaker.kt:24) at com.kaspersky.kaspresso.device.screenshots.screenshotmaker.CombinedScreenshotMaker.takeScreenshot(CombinedScreenshotMaker.kt:17) at com.kaspersky.kaspresso.device.screenshots.ScreenshotsImpl.doTakeAndApply(ScreenshotsImpl.kt:41) at com.kaspersky.kaspresso.device.screenshots.ScreenshotsImpl.takeAndApply(ScreenshotsImpl.kt:31) at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor.intercept(ScreenshotStepInterceptor.kt:21) at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor.interceptAfterWithSuccess(ScreenshotStepInterceptor.kt:13) at com.kaspersky.kaspresso.testcases.core.testcontext.TestContext.step(TestContext.kt:43) at com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest$counter$1.invoke(AllureSupportTest.kt:59) at com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest$counter$1.invoke(AllureSupportTest.kt:22) at com.kaspersky.kaspresso.testcases.core.TestRunner.runMainTestSection(TestRunner.kt:146) at com.kaspersky.kaspresso.testcases.core.TestRunner.run(TestRunner.kt:59) at com.kaspersky.kaspresso.testcases.core.sections.MainTestSection.run(MainTestSection.kt:29) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run(BaseTestCase.kt:92) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run$default(BaseTestCase.kt:87) at com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest.counter(AllureSupportTest.kt:22) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) 2022-12-29 13:09:24.732 UiDevice E at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:167) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252) at libcore.io.ForwardingOs.open(ForwardingOs.java:167) at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7255) at libcore.io.IoBridge.open(IoBridge.java:482) ... 51 more 2022-12-29 13:09:24.734 KASPRESSO E An error while making screenshot occurred: java.io.FileNotFoundException: /storage/emulated/0/Documents/screenshots/com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest/counter/AllureSupportTest_step_5.png: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileInputStream.<init>(FileInputStream.java:159) at com.kaspersky.components.alluresupport.files.AttachToReportKt.attachScreenshotToAllureReport(AttachToReport.kt:22) at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor$intercept$1.invoke(ScreenshotStepInterceptor.kt:21) at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor$intercept$1.invoke(ScreenshotStepInterceptor.kt:21) at com.kaspersky.kaspresso.device.screenshots.ScreenshotsImpl.doTakeAndApply(ScreenshotsImpl.kt:43) at com.kaspersky.kaspresso.device.screenshots.ScreenshotsImpl.takeAndApply(ScreenshotsImpl.kt:31) at com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor.intercept(ScreenshotStepInterceptor.kt:21) 2022-12-29 13:09:24.734 AllureLifecycle E Could not update step: step with uuid 855be471-7140-4ab6-85fd-c315329314d5 not found 2022-12-29 13:09:24.734 AllureLifecycle E Could not stop step: step with uuid 855be471-7140-4ab6-85fd-c315329314d5 not found

Failed video recording start

2022-12-29 13:23:56.489 TestRunner E java.io.IOException: No such file or directory at java.io.UnixFileSystem.createFileExclusively0(Native Method) at java.io.UnixFileSystem.createFileExclusively(UnixFileSystem.java:317) at java.io.File.createNewFile(File.java:1008) at com.kaspersky.kaspresso.internal.extensions.other.FileExtKt.createFileIfNeeded(FileExt.kt:31) at com.kaspersky.kaspresso.files.resources.impl.DefaultResourceFilesProvider.provideVideoFile(DefaultResourceFilesProvider.kt:47) at com.kaspersky.kaspresso.files.resources.ResourceFilesProvider$DefaultImpls.provideVideoFile$default(ResourceFilesProvider.kt:11) at com.kaspersky.kaspresso.device.video.VideosImpl.record(VideosImpl.kt:15) at com.kaspersky.components.alluresupport.interceptors.testrun.VideoRecordingTestInterceptor.onTestStarted(VideoRecordingTestInterceptor.kt:13) at com.kaspersky.kaspresso.interceptors.watcher.testcase.impl.composite.TestRunCompositeWatcherInterceptor.onTestStarted(TestRunCompositeWatcherInterceptor.kt:37) at com.kaspersky.kaspresso.testcases.core.TestRunner.run(TestRunner.kt:47) at com.kaspersky.kaspresso.testcases.core.sections.MainTestSection.run(MainTestSection.kt:29) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run(BaseTestCase.kt:92) at com.kaspersky.kaspresso.testcases.api.testcase.BaseTestCase.run$default(BaseTestCase.kt:87) at com.kaspersky.kaspresso.alluresupport.sample.AllureSupportTest.counter(AllureSupportTest.kt:22) at java.lang.reflect.Method.invoke(Native Method) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) at org.junit.runners.ParentRunner.run(ParentRunner.java:413) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:67) at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:58) at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:446) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2189)

Expected behavior
Video and logcat output is successfully generated.

Smartphone (please complete the following information):

  • Device: Android arm64-v8a emulator with Google APIs
  • OS: Android 10
@maciejpigulski maciejpigulski added the bug Something isn't working label Dec 29, 2022
@Nikitae57
Copy link
Collaborator

Hi. @maciejpigulski! Please, could you check whether the AVD you're using has Documents folder? There're some AVDs which which come without it. If this is the case, I recommend you using another AVD

@Nikitae57
Copy link
Collaborator

And another thing that could help us - image name
image

@maciejpigulski
Copy link
Author

maciejpigulski commented Dec 29, 2022

Hey @Nikitae57, well, mine definetely doesn't have Documents, I thought that this should be handled by mkdirs?

emulator64_arm64:/ $ cd sdcard
emulator64_arm64:/sdcard $ ls -al
total 56
drwxrwx--x 13 root sdcard_rw 4096 2022-12-22 13:03 .
drwx--x--x  3 root sdcard_rw 4096 2022-12-23 09:55 ..
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Alarms
drwxrwx--x  5 root sdcard_rw 4096 2022-12-22 12:31 Android
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 DCIM
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Download
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Movies
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Music
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Notifications
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Pictures
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Podcasts
drwxrwx--x  2 root sdcard_rw 4096 2022-12-21 13:48 Ringtones
drwxrwx--x  6 root sdcard_rw 4096 2022-12-29 13:23 googletest

Emulator details

image

@maciejpigulski
Copy link
Author

maciejpigulski commented Dec 29, 2022

I have also tried creating the exact same device you have, like a brand new AVD and it has no Documents as well, surprisingly... Only difference is the architecture x86 vs arm64-v8a

image

@Nikitae57
Copy link
Collaborator

I see. It can't be handled by mkdirs because your app probably doesn't have device wide rights to manage files. I think, we could try to fallback to Downloads folder (I think it's present on the wider range of devices). Until then, please, use another AVD

@maciejpigulski
Copy link
Author

I have found an AVD that works for me because it has a Documents folder created. I've used this:

avdmanager create avd --force -n Pixel_3a --abi 'google_apis/arm64-v8a' --package 'system-images;android-32;google_apis;arm64-v8a' --device 'pixel_3a'

Thanks for the support!

@maciejpigulski
Copy link
Author

What is still confusing though is that in my app run with Kaspresso and allure logcat is still in /data/user/0/ but video is saved to Documents on sdcard

2022-12-29 14:52:51.098 KASPRESSO                       I  ---------------------------------------------------------------------------
2022-12-29 14:52:51.098 KASPRESSO                       I  TEST PASSED
2022-12-29 14:52:51.098 KASPRESSO                       I  ---------------------------------------------------------------------------
2022-12-29 14:52:51.125 KASPRESSO                       I  Dump logcat buffer to /data/user/0/com.myapp.benchmark/files/logcat/com.myapp.benchmark.baseline.BaselineProfileGenerator/appWalkThrough/TestLogcat.txt: logcat -b default -d -t "12-29 14:51:54.660" -s "KASPRESSO","KASPRESSO_TEST"
2022-12-29 14:52:51.230 KASPRESSO                       I  Stopping video recording
2022-12-29 14:52:51.241 KASPRESSO                       I  Waiting for 2000 ms
2022-12-29 14:52:53.253 KASPRESSO                       I  Video saved to /storage/emulated/0/Documents/video/com.myapp.benchmark.baseline.BaselineProfileGenerator/appWalkThrough/Video_BaselineProfileGenerator.mp4

I can workaround it but this is odd.

@Nikitae57
Copy link
Collaborator

Could you post code with kaspresso builder? /data/user/0/ seem like odd path. I want to make sure you don't have any workaround that change artifacts paths

@maciejpigulski
Copy link
Author

Builder is very simple

class BaselineProfileGenerator : TestCase(
    kaspressoBuilder = Kaspresso.Builder.withForcedAllureSupport()
)

Also ViewHierarchy seems to be dumped to this /data/ folder.

12-29 18:13:28.101 12720 12760 I KASPRESSO: View hierarchy dumped to /data/user/0/com.myapp.benchmark/files/view_hierarchy/com.myapp.benchmark.baseline.BaselineProfileGenerator/appWalkThrough/ViewHierarchy_MainTestSection_failure_UnfoundedUiObjectException.xml
12-29 18:13:28.101 12720 12760 I KASPRESSO: ---------------------------------------------------------------------------
12-29 18:13:28.103 12720 12760 I KASPRESSO: AFTER TEST SECTION
12-29 18:13:28.103 12720 12760 I KASPRESSO: ---------------------------------------------------------------------------
12-29 18:13:28.104 12720 12760 I KASPRESSO: ---------------------------------------------------------------------------
12-29 18:13:28.104 12720 12760 I KASPRESSO: TEST FAILED
12-29 18:13:28.104 12720 12760 I KASPRESSO: ---------------------------------------------------------------------------
12-29 18:13:28.156 12720 12760 I KASPRESSO: Dump logcat buffer to /data/user/0/com.myapp.benchmark/files/logcat/com.myapp.benchmark.baseline.BaselineProfileGenerator/appWalkThrough/TestLogcat.txt: logcat -b default -d -t "12-29 18:08:35.508" -s "KASPRESSO","KASPRESSO_TEST"

@Nikitae57
Copy link
Collaborator

Hello again, @maciejpigulski! Could you check out the latest kaspresso release (1.5.2.) and tell the results, please? I remind you that you'll need to use KaspressoRunner (replace androidx.test.runner.AndroidJUnitRunner with com.kaspersky.kaspresso.runner.KaspressoRunner) and use withForcedAllureSupport() builder

@vrnvorona
Copy link
Contributor

vrnvorona commented May 31, 2023

Hello again, @maciejpigulski! Could you check out the latest kaspresso release (1.5.2.) and tell the results, please? I remind you that you'll need to use KaspressoRunner (replace androidx.test.runner.AndroidJUnitRunner with com.kaspersky.kaspresso.runner.KaspressoRunner) and use withForcedAllureSupport() builder

Not sure if related, but with 1.5.2 we have another problem:
#518

On the video recording note I have similar error in 1.5.2 with KaspressoRunner and forcedAllureSupport. I also manually created /sdcard/Documents but it didn't help because there are no permissions to write to /sdcard

Can't we write video to the same folder as allure-results?

P.S. i use system-images/android-33/google_apis/arm64-v8a/

@Nikitae57
Copy link
Collaborator

Unfortunately, recording video into private directory (where allure places it's report) is not an option. Have you tried to add runtime permission rules to your test?

@vrnvorona
Copy link
Contributor

Unfortunately, recording video into private directory (where allure places it's report) is not an option. Have you tried to add runtime permission rules to your test?

Yes. Issue lies in emulators which don't have screenrecord, so my files are empty unless I use real device.

@Nikitae57
Copy link
Collaborator

That's one of a strange emulator. Guess google just can't publish new image without bugs. I'll ask out my collegues with ARM macs and try to find the working image

@cee-dee
Copy link

cee-dee commented Jul 5, 2023

I've just migrated to Kaspresso 1.5.2 and have the problem with 0-byte videos on Mac M1 machines when using forcedAllureSupport -- without forcedAllureSupport I even don't get any allure-results. Even the sample test for allure support coming with the Kaspresso repo doesn't generate any allure-results.

Would be great to at least have some workaround until the issue is solved in Kaspresso itself.

@cee-dee
Copy link

cee-dee commented Jul 7, 2023

For anyone interested, video recording works for me using this:

echo no | avdmanager create avd --name "$AVD_NAME" --package "$SYSTEM_IMAGE_ID" --device "$ANDROID_DEVICE" --force
emulator -avd "$AVD_NAME" -no-snapshot -wipe-data -noaudio -no-boot-anim -accel auto -verbose -show-kernel

with

export AVD_NAME="uitest-avd"
export SYSTEM_IMAGE_ID="system-images;android-33;google_apis;arm64-v8a"
export ANDROID_DEVICE="pixel_5"

I fetched the emulator using

sdkmanager "emulator" --channel=3 --verbose

from the Canary channel as of version 33.1.14.

Any rules to grant permissions have been removed since they don't provide any benefit but just let the test crash.

@maciejpigulski
Copy link
Author

Hello again, @maciejpigulski! Could you check out the latest kaspresso release (1.5.2.) and tell the results, please? I remind you that you'll need to use KaspressoRunner (replace androidx.test.runner.AndroidJUnitRunner with com.kaspersky.kaspresso.runner.KaspressoRunner) and use withForcedAllureSupport() builder

Hello @vrnvorona, I didn't notice the message. I just did a test run on latest main from Kaspresso repository and I am still getting errors with writing files. I didn't get into the details of the errors as I do not have time at the moment.

By the look of the logcat it seems mostly the same thing (apart from the codec error). Attached the log.

test_run.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants