Issue#16 Move login state setup into homerobot
This commit is contained in:
parent
e827af515d
commit
40791ca462
3 changed files with 12 additions and 4 deletions
|
|
@ -19,7 +19,10 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
|
|||
import org.fnives.test.showcase.R
|
||||
import org.fnives.test.showcase.model.content.Content
|
||||
import org.fnives.test.showcase.model.content.FavouriteContent
|
||||
import org.fnives.test.showcase.network.mockserver.MockServerScenarioSetup
|
||||
import org.fnives.test.showcase.testutils.configuration.MainDispatcherTestRule
|
||||
import org.fnives.test.showcase.testutils.robot.Robot
|
||||
import org.fnives.test.showcase.testutils.statesetup.SetupAuthenticationState
|
||||
import org.fnives.test.showcase.testutils.viewactions.PullToRefresh
|
||||
import org.fnives.test.showcase.testutils.viewactions.WithDrawable
|
||||
import org.fnives.test.showcase.testutils.viewactions.notIntended
|
||||
|
|
@ -100,4 +103,11 @@ class HomeRobot : Robot {
|
|||
Espresso.onView(withId(R.id.error_message))
|
||||
.check(matches(allOf(isDisplayed(), withText(R.string.something_went_wrong))))
|
||||
}
|
||||
|
||||
fun setupLogin(
|
||||
mainDispatcherTestRule: MainDispatcherTestRule,
|
||||
mockServerScenarioSetup: MockServerScenarioSetup
|
||||
) {
|
||||
SetupAuthenticationState.setupLogin(mainDispatcherTestRule, mockServerScenarioSetup)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import org.fnives.test.showcase.testutils.idling.NetworkSynchronization
|
|||
import org.fnives.test.showcase.testutils.idling.loopMainThreadFor
|
||||
import org.fnives.test.showcase.testutils.idling.loopMainThreadUntilIdleWithIdlingResources
|
||||
import org.fnives.test.showcase.testutils.robot.RobotTestRule
|
||||
import org.fnives.test.showcase.testutils.statesetup.SetupAuthenticationState
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
|
@ -69,7 +68,7 @@ class MainActivityTest {
|
|||
|
||||
hiltRule.inject()
|
||||
disposable = networkSynchronization.registerNetworkingSynchronization()
|
||||
SetupAuthenticationState.setupLogin(mainDispatcherTestRule, mockServerScenarioSetupTestRule.mockServerScenarioSetup)
|
||||
homeRobot.setupLogin(mainDispatcherTestRule, mockServerScenarioSetupTestRule.mockServerScenarioSetup)
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ import org.fnives.test.showcase.testutils.idling.NetworkSynchronization
|
|||
import org.fnives.test.showcase.testutils.idling.loopMainThreadFor
|
||||
import org.fnives.test.showcase.testutils.idling.loopMainThreadUntilIdleWithIdlingResources
|
||||
import org.fnives.test.showcase.testutils.robot.RobotTestRule
|
||||
import org.fnives.test.showcase.testutils.statesetup.SetupAuthenticationState
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Rule
|
||||
|
|
@ -64,7 +63,7 @@ class MainActivityTest : KoinTest {
|
|||
.invoke(mockServerScenarioSetupTestRule.mockServerScenarioSetup)
|
||||
|
||||
disposable = NetworkSynchronization.registerNetworkingSynchronization()
|
||||
SetupAuthenticationState.setupLogin(
|
||||
homeRobot.setupLogin(
|
||||
mainDispatcherTestRule,
|
||||
mockServerScenarioSetupTestRule.mockServerScenarioSetup
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue