Skip to content

Commit

Permalink
requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GOVINDDIXIT committed Aug 10, 2019
1 parent bb784fc commit 58d0ef3
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ import androidx.test.rule.ActivityTestRule
import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.withTextInChild
import chat.rocket.android.util.extensions.addFragmentBackStack
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.EXISTING_USER
import testConfig.Config.Companion.FAVORITE_MESSAGES
import testConfig.Config.Companion.FILES
import testConfig.Config.Companion.MEMBERS
import testConfig.Config.Companion.MENTIONS
import testConfig.Config.Companion.PINNED_MESSAGES
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL
import testConfig.Config.Companion.TEST_USER

class ChatDetailsFragmentTest {

Expand Down Expand Up @@ -122,14 +122,14 @@ class ChatDetailsFragmentTest {

private fun navigateToExistingDMDetails() {
Thread.sleep(5000)
onView(withText(EXISTING_USER)).perform(click())
onView(withText(TEST_USER)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}

private fun navigateToExistingChannelDetails() {
Thread.sleep(5000)
onView(withText(EXISTING_CHANNEL)).perform(click())
onView(withText(TEST_CHANNEL)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import chat.rocket.android.util.loginUserToTheApp
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL2
import testConfig.Config.Companion.EXISTING_USER
import testConfig.Config.Companion.EXISTING_USER2
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL2
import testConfig.Config.Companion.TEST_MESSAGE
import testConfig.Config.Companion.TEST_USER
import testConfig.Config.Companion.TEST_USER2

@LargeTest
class ChatRoomFragmentTest {
Expand Down Expand Up @@ -136,17 +136,17 @@ class ChatRoomFragmentTest {
}

private fun navigateToExistingChannel() {
onView(withText(EXISTING_CHANNEL2)).perform(click())
onView(withText(TEST_CHANNEL2)).perform(click())
Thread.sleep(2000)
}

private fun navigateToExistingUser1() {
onView(withText(EXISTING_USER)).perform(click())
onView(withText(TEST_USER)).perform(click())
Thread.sleep(2000)
}

private fun navigateToExistingUser2() {
onView(withText(EXISTING_USER2)).perform(click())
onView(withText(TEST_USER2)).perform(click())
Thread.sleep(2000)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import androidx.test.rule.ActivityTestRule
import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.withIndex
import chat.rocket.android.util.extensions.addFragmentBackStack
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL

class ChatRoomsFragmentTest {

Expand Down Expand Up @@ -50,9 +50,9 @@ class ChatRoomsFragmentTest {

@Test
fun clicking_channel_should_open_chatroom() {
onView(withText(EXISTING_CHANNEL)).perform(click())
onView(withText(TEST_CHANNEL)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).check(matches(withText(EXISTING_CHANNEL)))
onView(withId(R.id.text_toolbar_title)).check(matches(withText(TEST_CHANNEL)))
onView(withId(R.id.message_list_container)).check(matches(isDisplayed()))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.RecyclerViewItemCountAssertion.Companion.withItemCount
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.greaterThan
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.CHANNELS
import testConfig.Config.Companion.DIRECTORY
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.EXISTING_USER
import testConfig.Config.Companion.NON_EXISTING_CHANNEL
import testConfig.Config.Companion.NON_EXISTING_USER
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL
import testConfig.Config.Companion.TEST_USER
import testConfig.Config.Companion.USERS

class DirectoryFragmentTest {
Expand Down Expand Up @@ -80,7 +80,7 @@ class DirectoryFragmentTest {
onView(withId(R.id.action_search)).perform(click())
onView(isAssignableFrom(AutoCompleteTextView::class.java)).perform(
clearText(),
typeText(EXISTING_CHANNEL),
typeText(TEST_CHANNEL),
closeSoftKeyboard()
)
Thread.sleep(8000)
Expand All @@ -107,7 +107,7 @@ class DirectoryFragmentTest {
onView(withId(R.id.action_search)).perform(click())
onView(isAssignableFrom(AutoCompleteTextView::class.java)).perform(
clearText(),
typeText(EXISTING_USER),
typeText(TEST_USER),
closeSoftKeyboard()
)
Espresso.pressBack()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ package chat.rocket.android.favoritemessages.ui

import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.NoMatchingViewException
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.rule.ActivityTestRule
import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.RecyclerViewItemCountAssertion.Companion.withItemCount
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.greaterThan
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.EXISTING_CHANNEL2
import testConfig.Config.Companion.FAVORITE_MESSAGES
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL
import testConfig.Config.Companion.TEST_CHANNEL2


class FavoriteMessagesFragmentTest {
Expand Down Expand Up @@ -60,14 +60,14 @@ class FavoriteMessagesFragmentTest {

private fun navigateToSandboxChannelDetails() {
Thread.sleep(5000)
onView(withText(EXISTING_CHANNEL2)).perform(click())
onView(withText(TEST_CHANNEL2)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}

private fun navigateToGeneralChannelDetails() {
Thread.sleep(5000)
onView(withText(EXISTING_CHANNEL)).perform(click())
onView(withText(TEST_CHANNEL)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.RecyclerViewItemCountAssertion.Companion.withItemCount
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import org.hamcrest.Matchers.*
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.EXISTING_USER
import testConfig.Config.Companion.FILES
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL
import testConfig.Config.Companion.TEST_USER

class FilesFragmentTest {

Expand Down Expand Up @@ -72,14 +72,14 @@ class FilesFragmentTest {

private fun navigateToGeneralChannelDetails() {
Thread.sleep(5000)
onView(withText(EXISTING_CHANNEL)).perform(click())
onView(withText(TEST_CHANNEL)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}

private fun navigateToDummyUserChannelDetails() {
Thread.sleep(5000)
onView(withText(EXISTING_USER)).perform(click())
onView(withText(TEST_USER)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import org.hamcrest.Matchers.greaterThan
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL3
import testConfig.Config.Companion.EXISTING_USER2
import testConfig.Config.Companion.MEMBERS
import testConfig.Config.Companion.NON_EXISTING_USER
import testConfig.Config.Companion.PASSWORD
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL3
import testConfig.Config.Companion.TEST_USER2
import testConfig.Config.Companion.USERNAME


Expand All @@ -45,7 +45,7 @@ class InviteUsersFragmentTest {
}

private fun navigateToInviteUser() {
onView(withText(EXISTING_CHANNEL3)).perform(click())
onView(withText(TEST_CHANNEL3)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
onView(withText(MEMBERS)).perform(click())
Expand All @@ -63,13 +63,13 @@ class InviteUsersFragmentTest {
@Test
fun search_an_existing_user() {
onView(withId(R.id.text_invite_users)).perform(
typeText(EXISTING_USER2), closeSoftKeyboard()
typeText(TEST_USER2), closeSoftKeyboard()
)
Thread.sleep(2000)
onView(withId(R.id.recycler_view)).check(
RecyclerViewItemCountAssertion.withItemCount(greaterThan(0))
)
onView(withId(R.id.text_member)).check(matches(withText(EXISTING_USER2)))
onView(withId(R.id.text_member)).check(matches(withText(TEST_USER2)))
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.RecyclerViewItemCountAssertion.Companion.withItemCount
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import org.hamcrest.Matchers.greaterThan
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.MEMBERS
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL


class MembersFragmentTest {
Expand Down Expand Up @@ -51,7 +51,7 @@ class MembersFragmentTest {

private fun navigateToChannelDetails() {
Thread.sleep(3000)
onView(withText(EXISTING_CHANNEL)).perform(click())
onView(withText(TEST_CHANNEL)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import chat.rocket.android.R
import chat.rocket.android.analytics.event.ScreenViewEvent
import chat.rocket.android.authentication.ui.AuthenticationActivity
import chat.rocket.android.util.RecyclerViewItemCountAssertion.Companion.withItemCount
import chat.rocket.android.util.loginUserToTheApp
import chat.rocket.android.util.extensions.addFragmentBackStack
import chat.rocket.android.util.loginUserToTheApp
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.greaterThan
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_CHANNEL
import testConfig.Config.Companion.EXISTING_CHANNEL2
import testConfig.Config.Companion.MENTIONS
import testConfig.Config.Companion.SERVER_URL
import testConfig.Config.Companion.TEST_CHANNEL
import testConfig.Config.Companion.TEST_CHANNEL2


class MentionsFragmentTest {
Expand Down Expand Up @@ -60,14 +60,14 @@ class MentionsFragmentTest {

private fun navigateToSandboxChannelDetails() {
Thread.sleep(3000)
onView(withText(EXISTING_CHANNEL2)).perform(click())
onView(withText(TEST_CHANNEL2)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}

private fun navigateToGeneralChannelDetails() {
Thread.sleep(3000)
onView(withText(EXISTING_CHANNEL)).perform(click())
onView(withText(TEST_CHANNEL)).perform(click())
Thread.sleep(2000)
onView(withId(R.id.text_toolbar_title)).perform(click())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import chat.rocket.android.util.clickChildViewWithId
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import testConfig.Config.Companion.EXISTING_USER2
import testConfig.Config.Companion.TEST_USER2

class UserDetailsFragmentTest {

Expand All @@ -27,7 +27,7 @@ class UserDetailsFragmentTest {
@Before
fun setUp() {
Thread.sleep(5000)
onView(withText(EXISTING_USER2)).perform(click())
onView(withText(TEST_USER2)).perform(click())
Thread.sleep(5000)
onView(withId(R.id.recycler_view)).perform(
RecyclerViewActions.actionOnItemAtPosition<RecyclerView.ViewHolder>(
Expand Down
13 changes: 6 additions & 7 deletions app/src/main/java/testConfig/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,17 @@ class Config {
const val EMAIL: String = "qasdf@gmail.com"

//Existing User
const val EXISTING_USER: String ="dfcxc"
const val EXISTING_USER2: String ="govind.dixit"
const val TEST_USER: String ="dfcxc"
const val TEST_USER2: String ="govind.dixit"

//Non existing User
const val NON_EXISTING_USER: String = "**33##&&"

//Existing Channel
// For RC there are already two default channels, for other organisation they have to create
// two channels before testing
const val EXISTING_CHANNEL: String ="general"
const val EXISTING_CHANNEL2: String ="sandbox"
const val EXISTING_CHANNEL3: String ="dfcxc"
// Other organisation have to create channels before testing
const val TEST_CHANNEL: String ="general"
const val TEST_CHANNEL2: String ="sandbox"
const val TEST_CHANNEL3: String ="dfcxc"


//Non existing Channel
Expand Down

0 comments on commit 58d0ef3

Please sign in to comment.