-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#17 in progress - first espresso tests
- Loading branch information
Showing
18 changed files
with
120 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
...c/androidTestKalinowiceCustomDebug/java/pl/marianjureczko/poszukiwacz/CustomTestRunner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package pl.marianjureczko.poszukiwacz | ||
|
||
import android.app.Application | ||
import android.content.Context | ||
import androidx.test.runner.AndroidJUnitRunner | ||
import dagger.hilt.android.testing.HiltTestApplication | ||
|
||
class CustomTestRunner : AndroidJUnitRunner() { | ||
|
||
override fun newApplication(cl: ClassLoader?, name: String?, context: Context?): Application { | ||
return super.newApplication(cl, HiltTestApplication::class.java.name, context) | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
...androidTestKalinowiceCustomDebug/java/pl/marianjureczko/poszukiwacz/MyInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package pl.marianjureczko.poszukiwacz | ||
|
||
import androidx.compose.ui.test.assertCountEquals | ||
import androidx.compose.ui.test.assertTextContains | ||
import androidx.compose.ui.test.junit4.createAndroidComposeRule | ||
import androidx.compose.ui.test.onAllNodesWithContentDescription | ||
import androidx.test.rule.GrantPermissionRule | ||
import dagger.hilt.android.testing.HiltAndroidRule | ||
import dagger.hilt.android.testing.HiltAndroidTest | ||
import org.junit.Before | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import pl.marianjureczko.poszukiwacz.activity.main.MainActivity | ||
|
||
//@UninstallModules(SingletonModule::class) | ||
@HiltAndroidTest | ||
//@Config(application = HiltTestApplication::class) | ||
class MyInstrumentedTest { | ||
|
||
|
||
@get:Rule(order = 0) | ||
val hiltRule = HiltAndroidRule(this) | ||
|
||
@get:Rule(order = 1) | ||
val composeRule = createAndroidComposeRule<MainActivity>() | ||
|
||
@get:Rule(order = 3) | ||
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant( | ||
android.Manifest.permission.ACCESS_FINE_LOCATION, | ||
android.Manifest.permission.CAMERA | ||
) | ||
|
||
@Before | ||
fun init() { | ||
hiltRule.inject() | ||
} | ||
|
||
@Test | ||
fun test() { | ||
//given | ||
// composeRule.waitForIdle() | ||
val text = composeRule.onAllNodesWithContentDescription("TEST", false, false, true) | ||
.assertCountEquals(1) | ||
.get(0) | ||
|
||
//then | ||
text.assertTextContains("WARNING", substring = true) | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters