Esempio n. 1
0
  @Test
  public void testStableSort() throws Exception {
    page.click(By.id("button_sortid"));
    page.click(By.id("button_sortid"));
    page.click(By.id("button_sortname"));

    String[] idList = {
      "15", "0", "-13.5", "2", "-2", "-1.3", "10.01", "24", "1", "10.7", "3", "33", "10.35",
      "-0.001", "10.3"
    };

    String searchString = "";
    for (int i = 0; i < idList.length; i++) {
      searchString += idList[i] + "{*}";
    }
    page.verifyContains(searchString);

    page.click(By.id("button_sortname"));
    String[] reversedIdList = {
      "10.3", "-0.001", "10.35", "33", "3", "10.7", "1", "-2", "-1.3", "10.01", "24", "2", "-13.5",
      "0", "15"
    };

    searchString = "";
    for (int i = 0; i < reversedIdList.length; i++) {
      searchString += reversedIdList[i] + "{*}";
    }
    page.verifyContains(searchString);
  }
Esempio n. 2
0
  private void verifySortingOrder(By sortIcon, String... values) {
    // check if the rows match the given order of values
    page.click(sortIcon);
    String searchString = "";
    for (int i = 0; i < values.length; i++) {
      searchString += values[i] + "{*}";
    }
    page.verifyContains(searchString);

    // click the sort icon again and check for the reverse order
    page.click(sortIcon);
    searchString = "";
    for (int i = values.length; i > 0; i--) {
      searchString += values[i - 1] + "{*}";
    }
    page.verifyContains(searchString);
  }