-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
Kaspresso allure support final
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
plugins { | ||
id("convention.android-library") | ||
id("convention.publication-android-lib") | ||
} | ||
|
||
publish { | ||
artifactId.set("kaspresso-allure-support") | ||
} | ||
|
||
dependencies { | ||
implementation(projects.kaspresso) | ||
|
||
implementation(libs.kotlinStdlib) | ||
implementation(libs.truth) | ||
implementation(libs.testCore) | ||
implementation(libs.uiAutomator) | ||
implementation(libs.runner) | ||
|
||
implementation(libs.bundles.allure) | ||
|
||
testImplementation(libs.junit) | ||
|
||
androidTestImplementation(libs.espressoCore) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<manifest package="com.kaspersky.components.alluresupport" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.kaspersky.components.alluresupport | ||
|
||
import com.kaspersky.components.alluresupport.interceptors.step.AllureMapperStepInterceptor | ||
import com.kaspersky.components.alluresupport.interceptors.step.ScreenshotStepInterceptor | ||
import com.kaspersky.components.alluresupport.interceptors.testrun.DumpLogcatTestInterceptor | ||
import com.kaspersky.components.alluresupport.interceptors.testrun.DumpViewsTestInterceptor | ||
import com.kaspersky.components.alluresupport.interceptors.testrun.ScreenshotTestInterceptor | ||
import com.kaspersky.components.alluresupport.interceptors.testrun.VideoRecordingTestInterceptor | ||
import com.kaspersky.kaspresso.kaspresso.Kaspresso | ||
|
||
fun Kaspresso.Builder.Companion.withAllureSupport( | ||
customize: Kaspresso.Builder.() -> Unit = {} | ||
): Kaspresso.Builder = simple(customize).addAllureSupport() | ||
|
||
fun Kaspresso.Builder.addAllureSupport(): Kaspresso.Builder = apply { | ||
stepWatcherInterceptors.addAll( | ||
listOf( | ||
ScreenshotStepInterceptor(screenshots), | ||
AllureMapperStepInterceptor() | ||
) | ||
) | ||
testRunWatcherInterceptors.addAll( | ||
listOf( | ||
ScreenshotTestInterceptor(screenshots), | ||
VideoRecordingTestInterceptor(videos), | ||
DumpLogcatTestInterceptor(logcatDumper), | ||
DumpViewsTestInterceptor(viewHierarchyDumper) | ||
) | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.kaspersky.components.alluresupport.files | ||
|
||
import io.qameta.allure.android.AllureAndroidLifecycle | ||
import java.io.File | ||
|
||
fun File.attachLogcatToAllureReport(): Unit = AllureAndroidLifecycle.addAttachment( | ||
name = name, | ||
stream = this.inputStream(), | ||
type = "text/plain", | ||
fileExtension = "txt", | ||
) | ||
|
||
fun File.attachViewHierarchyToAllureReport(): Unit = AllureAndroidLifecycle.addAttachment( | ||
name = name, | ||
stream = this.inputStream(), | ||
type = "text/xml", | ||
fileExtension = "xml", | ||
) | ||
|
||
fun File.attachScreenshotToAllureReport(): Unit = AllureAndroidLifecycle.addAttachment( | ||
name = name, | ||
stream = this.inputStream(), | ||
type = "image/png", | ||
fileExtension = "png", | ||
) | ||
|
||
fun File.attachVideoToAllureReport(): Unit = AllureAndroidLifecycle.addAttachment( | ||
name = name, | ||
stream = this.inputStream(), | ||
type = "video/mp4", | ||
fileExtension = "mp4", | ||
) |