Skip to content

Commit

Permalink
Merge pull request #39 from detlog/feature/MULI-13
Browse files Browse the repository at this point in the history
Feature/muli 13
  • Loading branch information
tom-reith authored May 6, 2021
2 parents f0236f1 + 9672431 commit d0b3085
Show file tree
Hide file tree
Showing 11 changed files with 426 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AddGameRoundActivityTest{
fun test_isActivityInView() {
onView(ViewMatchers.withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())


onView(withId(R.id.update_game_score))
Expand All @@ -44,7 +44,7 @@ class AddGameRoundActivityTest{
fun test_isButtonPlayer1Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_1))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -54,7 +54,7 @@ class AddGameRoundActivityTest{
fun test_isButtonPlayer2Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_2))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -64,7 +64,7 @@ class AddGameRoundActivityTest{
fun test_isButtonPlayer3Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_3))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -74,7 +74,7 @@ class AddGameRoundActivityTest{
fun test_isButtonPlayer4Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_4))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -85,7 +85,7 @@ class AddGameRoundActivityTest{
fun is_tvPlayer1Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.tvPlayerOne))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -95,7 +95,7 @@ class AddGameRoundActivityTest{
fun is_tvPlayer2Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.tvPlayerTwo))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -105,7 +105,7 @@ class AddGameRoundActivityTest{
fun is_tvPlayer3Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.tvPlayerThree))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -115,7 +115,7 @@ class AddGameRoundActivityTest{
fun is_tvPlayer4Displayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.tvPlayerFour))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand Down Expand Up @@ -143,7 +143,7 @@ class AddGameRoundActivityTest{


onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())



Expand All @@ -159,7 +159,7 @@ class AddGameRoundActivityTest{
fun is_isButtonEndroundDisplayed() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.endround))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
Expand All @@ -171,7 +171,7 @@ class AddGameRoundActivityTest{
fun test_button1ClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_1)).perform(ViewActions.click())
onView(withId(R.id.button_player_1))
Expand All @@ -182,7 +182,7 @@ class AddGameRoundActivityTest{
fun test_button2ClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_2)).perform(ViewActions.click())
onView(withId(R.id.button_player_2))
Expand All @@ -193,7 +193,7 @@ class AddGameRoundActivityTest{
fun test_button3ClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_3)).perform(ViewActions.click())
onView(withId(R.id.button_player_3))
Expand All @@ -204,7 +204,7 @@ class AddGameRoundActivityTest{
fun test_button4ClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_4)).perform(ViewActions.click())
onView(withId(R.id.button_player_4))
Expand All @@ -216,7 +216,7 @@ class AddGameRoundActivityTest{
fun test_button1LongClickableAndIncrementFail() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_1)).perform(ViewActions.longClick())
onView(withId(R.id.button_player_1))
Expand All @@ -227,7 +227,7 @@ class AddGameRoundActivityTest{
fun test_button2LongClickableAndIncrementFail() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_2)).perform(ViewActions.longClick())
onView(withId(R.id.button_player_2))
Expand All @@ -238,7 +238,7 @@ class AddGameRoundActivityTest{
fun test_button3LongClickableAndIncrementFail() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_3)).perform(ViewActions.longClick())
onView(withId(R.id.button_player_3))
Expand All @@ -249,7 +249,7 @@ class AddGameRoundActivityTest{
fun test_button4LongClickableAndIncrementFail() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_4)).perform(ViewActions.longClick())
onView(withId(R.id.button_player_4))
Expand All @@ -263,7 +263,7 @@ class AddGameRoundActivityTest{
fun test_button1LongClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_1)).perform(ViewActions.click())
onView(withId(R.id.button_player_1)).perform(ViewActions.click())
Expand All @@ -276,7 +276,7 @@ class AddGameRoundActivityTest{
fun test_button2LongClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_2)).perform(ViewActions.click())
onView(withId(R.id.button_player_2)).perform(ViewActions.click())
Expand All @@ -289,7 +289,7 @@ class AddGameRoundActivityTest{
fun test_button3LongClickableAndIncrement() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_3)).perform(ViewActions.click())
onView(withId(R.id.button_player_3)).perform(ViewActions.click())
Expand All @@ -302,7 +302,7 @@ class AddGameRoundActivityTest{
fun test_button4LongClickableAndIncrement() {
onView(ViewMatchers.withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_4)).perform(ViewActions.click())
onView(withId(R.id.button_player_4)).perform(ViewActions.click())
Expand All @@ -315,7 +315,7 @@ class AddGameRoundActivityTest{
fun is_tvPlayerRightScore() {
onView(withId(R.id.StartNewGameActivityButton)).perform(ViewActions.click())
onView(withId(R.id.StartNewGameButton)).perform(ViewActions.click())
onView(withId(R.id.EndGameButton)).perform(ViewActions.click())
onView(withId(R.id.AddRoundButton)).perform(ViewActions.click())

onView(withId(R.id.button_player_1)).perform(ViewActions.longClick())
onView(withId(R.id.button_player_3)).perform(ViewActions.click())
Expand Down Expand Up @@ -354,7 +354,7 @@ class AddGameRoundActivityTest{
val new_round = RoundObject(scoreToSavePlayer1,scoreToSavePlayer2,scoreToSavePlayer3,scoreToSavePlayer4,0,0)
repo.enterNewRound(new_round, newGameId)

val cursor = repo.getCursor2(newGameId)
val cursor = repo.getCursorRounds(newGameId)
if (cursor.moveToFirst()) {
scorePlayer1 = cursor.getInt(cursor.getColumnIndex(ROUND_COLUMN_PLAYER1_TICKS))
scorePlayer2 = cursor.getInt(cursor.getColumnIndex(ROUND_COLUMN_PLAYER2_TICKS))
Expand All @@ -370,24 +370,26 @@ class AddGameRoundActivityTest{
}


//helper function for comparing 2 strings from textboxes
fun getText(matcher: ViewInteraction): String {
var text = String()
matcher.perform(object : ViewAction {
override fun getConstraints(): Matcher<View> {
return ViewMatchers.isAssignableFrom(TextView::class.java)
}
companion object {
//helper function for comparing 2 strings from textboxes
fun getText(matcher: ViewInteraction): String {
var text = String()
matcher.perform(object : ViewAction {
override fun getConstraints(): Matcher<View> {
return ViewMatchers.isAssignableFrom(TextView::class.java)
}

override fun getDescription(): String {
return "Text of the view"
}
override fun getDescription(): String {
return "Text of the view"
}

override fun perform(uiController: UiController, view: View) {
val tv = view as TextView
text = tv.text.toString()
}
})
override fun perform(uiController: UiController, view: View) {
val tv = view as TextView
text = tv.text.toString()
}
})

return text
return text
}
}
}
}
Loading

0 comments on commit d0b3085

Please sign in to comment.