예제 #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();
    }
  }
  @TestFirst
  @Test(enabled = true)
  public void setBudgetTest() {

    secondaryBoard = board.getSecondaryBoard();
    BudgetNavigator navigator = new BudgetNavigator();
    navigator.selectRandomBudgetWithPrefix("budget7_144215547406");

    innerBar = board.getInnerBar();
    Assert.assertTrue(innerBar.isDisplayed(), "expected to inner bar to be dislayed");

    secondaryBoard.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);

    innerBar.openViewTab();
    Assert.assertEquals(innerBar.getOpenTab(), "View");
    sheets = new Sheets();
    Assert.assertTrue(sheets.isDisplayed(), "expected to View to be displayed");
    dates = sheets.getAllDates();
    Assert.assertEquals(dates.size(), expectedDates.size());
    for (int i = 0; i < expectedDates.size(); i++) {
      Assert.assertEquals(dates.get(i), expectedDates.get(i));
    }
  }
예제 #3
0
  @Test(enabled = true, priority = 3)
  public void ValidateActualSummary() {
    actuals = new Actuals();

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

    String currency = settings.getSelectedCurrency();
    settings.clickCancel();

    AddTransaction transaction = new AddTransaction();
    transaction.selectSubReportType("Cash contribution");

    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));
      }

      transaction.clickTransactionTab();

      TransactionTable table = new TransactionTable();

      int transactionRows = table.getNumberOfTransactionRows();
      if (transactionRows == 0) {
        transaction.clickAddTransaction();
        DateRange date = table.openDate();
        date.setHireYear("2016");
        date.setHireMonth("Aug");

        table.setAmount("1000");

        if (!currency.equals(table.getCurrentCurrency())) {
          table.selectCurrency(currency);
        }

        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];
        String actualsDate = Month + " " + Year;

        String totalRowValue = table.getTotalValue();
        //		String amountRowValue = table.getAmountValue();
        transaction.clickSummaryTab();
        transaction = new AddTransaction();

        transaction.selectSubReportType("Cash contribution");

        SummaryTable summary = new SummaryTable();

        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(),
            "Summary dates not equals Expected dates as in budget settings ");

        for (int i = 0; i < expectedDates.size(); i++) {
          String getDate = dates.get(i);
          if (getDate.equals(actualsDate)) {
            System.out.println("****************");
            System.out.println(summary.getRowTitleByIndex(row));
            Assert.assertEquals(
                summary.getActualsAmountOfRow(row, "Actuals"),
                totalRowValue,
                "... Row title is: " + rowTitle + ", in header: " + dates.get(i));
          }
        }

      } else if (transactionRows > 0) {
        if (table.sameDateInAllLines()) {
          String totalRowValue = table.getTotalValue();

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

          String actualsDate = Month + " " + Year;

          transaction.clickSummaryTab();
          transaction = new AddTransaction();

          transaction.selectSubReportType("Cash contribution");

          SummaryTable summary = new SummaryTable();

          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(),
              "Summary dates not equals Expected dates as in budget settings ");

          for (int i = 0; i < expectedDates.size(); i++) {
            String getDate = dates.get(i);
            if (getDate.equals(actualsDate)) {
              System.out.println("****************");
              Assert.assertEquals(
                  summary.getActualsAmountOfRow(row, "Actuals"),
                  totalRowValue,
                  "... Row title is: " + rowTitle + ", in header: " + dates.get(i));
            }
          }
        }
      }
    }
  }