Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Merge pull request #148 from MaximeZmt/jwen/single-player-lyrics-game
Browse files Browse the repository at this point in the history
Jwen/single player lyrics game basic version
  • Loading branch information
jiabaow authored Apr 3, 2022
2 parents 724dddb + 4b24ba5 commit 72e57ff
Show file tree
Hide file tree
Showing 22 changed files with 650 additions and 441 deletions.
47 changes: 0 additions & 47 deletions app/src/androidTest/java/ch/sdp/vibester/GenreTemporaryTest.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package ch.sdp.vibester

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.Intents.intended
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import ch.sdp.vibester.activity.TypingGameActivity
import org.junit.After
import org.junit.Before
import org.junit.Rule
Expand All @@ -19,7 +15,6 @@ import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class GenreTemporaryTest {
private val sleepTime: Long = 2500

@get:Rule
val testRule = ActivityScenarioRule(
Expand All @@ -46,46 +41,4 @@ class GenreTemporaryTest {
onView(withId(R.id.billieEilishButton)).check(matches(isDisplayed()))
}

@Test
fun rockButtonClick() {
onView(withId(R.id.rockButton)).perform(click())
Thread.sleep(sleepTime)
intended(hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun topButtonClick() {
onView(withId(R.id.topTracksButton)).perform(click())
Thread.sleep(sleepTime)

intended(hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun kpopButtonClick() {
onView(withId(R.id.kpopButton)).perform(click())
Thread.sleep(sleepTime)
intended(hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun billieEilishButtonClick() {
onView(withId(R.id.billieEilishButton)).perform(click())
Thread.sleep(sleepTime)
intended(hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun imagineDragonsButtonClick() {
onView(withId(R.id.imagDragonsButton)).perform(click())
Thread.sleep(sleepTime)
intended(hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun btsButtonClick() {
onView(withId(R.id.btsButton)).perform(click())
Thread.sleep(sleepTime)
intended(hasComponent(TypingGameActivity::class.java.name))
}
}
78 changes: 78 additions & 0 deletions app/src/androidTest/java/ch/sdp/vibester/GenreToLyricsTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package ch.sdp.vibester

import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import ch.sdp.vibester.activity.LyricsBelongGameActivity
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class GenreToLyricsTest {

private val sleepTime: Long = 2500

@get:Rule
val testRule = ActivityScenarioRule(
GenreToLyrics::class.java
)

@Before
fun setUp() {
Intents.init()
}

@After
fun clean() {
Intents.release()
}

@Test
fun rockButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.rockButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(LyricsBelongGameActivity::class.java.name))
}

@Test
fun topButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.topTracksButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(LyricsBelongGameActivity::class.java.name))
}

@Test
fun kpopButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.kpopButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(LyricsBelongGameActivity::class.java.name))
}

@Test
fun billieEilishButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.billieEilishButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(LyricsBelongGameActivity::class.java.name))
}

@Test
fun imagineDragonsButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.imagDragonsButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(LyricsBelongGameActivity::class.java.name))
}

@Test
fun btsButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.btsButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(LyricsBelongGameActivity::class.java.name))
}
}
77 changes: 77 additions & 0 deletions app/src/androidTest/java/ch/sdp/vibester/GenreToTypingTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package ch.sdp.vibester

import androidx.test.espresso.Espresso
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import ch.sdp.vibester.activity.TypingGameActivity
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class GenreToTypingTest {
private val sleepTime: Long = 2500

@get:Rule
val testRule = ActivityScenarioRule(
GenreToTyping::class.java
)

@Before
fun setUp() {
Intents.init()
}

@After
fun clean() {
Intents.release()
}

@Test
fun rockButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.rockButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun topButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.topTracksButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun kpopButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.kpopButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun billieEilishButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.billieEilishButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun imagineDragonsButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.imagDragonsButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(TypingGameActivity::class.java.name))
}

@Test
fun btsButtonClick() {
Espresso.onView(ViewMatchers.withId(R.id.btsButton)).perform(ViewActions.click())
Thread.sleep(sleepTime)
Intents.intended(IntentMatchers.hasComponent(TypingGameActivity::class.java.name))
}
}
79 changes: 0 additions & 79 deletions app/src/androidTest/java/ch/sdp/vibester/LyricTemporaryTest.kt

This file was deleted.

Loading

0 comments on commit 72e57ff

Please sign in to comment.