Package com.foreach.cuke.sahi.element

Examples of com.foreach.cuke.sahi.element.ElementDescriptor


                                                     Integer position,
                                                     String parentType,
                                                     String parentLocator,
                                                     Integer parentPosition,
                                                     String value ) throws Throwable {
    verify( Arrays.asList( new ElementDescriptor( locator, position, type, value ) ),
            find( parentType, parentLocator, parentPosition ), VerifyOperation.ENDS_WITH, true );
  }
View Full Code Here


  @Then("^(?:ensure that )?" + StandardSahiSteps.ELEMENT_REGEX + " (?:should end with|ends with) \"([^\"]*)\"$")
  public void the_element_should_end_with( String type,
                                           String locator,
                                           Integer position,
                                           String value ) throws Throwable {
    verify( Arrays.asList( new ElementDescriptor( locator, position, type, value ) ), null,
            VerifyOperation.ENDS_WITH, true );
  }
View Full Code Here

                                                  Integer position,
                                                  String parentType,
                                                  String parentLocator,
                                                  Integer parentPosition,
                                                  String value ) throws Throwable {
    ElementDescriptor descriptor = new ElementDescriptor( locator, position, type, value, VerifyOperation.EQUALS );
    descriptor.setParent( find( parentType, parentLocator, parentPosition ) );

    elementHandleService.verify( descriptor, true );
  }
View Full Code Here

  @Then("^(?:ensure that )?" + StandardSahiSteps.ELEMENT_REGEX + " (?:should equal|equals|matches|should match) \"([^\"]*)\"$")
  public void the_element_should_equal( String type,
                                        String locator,
                                        Integer position,
                                        String value ) throws Throwable {
    elementHandleService.verify( new ElementDescriptor( locator, position, type, value, VerifyOperation.EQUALS ),
                                 true );
  }
View Full Code Here

                                            Integer position,
                                            String parentType,
                                            String parentLocator,
                                            Integer parentPosition,
                                            String value ) throws Throwable {
    ElementDescriptor descriptor = new ElementDescriptor( locator, position, type, value, VerifyOperation.EQUALS );
    descriptor.setParent( find( parentType, parentLocator, parentPosition ) );

    elementHandleService.verify( descriptor, false );
  }
View Full Code Here

  @Then("^(?:ensure that )?" + StandardSahiSteps.ELEMENT_REGEX + " (?:should not equal|does not equal|does not match|should not match) \"([^\"]*)\"$")
  public void the_element_should_not_equal( String type,
                                            String locator,
                                            Integer position,
                                            String value ) throws Throwable {
    elementHandleService.verify( new ElementDescriptor( locator, position, type, value, VerifyOperation.EQUALS ),
                                 false );
  }
View Full Code Here

  protected ElementStub find( String type, String locator, Integer position ) {
    return find( type, locator, position, null );
  }

  protected ElementStub find( String type, String locator, Integer position, ElementStub parent ) {
    ElementDescriptor descriptor = new ElementDescriptor( locator, position, type );
    descriptor.setParent( parent );

    return elementHandleService.find( descriptor );
  }
View Full Code Here

    int actualTimeToWait = timeToWait == null || timeToWait <= 0 ? DEFAULT_WAIT_TIMEOUT : timeToWait;

    int totalWait = 0;
    boolean status;

    ElementDescriptor descriptor = new ElementDescriptor( locator, position, type );
    ElementDescriptor parent =
        parentType != null ? new ElementDescriptor( parentLocator, parentPosition, parentType ) : null;

    String successMessage = "exist";
    String failedMessage = "did not exist";

    if ( checkVisibility && expectedStatus ) {
      successMessage = "appear";
      failedMessage = "did not appear";
    }
    else if ( checkVisibility ) {
      successMessage = "disappear";
      failedMessage = "did not disappear";
    }
    else if ( !expectedStatus ) {
      successMessage = "not exist";
      failedMessage = "dit not stop existing";
    }

    LOG.debug( "Waiting for {}{} to " + successMessage, descriptor, parent != null ? " in " + parent : "" );

    do {
      if ( parent != null ) {
        ElementStub parentStub = elementHandleService.find( parent );

        if ( exists( parentStub ) ) {
          descriptor.setParent( parentStub );
          status = checkVisibility ? isVisible( elementHandleService.find( descriptor ) ) : exists(
              elementHandleService.find( descriptor ) );
        }
        else {
          status = false;
        }
      }
      else {
        status = checkVisibility ? isVisible( elementHandleService.find( descriptor ) ) : exists(
            elementHandleService.find( descriptor ) );
      }

      if ( status != expectedStatus ) {
        browser.waitFor( WAIT_INCREMENT );
        totalWait += WAIT_INCREMENT;
      }
    }
    while ( status != expectedStatus && totalWait < actualTimeToWait );

    if ( status != expectedStatus ) {
      LOG.warn( "{}{} " + failedMessage + " within {} ms", descriptor, parent != null ? " in " + parent : "",
                actualTimeToWait );
      fail( descriptor.toString() + ( parent != null ? " in " + parent.toString() : "" ) + " " + failedMessage + " within " + actualTimeToWait + " ms" );
    }
    else {
      LOG.debug( "{}{} " + successMessage + "ed after {} ms", descriptor, parent != null ? " in " + parent : "",
                 totalWait );
    }
View Full Code Here

TOP

Related Classes of com.foreach.cuke.sahi.element.ElementDescriptor

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.