Skip to content

Commit

Permalink
Make tests less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
joffrey-bion committed Jan 3, 2025
1 parent 9c59d51 commit 2f13633
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/jvmTest/kotlin/IntegrationTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.testcontainers.junit.jupiter.Testcontainers
import org.testcontainers.utility.*
import kotlin.test.*
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.seconds

@Testcontainers
class IntegrationTests {
Expand Down Expand Up @@ -80,10 +81,10 @@ class IntegrationTests {

assertTrue(chrome.targets().any { it.id == targetId }, "the new target should be listed")

val nodeId = withTimeoutOrNull(1000) {
val nodeId = withTimeoutOrNull(5.seconds) {
page.dom.awaitNodeBySelector("form[action='/search']")
}
assertNotNull(nodeId)
assertNotNull(nodeId, "timed out while waiting for DOM node with attribute: form[action='/search']")

val getOuterHTMLResponse = page.dom.getOuterHTML(GetOuterHTMLRequest(nodeId = nodeId))
assertTrue(getOuterHTMLResponse.outerHTML.contains("<input name=\"source\""))
Expand Down Expand Up @@ -123,10 +124,10 @@ class IntegrationTests {
page.goto("http://www.google.com")
assertEquals("Google", page.target.getTargetInfo().targetInfo.title)

val nodeId = withTimeoutOrNull(1000) {
val nodeId = withTimeoutOrNull(5.seconds) {
page.dom.awaitNodeBySelector("form[action='/search']")
}
assertNotNull(nodeId)
assertNotNull(nodeId, "timed out while waiting for DOM node with attribute: form[action='/search']")
}
}
}
Expand Down

0 comments on commit 2f13633

Please sign in to comment.