Tests for the profile page's textViews

This commit is contained in:
mjaillot 2020-03-05 23:10:33 +01:00
parent 5f3abfa4dc
commit 9bcf715a88
2 changed files with 29 additions and 3 deletions

View File

@ -1,4 +1,33 @@
package com.h.pixeldroid
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.hamcrest.Matchers.not
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class ProfileTest {
@get:Rule
var activityRule: ActivityScenarioRule<MainActivity>
= ActivityScenarioRule(MainActivity::class.java)
@Test
fun testFollowersTextView() {
onView(withId(R.id.button)).perform(click())
onView(withId(R.id.followers)).check(matches(withText("Followers")))
}
@Test
fun testAccountNameTextView() {
onView(withId(R.id.button)).perform(click())
onView(withId(R.id.accountName)).check(matches(not(withText("No Name"))))
}
}

View File

@ -33,9 +33,6 @@ class ProfileActivity : AppCompatActivity() {
if(statuses.isNullOrEmpty()) {
// ImageView : profile picture
val profilePicture = findViewById<ImageView>(R.id.profilePicture)
// TextView : description / bio
val description = findViewById<TextView>(R.id.description)
description.setText("")