Skip to content

Commit 0612519

Browse files
madhurgupta10domdomegg
authored andcommitted
Add sign-up button instrumentation test (#2687)
1 parent fc7399c commit 0612519

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package fr.free.nrw.commons
2+
3+
import androidx.test.espresso.Espresso
4+
import androidx.test.espresso.action.ViewActions.click
5+
import androidx.test.espresso.assertion.ViewAssertions
6+
import androidx.test.espresso.intent.Intents
7+
import androidx.test.espresso.intent.Intents.intended
8+
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
9+
import androidx.test.espresso.matcher.ViewMatchers
10+
import androidx.test.espresso.matcher.ViewMatchers.withId
11+
import androidx.test.filters.LargeTest
12+
import androidx.test.rule.ActivityTestRule
13+
import androidx.test.runner.AndroidJUnit4
14+
import fr.free.nrw.commons.auth.LoginActivity
15+
import fr.free.nrw.commons.auth.SignupActivity
16+
import org.junit.Rule
17+
import org.junit.Test
18+
import org.junit.runner.RunWith
19+
20+
@LargeTest
21+
@RunWith(AndroidJUnit4::class)
22+
class LoginActivityTest {
23+
@get:Rule
24+
var activity: ActivityTestRule<*> = ActivityTestRule(LoginActivity::class.java)
25+
26+
@Test
27+
fun isSignUpButtonWorks() {
28+
// Clicks the SignUp Button
29+
Intents.init()
30+
Espresso.onView(withId(R.id.signupButton))
31+
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
32+
.perform(click())
33+
intended(hasComponent(SignupActivity::class.java.name))
34+
Intents.release()
35+
}
36+
}

0 commit comments

Comments
 (0)