Search in sources :

Example 6 with Builds

use of com.github.vase4kin.teamcityapp.buildlist.api.Builds in project TeamCityApp by vase4kin.

the class FilterBuildsActivityTest method setUp.

@Before
public void setUp() {
    TeamCityApplication app = (TeamCityApplication) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext();
    app.getRestApiInjector().sharedUserStorage().clearAll();
    app.getRestApiInjector().sharedUserStorage().saveGuestUserAccountAndSetItAsActive(Mocks.URL);
    when(mTeamCityService.listBuilds(anyString(), anyString())).thenReturn(Observable.just(new Builds(0, Collections.<Build>emptyList())));
}
Also used : Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) TeamCityApplication(com.github.vase4kin.teamcityapp.TeamCityApplication) Before(org.junit.Before)

Example 7 with Builds

use of com.github.vase4kin.teamcityapp.buildlist.api.Builds in project TeamCityApp by vase4kin.

the class FakeTeamCityServiceImpl method listQueueBuilds.

@Override
public Observable<Builds> listQueueBuilds(@Query("fields") String fields) {
    List<Build> builds = new ArrayList<>();
    builds.add(Mocks.queuedBuild1());
    builds.add(Mocks.queuedBuild2());
    builds.add(Mocks.queuedBuild3());
    return Observable.just(new Builds(3, builds));
}
Also used : Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) ArrayList(java.util.ArrayList)

Example 8 with Builds

use of com.github.vase4kin.teamcityapp.buildlist.api.Builds in project TeamCityApp by vase4kin.

the class FakeTeamCityServiceImpl method listRunningBuilds.

@Override
public Observable<Builds> listRunningBuilds(@Query("locator") String locator, @Query("fields") String fields) {
    List<Build> builds = new ArrayList<>();
    builds.add(Mocks.runningBuild());
    return Observable.just(new Builds(1, builds));
}
Also used : Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) ArrayList(java.util.ArrayList)

Example 9 with Builds

use of com.github.vase4kin.teamcityapp.buildlist.api.Builds in project TeamCityApp by vase4kin.

the class BuildListActivityTest method testUserCanSeeSnackBarIfBuildIsAddedToQueue.

@Test
public void testUserCanSeeSnackBarIfBuildIsAddedToQueue() throws Exception {
    when(mTeamCityService.listBuilds(anyString(), anyString())).thenReturn(Observable.just(new Builds(0, Collections.<Build>emptyList())));
    // Preparing stubbing intent
    Intent resultData = new Intent();
    resultData.putExtra(RunBuildRouter.EXTRA_HREF, "href");
    Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData);
    mActivityRule.launchActivity(null);
    // Open build type
    onView(withText("build type")).perform(click());
    // Set up result stubbing
    intending(hasComponent(RunBuildActivity.class.getName())).respondWith(result);
    // Pressing run build fab
    onView(withId(R.id.floating_action_button)).perform(click());
    // Check snack bar text
    onView(withText(R.string.text_build_is_run)).check(matches(isDisplayed()));
}
Also used : RunBuildActivity(com.github.vase4kin.teamcityapp.runbuild.view.RunBuildActivity) Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) Instrumentation(android.app.Instrumentation) Intent(android.content.Intent) Test(org.junit.Test)

Example 10 with Builds

use of com.github.vase4kin.teamcityapp.buildlist.api.Builds in project TeamCityApp by vase4kin.

the class BuildListActivityTest method testUserCanSeeErrorSnackbarWhenOpenRecentlyQueuedBuildIfThereAreErrors.

@Test
public void testUserCanSeeErrorSnackbarWhenOpenRecentlyQueuedBuildIfThereAreErrors() throws Exception {
    when(mTeamCityService.listBuilds(anyString(), anyString())).thenReturn(Observable.just(new Builds(0, Collections.<Build>emptyList())));
    // Preparing stubbing intent
    Intent resultData = new Intent();
    resultData.putExtra(RunBuildRouter.EXTRA_HREF, "href");
    Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData);
    mActivityRule.launchActivity(null);
    // Open build type
    onView(withText("build type")).perform(click());
    // Set up result stubbing
    intending(hasComponent(RunBuildActivity.class.getName())).respondWith(result);
    // Pressing run build fab
    onView(withId(R.id.floating_action_button)).perform(click());
    // Mock build call
    when(mTeamCityService.build(anyString())).thenReturn(Observable.<Build>error(new RuntimeException()));
    // Click on show button of queued build snack bar
    onView(withText(R.string.text_show_build)).perform(click());
    // Check error snack bar
    onView(withText(R.string.error_opening_build)).check(matches(isDisplayed()));
    // Click on retry button
    onView(withText(R.string.download_artifact_retry_snack_bar_retry_button)).perform(click());
    // Check error snack bar again
    onView(withText(R.string.error_opening_build)).check(matches(isDisplayed()));
}
Also used : RunBuildActivity(com.github.vase4kin.teamcityapp.runbuild.view.RunBuildActivity) Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) Instrumentation(android.app.Instrumentation) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

Builds (com.github.vase4kin.teamcityapp.buildlist.api.Builds)11 Build (com.github.vase4kin.teamcityapp.buildlist.api.Build)6 Instrumentation (android.app.Instrumentation)5 Intent (android.content.Intent)5 Test (org.junit.Test)5 RunBuildActivity (com.github.vase4kin.teamcityapp.runbuild.view.RunBuildActivity)4 ArrayList (java.util.ArrayList)3 Subscription (rx.Subscription)2 TeamCityApplication (com.github.vase4kin.teamcityapp.TeamCityApplication)1 BuildDetailsActivity (com.github.vase4kin.teamcityapp.build_details.view.BuildDetailsActivity)1 BuildListFilter (com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilter)1 BuildListFilterImpl (com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilterImpl)1 FilterBuildsActivity (com.github.vase4kin.teamcityapp.filter_builds.view.FilterBuildsActivity)1 BuildDetails (com.github.vase4kin.teamcityapp.overview.data.BuildDetails)1 BuildDetailsImpl (com.github.vase4kin.teamcityapp.overview.data.BuildDetailsImpl)1 List (java.util.List)1 Before (org.junit.Before)1 Observable (rx.Observable)1 Func1 (rx.functions.Func1)1 Func2 (rx.functions.Func2)1