Skip to content

Commit 9e65617

Browse files
authored
Use other screenshot mechanism (#277)
* Use other screenshot mechanism * Accept new screenshots
1 parent 50fa209 commit 9e65617

File tree

202 files changed

+6
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+6
-5
lines changed

MPChartExample/src/androidTest/java/com/xxmassdeveloper/mpchartexample/StartTest.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.xxmassdeveloper.mpchartexample
22

3-
import androidx.test.core.app.takeScreenshot
43
import androidx.test.core.graphics.writeToTestStorage
54
import androidx.test.espresso.Espresso
65
import androidx.test.espresso.Espresso.onData
@@ -16,7 +15,6 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
1615
import androidx.test.espresso.screenshot.captureToBitmap
1716
import androidx.test.ext.junit.rules.activityScenarioRule
1817
import androidx.test.ext.junit.runners.AndroidJUnit4
19-
import androidx.test.platform.app.InstrumentationRegistry
2018
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
2119
import com.xxmassdeveloper.mpchartexample.notimportant.DemoBase.Companion.optionMenus
2220
import com.xxmassdeveloper.mpchartexample.notimportant.MainActivity
@@ -70,7 +68,8 @@ class StartTest {
7068
.atPosition(index).perform(click())
7169

7270
Intents.intended(hasComponent(it.name))
73-
takeScreenshot()
71+
onView(ViewMatchers.isRoot())
72+
.captureToBitmap()
7473
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${index}-${it.simpleName}-${contentItem.name}-1SampleClick")
7574

7675
optionMenu = ""
@@ -85,7 +84,8 @@ class StartTest {
8584
Espresso.pressBack()
8685
} catch (e: Exception) {
8786
Timber.e(optionMenu + e.message!!)
88-
takeScreenshot()
87+
onView(ViewMatchers.isRoot())
88+
.captureToBitmap()
8989
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${index}-${it.simpleName}-Error")
9090
}
9191
}
@@ -95,7 +95,8 @@ class StartTest {
9595
private fun screenshotOfOptionMenu(simpleName: String, menuTitle: String) {
9696
onView(withText(menuTitle)).perform(click())
9797
Timber.d("screenshotOfOptionMenu ${menuTitle}-${simpleName}")
98-
takeScreenshot()
98+
onView(ViewMatchers.isRoot())
99+
.captureToBitmap()
99100
.writeToTestStorage("${simpleName}-2menu-click-$menuTitle")
100101
}
101102

0 commit comments

Comments
 (0)