Package com.canoo.webtest.engine

Examples of com.canoo.webtest.engine.IStringVerifier


   * @param select the select in which to search
   * @param text   The text representing a particular value
   * @return The option element corresponding to the specified text
   */
  private HtmlOption getOptionForText(final HtmlSelect select, final String text) {
    final IStringVerifier verifier = getVerifier(fIsRegex);
    for (final Iterator iter = select.getOptions().iterator(); iter.hasNext();) {
      final HtmlOption option = (HtmlOption) iter.next();
      LOG.debug("Examining option: " + option);
      if (verifier.verifyStrings(text, option.asText())) {
        LOG.debug("Found option by text: " + option);
        return option;
      }
    }
    throw new StepFailedException("No option element found with text \"" + text + "\"", this);
View Full Code Here


  {
    LOG.debug("Searching label tag with text: " + labelText);
    final List labels = page.getDocumentElement().getHtmlElementsByTagName("label");
    LOG.debug(labels.size() + " found in the page");
   
    final IStringVerifier verifier = getVerifier(false);
    for (final Iterator iter=labels.iterator(); iter.hasNext();)
    {
      final HtmlLabel label = (HtmlLabel) iter.next();
      if (verifier.verifyStrings(labelText, label.asText()))
      {
        LOG.debug("Found label with matching text, examining the associated field: " + label);
        final HtmlElement target = label.getReferencedElement();
        if (keepField(target))
        {
View Full Code Here

      if (fields.isEmpty())
      {
              throw new StepFailedException("No checkbox field named '" + getName() + "' found.");
      }
      boolean regex = ConversionUtil.convertToBoolean(getRegex(), false);
      final IStringVerifier verifier = getVerifier(regex);
      for (final Iterator iter = fields.iterator(); iter.hasNext();) {
        final PDFField field = (PDFField) iter.next();
        if (!verifier.verifyStrings(getValue(), field.getValue()))
          throw new StepFailedException("Wrong checkbox field value", getValue(), field.getValue());
      }
    }
  }
View Full Code Here

        paramCheck(getText() != null && getHref() != null, "Only one of 'text' and 'href' can be set!");
  }

    protected void verifyPdf(final PDFPage pdfPage)
    {
      final IStringVerifier verifier = getVerifier(getRegex());
      final String expectedValue = StringUtils.defaultString(getText(), getHref());

      final List links = pdfPage.getLinks();
      for (final Iterator iter = links.iterator(); iter.hasNext();)
      {
View Full Code Here

  }

    protected void verifyPdf(final PDFPage pdfPage)
    {
      final List bookmarks = pdfPage.getBookmarks();
      final IStringVerifier verifier = getVerifier(getRegex());
      for (Iterator iter = bookmarks.iterator(); iter.hasNext();) {
      final PDFBookmark element = (PDFBookmark) iter.next();
      if (verifier.verifyStrings(getName(), element.getTitle()))
        return; // bookmark found
    }
     
      throw new StepFailedException("No bookmark found with name >" + getName() + "< (regex: " + getRegex() + ")", this);
    }
View Full Code Here

    {
      LOG.debug("Retrieving fonts");
      final List fonts = pdfPage.getFonts();
      LOG.debug(fonts.size() + " fonts to examine");

      final IStringVerifier verifier = getVerifier();
      for (final Iterator iter = fonts.iterator(); iter.hasNext();) {
      final PDFFont font = (PDFFont) iter.next();
      if (verifyFont(font, verifier))
      {
          LOG.info("Found font " + font);
View Full Code Here

  private IStringVerifier getVerifier() {
    if (getMatchCase())
      return EqualsStringVerfier.INSTANCE;
    else
    {
      return new IStringVerifier()
      {
        public boolean verifyStrings(final String expectedValue, final String actualValue) {
          return StringUtils.equalsIgnoreCase(expectedValue, actualValue);
        }
      };
View Full Code Here

      if (fields.isEmpty())
      {
              throw new StepFailedException("No text field named '" + getName() + "' found.");
      }
      boolean regex = ConversionUtil.convertToBoolean(getRegex(), false);
      final IStringVerifier verifier = getVerifier(regex);
      for (final Iterator iter = fields.iterator(); iter.hasNext();) {
        final PDFField field = (PDFField) iter.next();
        if (!verifier.verifyStrings(getValue(), field.getValue()))
          throw new StepFailedException("Wrong field value", getValue(), field.getValue());
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.canoo.webtest.engine.IStringVerifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.