Package com.canoo.webtest.engine

Examples of com.canoo.webtest.engine.StepFailedException


    protected void verifyParameters() {
        super.verifyParameters();
        nullParamCheck(getReferenceFile(), "referenceFile");
        if (!getReferenceFile().exists()) {
            throw new StepFailedException("Reference file doesn't exist: " + getReferenceFile().getAbsolutePath());
        }
       
        final String mode = getMode().toLowerCase();
        final String[] allowedModes = {DIFF_MODE_AUTO, DIFF_MODE_BIN, DIFF_MODE_TEXT, DIFF_MODE_REGEXPERLINE};
        if (!ArrayUtils.contains(allowedModes, mode))
View Full Code Here


        final WebClientContext.StoredResponses origResponses = getContext().getResponses();
        final String result = diffContentWithExpected();
        getContext().restoreResponses(origResponses);

        if (!StringUtils.isEmpty(result)) {
          final StepFailedException e = new StepFailedException("Current response and the reference differ.", this);
          e.addDetail("diff", result);
            throw e;
        }
    }
View Full Code Here

      {
        pdfPage.decrypt(getPassword());
      }
      catch (final PDFInvalidPasswordException e)
      {
        throw new StepFailedException("Invalid password", this);
      }
      catch (final Throwable e)
      {
        throw new StepFailedException("Invalid password", this);
      }
    }
    else
      throw new StepFailedException("Document is not encrypted!");
  }
View Full Code Here

  /**
   * Builds an exception with helpfull information
   * @return the exception
   */
  private StepFailedException buildNoButtonFoundException() {
    final StepFailedException e = new StepFailedException("No button found", this);

    final HtmlForm currentForm = getContext().getCurrentForm();
    final StringBuffer msg = new StringBuffer();
    if (currentForm != null) {
      msg.append("In current form:\n");
      msg.append(getButtonsDescription(currentForm));
    }

    final Iterator formsIterator = getContext().getCurrentHtmlResponse(this).getForms().iterator();
    while (formsIterator.hasNext()) {
      final HtmlForm form = (HtmlForm) formsIterator.next();
      if (form != currentForm)
      {
        if (msg.length() != 0)
          msg.append("\n\n");
        msg.append("In " + form + ":\n");
        msg.append(getButtonsDescription(form));
      }
    }
   
    e.addDetail("available buttons", msg.toString());
    return e;
  }
View Full Code Here

   * @return the button if ok, <code>null</code> otherwise
   */
  ClickableElement checkFoundElement(final HtmlElement elt) throws StepFailedException {
    // check that it is a "button"
    if (!isButton(elt)) {
      throw new StepFailedException("Selected element is a " + elt.getTagName() + " tag and not a button", this);
    }

    if (hasMatchingNameOrDontCare(elt) && hasMatchingLabelOrDontCare(elt)) {
      LOG.debug("Button passes test with label and name");
      return (ClickableElement) elt;
View Full Code Here

  public void addTask(final Task newTask) {
        final Task task = AntBoundary.maybeConfigure(newTask);
        if (task instanceof AbstractDialogStep) {
            super.addTask(task);
        } else {
          throw new StepFailedException("Not a dialog step: " + task);
        }
    }
View Full Code Here

            return thisDialog;
        }

        private void checkExpectationsSet(final Context context) {
            if (DialogHelper.getExpectedDialogsCount(context) == 0) {
                throw new StepFailedException("Expected dialogs but none found!", fOuter);
            }
        }
View Full Code Here

        private void checkResponseType(final AbstractDialogStep thisDialog, final String dialogType) {
            final String name = ClassUtils.getShortClassName(thisDialog.getClass());
            final String prefix = name.substring(0, name.length() - 4);
            if (!prefix.equals(dialogType)) {
                throw new StepFailedException("Incorrect dialog type", dialogType, prefix, fOuter);
            }
        }
View Full Code Here

    public void doExecute() {
        final int count = DialogHelper.getExpectedDialogsCount(getContext());
        LOG.debug("Number of expected dialogs = " + count);
        if (count > 0) {
            throw new StepFailedException("Dialogs found but none expected!", this);
        }
    }
View Full Code Here

  protected Page findTarget() throws IOException {
    final HtmlPage currentResp = getContext().getCurrentHtmlResponse(this);
    final HtmlElement element = StoreElementAttribute.findElement(currentResp, getHtmlId(), getXpath(), LOG, this);
    if (!(element instanceof ClickableElement)) {
      throw new StepFailedException("Element is not clickable (" + element + ")", this);
    }
        return ((ClickableElement) element).click();
  }
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.