Пример #1
0
 /**
  * Simplified method to verify skin influence editor's class attribute. Choosen skin should be
  * present as cke_skin_{@skinName} class in editor's container @@class attribute
  *
  * @param skinName
  */
 private void verifySkin(String skinName) {
   editorAttributes.set(skin, skinName);
   String editorClass = selenium.getAttribute(editor.getAttribute(new Attribute("class")));
   assertTrue(
       editorClass.contains("cke_skin_" + skinName),
       "Seems that skin '" + skinName + "' didn't influence editor's @class attribute!");
 }
Пример #2
0
  @Test
  @RegressionTest("https://issues.jboss.org/browse/RFPL-1658")
  public void testReadonly() {

    editorAttributes.set(readonly, Boolean.TRUE);

    String readOnlyAttrVal =
        selenium.getAttribute(editorTextArea.getAttribute(new Attribute("readonly")));
    assertEquals(readOnlyAttrVal, "readonly");

    selenium.selectFrame(frameLocator);
    String contentEditableVal =
        selenium.getAttribute(editorArea.getAttribute(new Attribute("contenteditable")));
    assertEquals(contentEditableVal, "false");

    selenium.selectFrame(FrameRelativeLocator.TOP);
  }
Пример #3
0
  @Test
  @RegressionTest("https://issues.jboss.org/browse/RF-11394")
  public void testLang() {
    String langVal = "xyz";
    editorAttributes.set(lang, langVal);

    assertTrue(langVal.equals(selenium.getAttribute(editorTextArea.getAttribute(langAttribute))));
  }
Пример #4
0
  @Test
  public void testStyle() {

    final AttributeLocator<?> styleAttr = editor.getAttribute(Attribute.STYLE);
    final String style = "background-color: yellow; font-size: 1.5em;";

    editorAttributes.set(EditorAttributes.style, style);

    waitModel
        .failWith("Attribute style should contain \"" + style + "\"")
        .until(
            new SeleniumCondition() {
              @Override
              public boolean isTrue() {
                return selenium.getAttribute(styleAttr).contains(style);
              }
            });
  }
Пример #5
0
  @Test
  public void testTitle() {

    String titleVal = "RichFaces 4";
    AttributeLocator<?> attribute = editor.getAttribute(new Attribute("title"));

    // title = null
    assertFalse(
        titleVal.equals(selenium.getAttribute(attribute)),
        "Attribute title should not be present.");

    // set title
    editorAttributes.set(title, titleVal);

    // wait until attribute present
    assertTrue(selenium.isAttributePresent(attribute), "Attribute title should be present.");
    // assert correct attribute value: title
    waitModel.until(attributeEquals.locator(attribute).text(titleVal));
  }
Пример #6
0
  private void testOneRunOfProgressBar(JQueryLocator button, int interval) throws ParseException {
    SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss.SSS");
    long delta = (long) (interval * 0.5);
    Set<String> timesSet = new TreeSet<String>();
    List<String> labelsList = new ArrayList<String>();
    List<String> progressList = new ArrayList<String>();

    guardXhr(selenium).click(button);

    for (int i = 0; i < 40; i++) {
      waitFor(delta);
      timesSet.add(selenium.getText(time));
      labelsList.add(selenium.getText(label).replace(" %", ""));
      String width =
          selenium
              .getAttribute(progress.getAttribute(Attribute.STYLE))
              .replace("%", "")
              .replace("width:", "");
      progressList.add(width.replace(";", "").trim());
    }

    Date[] timesArray = new Date[timesSet.size()];
    List<String> timesList = new ArrayList<String>(timesSet);

    for (int i = 1; i < timesList.size(); i++) {
      timesArray[i] = sdf.parse(timesList.get(i));
    }

    long average = countAverage(timesArray);
    assertTrue(
        Math.abs(average - interval) < delta,
        "Average interval " + average + " is too far from set value (" + interval + ")");
    assertFalse(
        average < interval,
        "Average interval " + average + " cannot be smaller than set value (" + interval + ")");

    int first, second;
    for (int i = 0; i < labelsList.size() - 1; i++) {
      first = Integer.parseInt(labelsList.get(i));
      second = Integer.parseInt(labelsList.get(i + 1));
      assertTrue(
          first <= second,
          "Number of percent in label should be increasing: " + first + "!<= " + second);
    }

    for (int i = 0; i < progressList.size() - 1; i++) {
      first = Integer.parseInt(progressList.get(i));
      second = Integer.parseInt(progressList.get(i + 1));
      assertTrue(
          first <= second,
          "Progress of progress bar should be increasing: " + first + "!<= " + second);
    }

    waitGui
        .timeout(40000)
        .failWith("Progress bar should disappear after it finishes.")
        .until(elementPresent.locator(restartButton));
    assertTrue(
        selenium.isElementPresent(completeOutput),
        "Complete output should be present on the page.");

    assertTrue(selenium.isVisible(progressBar), "Progress bar is not present on the page.");
    assertFalse(
        selenium.isElementPresent(initialOutput),
        "Initial output should not be present on the page.");
    assertTrue(
        selenium.isVisible(completeOutput), "Complete output should be present on the page.");
    assertFalse(
        selenium.isElementPresent(startButton), "Start button should not be present on the page.");
    assertTrue(selenium.isVisible(restartButton), "Restart button should be present on the page.");

    assertFalse(selenium.isVisible(remain), "Progress bar should not show progress.");
  }