-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Moritz Lindner
committed
Jan 22, 2024
1 parent
ceee469
commit e9ae13a
Showing
74 changed files
with
1,749 additions
and
92 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
app/src/androidTest/java/com/boozeblaster/minigames/common/HighestBidderTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.boozeblaster.minigames.common | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import com.boozeblaster.models.Player | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class HighestBidderTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
private val highestBidder = HighestBidder(pointsToGet = 4) | ||
private val player = Player(name = "John") | ||
|
||
@Test | ||
fun testHighestBidderShowsBid() { | ||
testComposableRule.setContent { | ||
highestBidder.DisplayContent(player = player, callback = { /*TODO*/ }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Current Bid:").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun testHighestBidderShowsCorrectPoints() { | ||
testComposableRule.setContent { | ||
highestBidder.DisplayContent(player = player, callback = { /*TODO*/ }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("4 points can be snatched!").assertIsDisplayed() | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
app/src/androidTest/java/com/boozeblaster/minigames/common/NeverHaveIEverTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.boozeblaster.minigames.common | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import com.boozeblaster.models.Player | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class NeverHaveIEverTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
private val neverHaveIEver = NeverHaveIEver(statement = "Smoked a Beer") | ||
private val player = Player(name = "John") | ||
|
||
@Test | ||
fun testNeverHaveIEverDisplaysText() { | ||
testComposableRule.setContent { | ||
neverHaveIEver.DisplayContent(player = player, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Never Have I Ever").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun testNeverHaveIEverDisplaysCorrectStatement() { | ||
testComposableRule.setContent { | ||
neverHaveIEver.DisplayContent(player = player, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Smoked a Beer").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun testNeverHaveIEverAsksForConfirmation() { | ||
testComposableRule.setContent { | ||
neverHaveIEver.DisplayContent(player = player, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Check").performClick() | ||
testComposableRule.onNodeWithText("Confirm").assertIsDisplayed() | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
app/src/androidTest/java/com/boozeblaster/minigames/common/WhoInThisRoomTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package com.boozeblaster.minigames.common | ||
|
||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.assertIsNotEnabled | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class WhoInThisRoomTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
private val whoInThisRoom = WhoInThisRoom(statement = "Has the most rizz") | ||
|
||
@Test | ||
fun testWhoInThisRoomDisplaysStatement() { | ||
testComposableRule.setContent { | ||
whoInThisRoom.DisplayContent(player = null, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Has the most rizz").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun testWhoInThisRoomDisplaysCorrectText() { | ||
testComposableRule.setContent { | ||
whoInThisRoom.DisplayContent(player = null, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Who In This Room?").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun testWhoInThisRoomCanPickPlayers() { | ||
testComposableRule.setContent { | ||
whoInThisRoom.DisplayContent(player = null, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Select Players").assertIsDisplayed() | ||
} | ||
|
||
@Test | ||
fun testWhoInThisRoomCannotContinueWithoutPickingPlayers() { | ||
testComposableRule.setContent { | ||
whoInThisRoom.DisplayContent(player = null, callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText("Continue").assertIsNotEnabled() | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
app/src/androidTest/java/com/boozeblaster/minigames/individual/FactOrFictionTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.boozeblaster.minigames.individual | ||
|
||
import androidx.compose.ui.test.assertHasClickAction | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import com.boozeblaster.minigames.individual.FactOrFiction | ||
import com.boozeblaster.models.Player | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class FactOrFictionTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
@Test | ||
fun testFactOrFictionDisplay() { | ||
val question = "Is the sky blue?" | ||
val isCorrect = true | ||
|
||
testComposableRule.setContent { | ||
FactOrFiction(question = question, isCorrect = isCorrect) | ||
.DisplayContent(player = Player(name = "TestPlayer"), callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText(question).assertIsDisplayed() | ||
|
||
testComposableRule.onNodeWithText("Wrong").assertIsDisplayed() | ||
.assertHasClickAction() | ||
.performClick() | ||
|
||
testComposableRule.onNodeWithText("Right").assertIsDisplayed() | ||
.assertHasClickAction() | ||
.performClick() | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
app/src/androidTest/java/com/boozeblaster/minigames/individual/GuessTheLyricsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package com.boozeblaster.minigames.individual | ||
|
||
import androidx.compose.ui.test.assertHasClickAction | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.assertTextEquals | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import com.boozeblaster.enums.ButtonType | ||
import com.boozeblaster.enums.Genre | ||
import com.boozeblaster.minigames.individual.GuessTheLyrics | ||
import com.boozeblaster.models.Player | ||
import com.boozeblaster.models.Song | ||
import com.boozeblaster.utils.GenrePicker | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class GuessTheLyricsTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
@Test | ||
fun testGuessTheLyricsDisplay() { | ||
val song = Song("TestSong", "TestArtist", genre = Genre.ROCK) | ||
val lyrics = "These are the lyrics to be displayed." | ||
val lyricsCompletion = "These are the lyrics to be displayed." | ||
|
||
val guessTheLyrics = GuessTheLyrics(song = song, lyrics = lyrics, lyricsCompletion = lyricsCompletion) | ||
|
||
testComposableRule.setContent { | ||
guessTheLyrics.DisplayContent(player = Player(name = "TestPlayer"), callback = { }, versusPlayer = null) | ||
} | ||
|
||
testComposableRule.onNodeWithText(song.getSongName()).assertTextEquals(song.getSongName()) | ||
|
||
testComposableRule.onNodeWithText(song.getArtistName()).assertTextEquals(song.getArtistName()) | ||
|
||
testComposableRule.onNodeWithText(lyrics).assertTextEquals(lyrics) | ||
|
||
testComposableRule.onNodeWithText("Show Solution").assertIsDisplayed().performClick() | ||
|
||
testComposableRule.onNodeWithText("Correct").assertIsDisplayed() | ||
.assertHasClickAction() | ||
|
||
testComposableRule.onNodeWithText("Partially Correct").assertIsDisplayed() | ||
.assertHasClickAction() | ||
|
||
testComposableRule.onNodeWithText("Wrong").assertIsDisplayed() | ||
.assertHasClickAction() | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
app/src/androidTest/java/com/boozeblaster/minigames/individual/GuessTheSongTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package com.boozeblaster.minigames.individual | ||
|
||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.test.assertHasClickAction | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.assertTextEquals | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import com.boozeblaster.enums.ButtonType | ||
import com.boozeblaster.minigames.individual.GuessTheSong | ||
import com.boozeblaster.models.Player | ||
import com.boozeblaster.models.Song | ||
import com.boozeblaster.utils.GenrePicker | ||
import com.boozeblaster.R | ||
import com.boozeblaster.enums.Genre | ||
import kotlinx.coroutines.delay | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class GuessTheSongTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
@Test | ||
fun testGuessTheSongDisplay() { | ||
val song = Song("TestSong", "TestArtist", genre = Genre.ROCK) | ||
val resid = R.raw.waka_waka | ||
val duration = 1000L | ||
|
||
val guessTheSong = GuessTheSong(song = song, resid = resid, duration = duration) | ||
|
||
testComposableRule.setContent { | ||
guessTheSong.DisplayContent(player = Player(name = "TestPlayer"), callback = { }, versusPlayer = null) | ||
LaunchedEffect(Unit) { | ||
delay(2000) | ||
testComposableRule.onNodeWithText("Show Solution").assertIsDisplayed().performClick() | ||
|
||
testComposableRule.onNodeWithText(song.getSongName()).assertTextEquals(song.getSongName()) | ||
|
||
testComposableRule.onNodeWithText(song.getArtistName()).assertTextEquals(song.getArtistName()) | ||
|
||
testComposableRule.onNodeWithText("Got Both").assertIsDisplayed() | ||
.assertHasClickAction() | ||
|
||
testComposableRule.onNodeWithText("One Correct").assertIsDisplayed() | ||
.assertHasClickAction() | ||
|
||
testComposableRule.onNodeWithText("Wrong").assertIsDisplayed() | ||
.assertHasClickAction() | ||
} | ||
} | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/androidTest/java/com/boozeblaster/minigames/individual/GuessTheThemeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.boozeblaster.minigames.individual | ||
|
||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.ui.test.assertHasClickAction | ||
import androidx.compose.ui.test.assertIsDisplayed | ||
import androidx.compose.ui.test.assertTextEquals | ||
import androidx.compose.ui.test.junit4.createComposeRule | ||
import androidx.compose.ui.test.onNodeWithText | ||
import androidx.compose.ui.test.performClick | ||
import com.boozeblaster.enums.ButtonType | ||
import com.boozeblaster.minigames.individual.GuessTheTheme | ||
import com.boozeblaster.models.Player | ||
import com.boozeblaster.R | ||
import kotlinx.coroutines.delay | ||
import org.junit.Rule | ||
import org.junit.Test | ||
|
||
class GuessTheThemeTest { | ||
|
||
@get:Rule | ||
val testComposableRule = createComposeRule() | ||
|
||
@Test | ||
fun testGuessTheThemeDisplay() { | ||
val name = "TestTheme" | ||
val resid = R.raw.ghostbusters | ||
val duration = 1000L | ||
|
||
val guessTheTheme = GuessTheTheme(name = name, resid = resid, duration = duration) | ||
|
||
testComposableRule.setContent { | ||
guessTheTheme.DisplayContent( | ||
player = Player(name = "TestPlayer"), | ||
callback = { }, | ||
versusPlayer = null | ||
) | ||
LaunchedEffect(Unit) { | ||
delay(2000) | ||
testComposableRule.onNodeWithText(name).assertTextEquals(name) | ||
|
||
testComposableRule.onNodeWithText("Show Solution").assertIsDisplayed().performClick() | ||
|
||
testComposableRule.onNodeWithText("Correct").assertIsDisplayed() | ||
.assertHasClickAction() | ||
|
||
testComposableRule.onNodeWithText("Almost").assertIsDisplayed() | ||
.assertHasClickAction() | ||
|
||
testComposableRule.onNodeWithText("Wrong").assertIsDisplayed() | ||
.assertHasClickAction() | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.