当前位置: 首页>>代码示例>>Java>>正文


Java Intents类代码示例

本文整理汇总了Java中android.support.test.espresso.intent.Intents的典型用法代码示例。如果您正苦于以下问题:Java Intents类的具体用法?Java Intents怎么用?Java Intents使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Intents类属于android.support.test.espresso.intent包,在下文中一共展示了Intents类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startNewLocalConnection

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
private void startNewLocalConnection(String name) {
	onView(withId(R.id.add_host_button)).perform(click());
	onView(withId(R.id.protocol_text)).perform(click());
	onView(withText("local")).perform(click());
	onView(withId(R.id.quickconnect_field)).perform(typeText(name));
	onView(withId(R.id.save)).perform(click());

	Intents.init();
	try {
		onView(withId(R.id.list)).perform(actionOnHolderItem(
				withHostNickname(name), click()));
		intended(hasComponent(ConsoleActivity.class.getName()));
	} finally {
		Intents.release();
	}

	onView(withId(R.id.console_flip)).check(matches(
			hasDescendant(allOf(isDisplayed(), withId(R.id.terminal_view)))));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:StartupTest.java

示例2: setUp

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Before
public void setUp() {
    Intents.init();

    // Wait till the splashactivity is closed, indicating blockchain was instantiated has started
    Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mActivityRule.launchActivity(new Intent(targetContext, ElectionChoiceActivity.class));
    while (!mActivityRule.getActivity().isFinishing()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    activity = (ElectionChoiceActivity) mElectionActivityRule.launchActivity(new Intent(targetContext, ElectionChoiceActivity.class));
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:17,代码来源:ElectionChoiceActivityTest.java

示例3: setUp

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Before
public void setUp() {
    Intents.init();

    // Wait till the splashactivity is closed, indicating blockchain was instantiated has started
    Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    splashActivityRule.launchActivity(new Intent(targetContext, SplashActivity.class));
    while (!splashActivityRule.getActivity().isFinishing()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    Context targetContext2 = InstrumentationRegistry.getInstrumentation()
            .getTargetContext();
    Intent intent = new Intent(targetContext2, ResultActivity.class);
    intent.putExtra("pubKey", pubKey);
    intent.putExtra("voter", voter);
    resultActivity = (ResultActivity) activityRule.launchActivity(intent);
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:23,代码来源:TestResultActivity.java

示例4: setUp

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Before
public void setUp() {
    Intents.init();

    // Wait till the splashactivity is closed, indicating blockchain was instantiated has started
    Context targetContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mActivityRule.launchActivity(new Intent(targetContext, SplashActivity.class));
    while (!mActivityRule.getActivity().isFinishing()) {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    electionActivity = (ElectionChoiceActivity) mElectionActivityRule.launchActivity(new Intent(targetContext, ElectionChoiceActivity.class));
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:17,代码来源:TestElectionChoice.java

示例5: checkActivityOnViewClicked

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
/**
 * Check if the activity is changed when any view is clicked.
 *
 * @param context          instance of the caller.
 * @param viewId           id of the view.
 * @param nextActivityName Name of the next activity.
 */
public static void checkActivityOnViewClicked(Context context,
                                              int viewId,
                                              String nextActivityName) {
    Intents.init();

    //set intent package
    intending(toPackage(context.getString(R.string.package_name)));

    // Perform click operation on FAB
    onView(withId(viewId)).perform(click());

    // Assert that if the opened activity is Quiz activity.
    intended(hasComponent(nextActivityName));

    Intents.release();
}
 
开发者ID:kevalpatel2106,项目名称:smart-lens,代码行数:24,代码来源:IntentTestUtils.java

示例6: checkTextOnScreen

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Test
public void checkTextOnScreen() {
    //to check view on screen

    Intent resultData = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    resultData.setData(Uri.parse(("content://media/external/images/media/337663")));
    Matcher<Intent> MediaPickIntent = allOf(hasAction(Intent.ACTION_PICK), hasData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI));
    Intents.init();
    intending(MediaPickIntent).respondWith(new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));

    onView(withText("Gallery")).perform(click());
    onView(withId(R.id.btnGalleryPick)).perform(click());
    intended(MediaPickIntent);
    //To check the image pick works or not
    try{
        Thread.sleep(4500);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
 
开发者ID:parthdave93,项目名称:AndroidTestingTutorial,代码行数:21,代码来源:GalleryPickerTesting.java

示例7: shouldLoadUsersAndTriggerIntent

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Test
public void shouldLoadUsersAndTriggerIntent() {
    serverRule
            .enqueueGET(200, "users.json")
            .assertPathIs("/2.2/users")
            .assertHasQuery("order", "desc")
            .assertHasQuery("sort", "reputation")
            .assertHasQuery("site", "stackoverflow");

    Intents.init();
    activityRule.launchActivity(new Intent(Intent.ACTION_MAIN));

    onView(withId(R.id.recyclerView))
            .perform(scrollToPosition(3));

    TestUtils.rotateScreen(activityRule);

    onView(withId(R.id.recyclerView))
            .perform(actionOnItemAtPosition(2, click()));

    intended(allOf(
            hasAction(Intent.ACTION_VIEW),
            hasData(Uri.parse("http://stackoverflow.com/users/157882/balusc"))
    ));
    Intents.release();
}
 
开发者ID:rafaeltoledo,项目名称:android-keep-testing,代码行数:27,代码来源:HomeActivityTest.java

示例8: shouldLoadUsersAndTriggerIntent

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Test
public void shouldLoadUsersAndTriggerIntent() {
    when(mockApi.getUsers(anyInt())).thenReturn(successResult());

    Intents.init();
    activityRule.launchActivity(new Intent(Intent.ACTION_MAIN));

    onView(withId(R.id.recyclerView))
            .perform(scrollToPosition(3));

    TestUtils.rotateScreen(activityRule);

    onView(withId(R.id.recyclerView))
            .perform(actionOnItemAtPosition(2, click()));

    intended(allOf(
            hasAction(Intent.ACTION_VIEW),
            hasData(Uri.parse("http://stackoverflow.com/users/157882/balusc"))
    ));
    Intents.release();
}
 
开发者ID:rafaeltoledo,项目名称:android-keep-testing,代码行数:22,代码来源:HomeActivityMockTest.java

示例9: testTapItem

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
public void testTapItem() {
    Intents.init();
    addInitialData();

    pause();

    // DO UI INTERACTION
    onView(withId(R.id.recycler)).perform(RecyclerViewActions.actionOnItemAtPosition(1, click
            ()));

    pause();

    // Confirm that the TodoListActivity was started!
    intended(hasComponent(TodoListActivity.class.getName()));
    Intents.release();
}
 
开发者ID:vanadium-archive,项目名称:todos,代码行数:17,代码来源:MainActivityTest.java

示例10: speakerImage_WhenClicked_IntentFired

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Test
public void speakerImage_WhenClicked_IntentFired() {
    Intent resultData = new Intent();
    resultData.putExtras(new Bundle());

    // Create the ActivityResult with the Intent.
    Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())).respondWith(
            new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));

    // When clicking on speaker image
    onView(withId(R.id.session_detail_frag)).perform(swipeUp());
    onView(withId(R.id.speaker_image)).perform(click());

    // Then the intent to display the speaker url is fired
    Uri expectedSpeakerUri = Uri.parse(SpeakersMockCursor.FAKE_SPEAKER_URL);
    intended(CoreMatchers.allOf(
            hasAction(IsEqual.equalTo(Intent.ACTION_VIEW)),
            hasData(expectedSpeakerUri)));
}
 
开发者ID:google,项目名称:iosched,代码行数:20,代码来源:SessionDetailActivity_InScheduleStarredSessionTest.java

示例11: youTubeVideo_WhenClicked_IntentFired

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Test
public void youTubeVideo_WhenClicked_IntentFired() {
    Intent resultData = new Intent();
    resultData.putExtras(new Bundle());

    // Create the ActivityResult with the Intent.
    Intents.intending(CoreMatchers.not(IntentMatchers.isInternal())).respondWith(
            new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData));

    // When clicking on video
    onView(withId(R.id.watch)).perform(click());

    // Then the intent to play the video is fired
    IntentUtils.checkVideoIntentIsFired(SessionsMockCursor.FAKE_YOUTUBE_URL,
            mActivityRule.getActivity(), false);
}
 
开发者ID:google,项目名称:iosched,代码行数:17,代码来源:SessionDetailActivity_EndedLiveStarredSessionTest.java

示例12: destroy

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@After
public void destroy() {
    Intents.release();
    try {
        BlockChain.getInstance(null).disconnect();
    } catch (Exception e) {
        e.printStackTrace();
    }
    activity.finish();
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:11,代码来源:ElectionChoiceActivityTest.java

示例13: destroy

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@After
public void destroy() {
    Intents.release();
    try {
        BlockChain.getInstance(null).disconnect();
    } catch (Exception e) {
        e.printStackTrace();
    }
    resultActivity.finish();
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:11,代码来源:TestResultActivity.java

示例14: destroy

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@After
public void destroy() {
    Intents.release();
    try {
        BlockChain.getInstance(null).disconnect();
    } catch (Exception e) {
        e.printStackTrace();
    }
    electionActivity.finish();
}
 
开发者ID:digital-voting-pass,项目名称:polling-station-app,代码行数:11,代码来源:TestElectionChoice.java

示例15: setUp

import android.support.test.espresso.intent.Intents; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Intents.init();

    mIdlingResource = mActivityRule.getActivity().getIdlingResource();
    IdlingRegistry.getInstance().register(mIdlingResource);
}
 
开发者ID:CMPUT301F17T13,项目名称:cat-is-a-dog,代码行数:8,代码来源:AuthTest.java


注:本文中的android.support.test.espresso.intent.Intents类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。