public void testRun() {
   // Wait for activity: 'it.feio.android.omninotes.MainActivity'
   solo.waitForActivity(it.feio.android.omninotes.MainActivity.class, 4000);
   // Set default small timeout to 30522 milliseconds
   Timeout.setSmallTimeout(30522);
   // Click on ImageView
   solo.clickOnView(solo.getView(it.feio.android.omninotes.R.id.fab_expand_menu_button));
   // Click on LinearLayout
   solo.clickOnView(solo.getView(it.feio.android.omninotes.R.id.reminder_layout));
   // Check that no reminder is set
   assertEquals(
       ((TextView) solo.getView(it.feio.android.omninotes.R.id.datetime))
           .getText()
           .toString()
           .length(),
       0);
   // Wait for dialog
   solo.waitForDialogToOpen(5000);
   // Click on Done
   solo.clickOnView(solo.getView(it.feio.android.omninotes.R.id.done));
   // Wait for dialog
   solo.waitForDialogToOpen(5000);
   // Click on Done
   solo.clickOnView(solo.getView(it.feio.android.omninotes.R.id.done_button));
   // Check if a reminder is present
   assertNotNull(
       ((TextView) solo.getView(it.feio.android.omninotes.R.id.datetime)).getText().toString());
   // Click on Empty Text View
   solo.clickOnView(solo.getView(it.feio.android.omninotes.R.id.menu_attachment));
   // Click on Sketch
   solo.clickOnView(solo.getView(it.feio.android.omninotes.R.id.sketch));
   // Draw a line
   solo.drag(222.79372F, 470.5643F, 590.6923F, 1048.4539F, 40);
   // Click on ImageView
   solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));
   // Wait for thumbnail
   solo.sleep(1000);
   // Click on RelativeLayout
   solo.clickInList(1, 0);
   // Wait for activity: 'it.feio.android.omninotes.GalleryActivity'
   assertTrue(
       "it.feio.android.omninotes.GalleryActivity is not found!",
       solo.waitForActivity(it.feio.android.omninotes.GalleryActivity.class));
   // Click on ImageView
   solo.clickOnView(solo.getView(android.widget.ImageView.class, 0));
   // Click on ImageView
   solo.clickOnView(solo.getView(android.widget.ImageView.class, 0));
   // Click on ImageView
   solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));
   // Click on ImageView
   solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));
 }
Esempio n. 2
0
  public void testRun() {
    /** Given: I am logged into a valid user profile starting from the main restaurant list */
    // Wait for activity: 'com.woww.woww.BaseDrawer'
    solo.waitForActivity(com.woww.woww.BaseDrawer.class, 2000);
    // Set default small timeout to 23836 milliseconds
    Timeout.setSmallTimeout(23836);
    // Click on ImageView
    solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));
    // Click on Log In
    solo.clickOnText(java.util.regex.Pattern.quote("Log In"));
    // Wait for activity: 'com.woww.woww.LoginActivity'
    assertTrue(
        "com.woww.woww.LoginActivity is not found!",
        solo.waitForActivity(com.woww.woww.LoginActivity.class));
    // Enter the text: 'changed'
    solo.clearEditText((android.widget.EditText) solo.getView(com.woww.woww.R.id.userName));
    solo.enterText((android.widget.EditText) solo.getView(com.woww.woww.R.id.userName), "changed");
    // Enter the text: 'c'
    solo.clearEditText((android.widget.EditText) solo.getView(com.woww.woww.R.id.password));
    solo.enterText((android.widget.EditText) solo.getView(com.woww.woww.R.id.password), "c");
    // Click on Login
    solo.clickOnView(solo.getView(com.woww.woww.R.id.loginButton));
    // Click on ImageView
    solo.clickOnView(solo.getView(android.widget.ImageButton.class, 0));

    /** When: I go to the profile page */
    // Click on Profile
    solo.clickOnText(java.util.regex.Pattern.quote("Profile"));
    ParseUser user = ParseUser.getCurrentUser();
    TextView profile = (TextView) solo.getView(R.id.profileName);

    /** Then: It is my profile page */
    assertEquals(
        "check that on same user profile as login name", user.getUsername(), profile.getText());

    /** When: When I go to my reviews from the profile page */
    // Long click Restaurant:   Rubio's Rating:   Review:   itwas
    solo.clickLongInList(1, 1);
    // Wait for activity: 'com.woww.woww.ViewUserReviewsActivity'

    /** Then: I am brought to my reviews */
    assertTrue(
        "com.woww.woww.ViewUserReviewsActivity is not found!",
        solo.waitForActivity(com.woww.woww.ViewUserReviewsActivity.class));
    // Press menu back key
    solo.goBack();
    // Press menu back key
    solo.goBack();
  }
Esempio n. 3
0
  public void testRun() throws InterruptedException {
    /*
     GIVEN THAT I AM ON THE MAIN RESTAURANT LIST
    */
    // Wait for activity: 'com.woww.woww.BaseDrawer'
    solo.waitForActivity(com.woww.woww.BaseDrawer.class, 2000);
    // Set default small timeout to 20009 milliseconds
    Timeout.setSmallTimeout(30009);
    // Scroll to ImageView
    android.widget.ListView listView0 =
        (android.widget.ListView) solo.getView(android.widget.ListView.class, 0);

    ArrayList<Restaurant> res;
    solo.scrollListToLine(listView0, 0);
    /*
     WHEN I OPEN THE MENU AND CLICK SORT BY PRICE
    */
    solo.clickOnView(solo.getView(android.widget.ImageView.class, 1));
    solo.clickInList(2, 0);
    Thread.sleep(2000);
    res = getListViewArray((RestaurantListAdapter) listView0.getAdapter());
    /*
    THEN THE LIST SHOULD BE SORTED BY PRICE IN ASCENDING ORDER
    */
    assertTrue(isOrderingValid(res, "price"));
    /*
     WHEN I OPEN THE MENU AND CLICK SORT BY RATING
    */
    solo.clickOnView(solo.getView(android.widget.ImageView.class, 1));
    solo.clickInList(3, 0);
    Thread.sleep(2000);
    res = getListViewArray((RestaurantListAdapter) listView0.getAdapter());
    /*
    THEN THE LIST SHOULD BE SORTED BY RATING IN DESCENDING ORDER
    */
    assertTrue(isOrderingValid(res, "rating"));
    /*
     WHEN I OPEN THE MENU AND CLICK SORT BY NAME
    */
    solo.clickOnView(solo.getView(android.widget.ImageView.class, 1));
    solo.clickInList(1, 0);
    Thread.sleep(5000);
    res = getListViewArray((RestaurantListAdapter) listView0.getAdapter());
    /*
     THEN THE LIST SHOULD BE SORTED BY NAME IN ALPHABETICAL ORDER
    */
    assertTrue(isOrderingValid(res, "name"));
  }
  public void testRun() {
    // Wait for activity: 'course.labs.locationlab.PlaceViewActivity'
    solo.waitForActivity(course.labs.locationlab.PlaceViewActivity.class, 2000);

    // Set default small timeout to 55372 milliseconds
    Timeout.setSmallTimeout(55372);

    // Click on action bar item
    solo.clickOnActionBarItem(course.labs.locationlab.R.id.place_one);

    solo.sleep(2000);

    // Click on Get New Place
    solo.clickOnView(solo.getView(course.labs.locationlab.R.id.footer));

    solo.sleep(5000);

    // Click on action bar item
    solo.clickOnActionBarItem(course.labs.locationlab.R.id.print_badges);
  }
  /**
   * Test method to check if the Sales Management Game is loaded with proper default initialization
   */
  public void testPlayGridActivityLoadedWithData() {

    robotiumSolo.waitForActivity(com.shrikanthavale.salesmanagement.StartPageActivity.class, 2000);
    assertTrue(
        "com.shrikanthavale.salesmanagement.StartPageActivity is not found!",
        robotiumSolo.waitForActivity(com.shrikanthavale.salesmanagement.StartPageActivity.class));
    robotiumSolo.clickOnView(
        robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.startPageStartButton));
    assertTrue(
        "com.shrikanthavale.salesmanagement.PlayGridActivity is not found!",
        robotiumSolo.waitForActivity(com.shrikanthavale.salesmanagement.PlayGridActivity.class));

    Timeout.setSmallTimeout(22015);

    while (true) {

      int randomNumber = (int) (Math.random() * (5 - 1)) + 1;
      System.out.println("****************" + randomNumber);

      switch (randomNumber) {
        case 1:
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));

          break;
        case 2:
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));

        case 3:
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
        case 4:
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.upNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.leftNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.downNavigation));
          robotiumSolo.clickOnView(
              robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.rightNavigation));
        default:
          break;
      }

      if (((PlayGridActivity) robotiumSolo.getCurrentActivity()).checkSufficientTimeCustomerTravel()
          || ((PlayGridActivity) robotiumSolo.getCurrentActivity())
              .checkSufficientTimeCustomerVisit()) {
        robotiumSolo.sendKey(Solo.MENU);
        robotiumSolo.sleep(1000);
        robotiumSolo.waitForText(robotiumSolo.getString(R.string.refreshGrid));
        robotiumSolo.clickOnActionBarItem(R.id.refresh_game);
        robotiumSolo.waitForDialogToOpen();
        robotiumSolo.clickOnButton(robotiumSolo.getString(R.string.popupdialogConfirmButton));
        robotiumSolo.waitForDialogToClose();
        robotiumSolo.waitForDialogToOpen();
        robotiumSolo.waitForDialogToClose();
        continue;
      }

      robotiumSolo.clickOnView(
          robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.confirmSelection));

      // get the current focus button
      Button focusedButton =
          ((PlayGridActivity) robotiumSolo.getCurrentActivity()).getFocusedButton();

      if (focusedButton
              .getText()
              .toString()
              .trim()
              .equals(robotiumSolo.getString(R.string.emptystring))
          || focusedButton.getText().toString().trim().contains("Start")
          || focusedButton.getText().toString().trim().contains("R")) {
        // non customer node was clicked
        assertTrue(
            "Non Customer node clicked error message missing",
            robotiumSolo.searchText(robotiumSolo.getString(R.string.nonnodeclickederrormessage)));
        continue;

      } else if (((PlayGridActivity) robotiumSolo.getCurrentActivity())
          .getVisitedCustomers()
          .contains(focusedButton.getId())) {

        assertTrue(
            "Visited Customer node clicked error message missing",
            robotiumSolo.searchText(robotiumSolo.getString(R.string.alreadyvisitednode)));

        continue;

      } else {
        robotiumSolo.waitForDialogToOpen();
        robotiumSolo.waitForDialogToClose();
        assertTrue(
            "com.shrikanthavale.salesmanagement.CaseStudyDescriptionActivity is not found!",
            robotiumSolo.waitForActivity(
                com.shrikanthavale.salesmanagement.CaseStudyDescriptionActivity.class));
        break;
      }
    }

    robotiumSolo.clickOnView(robotiumSolo.getView(R.id.scrollView1));
    robotiumSolo.scrollDown();
    robotiumSolo.scrollUp();
    robotiumSolo.scrollDown();
    robotiumSolo.scrollUp();

    robotiumSolo.clickOnView(
        robotiumSolo.getView(com.shrikanthavale.salesmanagement.R.id.optionsNavigate));
    robotiumSolo.waitForDialogToOpen();
    assertTrue(
        "Loading Dialogue Missing",
        robotiumSolo.waitForText("Loading Option Details .... Please Wait"));
    robotiumSolo.waitForDialogToClose();
    assertTrue(
        "com.shrikanthavale.salesmanagement.CaseStudyDescriptionActivity is not found!",
        robotiumSolo.waitForActivity(
            com.shrikanthavale.salesmanagement.CaseStudyOptionsActivity.class));

    robotiumSolo.clickOnView(robotiumSolo.getView(R.id.scrollViewOptions));
    robotiumSolo.scrollDown();
    robotiumSolo.scrollUp();
    robotiumSolo.scrollDown();
    robotiumSolo.scrollUp();

    robotiumSolo.clickOnRadioButton(0);
    robotiumSolo.clickOnRadioButton(1);
    robotiumSolo.clickOnRadioButton(2);

    robotiumSolo.clickOnRadioButton(1);

    Display display = robotiumSolo.getCurrentActivity().getWindowManager().getDefaultDisplay();
    Instrumentation inst = getInstrumentation();
    PackageManager pm = robotiumSolo.getCurrentActivity().getPackageManager();

    Monkey monkey = new Monkey(display, packageToTest, inst, pm);

    for (int i = 0; i < NUM_EVENTS; i++) {
      monkey.nextRandomEvent();
    }
  }