Package com.canoo.webtest.engine

Examples of com.canoo.webtest.engine.StepFailedException


    protected String processContent(final Folder folder) throws MessagingException {
        final int id = ConversionUtil.convertToInt(getMessageId(), 0);
        final Message message = getHelper().getMessage(id, folder);
        if (message == null) {
            throw new StepFailedException("Could not find message with id '" + id + "' on server.", this);
        }
        return performOperation(message);
    }
View Full Code Here


    {
      final XmlPage xmlPage = (XmlPage) page;
      if (xmlPage.getXmlDocument() == null) // when content type was xml
                          // but document couldn't be
                          // parsed
        throw new StepFailedException(
            "The xml document couldn't be parsed as it is not well formed");
      return xmlPage.getXmlDocument();
    }
    else
    {
View Full Code Here

   * @param page the page
   * @return the exception to throw
   */
  StepFailedException buildInvalidDocumentException(final Page page)
  {
    return new StepFailedException(
        "Current response is not an HTML or XML page but of type "
            + page.getWebResponse().getContentType() + " ("
            + page.getClass().getName() + ")");
  }
View Full Code Here

  public void doExecute() throws Exception {
        final String url = getContext().getCurrentResponse().getWebResponse().getRequestUrl().toExternalForm();
    LOG.info("Response URL is: '" + url + "'");
    if (!verifyText(url)) {
      throw new StepFailedException("The url '" + url + "' didn't match '" + getText() + "'.", this);
    }
  }
View Full Code Here

  public void doExecute() throws SAXException, IOException {
    if (fName != null) {
      final HtmlForm form = findForm();
      if (form == null) {
        throw new StepFailedException("No suitable form found having field named \"" + getName() + "\"", this);
      }
      LOG.debug("Found matching form " + form);
      setField(selectField(trimFields(findFields(form)), getFieldIndex(), this));
    }
    else if (getForLabel() != null)
View Full Code Here

        {
          LOG.debug("Target doesn't match: " + target);
        }
      }
    }
    throw new StepFailedException("No label found with text \"" + labelText + "\"", this);
  }
View Full Code Here

   * @param step The calling step, for exception.
   * @return The selected field
   */
  public static HtmlElement selectField(final List fieldList, final String indexStr, final Step step) {
    if (fieldList.isEmpty()) {
      throw new StepFailedException("No suitable field(s) found", step);
    }

    int numFieldsFound = fieldList.size();
    int index;
    if (StringUtils.isEmpty(indexStr)) {
      LOG.info("Found " + numFieldsFound + " suitable fields, considering only the first one");
      index = 0;
    } else {
      index = ConversionUtil.convertToInt(indexStr, 0);
      if (index < 0 || index >= numFieldsFound) {
        throw new StepFailedException("Can't set field with index '" + index + "', valid range is 0.." + (numFieldsFound - 1), step);
      }
    }
    return (HtmlElement) fieldList.get(index);
  }
View Full Code Here

      elt = ((HtmlPage) getContext().getCurrentResponse()).getHtmlElementById(fHtmlId);
    } catch (final ElementNotFoundException e) {
      //ignore
    }
    if (elt == null || !(elt instanceof HtmlAnchor)) {
      throw new StepFailedException("No link found with id >" + getHtmlId() + "<", this);
    }
    final HtmlAnchor webLink = (HtmlAnchor) elt;
    final String value = extractParameterValue(webLink.getHrefAttribute(), getParameter());
    if (value == null) {
      throw new StepFailedException("No parameter >" + getParameter() + "< found in link >"
         + webLink.getHrefAttribute() + "<", this);
    }
    storeProperty(value, getParameter());
  }
View Full Code Here

      } catch (final BuildException accepted) {
        // ok.
      }
    }
    if (!allOk) {
      throw new StepFailedException("Failed - retried the nested steps " + fCount + " time(s) without success",
         this);
    }
  }
View Full Code Here

        else
          msg += fields.size();
        msg += " checkbox field(s) found with name >" + getName() + "<";
        if (getPage() != ANY_PAGE)
          msg += " on page " + getPage();
        throw new StepFailedException(msg);
      }
    }
    else // test value
    {
      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

TOP

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

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.