Skip to content

Commit

Permalink
add reload to party E2E
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssaruth committed Apr 21, 2024
1 parent 9ab702f commit 59b29bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/kotlin/dartzee/e2e/TestPartyModeE2E.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import dartzee.drtTrebleFive
import dartzee.drtTrebleNineteen
import dartzee.drtTrebleSeven
import dartzee.drtTrebleTwenty
import dartzee.game.GameLauncher
import dartzee.getRows
import dartzee.helper.preparePlayers
import dartzee.screen.DartsApp
Expand All @@ -35,6 +36,7 @@ import io.kotest.matchers.collections.shouldContainExactly
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import javax.swing.JButton
import javax.swing.SwingUtilities
import org.junit.jupiter.api.Test

class TestPartyModeE2E : AbstractE2ETest() {
Expand Down Expand Up @@ -89,6 +91,14 @@ class TestPartyModeE2E : AbstractE2ETest() {
.getRows()
.map { it.filterIndexed { index: Int, _ -> index != 1 } }
.shouldContainExactly(arrayOf(1, "Alice", 1L, 12), arrayOf(2, "Bob", 1L, 14))

// Reload the game
SwingUtilities.invokeAndWait { GameLauncher().loadAndDisplayGame(gamePanel.getGameId()) }

val loadedWindow = ScreenCache.getDartsGameScreen(gamePanel.getGameId())!!
loadedWindow.shouldBeVisible()
loadedWindow.getScorer("Alice").lblResult.text shouldBe "12 Darts"
loadedWindow.getScorer("Bob").lblResult.text shouldBe "14 Darts"
}

private fun launchApp(): DartsApp {
Expand Down

0 comments on commit 59b29bc

Please sign in to comment.