mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
Ladybird: Add Espresso test on Android to verify we can load our views
The simple smoke test makes sure that we can boot up an android emulator with our package in it, and that the WebView is visible on boot. More tests to come with more features :^)
This commit is contained in:
parent
f87388ff72
commit
52d6c49ccc
2 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,40 @@
|
|||
package org.serenityos.ladybird
|
||||
|
||||
import androidx.test.ext.junit.rules.activityScenarioRule
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.withId
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
import org.junit.Rule
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class SmokeTest {
|
||||
|
||||
@get:Rule
|
||||
var activityScenarioRule = activityScenarioRule<LadybirdActivity>()
|
||||
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("org.serenityos.ladybird", appContext.packageName)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun loadWebView() {
|
||||
// We can actually load a web view, and it is visible
|
||||
onView(withId(R.id.web_view)).check(matches(isDisplayed()))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue