jeudi 8 octobre 2015

Android UI Test --one activity, two fragments, cannot get the second fragment

Following is my ui test codes: one activity : DocumentActivity;
two fragment are: DocumentApproveFragment & DocumentOperationFragment;

    boolean started = solo.waitForActivity(DocumentActivity.class, WAIT_ACTIVITY_TIME_OUT);
    assertTrue("DocumentActivity not started", started);
    documentOperationActivity = solo.getCurrentActivity();
    waitForFragment(documentOperationActivity, DocumentApproveFragment.class.getName());// this is the first fragment, i can get it 

    rejectBtn = (Button) documentOperationActivity.findViewById(R.id.reject_btn);
    assertNotNull(rejectBtn);
    solo.clickOnView(rejectBtn);// After click the btn, the second fragment will be added in the source code

    waitForFragment(documentOperationActivity, DocumentOperationFragment.class.getName());// this is the second fragment, but i can't get this fragment, the log tips me this fragment is not showed.

so why?

Aucun commentaire:

Enregistrer un commentaire