private List<String> findAllMatchingObjectNamesForExpression(
      String objectExpression, StructNode source) {
    String[] parts = objectExpression.split(",");

    List<String> resultingObjectNames = new LinkedList<String>();

    for (String part : parts) {
      String singleExpression = part.trim();

      if (singleExpression.isEmpty()) {
        throw new SyntaxException(source, "Incorrect object expression");
      }

      if (GalenUtils.isObjectExpression(singleExpression)) {
        Pattern objectPattern = GalenUtils.convertObjectNameRegex(singleExpression);
        for (String objectName : pageSpecHandler.getSortedObjectNames()) {
          if (objectPattern.matcher(objectName).matches()) {
            resultingObjectNames.add(objectName);
          }
        }
      } else {
        resultingObjectNames.add(singleExpression);
      }
    }
    return resultingObjectNames;
  }
 @Override
 public void execute(
     TestReport report,
     Browser browser,
     GalenPageTest pageTest,
     ValidationListener validationListener)
     throws IOException {
   String javascript = FileUtils.readFileToString(GalenUtils.findFile(javascriptFilePath));
   browser.executeJavascript(javascript);
 }
Esempio n. 3
0
  public PageSpec read(
      String path,
      Page page,
      SectionFilter sectionFilter,
      Properties properties,
      Map<String, Object> jsVariables,
      Map<String, Locator> objects)
      throws IOException {

    String contextPath = GalenUtils.getParentForFile(path);
    if (contextPath == null) {
      contextPath = "./";
    }

    InputStream stream = GalenUtils.findFileOrResourceAsStream(path);
    if (stream == null) {
      throw new FileNotFoundException(path);
    }
    return read(stream, path, contextPath, page, sectionFilter, properties, jsVariables, objects);
  }
Esempio n. 4
0
 private static GalenPageAction resizeActionFrom(String[] args) {
   Dimension size = GalenUtils.readSize(args[1]);
   return new GalenPageActionResize(size.width, size.height);
 }