-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from AppDevNext/BumpMoka
Bump Moka
- Loading branch information
Showing
8 changed files
with
80 additions
and
114 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
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
23 changes: 12 additions & 11 deletions
23
sample/src/androidTest/java/info/hannes/logcat/LogcatTest.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 |
---|---|---|
@@ -1,42 +1,43 @@ | ||
package info.hannes.logcat | ||
|
||
import android.Manifest | ||
import androidx.test.core.graphics.writeToTestStorage | ||
import androidx.test.espresso.Espresso.onView | ||
import androidx.test.espresso.matcher.ViewMatchers.* | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import androidx.test.espresso.screenshot.captureToBitmap | ||
import androidx.test.ext.junit.rules.activityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.SdkSuppress | ||
import androidx.test.rule.GrantPermissionRule | ||
import com.moka.lib.assertions.MatchOperator | ||
import com.moka.lib.assertions.WaitingAssertion | ||
import com.moka.utils.Screenshot | ||
import info.hannes.logcat.ui.LogcatActivity | ||
import org.hamcrest.Matchers.allOf | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.rules.TestName | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@SdkSuppress(minSdkVersion = 18) | ||
class LogcatTest { | ||
|
||
@get:Rule | ||
var mActivityTestRule = ActivityScenarioRule(LogcatActivity::class.java) | ||
val activityScenarioRule = activityScenarioRule<LogcatActivity>() | ||
|
||
@get:Rule | ||
val grantPermissionRule: GrantPermissionRule = GrantPermissionRule.grant( | ||
Manifest.permission.WRITE_EXTERNAL_STORAGE, | ||
Manifest.permission.READ_EXTERNAL_STORAGE | ||
) | ||
var nameRule = TestName() | ||
|
||
@Test | ||
fun basicLogcatTest() { | ||
onView(allOf(withContentDescription("Logcat"), withParent(withId(info.hannes.logcat.ui.R.id.action_bar)), isDisplayed())) | ||
|
||
WaitingAssertion.checkAssertion(info.hannes.logcat.ui.R.id.log_recycler, isDisplayed(), 1500) | ||
Screenshot.takeScreenshot("Step1") | ||
onView(isRoot()) | ||
.captureToBitmap() | ||
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-Step1") | ||
WaitingAssertion.assertRecyclerAdapterItemsCount(info.hannes.logcat.ui.R.id.log_recycler, 15, MatchOperator.GREATER, 1500) | ||
Screenshot.takeScreenshot("End") | ||
onView(isRoot()) | ||
.captureToBitmap() | ||
.writeToTestStorage("${javaClass.simpleName}_${nameRule.methodName}-End") | ||
} | ||
|
||
} |
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
27 changes: 20 additions & 7 deletions
27
sample/src/androidTest/java/info/hannes/logcat/ResumeTest.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
Oops, something went wrong.