我正在尝试创建一个执行选择的辅助方法(按下按钮)。
public void performPoseSelection(String roomName, int selection) {
onData(anything())
.inAdapterView(withId(android.R.id.list))
.atPosition(selection)
.onChildView(withId(R.id.btn))
.perform(click());
}
public void testPickPose() throws InterruptedException{
performPoseSelection("White Room", 0);
performPoseSelection("White Room", 1);
performPoseSelection("White Room", 1);
performPoseSelection("White Room", 0);
}
我发现结果是不一致的。有时候根本没有选择!其他时候,测试正确执行。是什么导致了这个问题?