-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from KasperskyLab/issue-96/Doc_loc_tests_dont…
…_take_fail_screenshots Issue 96/doc loc tests dont take fail screenshots
- Loading branch information
Showing
6 changed files
with
69 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...sso/interceptors/watcher/testcase/impl/screenshot/ScreenshotFailStepWatcherInterceptor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.kaspersky.kaspresso.interceptors.watcher.testcase.impl.screenshot | ||
|
||
import com.kaspersky.kaspresso.device.screenshots.Screenshots | ||
import com.kaspersky.kaspresso.interceptors.watcher.testcase.StepWatcherInterceptor | ||
import com.kaspersky.kaspresso.testcases.models.info.StepInfo | ||
|
||
class ScreenshotFailStepWatcherInterceptor( | ||
private val screenshots: Screenshots | ||
) : StepWatcherInterceptor { | ||
/** | ||
* Takes a screenshot of the screen on which the step failed. | ||
* | ||
* @param stepInfo the step info to log. | ||
* @param error the error occurred to use in screenshots name. | ||
*/ | ||
override fun interceptAfterWithError(stepInfo: StepInfo, error: Throwable) { | ||
screenshots.take("${makeTag(stepInfo)}_failure_${error.javaClass.simpleName}") | ||
} | ||
|
||
private fun makeTag(stepInfo: StepInfo): String = "${stepInfo.testClassName}_step_${stepInfo.ordinal}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters