Search in sources :

Example 6 with Triggered

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

the class OverviewFragmentTest method testUserCanSeeWhatUserRestartedBuildIfUserWasDeleted.

@Test
public void testUserCanSeeWhatUserRestartedBuildIfUserWasDeleted() {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    Triggered triggered = new Triggered(TRIGGER_TYPE_RESTARTED, null, null);
    mBuild.setTriggered(triggered);
    // Prepare intent
    // <! ---------------------------------------------------------------------- !>
    // Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
    // <! ---------------------------------------------------------------------- !>
    Intent intent = new Intent();
    Bundle b = new Bundle();
    b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
    b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
    intent.putExtras(b);
    // Start activity
    mActivityRule.launchActivity(intent);
    // Scrolling to last item to make it visible
    onView(withId(R.id.overview_recycler_view)).perform(scrollToPosition(4));
    // Checking restarted by
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemHeader)).check(matches(withText(R.string.build_restarted_by_section_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(R.string.triggered_deleted_user_text)));
}
Also used : Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) Bundle(android.os.Bundle) Intent(android.content.Intent) Test(org.junit.Test)

Example 7 with Triggered

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

the class OverviewFragmentTest method testUserCanSeeWhatUserTriggeredBuildIfUserWasDeleted.

@Test
public void testUserCanSeeWhatUserTriggeredBuildIfUserWasDeleted() {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    Triggered triggered = new Triggered(TRIGGER_TYPE_USER, null, null);
    mBuild.setTriggered(triggered);
    // Prepare intent
    // <! ---------------------------------------------------------------------- !>
    // Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
    // <! ---------------------------------------------------------------------- !>
    Intent intent = new Intent();
    Bundle b = new Bundle();
    b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
    b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
    intent.putExtras(b);
    // Start activity
    mActivityRule.launchActivity(intent);
    // Scrolling to last item to make it visible
    onView(withId(R.id.overview_recycler_view)).perform(scrollToPosition(4));
    // Checking restarted by
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemHeader)).check(matches(withText(R.string.build_triggered_by_section_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(R.string.triggered_deleted_user_text)));
}
Also used : Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) Bundle(android.os.Bundle) Intent(android.content.Intent) Test(org.junit.Test)

Example 8 with Triggered

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

the class OverviewFragmentTest method testUserCanSeeWhatConfigurationTriggeredBuildIfConfigurationIsDeleted.

@Test
public void testUserCanSeeWhatConfigurationTriggeredBuildIfConfigurationIsDeleted() {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    Triggered triggered = new Triggered(TRIGGER_TYPE_BUILD_TYPE, null, null);
    mBuild.setTriggered(triggered);
    // Prepare intent
    // <! ---------------------------------------------------------------------- !>
    // Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
    // <! ---------------------------------------------------------------------- !>
    Intent intent = new Intent();
    Bundle b = new Bundle();
    b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
    b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
    intent.putExtras(b);
    // Start activity
    mActivityRule.launchActivity(intent);
    // Scrolling to last item to make it visible
    onView(withId(R.id.overview_recycler_view)).perform(scrollToPosition(4));
    // Checking restarted by
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemHeader)).check(matches(withText(R.string.build_triggered_by_section_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(R.string.triggered_deleted_configuration_text)));
}
Also used : Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) Bundle(android.os.Bundle) Intent(android.content.Intent) Test(org.junit.Test)

Example 9 with Triggered

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

the class OverviewFragmentTest method testUserCanSeeWhatUserRestartedBuildIfUserHasOnlyUserName.

@Test
public void testUserCanSeeWhatUserRestartedBuildIfUserHasOnlyUserName() {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    Triggered triggered = new Triggered(TRIGGER_TYPE_RESTARTED, null, new User(USER_NAME, null));
    mBuild.setTriggered(triggered);
    // Prepare intent
    // <! ---------------------------------------------------------------------- !>
    // Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
    // <! ---------------------------------------------------------------------- !>
    Intent intent = new Intent();
    Bundle b = new Bundle();
    b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
    b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
    intent.putExtras(b);
    // Start activity
    mActivityRule.launchActivity(intent);
    // Scrolling to last item to make it visible
    onView(withId(R.id.overview_recycler_view)).perform(scrollToPosition(4));
    // Checking restarted by
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemHeader)).check(matches(withText(R.string.build_restarted_by_section_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(USER_NAME)));
}
Also used : Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) User(com.github.vase4kin.teamcityapp.buildlist.api.User) Bundle(android.os.Bundle) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

Triggered (com.github.vase4kin.teamcityapp.buildlist.api.Triggered)9 Intent (android.content.Intent)8 Bundle (android.os.Bundle)8 Test (org.junit.Test)8 User (com.github.vase4kin.teamcityapp.buildlist.api.User)6 Build (com.github.vase4kin.teamcityapp.buildlist.api.Build)2 Agent (com.github.vase4kin.teamcityapp.agents.api.Agent)1 Artifacts (com.github.vase4kin.teamcityapp.artifact.api.Artifacts)1 Changes (com.github.vase4kin.teamcityapp.changes.api.Changes)1 Properties (com.github.vase4kin.teamcityapp.properties.api.Properties)1 TestOccurrences (com.github.vase4kin.teamcityapp.tests.api.TestOccurrences)1 ArrayList (java.util.ArrayList)1