Skip to content

Commit

Permalink
ISSUE-404: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikitae57 authored and eakurnikov committed Dec 2, 2022
1 parent f130cdb commit 764dc6a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.kaspersky.kaspresso.files.dirs

import android.annotation.SuppressLint
import android.app.Instrumentation
import android.content.Context
import android.os.Build
import android.os.Environment
import com.kaspersky.kaspresso.instrumental.InstrumentalDependencyProvider
Expand All @@ -21,7 +20,8 @@ open class DefaultDirsProvider(
val dir = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS).resolve(dest)
} else {
instrumentation.targetContext.applicationContext.getDir(dest.canonicalPath, Context.MODE_WORLD_READABLE)
Environment.getExternalStorageDirectory().resolve(dest)
// instrumentation.targetContext.applicationContext.getDir(dest.canonicalPath, Context.MODE_WORLD_READABLE)
}

return dir.createDirIfNeeded()
Expand All @@ -37,7 +37,7 @@ open class DefaultDirsProvider(
@Suppress("SameParameterValue")
private fun clearDir(dest: File, inclusive: Boolean) {
clearDirManually(dest, inclusive)
if (shouldClearDirThroughShell(dest)) {
if (dest.exists() && dest.list()?.size == 0 && shouldClearDirThroughShell(dest)) {
clearDirThroughShell(dest, inclusive)
}
}
Expand Down
3 changes: 1 addition & 2 deletions wiki/07_DocLoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ class ScreenshotSampleTest : DocLocScreenshotTestCase(

There is one parameter passed in the base constructor:
- locales - comma-separated string with locales to run test with.
Captured screenshots will be available in the device's storage at the path "/sdcard/screenshots/" for pre Android 10 devices and /data/user/0/<your_app_dir>/files/screenshots otherwise.
Please, notice that your package (and screenshots on android 10+) under /data folder is cleared if you use android test orchestrator with **clearPackageData** flag.
Captured screenshots will be available in the device's storage at the path "/sdcard/Documents/screenshots/" for API 19+ devices and /sdcard/screenshots otherwise.

For full example, check the [ScreenshotSampleTest](../samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/ScreenshotSampleTest.kt).

Expand Down
7 changes: 4 additions & 3 deletions wiki/09_Kaspresso-Allure.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ This dir should be moved from the device to the host machine which will do gener

Assuming your package is com.example
```
adb exec-out run-as com.example sh -c 'cd /data/data/com.example/files && tar cf - allure-results' > ~/allure-results.tar
adb exec-out sh -c "cd /sdcard/Documents && tar cf - allure-results" > ~/allure-results.tar
```
`exec-out` runs passed command and returns result as a file which we save by `> allure-results.tar` in the end

Expand All @@ -100,7 +100,7 @@ emulator-5554 device
```
Select the needed device and call:
```
adb -s emulator-5554 exec-out run-as com.example sh -c 'cd /data/data/com.example/files && tar cf - allure-results' > ~/allure-results.tar
adb -s emulator-5554 exec-out sh -c "cd /sdcard/Documents && tar cf - allure-results" > ~/allure-results.tar
```
And that's it, the **allure-results** archive with all the test resources is now at your home directory.
Expand All @@ -112,7 +112,8 @@ brew install allure
```
Now we are ready to generate and watch the report, just call:
```
allure serve /Users/username/Desktop/allure-results
tar -xvf allure-results.tar
allure serve ~/allure-results
```
Next, the Allure server generates the html-page representing the report and puts it to temp dir in your system. You will see the report opening in the new tab in your browser (the tab is opening automatically).
Expand Down

0 comments on commit 764dc6a

Please sign in to comment.