Skip to content

Commit ba1e0af

Browse files
authored
Merge pull request #263 from AppDevNext/Espresso-3.6.1
Espresso 3.6.1
2 parents 9e65617 + 5bc159e commit ba1e0af

File tree

221 files changed

+18
-24
lines changed

Some content is hidden

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

221 files changed

+18
-24
lines changed

MPChartExample/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ dependencies {
4242
implementation 'com.google.android.material:material:1.12.0'
4343
implementation project(':MPChartLib')
4444

45-
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.5"
45+
androidTestImplementation "androidx.test.ext:junit-ktx:1.2.1"
4646
androidTestImplementation "com.github.AppDevNext.Logcat:LogcatCoreLib:3.2"
4747
androidTestUtil "androidx.test.services:test-services:1.5.0"
48-
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
49-
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
48+
androidTestImplementation "androidx.test.espresso:espresso-core:3.6.1"
49+
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.6.1'
5050
}

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

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

3+
import android.graphics.Bitmap
34
import android.view.View
45
import android.widget.SeekBar
56
import androidx.test.core.graphics.writeToTestStorage
67
import androidx.test.espresso.Espresso.onView
78
import androidx.test.espresso.UiController
89
import androidx.test.espresso.ViewAction
10+
import androidx.test.espresso.action.ViewActions.captureToBitmap
911
import androidx.test.espresso.matcher.ViewMatchers
1012
import androidx.test.espresso.matcher.ViewMatchers.withId
11-
import androidx.test.espresso.screenshot.captureToBitmap
1213
import androidx.test.ext.junit.rules.activityScenarioRule
1314
import androidx.test.ext.junit.runners.AndroidJUnit4
1415
import org.hamcrest.Matcher
@@ -30,21 +31,18 @@ class PieTest {
3031
@Test
3132
fun piePolyline() {
3233
onView(ViewMatchers.isRoot())
33-
.captureToBitmap()
34-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
34+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
3535

3636
for (x in 10..50 step 10) {
3737
onView(withId(R.id.seekBarX)).perform(setProgress(x))
3838
onView(ViewMatchers.isRoot())
39-
.captureToBitmap()
40-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}1-${x}")
39+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}1-${x}")})
4140
}
4241

4342
for (x in 50..200 step 50) {
4443
onView(withId(R.id.seekBarY)).perform(setProgress(x))
4544
onView(ViewMatchers.isRoot())
46-
.captureToBitmap()
47-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}2-${x}")
45+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}2-${x}") })
4846
}
4947
}
5048

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

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

3+
import android.graphics.Bitmap
34
import androidx.test.core.graphics.writeToTestStorage
45
import androidx.test.espresso.Espresso
56
import androidx.test.espresso.Espresso.onData
67
import androidx.test.espresso.Espresso.onView
78
import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu
9+
import androidx.test.espresso.action.ViewActions.captureToBitmap
810
import androidx.test.espresso.action.ViewActions.click
911
import androidx.test.espresso.intent.Intents
1012
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent
1113
import androidx.test.espresso.matcher.ViewMatchers
1214
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
1315
import androidx.test.espresso.matcher.ViewMatchers.withId
1416
import androidx.test.espresso.matcher.ViewMatchers.withText
15-
import androidx.test.espresso.screenshot.captureToBitmap
1617
import androidx.test.ext.junit.rules.activityScenarioRule
1718
import androidx.test.ext.junit.runners.AndroidJUnit4
1819
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
@@ -53,8 +54,7 @@ class StartTest {
5354
@Test
5455
fun smokeTestStart() {
5556
onView(ViewMatchers.isRoot())
56-
.captureToBitmap()
57-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
57+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
5858

5959
var optionMenu = ""
6060
// iterate samples
@@ -69,8 +69,7 @@ class StartTest {
6969

7070
Intents.intended(hasComponent(it.name))
7171
onView(ViewMatchers.isRoot())
72-
.captureToBitmap()
73-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${index}-${it.simpleName}-${contentItem.name}-1SampleClick")
72+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${index}-${it.simpleName}-${contentItem.name}-1SampleClick") })
7473

7574
optionMenu = ""
7675
optionMenus.filter { plain -> Character.isDigit(plain.first()) }.forEach { filteredTitle ->
@@ -85,8 +84,7 @@ class StartTest {
8584
} catch (e: Exception) {
8685
Timber.e(optionMenu + e.message!!)
8786
onView(ViewMatchers.isRoot())
88-
.captureToBitmap()
89-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${index}-${it.simpleName}-Error")
87+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${index}-${it.simpleName}-Error") })
9088
}
9189
}
9290
}
@@ -96,8 +94,7 @@ class StartTest {
9694
onView(withText(menuTitle)).perform(click())
9795
Timber.d("screenshotOfOptionMenu ${menuTitle}-${simpleName}")
9896
onView(ViewMatchers.isRoot())
99-
.captureToBitmap()
100-
.writeToTestStorage("${simpleName}-2menu-click-$menuTitle")
97+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${simpleName}-2menu-click-$menuTitle") })
10198
}
10299

103100
}

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

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

3+
import android.graphics.Bitmap
34
import androidx.test.core.graphics.writeToTestStorage
45
import androidx.test.espresso.Espresso.onView
6+
import androidx.test.espresso.action.ViewActions.captureToBitmap
57
import androidx.test.espresso.action.ViewActions.swipeLeft
68
import androidx.test.espresso.matcher.ViewMatchers
79
import androidx.test.espresso.matcher.ViewMatchers.withId
8-
import androidx.test.espresso.screenshot.captureToBitmap
910
import androidx.test.ext.junit.rules.activityScenarioRule
1011
import androidx.test.ext.junit.runners.AndroidJUnit4
1112
import com.xxmassdeveloper.mpchartexample.fragments.ViewPagerSimpleChartDemo
@@ -27,15 +28,13 @@ class ViewPagerTest {
2728
fun smokeTestViewPager() {
2829
Thread.sleep(SHORT_DURATION_MS)
2930
onView(ViewMatchers.isRoot())
30-
.captureToBitmap()
31-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
31+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
3232

3333
repeat(4) {
3434
onView(withId(R.id.pager)).perform(swipeLeft())
3535
Thread.sleep(SHORT_DURATION_MS)
3636
onView(ViewMatchers.isRoot())
37-
.captureToBitmap()
38-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${it}")
37+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-${it}") })
3938
}
4039
}
4140

109 Bytes
18 Bytes
13 Bytes
226 Bytes
-94 Bytes
-118 Bytes
-118 Bytes
-118 Bytes
-118 Bytes
-116 Bytes

0 commit comments

Comments
 (0)