Skip to content

Commit

Permalink
Merge pull request #281 from eakurnikov/kaspresso_allure_support
Browse files Browse the repository at this point in the history
Kaspresso allure support final
  • Loading branch information
eakurnikov authored Sep 30, 2021
2 parents eae1ecc + 365b05d commit ac01363
Show file tree
Hide file tree
Showing 119 changed files with 2,148 additions and 678 deletions.
6 changes: 0 additions & 6 deletions allure-model/README.md

This file was deleted.

8 changes: 0 additions & 8 deletions allure-model/build.gradle.kts

This file was deleted.

12 changes: 0 additions & 12 deletions allure-model/src/main/kotlin/io/qameta/allure/model/Attachment.kt

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions allure-model/src/main/kotlin/io/qameta/allure/model/Label.kt

This file was deleted.

12 changes: 0 additions & 12 deletions allure-model/src/main/kotlin/io/qameta/allure/model/Link.kt

This file was deleted.

10 changes: 0 additions & 10 deletions allure-model/src/main/kotlin/io/qameta/allure/model/Parameter.kt

This file was deleted.

16 changes: 0 additions & 16 deletions allure-model/src/main/kotlin/io/qameta/allure/model/Stage.kt

This file was deleted.

26 changes: 0 additions & 26 deletions allure-model/src/main/kotlin/io/qameta/allure/model/Status.kt

This file was deleted.

This file was deleted.

This file was deleted.

22 changes: 0 additions & 22 deletions allure-model/src/main/kotlin/io/qameta/allure/model/TestResult.kt

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.

24 changes: 24 additions & 0 deletions allure-support/build.gradle.kts
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)
}
1 change: 1 addition & 0 deletions allure-support/src/main/AndroidManifest.xml
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",
)
Loading

0 comments on commit ac01363

Please sign in to comment.