Ejemplo n.º 1
0
 @Test
 public void testShowAndHidePopup() {
   CalendarPopup popup = calendar.getPopup();
   executeJSFromElement(showPopup);
   Graphene.waitGui().withMessage("popup should be visible").until(popup.isVisibleCondition());
   executeJSFromElement(hidePopup);
   Graphene.waitGui()
       .withMessage("popup should not be visible")
       .until(popup.isNotVisibleCondition());
 }
Ejemplo n.º 2
0
 @Test
 public void testShowAndHideTimeEditor() {
   calendar.setDateTime(todayMidday.plusMonths(1));
   TimeEditor timeEditor = calendar.getPopup().getFooterControls().getTimeEditor();
   executeJSFromElement(showTimeEditor);
   Graphene.waitGui()
       .withMessage("time editor should be visible")
       .until(timeEditor.isVisibleCondition());
   executeJSFromElement(hideTimeEditor);
   Graphene.waitGui()
       .withMessage("time editor should not be visible")
       .until(timeEditor.isNotVisibleCondition());
 }
Ejemplo n.º 3
0
 @Test
 public void testShowAndHideDateEditor() {
   YearAndMonthEditor yearAndMonthEditor =
       calendar.getPopup().getHeaderControls().getYearAndMonthEditor();
   executeJSFromElement(showDateEditor);
   Graphene.waitGui()
       .withMessage("year and month editor should be visible")
       .until(yearAndMonthEditor.isVisibleCondition());
   executeJSFromElement(hideDateEditor);
   Graphene.waitGui()
       .withMessage("year and month editor should not be visible")
       .until(yearAndMonthEditor.isNotVisibleCondition());
 }
Ejemplo n.º 4
0
  public void testMoveWithSlider() {
    moveWithSliderActionWithWaitRequest(0).perform();
    Graphene.waitGui().until().element(output).text().equalTo("-10");
    assertEquals(slider.advanced().getInput().getStringValue(), "-10", "Input was not updated.");
    assertEquals(output.getText(), "-10", "Output was not updated.");

    moveWithSliderActionWithWaitRequest(35).perform();
    Graphene.waitGui().until().element(output).text().equalTo("-7");
    assertEquals(slider.advanced().getInput().getStringValue(), "-7", "Input was not updated.");
    assertEquals(output.getText(), "-7", "Output was not updated.");

    moveWithSliderActionWithWaitRequest(slider.advanced().getWidth()).perform();
    Graphene.waitGui().until().element(output).text().equalTo("10");
    assertEquals(slider.advanced().getInput().getStringValue(), "10", "Input was not updated.");
    assertEquals(output.getText(), "10", "Output was not updated.");
  }
  protected void checkContextMenuRenderedAtCorrectPosition(
      WebElement target,
      WebElement contextMenuPopup,
      InvocationType type,
      ExpectedCondition<Boolean> conditionTargetIsFocused) {

    if (conditionTargetIsFocused != null) {
      target.click();
      Graphene.waitGui(webDriver).withTimeout(2, TimeUnit.SECONDS).until(conditionTargetIsFocused);
    }
    waitGui();

    // clicks in the middle of the target
    switch (type) {
      case LEFT_CLICK:
        actions.click(target);
        break;
      case RIGHT_CLICK:
        actions.contextClick(target);
        break;
      default:
        throw new IllegalArgumentException("Wrong type of context menu invocation!");
    }
    actions.build().perform();

    Graphene.waitGui()
        .withTimeout(2, TimeUnit.SECONDS)
        .until()
        .element(contextMenuPopup)
        .is()
        .visible();

    Point locationOfTarget = target.getLocation();
    Point locationOfCtxMenu = contextMenuPopup.getLocation();

    double witdth = getTargetWidth(target);
    double height = getTargetHeight(target);

    double halfOfDiagonal = Math.sqrt((height * height) + (witdth * witdth)) / 2.0;
    double distance = getDistance(locationOfTarget, locationOfCtxMenu);

    double result = halfOfDiagonal - distance;

    assertTrue(
        result >= 0 && result < TOLERANCE,
        "The context menu was not rendered on the correct position! The difference is: " + result);
  }
Ejemplo n.º 6
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);
  }
 public void setNonBlocking(final boolean nonBlocking) {
   if (nonBlockingCheckBox.isSelected() != nonBlocking) {
     actions.moveToElement(nonBlockingCheckBox).click().build().perform();
     Graphene.waitGui()
         .until(
             new Predicate<WebDriver>() {
               @Override
               public boolean apply(WebDriver input) {
                 return nonBlockingOpacityInput.isEnabled() == nonBlocking;
               }
             });
   }
 }
Ejemplo n.º 8
0
  public void testClickRightArrow() {
    int startValue = slider.advanced().getInput().getIntValue();
    int clicks = 1;

    inputNumberSliderAttributes.set(InputNumberSliderAttributes.showArrows, Boolean.TRUE);

    MetamerPage.waitRequest(slider, WaitRequestType.XHR).increase();

    Graphene.waitGui()
        .until("Output was not updated.")
        .element(output)
        .text()
        .equalTo(String.valueOf(startValue + clicks));
  }
Ejemplo n.º 9
0
  @Test
  public void testValidation() {
    String goodText = "1234";
    String longText = "1234567";
    assertEquals(input.getAttribute("value"), AbstractPlaceholderJSFTest.DEFAULT_PLACEHOLDER_TEXT);
    assertFalse(msg.isVisible(), "Validation message should not be visible");

    typeTextAndBlur(goodText);
    assertEquals(input.getAttribute("value"), goodText);
    assertFalse(msg.isVisible(), "Validation message should not be visible");

    typeTextAndBlur("");
    Graphene.waitGui().until(msg.isVisibleCondition());
    assertEquals(input.getAttribute("value"), AbstractPlaceholderJSFTest.DEFAULT_PLACEHOLDER_TEXT);
    assertTrue(msg.isVisible(), "Validation message should  be visible");

    typeTextAndBlur(goodText);
    Graphene.waitGui().until(msg.isNotVisibleCondition());

    typeTextAndBlur(longText);
    Graphene.waitGui().until(msg.isVisibleCondition());
    assertEquals(input.getAttribute("value"), longText);
    assertTrue(msg.isVisible(), "Validation message should  be visible");
  }
Ejemplo n.º 10
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);
  }
Ejemplo n.º 11
0
  @Test(groups = "smoke")
  public void testInit() {
    assertPresent(fileMenu, "Drop down menu \"File\" should be present on the page");
    assertVisible(fileMenu, "Drop down menu \"File\" should be visible on the page");

    assertPresent(group, "Menu group \"Save As...\" should be present on the page");
    assertNotVisible(group, "Menu group \"Save As...\" should not be visible on the page");

    assertNotVisible(fileMenuList, "Menu should not be expanded.");
    Graphene.guardNoRequest(fileDropDownMenu).advanced().show(target1);
    assertVisible(fileMenuList, "Menu should be expanded.");

    assertPresent(group, "Menu group \"Save As...\" should be present on the page");
    assertVisible(group, "Menu group \"Save As...\" should be visible on the page");

    assertPresent(menuItem41, "Menu item \"Save\" should be present on the page");
    assertNotVisible(menuItem41, "Menu item \"Save\" should not be visible on the page");

    assertNotVisible(groupList, "Submenu should not be expanded.");
    Graphene.guardNoRequest(group).click();
    Graphene.waitGui()
        .withMessage("Submenu should be expanded.")
        .until()
        .element(group)
        .is()
        .visible();

    assertPresent(menuItem41, "Menu item \"Save\" should be present on the page");
    assertVisible(menuItem41, "Menu item \"Save\" should be visible on the page");

    assertNotPresent(icon, "Icon of menu group should not be present on the page");

    assertPresent(fileMenuLabel, "Label of menu should be present on the page");
    assertVisible(fileMenuLabel, "Label of menu should be visible on the page");
    assertEquals(fileMenuLabel.getText(), "File", "Label of the menu");
  }
 public void startWebView() {
   startWebViewButton.click();
   Graphene.waitGui().until().element(startWebViewButton).is().not().visible();
 }
 public void startUserRegistration() {
   startUserRegistration.click();
   Graphene.waitGui().until().element(startUserRegistration).is().not().visible();
 }
Ejemplo n.º 14
0
 private String getGettersValue() {
   Graphene.waitGui().until(Graphene.attribute(gettersValue, "value").not().valueEquals(""));
   return gettersValue.getAttribute("value");
 }
Ejemplo n.º 15
0
 private void openMenuAndSubMenu() {
   openMenu();
   new Actions(driver).click(group).perform();
   Graphene.waitGui().until().element(groupList).is().visible();
 }