Skip to content

Commit

Permalink
Fix Compose recommended config
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tiurin committed Jul 25, 2024
1 parent 4229a99 commit 7d19d4e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ kotlin.mpp.enableCInteropCommonization=true

GROUP=com.atiurin
POM_ARTIFACT_ID=ultron
VERSION_NAME=2.5.0-alpha09
VERSION_NAME=2.5.0-alpha10
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ abstract class BaseTest {
@JvmStatic
fun config() {
UltronConfig.applyRecommended()
UltronAllureConfig.applyRecommended()
UltronComposeConfig.applyRecommended()
UltronAllureConfig.applyRecommended()
UltronAllureConfig.setAllureResultsDirectory(Environment.DIRECTORY_DOWNLOADS)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ object UltronConfig {
private fun modify() {
Espresso.ACTION_TIMEOUT = params.operationTimeoutMs
Espresso.ASSERTION_TIMEOUT = params.operationTimeoutMs
UiAutomator.OPERATION_TIMEOUT = params.operationTimeoutMs
UltronCommonConfig.addListener(LogLifecycleListener())
if (params.logToFile) {
UltronLog.addLogger(UltronLog.fileLogger)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,21 @@ object UltronComposeConfig {

fun applyRecommended() {
params = UltronComposeConfigParams()
modify()
}

fun apply(block: UltronComposeConfigParams.() -> Unit) {
params.block()
modify()
}

private fun modify(){
UltronCommonConfig.addListener(LogLifecycleListener())
if (UltronCommonConfig.logToFile) {
UltronLog.addLogger(UltronLog.fileLogger)
} else {
UltronLog.removeLogger(UltronLog.fileLogger.id)
}
UltronLog.info("UltronComposeConfig applied with params $params}")
}
}

0 comments on commit 7d19d4e

Please sign in to comment.