// #107185650
  public void testRestoreBudgetItemInDetailPage() {
    assertJoin();
    assertLogInOrJoinScreen(
        false, String.format("*****@*****.**", Calendar.getInstance().getTimeInMillis()), "123456");
    getSolo().goBack();
    getSolo().sleep(WAIT_SHORT_TIME);
    getSolo().clickOnView(getSolo().getView(android.R.id.home));
    getSolo().sleep(WAIT_LONG_TIME);
    //        getSolo().clickOnView(getSolo().getView(R.id.menu_item_title_budgeter));
    getSolo().sleep(WAIT_LONG_TIME);
    assertTitleEquals(getSolo().getString(R.string.fragment_title_budgeter));
    getSolo().waitForDialogToOpen();
    getSolo().goBack();
    getSolo().sleep(WAIT_SHORT_TIME);
    ListView budgeterList = (ListView) getSolo().getView(R.id.budgeter_Listview);
    assertTrue(
        getSolo().waitForCondition(new ListViewNotEmptyCondition(budgeterList), WAIT_ONE_MINITUS));
    getSolo().sleep(WAIT_SHORT_TIME);
    int budgeterCount = budgeterList.getAdapter().getCount();
    int j = 1;
    BudgeterItemPresenter.BudgeterDefaultItemPresenter budgeterDefaultItemPresenter = null;
    for (int i = 0; i < budgeterCount; i++) {
      getSolo().scrollListToLine(budgeterList, i);
      getSolo().sleep(WAIT_LONG_TIME);

      if (budgeterList.getAdapter().getItem(i)
          instanceof BudgeterItemPresenter.BudgeterDefaultItemPresenter) {
        budgeterDefaultItemPresenter =
            (BudgeterItemPresenter.BudgeterDefaultItemPresenter)
                budgeterList.getAdapter().getItem(i);
        getSolo().sleep(WAIT_SHORT_TIME);
        getSolo().scrollListToLine(budgeterList, i - 1);
        getSolo().sleep(WAIT_LONG_TIME);
        View view = budgeterList.getChildAt(i - 1);
        getSolo().scrollViewToSide(view, Solo.RIGHT);
        getSolo().sleep(WAIT_LONG_TIME);
        break;
      }
    }
    assertEquals(true, getSolo().searchText("ARCHIVE"));
    getSolo().clickOnText("ARCHIVE");
    assertWaitForSpinner(BudgeterFragment.BUDGETER_FRAGMENT_TAG, R.id.loading_bar);
    String name = budgeterDefaultItemPresenter.getBudgeterItem().getName();
    assertTrue(!getSolo().searchText(name));
    getSolo().scrollToTop();
    getSolo().clickOnView(getSolo().getView(R.id.menu_inbox));
    getSolo().sleep(WAIT_LONG_TIME);
    getSolo().clickOnActionBarItem(R.id.show_archive_conversations);
    assertWaitForSpinner(BudgeterFragment.BUDGETER_FRAGMENT_TAG, R.id.loading_bar);
    getSolo().sleep(WAIT_LONG_TIME);
    assertTrue(getSolo().searchText(name));
    getSolo().sleep(WAIT_LONG_TIME);

    getSolo().clickOnText(name);
    getSolo().sleep(WAIT_LONG_TIME);
    getSolo().clickOnText("SAVE");
    assertWaitForSpinner(BudgeterDetailPageFragment.FRAGMENT_BUDGETER_ITEM_TAG, R.id.spinner);
    assertTitleEquals(getSolo().getString(R.string.fragment_title_budgeter));
    assertWaitForSpinner(BudgeterFragment.BUDGETER_FRAGMENT_TAG, R.id.loading_bar);
    getSolo().clickOnView(getSolo().getView(R.id.menu_inbox));
    getSolo().sleep(WAIT_LONG_TIME);
    getSolo().clickOnActionBarItem(R.id.show_archive_conversations);
    getSolo().sleep(WAIT_SHORT_TIME);
    assertTrue(getSolo().searchText(name));
    getSolo().sleep(WAIT_LONG_TIME);
  }
  // #106192968
  public void testBudgeterItemDetailPage() {
    assertJoin();
    assertLogInOrJoinScreen(
        false, String.format("*****@*****.**", Calendar.getInstance().getTimeInMillis()), "123456");
    getSolo().goBack();
    getSolo().sleep(WAIT_SHORT_TIME);
    getSolo().clickOnView(getSolo().getView(android.R.id.home));
    getSolo().sleep(WAIT_LONG_TIME);
    //        getSolo().clickOnView(getSolo().getView(R.id.menu_item_title_budgeter));
    getSolo().sleep(WAIT_LONG_TIME);
    assertTitleEquals(getSolo().getString(R.string.fragment_title_budgeter));
    getSolo().waitForDialogToOpen();
    getSolo().goBack();
    getSolo().sleep(WAIT_SHORT_TIME);
    ListView budgeterList = (ListView) getSolo().getView(R.id.budgeter_Listview);
    assertTrue(
        getSolo().waitForCondition(new ListViewNotEmptyCondition(budgeterList), WAIT_ONE_MINITUS));
    getSolo().sleep(WAIT_SHORT_TIME);
    int budgeterCount = budgeterList.getAdapter().getCount();
    int j = 1;
    BudgeterItemPresenter.BudgeterDefaultItemPresenter budgeterDefaultItemPresenter = null;
    for (int i = 0; i < budgeterCount; i++) {
      getSolo().scrollListToLine(budgeterList, i);
      getSolo().sleep(WAIT_LONG_TIME);

      if (budgeterList.getAdapter().getItem(i)
          instanceof BudgeterItemPresenter.BudgeterDefaultItemPresenter) {
        budgeterDefaultItemPresenter =
            (BudgeterItemPresenter.BudgeterDefaultItemPresenter)
                budgeterList.getAdapter().getItem(i);
        getSolo().sleep(WAIT_SHORT_TIME);
        getSolo().scrollListToLine(budgeterList, i - 1);
        getSolo().sleep(WAIT_LONG_TIME);
        getSolo().clickInList(2);
        getSolo().sleep(WAIT_LONG_TIME);
        break;
      }
    }
    assertTitleEquals(getSolo().getString(R.string.budgeter_detail_edit_item_title));
    TextView itemName = (TextView) getSolo().getView(R.id.tv_item_title);
    assertTrue(
        budgeterDefaultItemPresenter
            .getBudgeterItem()
            .getName()
            .equals(itemName.getText().toString()));
    getSolo().searchText(getSolo().getString(R.string.budgeter_detail_item_budget_amount));
    getSolo().searchText(getSolo().getString(R.string.budgeter_detail_item_actual));
    getSolo().searchText(getSolo().getString(R.string.budgeter_detail_item_paid));
    TextView etBudgetAmount = (TextView) getSolo().getView(R.id.tv_item_budgeted_amount);
    String budgetAmount = etBudgetAmount.getText().toString();
    budgetAmount =
        PlannerApplication.isEmptyOrNull(budgetAmount)
            ? "0"
            : budgetAmount.replace("$", "").replace(",", "");
    assertTrue(
        budgetAmount.equals(
            String.valueOf(
                (int) budgeterDefaultItemPresenter.getBudgeterItem().getRecommendedAmount())));

    EditText etActualAmount = (EditText) getSolo().getView(R.id.et_item_actual_spend);
    String actualAmount = etActualAmount.getText().toString();
    actualAmount =
        PlannerApplication.isEmptyOrNull(actualAmount)
            ? "0"
            : actualAmount.replace("$", "").replace(",", "");
    assertTrue(
        actualAmount.equals(
            String.valueOf(
                (int) budgeterDefaultItemPresenter.getBudgeterItem().getActualAmount())));
    getSolo().sleep(WAIT_LONG_TIME);
  }