Merge branch 'edit_fix' into 'master'
Add tests See merge request pixeldroid/PixelDroid!330
This commit is contained in:
commit
1cf85fc624
@ -11,10 +11,10 @@ import androidx.core.net.toUri
|
|||||||
import androidx.test.core.app.ActivityScenario
|
import androidx.test.core.app.ActivityScenario
|
||||||
import androidx.test.espresso.Espresso.onView
|
import androidx.test.espresso.Espresso.onView
|
||||||
import androidx.test.espresso.action.ViewActions.click
|
import androidx.test.espresso.action.ViewActions.click
|
||||||
|
import androidx.test.espresso.action.ViewActions.typeText
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
|
||||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
import androidx.test.espresso.matcher.ViewMatchers.*
|
||||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import androidx.test.platform.app.InstrumentationRegistry
|
import androidx.test.platform.app.InstrumentationRegistry
|
||||||
import androidx.test.rule.GrantPermissionRule
|
import androidx.test.rule.GrantPermissionRule
|
||||||
@ -154,6 +154,42 @@ class PostCreationActivityTest {
|
|||||||
onView(withId(R.id.addPhotoSquare)).check(matches(isDisplayed()))
|
onView(withId(R.id.addPhotoSquare)).check(matches(isDisplayed()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type media description and check it's saved
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
fun mediaDescription() {
|
||||||
|
waitForView(R.id.postTextInputLayout)
|
||||||
|
|
||||||
|
|
||||||
|
fun typeDescription(text: String) {
|
||||||
|
onView(withId(R.id.tv_caption)).perform(click())
|
||||||
|
|
||||||
|
waitForView(R.id.editTextMediaDescription)
|
||||||
|
|
||||||
|
onView(withId(R.id.editTextMediaDescription)).perform(typeText(text))
|
||||||
|
onView(withId(R.id.imageDescriptionButton)).perform(click())
|
||||||
|
|
||||||
|
onView(withId(R.id.tv_caption)).check(matches(withText(text)))
|
||||||
|
}
|
||||||
|
|
||||||
|
val typedText1 = "Testi testo description"
|
||||||
|
typeDescription(typedText1)
|
||||||
|
|
||||||
|
onView(withId(R.id.btn_next)).perform(click())
|
||||||
|
|
||||||
|
val typedText2 = "Description 2"
|
||||||
|
typeDescription(typedText2)
|
||||||
|
|
||||||
|
onView(withId(R.id.btn_previous)).perform(click())
|
||||||
|
|
||||||
|
onView(withId(R.id.tv_caption)).check(matches(withText(typedText1)))
|
||||||
|
|
||||||
|
onView(withId(R.id.btn_next)).perform(click())
|
||||||
|
|
||||||
|
onView(withId(R.id.tv_caption)).check(matches(withText(typedText2)))
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes sure the [com.h.pixeldroid.postCreation.camera.CameraActivity] is launched
|
* Makes sure the [com.h.pixeldroid.postCreation.camera.CameraActivity] is launched
|
||||||
* when the add image button is pressed
|
* when the add image button is pressed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user