minor refactor and updt some versions in gradle

This commit is contained in:
Ulysse Widmer 2020-03-31 11:11:02 +02:00
parent c572d60213
commit 095525f701
4 changed files with 16 additions and 21 deletions

View File

@ -65,7 +65,7 @@ dependencies {
implementation "androidx.browser:browser:1.2.0" implementation "androidx.browser:browser:1.2.0"
implementation 'com.google.android.material:material:1.1.0' implementation 'com.google.android.material:material:1.1.0'
def room_version = "2.2.4" def room_version = "2.2.5"
implementation "androidx.room:room-runtime:$room_version" implementation "androidx.room:room-runtime:$room_version"
implementation 'androidx.recyclerview:recyclerview:1.1.0' implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
@ -84,6 +84,8 @@ dependencies {
androidTestImplementation("com.squareup.okhttp3:mockwebserver:4.4.0") androidTestImplementation("com.squareup.okhttp3:mockwebserver:4.4.0")
androidTestImplementation 'androidx.test.ext:junit:1.1.1' androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'

View File

@ -15,7 +15,6 @@ import okhttp3.mockwebserver.Dispatcher
import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockResponse
import okhttp3.mockwebserver.MockWebServer import okhttp3.mockwebserver.MockWebServer
import okhttp3.mockwebserver.RecordedRequest import okhttp3.mockwebserver.RecordedRequest
import org.hamcrest.CoreMatchers.allOf
import org.junit.Before import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
@ -80,6 +79,7 @@ class MockedServerTest {
preferences.edit().putString("accessToken", "azerty").apply() preferences.edit().putString("accessToken", "azerty").apply()
preferences.edit().putString("domain", baseUrl.toString()).apply() preferences.edit().putString("domain", baseUrl.toString()).apply()
} }
@Test @Test
fun testFollowersTextView() { fun testFollowersTextView() {
ActivityScenario.launch(MainActivity::class.java).onActivity{ ActivityScenario.launch(MainActivity::class.java).onActivity{
@ -90,16 +90,6 @@ class MockedServerTest {
onView(withId(R.id.accountNameTextView)).check(matches(withText("deerbard_photo"))) onView(withId(R.id.accountNameTextView)).check(matches(withText("deerbard_photo")))
} }
// @Test
// fun swipingDownOnHomepageShowsMorePosts() {
// Thread.sleep(1000)
//
// val firstDesc = allOf(withId(R.id.description))
// onView(withId(R.id.view_pager))
// .perform(ViewActions.swipeUp())
// .perform(ViewActions.swipeDown())
// onView(allOf(withId(R.id.description))).check(matches(firstDesc))
// }
@Test @Test
fun testNotificationsList() { fun testNotificationsList() {
ActivityScenario.launch(MainActivity::class.java).onActivity{ ActivityScenario.launch(MainActivity::class.java).onActivity{

View File

@ -30,8 +30,6 @@ class SettingsTest {
.targetContext.getSharedPreferences("com.h.pixeldroid.pref", Context.MODE_PRIVATE) .targetContext.getSharedPreferences("com.h.pixeldroid.pref", Context.MODE_PRIVATE)
preferences.edit().putString("accessToken", "azerty").apply() preferences.edit().putString("accessToken", "azerty").apply()
preferences.edit().putString("domain", "http://localhost").apply() preferences.edit().putString("domain", "http://localhost").apply()
ActivityScenario.launch(MainActivity::class.java)
} }
@Test @Test

View File

@ -1,16 +1,23 @@
package com.h.pixeldroid package com.h.pixeldroid
import android.content.Context import android.content.Context
import android.content.Intent
import androidx.test.core.app.ActivityScenario import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso.onView import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.swipeLeft import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.action.ViewActions.swipeRight import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.matches import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.intent.Intents
import androidx.test.espresso.intent.matcher.IntentMatchers
import androidx.test.espresso.intent.rule.IntentsTestRule
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
import com.google.android.material.tabs.TabLayout
import org.hamcrest.CoreMatchers
import org.hamcrest.Matcher
import org.junit.Before import org.junit.Before
import org.junit.Rule import org.junit.Rule
import org.junit.Test import org.junit.Test
@ -27,7 +34,6 @@ class SwipeTest {
.targetContext.getSharedPreferences("com.h.pixeldroid.pref", Context.MODE_PRIVATE) .targetContext.getSharedPreferences("com.h.pixeldroid.pref", Context.MODE_PRIVATE)
preferences.edit().putString("accessToken", "azerty").apply() preferences.edit().putString("accessToken", "azerty").apply()
preferences.edit().putString("domain", "http://localhost").apply() preferences.edit().putString("domain", "http://localhost").apply()
ActivityScenario.launch(MainActivity::class.java)
} }
@Test @Test
@ -43,11 +49,10 @@ class SwipeTest {
@Test @Test
fun swipingRightStopsAtHomepage() { fun swipingRightStopsAtHomepage() {
ActivityScenario.launch(MainActivity::class.java).onActivity {
a -> a.findViewById<TabLayout>(R.id.tabs).getTabAt(4)?.select()
} // go to the last tab
onView(withId(R.id.main_activity_main_linear_layout)) onView(withId(R.id.main_activity_main_linear_layout))
.perform(swipeLeft()) // search
.perform(swipeLeft()) // camera
.perform(swipeLeft()) // notifications
.perform(swipeLeft()) // profile
.perform(swipeRight()) // notifications .perform(swipeRight()) // notifications
.perform(swipeRight()) // camera .perform(swipeRight()) // camera
.perform(swipeRight()) // search .perform(swipeRight()) // search