Exemplo n.º 1
0
 private Component(String name) {
   final String id =
       name.substring(0, 1).toLowerCase()
           + WordUtils.capitalize(name).replace(" ", "").substring(1);
   GrapheneContext context = GrapheneContext.getContextFor(Default.class);
   final WebDriver browser = context.getWebDriver();
   this.select =
       GrapheneProxy.getProxyForHandler(
           GrapheneContextualHandler.forFuture(
               context,
               new GrapheneProxy.FutureTarget() {
                 @Override
                 public Object getTarget() {
                   return new Select(
                       browser.findElement(By.cssSelector("select[id$=" + id + "Select]")));
                 }
               }),
           Select.class);
   this.output =
       WebElementUtils.findElementLazily(
           By.cssSelector("span[id$=" + id + "ValueOutput]"), browser);
   this.input =
       WebElementUtils.findElementLazily(
           ByJQuery.selector("input:text[id$=" + id + "ValueInput]"), browser);
   this.link =
       WebElementUtils.findElementLazily(
           ByJQuery.selector("input:submit[id$=" + id + "ValueButton]"), browser);
   this.executeOption = name;
 }
 @Override
 public int getNumberOfColumns() {
   if (rowElements.isEmpty()) {
     return 0;
   }
   return rowElements.get(0).findElements(ByJQuery.selector(JQUERY_SEL_COLUMN)).size();
 }
  public ResourceTableFragment getResourceTable() {
    By selector = ByJQuery.selector(".default-cell-table[role='grid']:visible");
    WebElement tableRoot = getContentRoot().findElement(selector);
    ResourceTableFragment table =
        Graphene.createPageFragment(ResourceTableFragment.class, tableRoot);

    return table;
  }
Exemplo n.º 4
0
 @Test
 @RegressionTest("https://issues.jboss.org/browse/RF-10488")
 public void testName() {
   accordionItemAttributes.set(AccordionItemAttributes.name, "new name");
   guardAjax(driver.findElement(ByJQuery.selector("input[type=submit][name$=switchButtonCustom]")))
       .click();
   waitAjax(driver).until().element(page.getItemContents().get(0)).is().visible();
 }
Exemplo n.º 5
0
  private void waitForNewLine() {
    String emptyNameLabel = PropUtils.get("editor.shared.property.empty.key.label");

    String emptyValueLabel = PropUtils.get("editor.shared.property.empty.value.label");
    By selector =
        ByJQuery.selector(
            "tr:contains('" + emptyNameLabel + "')" + ":contains('" + emptyValueLabel + "')");

    Graphene.waitGui().until().element(getTable().getRoot(), selector);
  }
Exemplo n.º 6
0
  private ResourceTableRowFragment clickAddButton() {
    String cssClass = PropUtils.get("editor.shared.property.add.id");
    By selector = ByJQuery.selector("button[id$='" + cssClass + "']");
    WebElement button = root.findElement(selector);

    button.click();
    waitForNewLine();

    ResourceTableRowFragment row = getTable().getLastRow();

    return row;
  }
Exemplo n.º 7
0
 /**
  * Navigates to target item step by step
  *
  * @return target item
  */
 public TreeNavigationGroup navigateToTreeItem() {
   TreeNavigationGroup current =
       new TreeNavigationGroup(root.findElement(ByJQuery.selector("> div:nth-child(2)")));
   logger.debug(
       "Top level {}: '{}'",
       TreeNavigationGroup.class.getSimpleName(),
       current.getRoot().getAttribute("innerHTML"));
   for (String step : steps) {
     logger.debug("Navigating to next subtree with root label '{}'.", step);
     current = current.openSubTreeIfNotOpen().getDirectChildByLabel(step);
   }
   return current;
 }
Exemplo n.º 8
0
  private void setTextValue(ResourceTableRowFragment row, int index, String text) {
    WebElement cell = row.getCell(index);
    cell.click();

    By selector = ByJQuery.selector("input");

    Graphene.waitModel().until().element(cell, selector).is().present();

    WebElement input = cell.findElement(selector);

    input.clear();

    input.sendKeys(text);

    Graphene.waitGui().until().element(input).attribute("value").contains(text);
  }
 @Override
 public List<RECORD> getRecordsInRow(int rowIndex) {
   List<RECORD> result = new ArrayList<RECORD>();
   if (getNumberOfRows() - 1 > rowIndex) {
     throw new IllegalArgumentException(
         "There is not so many rows! Requesting: "
             + rowIndex
             + ", but there is only: "
             + getNumberOfRows());
   }
   List<WebElement> recordsInParticularRow =
       rowElements.get(rowIndex).findElements(ByJQuery.selector(JQUERY_SEL_RECORD));
   for (WebElement recordRoot : recordsInParticularRow) {
     result.add(Graphene.createPageFragment(recordClass, recordRoot));
   }
   return result;
 }
Exemplo n.º 10
0
  @Test
  @Templates("plain")
  public void testRightInactiveIcon() {
    By image = By.cssSelector(page.getRightIconSelector() + " img");

    // icon should not be locateable
    for (int i = 1; i < 6; i++) {
      try {
        driver.findElement(
            ByJQuery.selector(page.getRightIconSelector().replace("1", String.valueOf(i))));
      } catch (NoSuchElementException e) {
        // ok
      }
    }

    verifyStandardIcons(
        AccordionItemAttributes.rightInactiveIcon, page.getRightInactiveIcon(), image, "");
  }
Exemplo n.º 11
0
  @Test
  @Templates("plain")
  public void testRightActiveIcon() {
    By image = By.cssSelector(page.getRightIconSelector() + " img");

    // icon should not be locateable
    for (int i = 1; i < 6; i++) {
      try {
        driver.findElement(
            ByJQuery.selector(page.getRightIconSelector().replace("1", String.valueOf(i))));
      } catch (NoSuchElementException e) {
        // ok
      }
    }
    guardAjax(page.getItemHeaders().get(0)).click();
    waitAjax(driver).until().element(page.getItemContents().get(0)).is().visible();
    verifyStandardIcons(
        AccordionItemAttributes.rightActiveIcon, page.getRightActiveIcon(), image, "");
  }