本文整理汇总了Java中android.support.test.espresso.intent.Intents.init方法的典型用法代码示例。如果您正苦于以下问题:Java Intents.init方法的具体用法?Java Intents.init怎么用?Java Intents.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.test.espresso.intent.Intents
的用法示例。
在下文中一共展示了Intents.init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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)))));
}
示例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();
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));
}
示例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();
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);
}
示例5: 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));
}
示例6: 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();
}
示例7: 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();
}
}
示例8: 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();
}
示例9: 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);
}
示例10: onStartTest
import android.support.test.espresso.intent.Intents; //导入方法依赖的package包/类
@OnStartTest()
public void onStartTest(String featureName, String scenarioName) {
IdlingPolicies.setMasterPolicyTimeout(30, TimeUnit.SECONDS);
Log.v(runnerConfig.LogTag, "Starting Test: " + featureName + " - " + scenarioName);
Intents.init();
}
示例11: apply
import android.support.test.espresso.intent.Intents; //导入方法依赖的package包/类
@Override
public Statement apply(final Statement base, Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
try {
Intents.init();
base.evaluate();
} catch (Exception e) {
Intents.release();
}
}
};
}
示例12: before
import android.support.test.espresso.intent.Intents; //导入方法依赖的package包/类
@Before
public void before() {
// Initialize intents
Intents.init();
// Idling resource
mUploadIdlingResource = new ServiceIdlingResource(mActivityTestRule.getActivity(),
MyUploadService.class);
Espresso.registerIdlingResources(mUploadIdlingResource);
}
示例13: wipeDataOnLogout
import android.support.test.espresso.intent.Intents; //导入方法依赖的package包/类
@Test
public void wipeDataOnLogout(){
//Given
Intents.init();
onView(withId(org.hisp.dhis.android.sdk.R.id.server_url)).perform(replaceText(SDKTestUtils.HNQIS_DEV_CI));
onView(withId(org.hisp.dhis.android.sdk.R.id.username)).perform(replaceText(SDKTestUtils.TEST_USERNAME_WITH_PERMISSION));
onView(withId(org.hisp.dhis.android.sdk.R.id.password)).perform(replaceText(SDKTestUtils.TEST_PASSWORD_WITH_PERMISSION));
onView(withId(org.hisp.dhis.android.sdk.R.id.login_button)).perform(click());
intended(hasComponent(ProgressActivity.class.getName()));
//Waiting for pull to finish in order to clear the state of the app
waitForPull(DEFAULT_WAIT_FOR_PULL);
//When
SDKTestUtils.goToLogin();
//Then
//Removed sdk data
assertTrue(EventExtended.count() == 0);
assertTrue(DataValueExtended.count() == 0);
//removed app data
assertTrue(Survey.count() == 0);
assertTrue(Value.count() == 0);
Intents.release();
}
示例14: loginWithRightCredentials
import android.support.test.espresso.intent.Intents; //导入方法依赖的package包/类
@Test
public void loginWithRightCredentials(){
Intents.init();
onView(withId(org.hisp.dhis.android.sdk.R.id.server_url)).perform(replaceText(SDKTestUtils.HNQIS_DEV_CI));
onView(withId(org.hisp.dhis.android.sdk.R.id.username)).perform(replaceText(SDKTestUtils.TEST_USERNAME_WITH_PERMISSION));
onView(withId(org.hisp.dhis.android.sdk.R.id.password)).perform(replaceText(SDKTestUtils.TEST_PASSWORD_WITH_PERMISSION));
onView(withId(org.hisp.dhis.android.sdk.R.id.login_button)).perform(click());
intended(hasComponent(ProgressActivity.class.getName()));
//Waiting for pull to finish in order to clear the state of the app
waitForPull(DEFAULT_WAIT_FOR_PULL);
Intents.release();
}
示例15: setUp
import android.support.test.espresso.intent.Intents; //导入方法依赖的package包/类
@Before
public void setUp() {
final Intent testIntent =
new Intent(activityTestRule.getActivity(), MainDialog.class).putExtra(
NotificationTools.EXTRA_INTENT, Constants.testPin);
Intents.init();
activityTestRule.launchActivity(testIntent);
}