Skip to content

Instantly share code, notes, and snippets.

Avatar

Egor Kurnikov eakurnikov

View GitHub Profile
@eakurnikov
eakurnikov / ui_test_videos.kt
Last active Mar 11, 2021
Тест метод должен быть помечен аннотацией @RecordVideo.
View ui_test_videos.kt
class VideoTestInterceptor(
private val zenVideoRecorder: ZenVideoRecorder
) : TestRunWatcherInterceptor {
override fun onTestStarted(testInfo: TestInfo) {
zenVideoRecorder.start("Video_${testInfo.testName}")
}
override fun onTestFinished(testInfo: TestInfo, success: Boolean) {
zenVideoRecorder.stop()?.attachVideoToReport()
View ui_test_results_files.kt
class TestResultsFilesProvider(
private val testResultsDirsProvider: TestResultsDirsProvider,
private val addTimestamps: Boolean
) {
private val logcatRootDir = File("logcat")
private val screenshotsRootDir = File("screenshots")
private val videoRootDir = File("video")
private val viewHierarchy = File("view_hierarchy")
fun provideLogcatFile(tag: String): File =
View gist:2ead814a9eb74b755f9146c86e0f6961
//buildSrc
class PullResultsFromDevicesTask extends DefaultTask {
private Property<TestsRunConfig> config = project.objects.property(TestsRunConfig.class)
private DirectoryProperty testCasesDir = project.objects.directoryProperty()
@Input
Property<TestsRunConfig> getTestsRunConfig() {
return config
}
@eakurnikov
eakurnikov / Interceptors.kt
Created Jun 16, 2020
Kaspresso-Allure mapping interceptors
View Interceptors.kt
class AllureMapperStepInterceptor : StepWatcherInterceptor {
private var allureStep: Step? = null
override fun interceptBefore(stepInfo: StepInfo) {
allureStep = Step().apply { stepStart(stepInfo.description) }
}
override fun interceptAfterWithSuccess(stepInfo: StepInfo) {
allureStep?.stepCompleted()