Skip to content

Commit bcd3962

Browse files
authored
Merge pull request #674 from AppDevNext/BumpTestLibs
Bump test libs
2 parents 643b28f + c30b7ba commit bcd3962

6 files changed

Lines changed: 29 additions & 31 deletions

File tree

app/build.gradle

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ dependencies {
6262
implementation "androidx.appcompat:appcompat:1.7.0"
6363
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
6464
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1"
65+
implementation "androidx.test.uiautomator:uiautomator:2.3.0"
6566

66-
androidTestImplementation "com.github.AppDevNext:Moka:1.6"
67-
androidTestImplementation "androidx.test.ext:junit-ktx:1.1.5"
68-
androidTestUtil "androidx.test.services:test-services:1.5.0"
69-
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
70-
androidTestImplementation "androidx.test:rules:1.5.0" // GrantPermissionRule
67+
androidTestImplementation "androidx.test:rules:1.7.0" // GrantPermissionRule
68+
androidTestImplementation "com.github.AppDevNext:Moka:1.7"
69+
androidTestImplementation "androidx.test.ext:junit-ktx:1.3.0"
70+
androidTestUtil "androidx.test.services:test-services:1.6.0"
71+
androidTestImplementation "org.hamcrest:hamcrest:3.0"
72+
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.7.0"
7173
}

app/src/androidTest/java/info/hannes/logcat/AllFragmentsTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package info.hannes.logcat
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.assertion.ViewAssertions
68
import androidx.test.espresso.matcher.ViewMatchers.*
7-
import androidx.test.espresso.screenshot.captureToBitmap
89
import androidx.test.ext.junit.rules.activityScenarioRule
910
import androidx.test.ext.junit.runners.AndroidJUnit4
1011
import info.hannes.logcat.ui.BothLogActivity
11-
import org.hamcrest.Matchers.allOf
12+
import org.hamcrest.CoreMatchers.allOf
1213
import org.junit.Rule
1314
import org.junit.Test
1415
import org.junit.rules.TestName
@@ -33,8 +34,7 @@ class AllFragmentsTest {
3334
onView(withText("Logfile")).check(ViewAssertions.matches(isDisplayed()))
3435

3536
onView(isRoot())
36-
.captureToBitmap()
37-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
37+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
3838
}
3939

4040
}

app/src/androidTest/java/info/hannes/logcat/LogcatTest.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package info.hannes.logcat
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.matcher.ViewMatchers.*
6-
import androidx.test.espresso.screenshot.captureToBitmap
78
import androidx.test.ext.junit.rules.activityScenarioRule
89
import androidx.test.ext.junit.runners.AndroidJUnit4
910
import com.moka.lib.assertions.MatchOperator
1011
import com.moka.lib.assertions.WaitingAssertion
12+
import com.moka.lib.matchers.allOf
1113
import info.hannes.logcat.ui.LogcatActivity
12-
import org.hamcrest.Matchers.allOf
1314
import org.junit.Rule
1415
import org.junit.Test
1516
import org.junit.rules.TestName
@@ -30,12 +31,10 @@ class LogcatTest {
3031

3132
WaitingAssertion.checkAssertion(info.hannes.logcat.ui.R.id.log_recycler, isDisplayed(), 1500)
3233
onView(isRoot())
33-
.captureToBitmap()
34-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-Step1")
34+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-Step1") })
3535
WaitingAssertion.assertRecyclerAdapterItemsCount(info.hannes.logcat.ui.R.id.log_recycler, 15, MatchOperator.GREATER, 1500)
3636
onView(isRoot())
37-
.captureToBitmap()
38-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-End")
37+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-End") })
3938
}
4039

4140
}

app/src/androidTest/java/info/hannes/logcat/MainActivityTest.kt

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
package info.hannes.logcat
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.click
68
import androidx.test.espresso.assertion.ViewAssertions.matches
79
import androidx.test.espresso.matcher.ViewMatchers.*
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 info.hannes.logcat.app.MainActivity
12-
import org.hamcrest.Matchers.allOf
13+
import org.hamcrest.CoreMatchers.allOf
1314
import org.junit.Before
1415
import org.junit.Rule
1516
import org.junit.Test
@@ -31,8 +32,7 @@ class MainActivityTest {
3132
val navMain = onView(allOf(withContentDescription("Navigate up"), isDisplayed()))
3233
navMain.perform(click())
3334
onView(isRoot())
34-
.captureToBitmap()
35-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
35+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
3636
}
3737

3838
@Test
@@ -42,8 +42,7 @@ class MainActivityTest {
4242
menu.perform(click())
4343
Thread.sleep(1000)
4444
onView(isRoot())
45-
.captureToBitmap()
46-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
45+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
4746
}
4847

4948
@Test
@@ -52,8 +51,7 @@ class MainActivityTest {
5251
menu.check(matches(isDisplayed()))
5352
menu.perform(click())
5453
onView(isRoot())
55-
.captureToBitmap()
56-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
54+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
5755
}
5856

5957
@Test
@@ -63,8 +61,7 @@ class MainActivityTest {
6361
menu.perform(click())
6462
Thread.sleep(1000)
6563
onView(isRoot())
66-
.captureToBitmap()
67-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
64+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
6865
}
6966

7067
}

app/src/androidTest/java/info/hannes/logcat/ToFileTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
package info.hannes.logcat
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.assertion.ViewAssertions
68
import androidx.test.espresso.matcher.ViewMatchers.*
7-
import androidx.test.espresso.screenshot.captureToBitmap
89
import androidx.test.ext.junit.rules.activityScenarioRule
910
import androidx.test.ext.junit.runners.AndroidJUnit4
1011
import com.moka.lib.assertions.MatchOperator
1112
import com.moka.lib.assertions.RecyclerViewItemCountAssertion
1213
import info.hannes.logcat.ui.LogfileActivity
13-
import org.hamcrest.Matchers.allOf
14+
import org.hamcrest.CoreMatchers.allOf
1415
import org.junit.Rule
1516
import org.junit.Test
1617
import org.junit.rules.TestName
@@ -39,8 +40,7 @@ class ToFileTest {
3940
// Screenshot is too fast. It generates black screens
4041
Thread.sleep(300)
4142
onView(isRoot())
42-
.captureToBitmap()
43-
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}")
43+
.perform(captureToBitmap { bitmap: Bitmap -> bitmap.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}") })
4444
}
4545

4646
}

app/src/main/java/info/hannes/logcat/app/CrashlyticApplication.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class CrashlyticApplication : LoggingApplication() {
2222

2323
StrictMode.setThreadPolicy(
2424
StrictMode.ThreadPolicy.Builder()
25-
.detectDiskReads()
26-
.detectDiskWrites()
25+
// .detectDiskReads()
26+
// .detectDiskWrites()
2727
.detectNetwork()
2828
.penaltyDialog()
2929
.penaltyLog()

0 commit comments

Comments
 (0)