コード例 #1
0
 public void checkShowSummary() {
   messageAttributes.set(MessageAttributes.showDetail, Boolean.TRUE);
   messageAttributes.set(MessageAttributes.showSummary, Boolean.TRUE);
   generateValidationMessagesWithWait();
   assertVisible(
       getMessageComponentForFirstInput().advanced().getSummaryElement(),
       "Message should be visible.");
   assertVisible(
       getMessageComponentForSecondInput().advanced().getSummaryElement(),
       "Message should be visible.");
   assertVisible(
       getMessageComponentForSelectableInput().advanced().getSummaryElement(),
       "Message should be visible.");
   messageAttributes.set(MessageAttributes.showSummary, Boolean.FALSE);
   generateValidationMessagesWithWait();
   assertNotVisible(
       getMessageComponentForFirstInput().advanced().getSummaryElement(),
       "Message should not be visible.");
   assertNotVisible(
       getMessageComponentForSecondInput().advanced().getSummaryElement(),
       "Message should not be visible.");
   assertNotVisible(
       getMessageComponentForSelectableInput().advanced().getSummaryElement(),
       "Message should not be visible.");
 }
コード例 #2
0
  public void testMode() {
    updateDropDownMenuInvoker();
    // ajax
    dropDownMenuAttributes.set(DropDownMenuAttributes.mode, "ajax");
    getCurrentMenu().advanced().show(page.getTarget1());
    guardAjax(getCurrentMenu().advanced().getItemsElements().get(0)).click();
    assertEquals(page.getOutput().getText(), "New", "Menu action was not performed.");

    // server
    dropDownMenuAttributes.set(DropDownMenuAttributes.mode, "server");
    getCurrentMenu().advanced().show(page.getTarget1());
    guardHttp(getCurrentMenu().advanced().getItemsElements().get(8)).click();
    assertEquals(page.getOutput().getText(), "Close", "Menu action was not performed.");

    // client
    dropDownMenuAttributes.set(DropDownMenuAttributes.mode, "client");
    getCurrentMenu().advanced().show(page.getTarget1());
    guardNoRequest(getCurrentMenu().advanced().getItemsElements().get(0)).click();

    // null
    dropDownMenuAttributes.set(DropDownMenuAttributes.mode, "server");
    getCurrentMenu().advanced().show(page.getTarget1());
    guardHttp(getCurrentMenu().advanced().getItemsElements().get(8)).click();
    assertEquals(page.getOutput().getText(), "Close", "Menu action was not performed.");
  }
コード例 #3
0
 protected void increase(int count) {
   Double maxValue =
       Double.parseDouble(inputNumberSpinnerAttributes.get(InputNumberSpinnerAttributes.maxValue));
   Boolean cycled =
       Boolean.parseBoolean(inputNumberSpinnerAttributes.get(InputNumberSpinnerAttributes.cycled));
   Double actValue;
   WaitRequestType type;
   for (int i = 0; i < count; i++) {
     actValue = Double.parseDouble(spinner.advanced().getInput().getStringValue());
     type = (actValue < maxValue || cycled ? WaitRequestType.XHR : WaitRequestType.NONE);
     MetamerPage.waitRequest(spinner, type).increase();
   }
 }
コード例 #4
0
  public void testShowEvent() {
    dropDownMenuAttributes.set(DropDownMenuAttributes.showEvent, "contextmenu");
    getCurrentMenu().advanced().setupShowEvent(Event.CONTEXTCLICK);
    getCurrentMenu().advanced().show(page.getTarget1());

    dropDownMenuAttributes.set(DropDownMenuAttributes.showEvent, "mouseover");
    getCurrentMenu().advanced().setupShowEvent(Event.MOUSEOVER);
    getCurrentMenu().advanced().show(page.getTarget1());

    dropDownMenuAttributes.set(DropDownMenuAttributes.showEvent, "click");
    getCurrentMenu().advanced().setupShowEvent(Event.CLICK);
    getCurrentMenu().advanced().show(page.getTarget1());
  }
コード例 #5
0
 public void testStyleClass() {
   updateDropDownMenuInvoker();
   String styleClassVal = "test-style-class";
   dropDownMenuAttributes.set(DropDownMenuAttributes.styleClass, styleClassVal);
   String styleClass = getCurrentMenu().advanced().getTopLevelElement().getAttribute("class");
   assertTrue(styleClass.contains(styleClassVal));
 }
コード例 #6
0
  @Test
  public void testSwitchTypeClient() {
    accordionItemAttributes.set(AccordionItemAttributes.switchType, "client");

    guardNoRequest(page.getItemHeaders().get(0)).click();
    waitGui(driver).until().element(page.getItemContents().get(0)).is().visible();
  }
コード例 #7
0
  @Test
  @Templates("plain")
  public void testSwitchTypeAjax() {
    accordionItemAttributes.set(AccordionItemAttributes.switchType, "ajax");

    testSwitchTypeNull();
  }
コード例 #8
0
  @Test
  public void testSwitchTypeServer() {
    accordionItemAttributes.set(AccordionItemAttributes.switchType, "server");

    guardHttp(page.getItemHeaders().get(0)).click();
    waitModel(driver).until().element(page.getItemContents().get(0)).is().visible();
  }
コード例 #9
0
  public void checkFor() {
    // firstly, remove value from attribute @for and generate message
    messageAttributes.set(MessageAttributes.FOR, "");
    generateValidationMessages();
    submitWithA4jBtn();
    assertFalse(
        getMessageComponentForSelectableInput().advanced().isVisible(),
        "Message should not be visible.");

    // now set for attribute back to "simpleInput2"
    messageAttributes.set(MessageAttributes.FOR, "simpleInput2");
    generateValidationMessagesWithWait();
    assertTrue(
        getMessageComponentForSelectableInput().advanced().isVisible(),
        "Message should be visible.");
  }
コード例 #10
0
  public void checkAjaxRendered() {
    generateValidationMessagesWithWait();
    assertTrue(
        getMessageComponentForFirstInput().advanced().isVisible(), "Message should be visible.");
    assertTrue(
        getMessageComponentForSecondInput().advanced().isVisible(), "Message should be visible.");
    assertTrue(
        getMessageComponentForSelectableInput().advanced().isVisible(),
        "Message should be visible.");

    messageAttributes.set(MessageAttributes.ajaxRendered, Boolean.FALSE);
    generateValidationMessagesWithWait();
    assertFalse(
        getMessageComponentForFirstInput().advanced().isVisible(),
        "Message should not be visible.");
    assertFalse(
        getMessageComponentForSecondInput().advanced().isVisible(),
        "Message should not be visible.");
    assertFalse(
        getMessageComponentForSelectableInput().advanced().isVisible(),
        "Message should not be visible.");
    // submit with h:commandbutton
    MetamerPage.waitRequest(getPage().gethCommandButton(), WaitRequestType.HTTP).click();
    assertTrue(
        getMessageComponentForFirstInput().advanced().isVisible(), "Message should be visible.");
    assertTrue(
        getMessageComponentForSecondInput().advanced().isVisible(), "Message should be visible.");
    assertTrue(
        getMessageComponentForSelectableInput().advanced().isVisible(),
        "Message should be visible.");
  }
コード例 #11
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();
 }
コード例 #12
0
  @Test
  @Templates("plain")
  @RegressionTest("https://issues.jboss.org/browse/RF-10297")
  public void testHeaderDisabledClass() {
    accordionItemAttributes.set(AccordionItemAttributes.disabled, true);

    testStyleClass(page.getDisabledHeaders().get(0), headerDisabledClass);
  }
コード例 #13
0
  public void checkNoShowDetailNoShowSummary() {
    messageAttributes.set(MessageAttributes.showSummary, Boolean.FALSE);
    messageAttributes.set(MessageAttributes.showDetail, Boolean.FALSE);

    generateValidationMessages();
    submitWithA4jBtn();

    assertFalse(
        getMessageComponentForFirstInput().advanced().isVisible(),
        "Message should not be visible.");
    assertFalse(
        getMessageComponentForSecondInput().advanced().isVisible(),
        "Message should not be visible.");
    assertFalse(
        getMessageComponentForSelectableInput().advanced().isVisible(),
        "Message should not be visible.");
  }
コード例 #14
0
 @Test
 @Templates("plain")
 public void testLabel() {
   String testedLabel = "new label";
   menuGroupAttributes.set(MenuGroupAttributes.label, testedLabel);
   openMenuAndSubMenu();
   assertEquals(label.getText(), testedLabel, "New label of the menu group.");
 }
コード例 #15
0
  @Test(groups = "smoke")
  @RegressionTest("https://issues.jboss.org/browse/RF-9989")
  @Templates(value = "plain")
  public void testIcon() {
    menuGroupAttributes.set(MenuGroupAttributes.icon, "null");
    assertNotPresent(icon, "Icon should not be present.");
    assertPresent(emptyIcon, "Empty icon should be present.");

    menuGroupAttributes.set(MenuGroupAttributes.icon, "star");
    assertTrue(
        icon.getAttribute("src").contains("star.png"),
        "Icon's src attribute should contain \"star.png\".");

    menuGroupAttributes.set(MenuGroupAttributes.icon, "nonexisting");
    assertTrue(
        icon.getAttribute("src").contains("nonexisting"),
        "Icon's src attribute should contain \"nonexisting\".");
  }
コード例 #16
0
  @Test
  public void testDisabled() {
    menuGroupAttributes.set(MenuGroupAttributes.disabled, Boolean.TRUE);

    assertTrue(
        group.getAttribute("class").contains("rf-ddm-itm-dis"),
        "Menu group should have class \"rf-ddm-itm-dis\".");
    assertPresent(emptyIcon, "Empty icon should be present.");
    assertNotPresent(icon, "Icon should not be present.");
  }
コード例 #17
0
  public void testDir() {
    updateDropDownMenuInvoker();
    String expected = "rtl";
    dropDownMenuAttributes.set(DropDownMenuAttributes.dir, expected);

    getCurrentMenu().advanced().show(page.getTarget1());
    String directionCSS =
        getCurrentMenu().advanced().getItemsElements().get(0).getCssValue("direction");
    assertEquals(directionCSS, expected, "The direction attribute was not applied correctly!");
  }
コード例 #18
0
  public void testLang() {
    updateDropDownMenuInvoker();
    String langVal = "cs";
    dropDownMenuAttributes.set(DropDownMenuAttributes.lang, langVal);
    getCurrentMenu().advanced().show(page.getTarget1());

    assertEquals(
        getCurrentMenu().advanced().getLangAttribute(),
        langVal,
        "The lang attribute was not set correctly!");
  }
コード例 #19
0
  @Test
  @Templates(value = {"plain"})
  public void testPreviousItemWithCycledSwitching() {
    attributes.set(AccordionAttributes.cycledSwitching, Boolean.TRUE);

    prevItemButton.click();
    assertEquals(valueOutput.getStringValue(), "item5");

    Graphene.guardAjax(switchTo5Button).click();
    prevItemButton.click();
    assertEquals(valueOutput.getStringValue(), "item4");
  }
コード例 #20
0
  public void testDisabled() {
    updateDropDownMenuInvoker();
    getCurrentMenu().advanced().show(page.getTarget1());

    dropDownMenuAttributes.set(DropDownMenuAttributes.disabled, true);

    try {
      getCurrentMenu().advanced().show(page.getTarget1());
      fail("The context menu should not be invoked when disabled!");
    } catch (TimeoutException ex) {
      // OK
    }
  }
コード例 #21
0
 @Test
 @Templates(value = "plain")
 public void testColumnClasses() {
   String testedClass = "metamer-ftest-class";
   pickListAttributes.set(PickListAttributes.columnClasses, testedClass);
   for (SelectableListItem li : picklist.advanced().getSourceList().getItems()) {
     for (WebElement e : li.getRootElement().findElements(By.tagName("td"))) {
       assertTrue(
           e.getAttribute("class").contains(testedClass),
           "Item @class should contain " + testedClass);
     }
   }
 }
コード例 #22
0
 @Test
 public void testResize() {
   popupPanelAttributes.set(PopupPanelAttributes.maxHeight, 420);
   popupPanelAttributes.set(PopupPanelAttributes.maxWidth, 420);
   popupPanelAttributes.set(PopupPanelAttributes.height, 400);
   popupPanelAttributes.set(PopupPanelAttributes.width, 400);
   openPopupPanel();
   int widthBefore = panel.advanced().getLocations().getWidth();
   int heightBefore = panel.advanced().getLocations().getHeight();
   Assert.assertEquals(widthBefore, 400, TOLERANCE);
   Assert.assertEquals(heightBefore, 400, TOLERANCE);
   resize.click(); // resizes by 10x10
   Assert.assertEquals(panel.advanced().getLocations().getWidth(), 410, TOLERANCE);
   Assert.assertEquals(panel.advanced().getLocations().getHeight(), 410, TOLERANCE);
   resize.click(); // resizes by 10x10
   Assert.assertEquals(panel.advanced().getLocations().getWidth(), 420, TOLERANCE);
   Assert.assertEquals(panel.advanced().getLocations().getHeight(), 420, TOLERANCE);
   resize.click(); // resizes by 10x10, resize over max width/height, width/height stays at its
   // maximum
   Assert.assertEquals(panel.advanced().getLocations().getWidth(), 420, TOLERANCE);
   Assert.assertEquals(panel.advanced().getLocations().getHeight(), 420, TOLERANCE);
 }
コード例 #23
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));
  }
コード例 #24
0
 public void checkRendered() {
   messageAttributes.set(MessageAttributes.rendered, Boolean.TRUE);
   generateValidationMessagesWithWait();
   assertTrue(
       getMessageComponentForFirstInput().advanced().isVisible(), "Message should be visible.");
   assertTrue(
       getMessageComponentForSecondInput().advanced().isVisible(), "Message should be visible.");
   assertTrue(
       getMessageComponentForSelectableInput().advanced().isVisible(),
       "Message should be visible.");
   messageAttributes.set(MessageAttributes.rendered, Boolean.FALSE);
   generateValidationMessages();
   submitWithA4jBtn();
   assertFalse(
       getMessageComponentForFirstInput().advanced().isVisible(),
       "Message should not be visible.");
   assertFalse(
       getMessageComponentForSecondInput().advanced().isVisible(),
       "Message should not be visible.");
   assertFalse(
       getMessageComponentForSelectableInput().advanced().isVisible(),
       "Message should not be visible.");
 }
コード例 #25
0
 public void testStyle() {
   updateDropDownMenuInvoker();
   String color = "yellow";
   String styleVal = "background-color: " + color + ";";
   dropDownMenuAttributes.set(DropDownMenuAttributes.style, styleVal);
   getCurrentMenu().advanced().show(page.getTarget1());
   String backgroundColor =
       getCurrentMenu().advanced().getTopLevelElement().getCssValue("background-color");
   // webdriver retrieves the color in rgba format
   assertEquals(
       ContextMenuSimplePage.trimTheRGBAColor(backgroundColor),
       "rgba(255,255,0,1)",
       "The style was not applied correctly!");
 }
コード例 #26
0
  @Test
  @Templates("plain")
  public void testRightDisabledIcon() {
    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
      }
    }

    accordionItemAttributes.set(AccordionItemAttributes.disabled, true);

    verifyStandardIcons(
        AccordionItemAttributes.rightDisabledIcon, page.getRightDisabledIcon(), image, "-dis");
  }
コード例 #27
0
  public void testHideDelay(int delay) {
    dropDownMenuAttributes.set(DropDownMenuAttributes.showDelay, 0);
    updateDropDownMenuInvoker();
    getCurrentMenu().advanced().setupHideDelay(delay);

    testDelay(
        new Action() {
          @Override
          public void perform() {
            getCurrentMenu().advanced().show(page.getTarget1());
          }
        },
        new Action() {
          @Override
          public void perform() {
            getCurrentMenu().advanced().hide();
          }
        },
        "hideDelay",
        delay);
  }
コード例 #28
0
  public void testShowDelay(int delay) {
    dropDownMenuAttributes.set(DropDownMenuAttributes.hideDelay, 0);
    updateDropDownMenuInvoker();
    getCurrentMenu().advanced().setupShowDelay(delay);

    testDelay(
        new Action() {
          @Override
          public void perform() {
            try {
              getCurrentMenu().advanced().hide();
            } catch (IllegalStateException ignored) {
            }
          }
        },
        new Action() {
          @Override
          public void perform() {
            getCurrentMenu().advanced().show(page.getTarget1());
          }
        },
        "showDelay",
        delay);
  }
コード例 #29
0
 @Test
 @Templates(value = "plain")
 public void testRendered() {
   menuGroupAttributes.set(MenuGroupAttributes.rendered, false);
   assertNotPresent(group, "Menu group should not be rendered when rendered=false.");
 }
コード例 #30
0
 @Test
 @Templates("plain")
 public void testRendered() {
   accordionItemAttributes.set(AccordionItemAttributes.rendered, false);
   assertNotPresent(testElement, "Item1 should not be rendered when rendered=false.");
 }