Skip to content

Commit 0b6a1ad

Browse files
domdomeggmaskaravivek
authored andcommitted
Add WelcomeActivityTest (#2636)
* Add WelcomeActivityTest * Convert WelcomeActivityTest to Kotlin
1 parent 38dc0c3 commit 0b6a1ad

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package fr.free.nrw.commons
2+
3+
import androidx.test.espresso.Espresso.onView
4+
import androidx.test.espresso.assertion.ViewAssertions.matches
5+
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
6+
import androidx.test.espresso.matcher.ViewMatchers.withId
7+
import androidx.test.filters.LargeTest
8+
import androidx.test.rule.ActivityTestRule
9+
import androidx.test.runner.AndroidJUnit4
10+
import fr.free.nrw.commons.utils.ConfigUtils
11+
import org.hamcrest.core.IsNot.not
12+
import org.junit.Rule
13+
import org.junit.Test
14+
import org.junit.runner.RunWith
15+
16+
@LargeTest
17+
@RunWith(AndroidJUnit4::class)
18+
class WelcomeActivityTest {
19+
@get:Rule
20+
var activityRule: ActivityTestRule<*> = ActivityTestRule(WelcomeActivity::class.java)
21+
22+
@Test
23+
fun ifBetaShowsSkipButton() {
24+
if (ConfigUtils.isBetaFlavour()) {
25+
onView(withId(R.id.finishTutorialButton))
26+
.check(matches(isDisplayed()))
27+
}
28+
}
29+
30+
@Test
31+
fun ifProdHidesSkipButton() {
32+
if (!ConfigUtils.isBetaFlavour()) {
33+
onView(withId(R.id.finishTutorialButton))
34+
.check(matches(not(isDisplayed())))
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)