Skip to content

Commit

Permalink
Add placeholder to UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tuomas2 committed Jun 18, 2020
1 parent d753cdb commit 6165618
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
30 changes: 30 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ android {
multiDexEnabled true
buildConfigField "String", "GitHash", "\"${getGitHash()}\""
buildConfigField "String", "BuildDate", "\"${new Date().format('dd/MM/YY HH:mm:ss')}\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
Expand Down Expand Up @@ -140,6 +141,7 @@ android {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}

}

dependencies {
Expand Down Expand Up @@ -208,6 +210,34 @@ dependencies {
testImplementation 'org.hamcrest:hamcrest-library:2.2'
testImplementation 'org.mockito:mockito-core:3.3.3'
testImplementation 'junit:junit:4.13'

// Android UI testing

// Core library
androidTestImplementation 'androidx.test:core:1.2.0'

// AndroidJUnitRunner and JUnit Rules
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'

// Assertions
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.ext:truth:1.2.0'
androidTestImplementation 'com.google.truth:truth:0.42'

// Espresso dependencies
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-accessibility:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
androidTestImplementation 'androidx.test.espresso.idling:idling-concurrent:3.2.0'

// The following Espresso dependency can be either "implementation"
// or "androidTestImplementation", depending on whether you want the
// dependency to appear on your APK's compile classpath or the test APK
// classpath.
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (c) 2020 Martin Denham, Tuomas Airaksinen and the And Bible contributors.
*
* This file is part of And Bible (http://github.com/AndBible/and-bible).
*
* And Bible is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* And Bible is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with And Bible.
* If not, see http://www.gnu.org/licenses/.
*
*/

package net.bible.android

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.matcher.ViewMatchers.withId
import org.junit.runner.RunWith
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.rule.ActivityTestRule
import net.bible.android.activity.R

import net.bible.android.view.activity.page.MainBibleActivity
import org.junit.Rule
import org.junit.Test

@RunWith(AndroidJUnit4::class)
@LargeTest
class MainBibleActivityTests {
@get:Rule var activityRule: ActivityTestRule<MainBibleActivity>
= ActivityTestRule(MainBibleActivity::class.java)

@Test
fun testMainActivity() {
//mainBibleActivity.windowControl.activeWindowPageManager.currentPage.key =
onView(withId(R.id.speakButton))
}
}

0 comments on commit 6165618

Please sign in to comment.