Skip to content

Commit aec5aef

Browse files
update instrumentation test dependencies
1 parent ac07539 commit aec5aef

File tree

7 files changed

+44
-30
lines changed

7 files changed

+44
-30
lines changed

app/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ dependencies {
4848
testImplementation 'io.mockk:mockk:1.10.2'
4949
// Android Test Dependencies
5050
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
51-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
52-
androidTestImplementation 'androidx.test:rules:1.3.0'
51+
androidTestImplementation 'androidx.test.ext:junit-ktx:1.1.2'
5352
}
5453

5554
android {
@@ -112,6 +111,9 @@ android {
112111
targetCompatibility JavaVersion.VERSION_1_8
113112
}
114113

114+
kotlinOptions {
115+
jvmTarget = "1.8"
116+
}
115117
}
116118

117119
allOpen {

app/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Build Properties
2-
#Wed Oct 28 16:03:50 EDT 2020
2+
#Thu Oct 29 14:35:05 EDT 2020
33
version_minor=0
44
version_store=53
55
version_patch=1
6-
version_build=16
6+
version_build=17
77
version_major=3

app/src/androidTest/kotlin/com/vrem/wifianalyzer/FilterInstrumentedTest.kt

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,42 +18,50 @@
1818
package com.vrem.wifianalyzer
1919

2020
import androidx.test.espresso.Espresso
21-
import androidx.test.espresso.ViewInteraction
2221
import androidx.test.espresso.action.ViewActions
2322
import androidx.test.espresso.matcher.ViewMatchers
2423
import org.hamcrest.Matchers
2524

2625
internal class FilterInstrumentedTest : Runnable {
2726
override fun run() {
28-
pauseShort()
29-
actionOpen().perform(ViewActions.click())
30-
pauseLong()
31-
actionClose().perform(ViewActions.scrollTo(), ViewActions.click())
27+
actionOpen()
28+
actionClose()
3229
}
3330

34-
private fun actionClose(): ViewInteraction {
35-
val button3 = ViewMatchers.withId(android.R.id.button3)
36-
val filterClose = ViewMatchers.withText(FILTER_CLOSE_TAG)
37-
val scrollView = ViewMatchers.withClassName(Matchers.`is`("android.widget.ScrollView"))
38-
val filterButtonClose = ChildAtPosition(scrollView, FILTER_BUTTON_CLOSE)
39-
val filterActionClose = ChildAtPosition(filterButtonClose, FILTER_ACTION)
40-
return Espresso.onView(Matchers.allOf(button3, filterClose, filterActionClose))
31+
private fun actionClose() {
32+
pauseLong()
33+
Espresso.onView(
34+
Matchers.allOf(
35+
ViewMatchers.withId(android.R.id.button3),
36+
ViewMatchers.withText(FILTER_CLOSE_TAG),
37+
ChildAtPosition(
38+
ChildAtPosition(
39+
ViewMatchers.withClassName(Matchers.`is`("android.widget.ScrollView")),
40+
FILTER_BUTTON_CLOSE), FILTER_ACTION)))
41+
.perform(ViewActions.scrollTo(), ViewActions.click())
4142
}
4243

43-
private fun actionOpen(): ViewInteraction {
44-
val actionFilter = ViewMatchers.withId(R.id.action_filter)
45-
val filterButtonTag = ViewMatchers.withContentDescription(FILTER_BUTTON_TAG)
46-
val toolbar = ViewMatchers.withId(R.id.toolbar)
47-
val filterButtonOpen = ChildAtPosition(toolbar, FILTER_BUTTON_OPEN)
48-
val filterActionOpen = ChildAtPosition(filterButtonOpen, FILTER_ACTION)
49-
return Espresso.onView(Matchers.allOf(actionFilter, filterButtonTag, filterActionOpen, ViewMatchers.isDisplayed()))
44+
private fun actionOpen() {
45+
pauseShort()
46+
Espresso.onView(
47+
Matchers.allOf(
48+
ViewMatchers.withId(R.id.action_filter),
49+
ViewMatchers.withContentDescription(FILTER_BUTTON_TAG),
50+
ChildAtPosition(
51+
ChildAtPosition(
52+
ViewMatchers.withId(R.id.toolbar),
53+
FILTER_BUTTON_OPEN),
54+
FILTER_ACTION),
55+
ViewMatchers.isDisplayed()))
56+
.perform(ViewActions.click())
5057
}
5158

59+
5260
companion object {
5361
private const val FILTER_BUTTON_OPEN = 2
5462
private const val FILTER_BUTTON_CLOSE = 0
5563
private const val FILTER_ACTION = 0
56-
private const val FILTER_BUTTON_TAG = "FilterInstrumentedTest"
64+
private const val FILTER_BUTTON_TAG = "Filter"
5765
private const val FILTER_CLOSE_TAG = "Close"
5866
}
5967
}

app/src/androidTest/kotlin/com/vrem/wifianalyzer/MainInstrumentedTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
*/
1818
package com.vrem.wifianalyzer
1919

20+
import androidx.test.ext.junit.rules.ActivityScenarioRule
21+
import androidx.test.ext.junit.rules.activityScenarioRule
2022
import androidx.test.ext.junit.runners.AndroidJUnit4
2123
import androidx.test.filters.LargeTest
22-
import androidx.test.rule.ActivityTestRule
2324
import org.junit.Rule
2425
import org.junit.Test
2526
import org.junit.runner.RunWith
@@ -29,7 +30,7 @@ import org.junit.runner.RunWith
2930
class MainInstrumentedTest {
3031

3132
@get:Rule
32-
var mActivityTestRule: ActivityTestRule<MainActivity> = ActivityTestRule(MainActivity::class.java)
33+
val activityTestRule: ActivityScenarioRule<MainActivity> = activityScenarioRule()
3334

3435
@Test
3536
fun testNavigation() {

app/src/androidTest/kotlin/com/vrem/wifianalyzer/ScannerInstrumentedTest.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ internal class ScannerInstrumentedTest : Runnable {
3232
private fun scannerAction(tag: String) {
3333
pauseShort()
3434
val actionMenuItemView = Espresso.onView(
35-
Matchers.allOf(ViewMatchers.withId(R.id.action_scanner), ViewMatchers.withContentDescription(tag),
36-
ChildAtPosition(ChildAtPosition(ViewMatchers.withId(R.id.toolbar), SCANNER_BUTTON),
35+
Matchers.allOf(
36+
ViewMatchers.withId(R.id.action_scanner),
37+
ViewMatchers.withContentDescription(tag),
38+
ChildAtPosition(
39+
ChildAtPosition(ViewMatchers.withId(R.id.toolbar), SCANNER_BUTTON),
3740
SCANNER_ACTION),
3841
ViewMatchers.isDisplayed()))
3942
actionMenuItemView.perform(ViewActions.click())

app/src/main/kotlin/com/vrem/wifianalyzer/about/AboutFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class AboutFragment : Fragment() {
119119
val alertDialog: AlertDialog = AlertDialog.Builder(view.context)
120120
.setTitle(titleId)
121121
.setMessage(text)
122-
.setNeutralButton(android.R.string.ok) { dialog, which -> dialog.dismiss() }
122+
.setNeutralButton(android.R.string.ok) { dialog, _ -> dialog.dismiss() }
123123
.create()
124124
alertDialog.show()
125125
if (isSmallFont) {

app/src/main/kotlin/com/vrem/wifianalyzer/wifi/accesspoint/AccessPointPopup.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class AccessPointPopup {
2727
fun show(view: View): AlertDialog {
2828
val alertDialog: AlertDialog = AlertDialog.Builder(view.context)
2929
.setView(view)
30-
.setPositiveButton(android.R.string.ok) { dialog, which -> dialog.cancel(); }
30+
.setPositiveButton(android.R.string.ok) { dialog, _ -> dialog.cancel(); }
3131
.create()
3232
alertDialog.show()
3333
return alertDialog

0 commit comments

Comments
 (0)