-
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
1 parent
fb0740a
commit d762b19
Showing
8 changed files
with
166 additions
and
34 deletions.
There are no files selected for viewing
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
53 changes: 53 additions & 0 deletions
53
...dTest/java/com/zavierdev/cinemacatalogue/ui/detailcinema/movie/DetailMovieActivityTest.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.zavierdev.cinemacatalogue.ui.detailcinema.movie | ||
|
||
import android.content.Intent | ||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.IdlingRegistry | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.rule.ActivityTestRule | ||
import com.zavierdev.cinemacatalogue.R | ||
import com.zavierdev.cinemacatalogue.constant.CinemaType | ||
import com.zavierdev.cinemacatalogue.ui.detailcinema.tvshow.DetailTvShowActivity | ||
import com.zavierdev.cinemacatalogue.utils.EspressoIdlingResource | ||
import org.junit.After | ||
import org.junit.Assert.* | ||
import org.junit.Before | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.JUnit4 | ||
|
||
@RunWith(JUnit4::class) | ||
class DetailMovieActivityTest { | ||
private lateinit var detailMovieActivityRule: ActivityTestRule<DetailMovieActivity> | ||
|
||
@Before | ||
fun setup() { | ||
detailMovieActivityRule = ActivityTestRule<DetailMovieActivity>( | ||
DetailMovieActivity::class.java, | ||
true, // initialTouchMode | ||
false // launchActivity. False to customize the intent | ||
); | ||
IdlingRegistry.getInstance().register(EspressoIdlingResource.espressoTestIdlingResource) | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.espressoTestIdlingResource) | ||
} | ||
|
||
private fun startActivityWithIntent(id: Int) { | ||
val intent = Intent() | ||
intent.putExtra(DetailMovieActivity.EXTRA_ID, id) | ||
detailMovieActivityRule.launchActivity(intent) | ||
} | ||
|
||
@Test | ||
fun moviesRenderedDataCheck() { | ||
startActivityWithIntent(728754) | ||
Espresso.onView(ViewMatchers.withId(R.id.img_poster)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
Espresso.onView(ViewMatchers.withId(R.id.tv_title)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...est/java/com/zavierdev/cinemacatalogue/ui/detailcinema/tvshow/DetailTvShowActivityTest.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,47 @@ | ||
package com.zavierdev.cinemacatalogue.ui.detailcinema.tvshow | ||
|
||
import android.content.Intent | ||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.IdlingRegistry | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.rule.ActivityTestRule | ||
import com.zavierdev.cinemacatalogue.R | ||
import com.zavierdev.cinemacatalogue.utils.EspressoIdlingResource | ||
import org.junit.After | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class DetailTvShowActivityTest { | ||
private lateinit var detailTvShowActivityRule: ActivityTestRule<DetailTvShowActivity> | ||
|
||
@Before | ||
fun setup() { | ||
detailTvShowActivityRule = ActivityTestRule<DetailTvShowActivity>( | ||
DetailTvShowActivity::class.java, | ||
true, // initialTouchMode | ||
false // launchActivity. False to customize the intent | ||
); | ||
IdlingRegistry.getInstance().register(EspressoIdlingResource.espressoTestIdlingResource) | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.espressoTestIdlingResource) | ||
} | ||
|
||
private fun startActivityWithIntent(id: Int) { | ||
val intent = Intent() | ||
intent.putExtra(DetailTvShowActivity.EXTRA_ID, id) | ||
detailTvShowActivityRule.launchActivity(intent); | ||
} | ||
|
||
@Test | ||
fun tvShowsRenderedDataCheck() { | ||
startActivityWithIntent(99048) | ||
Espresso.onView(ViewMatchers.withId(R.id.img_poster)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
Espresso.onView(ViewMatchers.withId(R.id.tv_title)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
} | ||
} |
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
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
Oops, something went wrong.