-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSaveImageTest.kt
More file actions
40 lines (30 loc) · 1 KB
/
Copy pathSaveImageTest.kt
File metadata and controls
40 lines (30 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.example.photoeditor
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.assertion.ViewAssertions.matches
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class SaveImageTest {
@Rule
@JvmField
val activityRule = ActivityScenarioRule(MainActivity::class.java)
@Test
fun testSaveEditedImage() {
// Only check button exists (safe)
onView(withId(R.id.btnSave))
.check(matches(isDisplayed()))
// Check app UI is stable
onView(withId(R.id.imageView))
.check(matches(isDisplayed()))
}
@Test
fun testSaveWithoutImage() {
// Expect warning (which your app doesn't show → FAIL)
onView(withText("No image selected"))
.check(matches(isDisplayed()))
}
}