Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ To use kdriver, add the following to your `build.gradle.kts`:

```kotlin
dependencies {
implementation("dev.kdriver:core:0.5.4")
implementation("dev.kdriver:core:0.5.5")
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

allprojects {
group = "dev.kdriver"
version = "0.5.4"
version = "0.5.5"
project.ext.set("url", "https://github.com/cdpdriver/kdriver")
project.ext.set("license.name", "Apache 2.0")
project.ext.set("license.url", "https://www.apache.org/licenses/LICENSE-2.0.txt")
Expand Down
2 changes: 2 additions & 0 deletions core/src/commonMain/kotlin/dev/kdriver/core/browser/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
val browserConnectionTimeout: Long = Defaults.BROWSER_CONNECTION_TIMEOUT,
val browserConnectionMaxTries: Int = Defaults.BROWSER_CONNECTION_MAX_TRIES,
val autoDiscoverTargets: Boolean = Defaults.AUTO_DISCOVER_TARGETS,
val debugStringLimit: Int = Defaults.DEBUG_STRING_LIMIT,

Check warning on line 21 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Config.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Config.kt#L21

The property debugStringLimit is missing documentation. (detekt.UndocumentedPublicProperty)
) {

private val logger = KtorSimpleLogger("Config")
Expand Down Expand Up @@ -118,6 +119,7 @@
const val BROWSER_CONNECTION_TIMEOUT: Long = 500
const val BROWSER_CONNECTION_MAX_TRIES: Int = 60
const val AUTO_DISCOVER_TARGETS: Boolean = true
const val DEBUG_STRING_LIMIT: Int = 128

Check warning on line 122 in core/src/commonMain/kotlin/dev/kdriver/core/browser/Config.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/Config.kt#L122

The property DEBUG_STRING_LIMIT is missing documentation. (detekt.UndocumentedPublicProperty)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
var browserConnectionTimeout: Long = Defaults.BROWSER_CONNECTION_TIMEOUT
var browserConnectionMaxTries: Int = Defaults.BROWSER_CONNECTION_MAX_TRIES
var autoDiscoverTargets: Boolean = Defaults.AUTO_DISCOVER_TARGETS
var debugStringLimit: Int = Defaults.DEBUG_STRING_LIMIT

Check warning on line 33 in core/src/commonMain/kotlin/dev/kdriver/core/browser/ConfigBuilder.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/browser/ConfigBuilder.kt#L33

The property debugStringLimit is missing documentation. (detekt.UndocumentedPublicProperty)

/**
* Builds the Config instance with the configured parameters.
Expand All @@ -49,6 +50,7 @@
browserConnectionTimeout = browserConnectionTimeout,
browserConnectionMaxTries = browserConnectionMaxTries,
autoDiscoverTargets = autoDiscoverTargets,
debugStringLimit = debugStringLimit
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import dev.kdriver.cdp.*
import dev.kdriver.cdp.domain.*
import dev.kdriver.core.browser.Browser
import dev.kdriver.core.browser.Config.Defaults
import dev.kdriver.core.browser.WebSocketInfo
import io.ktor.client.*
import io.ktor.client.plugins.websocket.*
Expand Down Expand Up @@ -33,7 +34,6 @@
) : OwnedConnection {

private val logger = KtorSimpleLogger("Connection")
private val debugStringLimit = 64

private val client = HttpClient(getWebSocketClientEngine()) {
install(WebSockets)
Expand Down Expand Up @@ -82,7 +82,7 @@
try {
frame as? Frame.Text ?: continue
val text = frame.readText()
logger.debug("WS < CDP: ${text.take(debugStringLimit)}")
logger.debug("WS < CDP: ${text.take(owner?.config?.debugStringLimit ?: Defaults.DEBUG_STRING_LIMIT)}")

Check warning on line 85 in core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt

View check run for this annotation

codefactor.io / CodeFactor

core/src/commonMain/kotlin/dev/kdriver/core/connection/DefaultConnection.kt#L85

Line detected, which is longer than the defined maximum line length in the code style. (detekt.MaxLineLength)
val received = Serialization.json.decodeFromString<Message>(text)
allMessages.emit(received)
} catch (e: Exception) {
Expand All @@ -108,7 +108,7 @@
val requestId = currentIdMutex.withLock { currentId++ }
val jsonString = Serialization.json.encodeToString(Request(requestId, method, parameter))
wsSession?.send(jsonString)
logger.debug("WS > CDP: ${jsonString.take(debugStringLimit)}")
logger.debug("WS > CDP: ${jsonString.take(owner?.config?.debugStringLimit ?: Defaults.DEBUG_STRING_LIMIT)}")

val result = responses.first { it.id == requestId }
result.error?.throwAsException(method)
Expand Down
2 changes: 1 addition & 1 deletion docs/home/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ To install, add the dependency to your `build.gradle.kts`:

```kotlin
dependencies {
implementation("dev.kdriver:core:0.5.4")
implementation("dev.kdriver:core:0.5.5")
}
```

Expand Down