Example #1
0
  @Test(enabled = true, priority = 1)
  public void addTransaction() {
    actuals = new Actuals();
    int numberOfRows = actuals.getNumbreOfRows();
    for (int row = 0; row < numberOfRows; row++) {
      String rowTitle = actuals.getRowTitleByIndex(row);
      actuals.clickOnLineByIndex(row);
      if (rowTitle.contains(",")) {
        rowTitle = rowTitle.split(",")[1].trim();
        Assert.assertTrue(secondaryBoard.getSelectedLineName().contains(rowTitle));
      }
      AddTransaction transactio = new AddTransaction();
      transactio.clickTransactionTab();
      transactio.clickAddTransaction();

      TransactionTable table = new TransactionTable();

      DateRange date = table.openDate();
      date.setHireYear("2016");
      date.setHireMonth("Aug");

      table.setAmount("1000");

      table.clickSave();

      System.out.println(table.getAmountValue());
      System.out.println(table.getTotalValue());
      System.out.println(table.getTransactionDate());
      //			String Month =
      // BudgetaUtils.getMonthWithIndex(Integer.parseInt(table.getTransactionDate().split("/")[0]));
      //			String Year = table.getTransactionDate().split("/")[1];

      transactio.clickSummaryTab();

      SummaryTable summary = new SummaryTable();

      topHeaderBar.openBudgetSettings();
      BudgetSettings settings = new BudgetSettings();
      String dateFrom = settings.getDateRangeFrom();
      String dateTo = settings.getDateRangeTo();
      settings.clickCancel();

      fromMonth = BudgetaUtils.getMonthWithIndex(Integer.parseInt(dateFrom.split("/")[0]));
      fromYear = dateFrom.split("/")[1];
      toMonth = BudgetaUtils.getMonthWithIndex(Integer.parseInt(dateTo.split("/")[0]));
      toYear = dateTo.split("/")[1];
      List<String> expectedDates =
          BudgetaUtils.getAllMonthsBetweenTwoMonths(fromMonth, fromYear, toMonth, toYear, 0, false);

      summary = new SummaryTable();
      dates = summary.getAllDates();

      Assert.assertEquals(dates.size(), expectedDates.size());

      System.out.println(summary.getAllValuesOfRow(row));

      transactio = new AddTransaction();
      transactio.clickTransactionTab();
    }
  }