本文整理汇总了Java中com.robotium.solo.Condition类的典型用法代码示例。如果您正苦于以下问题:Java Condition类的具体用法?Java Condition怎么用?Java Condition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Condition类属于com.robotium.solo包,在下文中一共展示了Condition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testWithVideoPlaying
import com.robotium.solo.Condition; //导入依赖的package包/类
@Test
public void testWithVideoPlaying() {
mSolo.unlockScreen();
mSolo.assertCurrentActivity("Expected Current Activity", MainActivity.class);
final ParsingVideoView videoView = (ParsingVideoView) mSolo.getView(R.id.videoView);
String filePath = download(URL_2, URL_2.substring(URL_2.lastIndexOf('/')));
if (filePath != null) {
play(videoView, filePath);
assertEquals(true, mSolo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return MediaManagerTestHelper.isPlaying();
}
}, 10000));
}
}
示例2: testPostScrollDownToLoadMore
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testPostScrollDownToLoadMore() {
solo.waitForActivity(ACTIVITY_NAME, 1000);
final RecyclerView feedList = (RecyclerView) solo.getView(R.id.rv_feed_list);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return feedList.getAdapter().getItemCount() > 0;
}
}, 4000);
feedList.smoothScrollToPosition(31);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return feedList.getAdapter().getItemCount() > 31;
}
}, 4000);
assertTrue(feedList.getAdapter().getItemCount() > 31);
}
示例3: testAddTask
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testAddTask() throws Exception {
solo.clickOnView(solo.getView(R.id.fab));
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return solo.searchText("date");
}
}, 500);
solo.getCurrentActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
EditText name = (EditText) solo.getView(R.id.textTodo);
EditText date = (EditText) solo.getView(R.id.date);
EditText time = (EditText) solo.getView(R.id.time);
name.setText("Test");
date.setText("25.02.2015");
time.setText("18:00");
}
});
solo.clickOnView(solo.getView(R.id.fab));
assertTrue("Failed to add task", solo.searchText("Test"));
}
示例4: testJoinChannel
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testJoinChannel() throws Exception {
String AUTO_TEST_CHANNEL_NAME = "for_auto_test_" + BuildConfig.VERSION_NAME + BuildConfig.VERSION_CODE;
solo.unlockScreen();
solo.assertCurrentActivity("Expected MainActivity activity", "MainActivity");
solo.clearEditText(0);
solo.enterText(0, AUTO_TEST_CHANNEL_NAME);
solo.waitForText(AUTO_TEST_CHANNEL_NAME, 1, 2000L);
solo.clickOnView(solo.getView(R.id.button_join));
String targetActivity = ChatActivity.class.getSimpleName();
solo.waitForLogMessage("onJoinChannelSuccess " + AUTO_TEST_CHANNEL_NAME, JOIN_CHANNEL_SUCCESS_THRESHOLD + 1000);
solo.assertCurrentActivity("Expected " + targetActivity + " activity", targetActivity);
long firstRemoteAudioTs = System.currentTimeMillis();
solo.waitForLogMessage("volume: ", FIRST_REMOTE_AUDIO_RECEIVED_THRESHOLD + 500);
assertTrue("first remote audio frame not received", System.currentTimeMillis() - firstRemoteAudioTs <= FIRST_REMOTE_AUDIO_RECEIVED_THRESHOLD);
solo.waitForCondition(new Condition() { // stay at the channel for some time
@Override
public boolean isSatisfied() {
return false;
}
}, FIRST_REMOTE_AUDIO_RECEIVED_THRESHOLD);
}
示例5: testJoinChannel
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testJoinChannel() throws Exception {
String AUTO_TEST_CHANNEL_NAME = "for_auto_test_" + BuildConfig.VERSION_NAME + BuildConfig.VERSION_CODE;
solo.unlockScreen();
solo.assertCurrentActivity("Expected MainActivity activity", "MainActivity");
solo.clearEditText(0);
solo.enterText(0, AUTO_TEST_CHANNEL_NAME);
solo.waitForText(AUTO_TEST_CHANNEL_NAME, 1, 2000L);
solo.clickOnView(solo.getView(R.id.button_join));
String targetActivity = ChatActivity.class.getSimpleName();
solo.waitForLogMessage("onJoinChannelSuccess " + AUTO_TEST_CHANNEL_NAME, JOIN_CHANNEL_SUCCESS_THRESHOLD + 1000);
solo.waitForLogMessage("onFirstLocalVideoFrame ", FIRST_LOCAL_VIDEO_SHOWN_THRESHOLD + 500);
solo.assertCurrentActivity("Expected " + targetActivity + " activity", targetActivity);
long firstRemoteVideoTs = System.currentTimeMillis();
solo.waitForLogMessage("onFirstRemoteVideoDecoded ", FIRST_REMOTE_VIDEO_RECEIVED_THRESHOLD + 500);
assertTrue("first remote video frame not received", System.currentTimeMillis() - firstRemoteVideoTs <= FIRST_REMOTE_VIDEO_RECEIVED_THRESHOLD);
solo.waitForCondition(new Condition() { // stay at the channel for some time
@Override
public boolean isSatisfied() {
return false;
}
}, FIRST_REMOTE_VIDEO_RECEIVED_THRESHOLD);
}
示例6: testJoinChannel
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testJoinChannel() throws Exception {
String AUTO_TEST_CHANNEL_NAME = "for_auto_test_" + BuildConfig.VERSION_NAME + BuildConfig.VERSION_CODE;
solo.unlockScreen();
solo.assertCurrentActivity("Expected MainActivity activity", "MainActivity");
solo.clearEditText(0);
solo.enterText(0, AUTO_TEST_CHANNEL_NAME);
solo.waitForText(AUTO_TEST_CHANNEL_NAME, 1, 2000L);
solo.clickOnView(solo.getView(R.id.button_join_call));
String targetActivity = ChatActivity.class.getSimpleName();
solo.waitForLogMessage("onJoinChannelSuccess " + AUTO_TEST_CHANNEL_NAME, JOIN_CHANNEL_SUCCESS_THRESHOLD + 1000);
solo.waitForLogMessage("onFirstLocalVideoFrame ", FIRST_LOCAL_VIDEO_SHOWN_THRESHOLD + 500);
solo.assertCurrentActivity("Expected " + targetActivity + " activity", targetActivity);
long firstRemoteVideoTs = System.currentTimeMillis();
solo.waitForLogMessage("onFirstRemoteVideoDecoded ", FIRST_REMOTE_VIDEO_RECEIVED_THRESHOLD + 500);
assertTrue("first remote video frame not received", System.currentTimeMillis() - firstRemoteVideoTs <= FIRST_REMOTE_VIDEO_RECEIVED_THRESHOLD);
solo.waitForCondition(new Condition() { // stay at the channel for some time
@Override
public boolean isSatisfied() {
return false;
}
}, FIRST_REMOTE_VIDEO_RECEIVED_THRESHOLD);
}
示例7: testPostFetch
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testPostFetch() {
solo.waitForActivity(ACTIVITY_NAME, 1000);
final RecyclerView feedList = (RecyclerView) solo.getView(R.id.rv_feed_list);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return feedList.getAdapter().getItemCount() > 0;
}
}, 4000);
assertEquals(31, feedList.getAdapter().getItemCount());
}
示例8: testPostPullToRefresh
import com.robotium.solo.Condition; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void testPostPullToRefresh() {
solo.waitForActivity(ACTIVITY_NAME, 1000);
final RecyclerView feedList = (RecyclerView) solo.getView(R.id.rv_feed_list);
final SwipeRefreshLayout pullRefresh = (SwipeRefreshLayout) solo.getView(R.id.srl_feed_list);
final FeedAdapter feedAdapter = (FeedAdapter) feedList.getAdapter();
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return feedAdapter.getItemCount() > 0;
}
}, 4000);
assertEquals(31, feedAdapter.getItemCount());
Display display = solo.getCurrentActivity().getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
solo.drag(width / 2, width / 2, height / 2, height / 2 + height / 3, 20);
assertEquals(true, pullRefresh.isRefreshing());
solo.sleep(500);
assertEquals(1, feedAdapter.getItemCount());
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return !pullRefresh.isRefreshing();
}
}, 4000);
assertEquals(31, feedAdapter.getItemCount());
}
示例9: testClickOnPost
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testClickOnPost() {
String postActivityName = PostByIdActivity.class.getSimpleName();
solo.waitForActivity(ACTIVITY_NAME, 1000);
final RecyclerView feedList = (RecyclerView) solo.getView(R.id.rv_feed_list);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return feedList.getAdapter().getItemCount() > 0;
}
}, 4000);
solo.clickInRecyclerView(0);
solo.sleep(800);
assertEquals(postActivityName, solo.getCurrentActivity().getClass().getSimpleName());
}
示例10: testClickOnDifferentSortType
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testClickOnDifferentSortType() {
solo.waitForActivity(ACTIVITY_NAME, 1000);
RecyclerView feedList = (RecyclerView) solo.getView(R.id.rv_feed_list);
View fabMenu = solo.getView(R.id.fab_menu);
View menuSort = solo.getView(R.id.btn_menu_sort);
final BottomSheetLayout bottomSheetSort = (BottomSheetLayout) solo.getView(R.id.bsl_menu);
assertEquals(false, bottomSheetSort.isSheetShowing());
solo.clickOnView(fabMenu);
solo.sleep(500);
solo.clickOnView(menuSort);
solo.sleep(500);
assertEquals(true, bottomSheetSort.isSheetShowing());
solo.clickOnMenuItem("Updated Date");
solo.sleep(500);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return !bottomSheetSort.isSheetShowing();
}
}, 1000);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return !bottomSheetSort.isSheetShowing();
}
}, 1000);
solo.waitForView(feedList);
assertEquals(31, feedList.getAdapter().getItemCount());
}
示例11: openAccounts
import com.robotium.solo.Condition; //导入依赖的package包/类
private void openAccounts() {
mSolo.clickOnMenuItem(getString(R.string.accounts));
assertTrue(mSolo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return getString(R.string.accounts).equals(
getActivity().getSupportActionBar().getSubtitle());
}
}, WAIT_TIMEOUT_MS));
}
示例12: testRun
import com.robotium.solo.Condition; //导入依赖的package包/类
public void testRun() {
int shortDelay = 5000;
int longDelay = 10000;
// Wait for activity:
// 'course.labs.threadslab.TestFrontEndActivity'
solo.waitForActivity(course.labs.asynctasklab.MainActivity.class,
shortDelay);
solo.waitForView(android.R.id.list);
solo.setActivityOrientation(Solo.LANDSCAPE);
solo.waitForActivity(course.labs.asynctasklab.MainActivity.class,
shortDelay);
solo.waitForView(android.R.id.list);
final View listView = solo.getView(android.R.id.list);
solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return listView.isEnabled();
}
}, longDelay);
// Click on taylorswift13
solo.clickOnView(solo.getView(android.R.id.text1));
// Assert that: 'feed_view' is shown
assertTrue("feed_view not shown!", solo.waitForView(solo
.getView(course.labs.asynctasklab.R.id.feed_view)));
// Assert that: 'Taylor Swift' is shown
assertTrue("'Taylor Swift' is not shown!",
solo.searchText("Taylor Swift"));
}
示例13: testSetZeroSteps
import com.robotium.solo.Condition; //导入依赖的package包/类
/**
* Test the zeroSteps setting on first activation and on the manager's method
*/
@SmallTest
public void testSetZeroSteps() {
//Reset everything
String STEPS_PREFERENCE_KEY = "STEPS_PREFERENCE_KEY";
String ZERO_STEPS_PREFERENCE_KEY = "ZERO_STEPS_PREFERENCE_KEY";
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(solo.getCurrentActivity());
sharedPreferences.edit().remove(STEPS_PREFERENCE_KEY)
.remove(ZERO_STEPS_PREFERENCE_KEY)
.remove(SensorStepServiceManager.STEP_COUNTER_ACTIVATED_PREFERENCE_KEY)
.apply();
//Set zero steps on first call
final SensorStepServiceImpl sensorStepService = new SensorStepServiceImpl(solo.getCurrentActivity());
SensorStepServiceManagerImpl.startAutoUpdate(solo.getCurrentActivity());
assertTrue(solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return sensorStepService.getZeroSteps() != 0;
}
}, 60000));
//Set zero steps on method called
sensorStepService.storeRawSteps(sensorStepService.getZeroSteps() + 5);
solo.clickOnText("zero");
assertTrue(solo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return sensorStepService.getZeroSteps() == sensorStepService.getRawSteps();
}
}, 30000));
}
示例14: checkPIComputationWentOK
import com.robotium.solo.Condition; //导入依赖的package包/类
@Override
protected boolean checkPIComputationWentOK() {
mSolo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return mButtonSendPI.isEnabled();
}
}, 5000);
return mButtonSendPI.isEnabled();
}
示例15: checkSendPIWentOK
import com.robotium.solo.Condition; //导入依赖的package包/类
@Override
protected boolean checkSendPIWentOK() {
mSolo.waitForCondition(new Condition() {
@Override
public boolean isSatisfied() {
return mButtonShare.isEnabled();
}
}, 5000);
return mButtonShare.isEnabled();
}