Package com.crawljax.core.state

Examples of com.crawljax.core.state.StateVertex


    assertThat(counterFor(OnFireEventFailedPlugin.class), is(1));
  }

  @Test
  public void whenDomChangeErrorsTheDefaultIsUsed() {
    StateVertex stateBefore = mock(StateVertex.class);
    Eventable eventable = mock(Eventable.class);
    StateVertex stateAfter = mock(StateVertex.class);
    String oldDom = "old";
    String newDom = "new";
    when(stateBefore.getDom()).thenReturn(oldDom);
    when(stateAfter.getDom()).thenReturn(newDom);
    when(domChange.isDomChanged(context, oldDom, eventable, newDom)).thenThrow(
            new RuntimeException("This is an expected excpetion. ignore"));
    assertThat(
            plugins.runDomChangeNotifierPlugins(context, stateBefore, eventable, stateAfter),
            is(true));
View Full Code Here


    List<Map<String, String>> elements =
            Lists.newArrayListWithCapacity(candidateElements.size());

    for (CandidateElementPosition element : candidateElements) {
      Eventable eventable = getEventableByCandidateElementInState(state, element);
      StateVertex toState = null;
      Map<String, String> elementMap = new HashMap<String, String>();
      elementMap.put("xpath", element.getXpath());
      elementMap
              .put("left", "" + (element.getLeft() - 3 + state.getScreenshotOffsetLeft()));
      elementMap.put("top", "" + (element.getTop() - 3 + state.getScreenshotOffsetTop()));
      elementMap.put("width", "" + (element.getWidth() + 2));
      elementMap.put("height", "" + (element.getHeight() + 2));
      LOG.debug("State {} has offset {} {} for element {}", new Object[] { state.getName(),
              state.getScreenshotOffsetLeft(), state.getScreenshotOffsetTop(), element });
      if (eventable != null) {
        toState = sfg.getTargetState(eventable);
      }
      if (toState != null) {
        elementMap.put("targetname", toState.getName());
        if (getStateNumber(toState.getName()) < getStateNumber(state.getName())) {
          // state already found
          elementMap.put("color", COLOR_A_PREVIOUS_STATE);
        } else {
          // new state
          elementMap.put("color", COLOR_NEW_STATE);
View Full Code Here

    return elements;
  }

  private Eventable getEventableByCandidateElementInState(State state,
          CandidateElementPosition element) {
    StateVertex vertex = visitedStates.get(state.getName());
    for (Eventable eventable : sfg.getOutgoingClickables(vertex)) {
      // TODO Check if element.getIdentification().getValue() is correct replacement for
      // element.getXpath()
      if (eventable.getIdentification().getValue().equals(element.getXpath())) {
        return eventable;
View Full Code Here

   *             when the method is invoked more than once.
   */
  public void setup(StateVertex indexState) {
    if (!isSet.getAndSet(true)) {
      LOG.debug("Setting up the crawlsession");
      StateVertex added = stateFlowGraph.putIndex(indexState);
      Preconditions.checkArgument(added == null, "Could not set the initial state");
      session = new CrawlSession(config, stateFlowGraph, indexState);
    } else {
      throw new IllegalStateException("Session is already set");
    }
View Full Code Here

TOP

Related Classes of com.crawljax.core.state.StateVertex

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.