private void waitForServerToStart() throws Exception {
   Assertions.waitUntil(
       Timeout.TEN_MINUTES,
       new Assertions.Predicate() {
         public boolean call() {
           return isAlreadyRunning();
         }
       });
 }
 @com.thoughtworks.gauge.Step("Verify check package gives message containing <message>")
 public void verifyCheckPackageGivesMessageContaining(final String message) throws Exception {
   browser.button("check_package").click();
   Assertions.waitUntil(
       Timeout.TWENTY_SECONDS,
       new Predicate() {
         @Override
         public boolean call() throws Exception {
           String actualMessage = browser.byId("package_check_message").getText();
           return actualMessage != null && actualMessage.contains(message);
         }
       });
 }
 private void waitForPopupToLoad() {
   Assertions.waitUntil(
       Timeout.TEN_SECONDS,
       new Predicate() {
         public boolean call() throws Exception {
           ElementStub button = browser.submit("SAVE");
           if (!button.exists()) {
             return false;
           }
           return true;
         }
       });
 }
  @com.thoughtworks.gauge.Step(
      "Verify that <material> with name <materialName> is added with attributes <attributeNameValues>")
  public void verifyThatWithNameIsAddedWithAttributes(
      final String material, final String materialName, final String attributeNameValues)
      throws Exception {
    Assertions.waitUntil(
        Timeout.THIRTY_SECONDS,
        new Predicate() {

          @Override
          public boolean call() throws Exception {
            String[] nameValues = attributeNameValues.split(",");
            CruiseConfigDom dom = configuration.provideDomAsAdmin();
            dom.hasMaterialWithAttribs(
                scenarioState.currentRuntimePipelineName(), material, materialName, nameValues);
            return true;
          }
        });
  }
  public void setExpected(final String expected) throws Exception {
    this.expected = Boolean.valueOf(expected);

    Assertions.waitUntil(
        Timeout.THIRTY_SECONDS,
        new Predicate() {

          public boolean call() throws Exception {

            artifactsPage.enterArtifactDetail(1, source, destination, "Build Artifact");
            artifactsPage.clickSave();

            return ((artifactsPage.isMessagePresent(messageForDestination)
                    && artifactsPage.isMessagePresent(messageForSource)
                    && artifactsPage.isMessagePresent(saveStatus))
                == Boolean.valueOf(expected));
          }
        });
  }