に新しいOnTouchListenerを設定したとき、私は、このテストエスプレッソのクリックアクションが動作しない、私はボタン
@Test
public void theTimeViewMustBeDisplayedAfterRecordButtonClick(){
onView(withId(R.id.btn_record)).perform(click());
onView(withId(R.id.tempo)).check(matches(isDisplayed()));
}
を持っていますが、私のR.id.btn_record
は私のテストを実行すると、このテストはロックオンこのOnTouchListener
public View.OnTouchListener getOnTouchListener(){
return new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
status.setText(R.string.record_status_message);
status.setTextColor(Color.BLUE);
tempo.setAnimation(getPulse());
presenter.startRecord(getActivity().getFilesDir().getPath(), UUID.randomUUID().toString());
return true;
case MotionEvent.ACTION_UP:
status.setText(R.string.default_status_message);
status.setTextColor(Color.BLACK);
tempo.clearAnimation();
presenter.stopRecord();
return true;
}
return false;
}
};
}
を持っていますこの行
と何も起こりませんが、OnTouchListenerを削除すると、テストは正常に実行されます、なぜですか?何か案が?
完全なコード:おそらく、この問題を解決することができますUiControllerからMotionEventを使用してhttps://github.com/faeldix/faeldix-android-microphone-mvp
があなたのケースを壊し、そして試してください – W4R10CK