public void testScreenElementAutoResizeWithChild() throws InterruptedException {
    int oldX = screenElement.getRightBottom().getX();
    solo.enterText((EditText) textElement.getTextView(), "newnewasdfasdadfadsfasdfnewnewll");

    solo.waitForView(textElement.getTextView()); // better check?
    assertTrue(screenElement.getRightBottom().getX() > oldX);
  }
Esempio n. 2
0
 // Scroll until the view is on the screen if IN_AND_OUT_OF_FOCUS is enabled or if the force
 // parameter is true
 protected void requestView(final View v, boolean force) {
   if (force || isInAndOutFocusEnabled()) {
     home();
     solo.sendKey(Solo.UP); // Solo.waitForView() requires a widget to be focused
     solo.waitForView(v, 1000, true);
   }
   requestFocus(v);
 }
Esempio n. 3
0
  /**
   * The first walkthrough. Documented on the wiki. Starts on the login, ends up navigating to a
   * lesson after logging in.
   */
  @Test
  public void testWalkthroughLoginToDashboardToCoursesToCourseToLesson() {
    // Login first
    EditText user = solo.getEditText(0);
    EditText pass = solo.getEditText(1);
    solo.typeText(user, "*****@*****.**");
    solo.typeText(pass, "password");
    solo.clickOnButton(solo.getString(com.huskysoft.eduki.R.string.login));
    // Need to sleep to allow the activity to finish
    solo.sleep(8000);
    solo.assertCurrentActivity("Wrong activity", MainActivity.class);

    // Click on the all courses button
    solo.clickOnActionBarItem(com.huskysoft.eduki.R.id.action_courses);
    solo.sleep(1000);
    solo.assertCurrentActivity("Did not start the Course list Activity", CoursesListActivity.class);

    // Wait for the courses list to appear
    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.courseListView));
    solo.sleep(1000);
    List<Course> courseList = ((CoursesListActivity) solo.getCurrentActivity()).getCourseList();
    assertNotSame(courseList.size(), 0);
    solo.clickOnText("INTRODUCTION");
    solo.assertCurrentActivity("Wrong activity", CourseActivity.class);

    // Wait for the course page to appear
    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.course_activity));
    solo.sleep(1000);

    // Click a lesson, wait for it to appear
    List<Lesson> lessonList = ((CourseActivity) solo.getCurrentActivity()).getLessonList();
    assertNotSame(lessonList.size(), 0);
    solo.clickOnText(lessonList.get(0).toString());

    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.lessonViewLayoutText));
    solo.sleep(1000);
    String content =
        ((TextView)
                solo.getCurrentActivity()
                    .findViewById(com.huskysoft.eduki.R.id.lessonViewLayoutText))
            .getText()
            .toString();
    assertFalse(content.equals(""));
  }
Esempio n. 4
0
  /**
   * The second test, documented on the wiki. Starts on login. Does not login, instead navigates to
   * a course list and ends up at a quiz.
   */
  @Test
  public void testWalkthroughLoginToCoursesListToCourseToQuiz() {
    // Need to sleep to allow the activity to finish
    solo.clickOnActionBarItem(com.huskysoft.eduki.R.id.action_courses);
    solo.sleep(1000);
    solo.assertCurrentActivity("Did not start the Course list Activity", CoursesListActivity.class);

    // Wait for the courses list to appear
    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.courseListView));
    solo.sleep(1000);
    List<Course> courseList = ((CoursesListActivity) solo.getCurrentActivity()).getCourseList();
    assertNotSame(courseList.size(), 0);
    solo.clickOnText("INTRODUCTION");
    solo.assertCurrentActivity("Wrong activity", CourseActivity.class);

    // Wait for the course page to appear
    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.course_activity));
    solo.sleep(1000);

    // Click a quiz, wait for it to appear
    List<Quiz> quizList = ((CourseActivity) solo.getCurrentActivity()).getQuizList();
    assertNotSame(quizList.size(), 0);
    solo.clickOnText(quizList.get(0).toString());

    solo.waitForView(solo.getView(com.huskysoft.eduki.R.id.quizScrollView));
    solo.sleep(2000); // Sleep to wait for the answers to populate
    List<RadioGroup> answersGroupList =
        ((QuizzesViewActivity) solo.getCurrentActivity()).getAnswerGroup();
    for (int i = 0; i < answersGroupList.size(); i++) {
      RadioGroup current_rg = answersGroupList.get(i);
      List<RadioButton> list_rb = getRadioButtons(current_rg);
      assertTrue(list_rb.size() != 0);
      solo.clickOnView(list_rb.get(0)); // Answer "A" for everything
      solo.sleep(500);
    }
    solo.sleep(1000);
    solo.clickOnButton("SUBMIT");
    solo.waitForActivity(QuizzesResultsActivity.class);
    solo.assertCurrentActivity("Wrong activity", QuizzesResultsActivity.class);
  }