Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielJette committed Aug 15, 2022
1 parent c3efabb commit 6ee8649
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 38 deletions.
68 changes: 30 additions & 38 deletions Ext/JUnit5/src/main/java/dev/testify/junit5/ScreenshotExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
*/
package dev.testify.junit5

import android.app.Activity
import dev.testify.EspressoActions
import dev.testify.ScreenshotCore
import dev.testify.ScreenshotTestInterface
import dev.testify.ViewModification
import dev.testify.ViewProvider
import dev.testify.internal.TestifyConfigurationInterface
import org.junit.jupiter.api.extension.AfterEachCallback
import org.junit.jupiter.api.extension.AfterTestExecutionCallback
import org.junit.jupiter.api.extension.BeforeEachCallback
Expand All @@ -47,12 +40,11 @@ open class ScreenshotExtension :
AfterEachCallback,
BeforeEachCallback,
AfterTestExecutionCallback,
TestExecutionExceptionHandler,
ScreenshotTestInterface {
TestExecutionExceptionHandler {

private val core = ScreenshotCore<Activity>(
rootViewId = 0,
)
// private val core = ScreenshotCore<Activity>(
// rootViewId = 0,
// )

private val ExtensionContext.testMethodName: String
get() {
Expand All @@ -72,7 +64,7 @@ open class ScreenshotExtension :
val methodAnnotations = testMethod.annotations.asList()
val name = context.testMethodName

core.apply(name, context.testClass?.get()!!, methodAnnotations)
// core.apply(name, context.testClass?.get()!!, methodAnnotations)
}

/**
Expand All @@ -82,14 +74,14 @@ open class ScreenshotExtension :
*/
override fun beforeEach(context: ExtensionContext) {
initialize(context)
core.evaluateBeforeEach()
// core.evaluateBeforeEach()
}

/**
* Handle the supplied throwable.
*/
override fun handleTestExecutionException(context: ExtensionContext, throwable: Throwable) {
core.handleTestException(throwable)
// core.handleTestException(throwable)
}

/**
Expand All @@ -99,7 +91,7 @@ open class ScreenshotExtension :
* @param context – the current extension context
*/
override fun afterEach(context: ExtensionContext) {
core.evaluateAfterEach()
// core.evaluateAfterEach()
}

/**
Expand All @@ -109,28 +101,28 @@ open class ScreenshotExtension :
* @param context – the current extension context
*/
override fun afterTestExecution(context: ExtensionContext) {
core.evaluateAfterTestExecution()
// core.evaluateAfterTestExecution()
}

override var screenshotViewProvider: ViewProvider? = null // TODO: Not yet implemented

override fun configure(configure: TestifyConfigurationInterface.() -> Unit): ScreenshotTestInterface {
TODO("Not yet implemented")
}

override fun setEspressoActions(espressoActions: EspressoActions): ScreenshotTestInterface {
TODO("Not yet implemented")
}

override fun setViewModifications(viewModification: ViewModification): ScreenshotTestInterface {
TODO("Not yet implemented")
}

override fun assertSame() {
core.assertSame()
}

override fun isRecordMode(): Boolean {
TODO("Not yet implemented")
}
// override var screenshotViewProvider: ViewProvider? = null // TODO: Not yet implemented
//
// override fun configure(configure: TestifyConfigurationInterface.() -> Unit): ScreenshotTestInterface {
// TODO("Not yet implemented")
// }
//
// override fun setEspressoActions(espressoActions: EspressoActions): ScreenshotTestInterface {
// TODO("Not yet implemented")
// }
//
// override fun setViewModifications(viewModification: ViewModification): ScreenshotTestInterface {
// TODO("Not yet implemented")
// }
//
// override fun assertSame() {
// core.assertSame()
// }
//
// override fun isRecordMode(): Boolean {
// TODO("Not yet implemented")
// }
}
1 change: 1 addition & 0 deletions Sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ dependencies {
androidTestImplementation project(":ComposeExtensions")
androidTestImplementation project(":FullscreenCaptureMethod")
androidTestImplementation project(":Accessibility")
androidTestImplementation project(":JUnit5")
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ buildscript {
'dokka' : '1.4.32', // https://github.com/Kotlin/dokka/releases
'gson' : '2.9.0', // https://github.com/google/gson/releases
'guava' : '30.0-android', // https://github.com/google/guava/releases
'junit5' : '5.8.2', // https://junit.org/junit5/docs/current/release-notes/index.html
'kotlin' : '1.5.31', // https://kotlinlang.org/
'kotlinx' : '1.5.1', // https://github.com/Kotlin/kotlinx.coroutines/releases
'ktlint' : '0.45.2', // https://github.com/pinterest/ktlint
Expand Down

0 comments on commit 6ee8649

Please sign in to comment.