com.twosigma.webtau.cfg.WebTauConfig.getCfg()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中com.twosigma.webtau.cfg.WebTauConfig.getCfg()方法的一些代码示例,展示了WebTauConfig.getCfg()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebTauConfig.getCfg()方法的具体详情如下:
包路径:com.twosigma.webtau.cfg.WebTauConfig
类名称:WebTauConfig
方法名:getCfg

WebTauConfig.getCfg介绍

暂无

代码示例

代码示例来源:origin: twosigma/webtau

public static WebTauConfig getCfg() {
  return WebTauConfig.getCfg();
}

代码示例来源:origin: twosigma/webtau

private String generateHtml(Report report) {
  Map<String, Object> reportAsMap = new LinkedHashMap<>();
  reportAsMap.put("config", configAsListOfMaps(getCfg().getCfgValuesStream()));
  reportAsMap.put("summary", report.createSummary().toMap());
  reportAsMap.put("version", WebTauMeta.getVersion());
  reportAsMap.put("tests", report.getTestEntries().stream()
      .map(ReportTestEntry::toMap).collect(Collectors.toList()));
  report.extractReportCustomData().stream()
      .map(ReportCustomData::toMap)
      .forEach(reportAsMap::putAll);
  return generateHtml(reportAsMap);
}

代码示例来源:origin: twosigma/webtau

@Override
public long defaultTimeoutMillis() {
  return getCfg().waitTimeout();
}

代码示例来源:origin: com.twosigma.webtau/webtau-browser

@Override
public long defaultTimeoutMillis() {
  return getCfg().waitTimeout();
}

代码示例来源:origin: twosigma/webtau

private void createAnnotations(String screenshotName) {
  List<? extends Map<String, ?>> shapes = annotations.stream().map(this::createAnnotationData).collect(toList());
  Map<String, Object> result = new HashMap<>();
  result.put("shapes", shapes);
  result.put("pixelRatio", getPixelRatio());
  String annotationsJson = JsonUtils.serializePrettyPrint(result);
  FileUtils.writeTextContent(getCfg().getDocArtifactsPath().resolve(Paths.get(screenshotName + ".json")),
      annotationsJson);
}

代码示例来源:origin: com.twosigma.webtau/webtau-browser

private void createAnnotations(String screenshotName) {
  List<? extends Map<String, ?>> shapes = annotations.stream().map(this::createAnnotationData).collect(toList());
  Map<String, Object> result = new HashMap<>();
  result.put("shapes", shapes);
  result.put("pixelRatio", getPixelRatio());
  String annotationsJson = JsonUtils.serializePrettyPrint(result);
  FileUtils.writeTextContent(getCfg().getDocArtifactsPath().resolve(Paths.get(screenshotName + ".json")),
      annotationsJson);
}

代码示例来源:origin: twosigma/webtau

public static Path getSchemasDir() {
  Path schemasDirPath = schemasDir.getAsPath();
  if (schemasDirPath.isAbsolute()) {
    return schemasDirPath;
  }
  return getCfg().getWorkingDir().resolve(schemasDirPath);
}

代码示例来源:origin: twosigma/webtau

public static String specFullPath() {
  if (specUrl.getAsString().isEmpty()) {
    return "";
  }
  return getCfg().getWorkingDir()
      .resolve(specUrl.getAsString())
      .toString();
}

代码示例来源:origin: twosigma/webtau

private String textContent(String fileOrResourcePath) {
    Path filePath = WebTauConfig.getCfg().getWorkingDir().resolve(fileOrResourcePath);

    boolean hasResource = ResourceUtils.hasResource(fileOrResourcePath);
    boolean hasFile = Files.exists(filePath);

    if (!hasResource && ! hasFile) {
      throw new IllegalArgumentException("Can't find resource \"" + fileOrResourcePath + "\" or " +
          "file \"" + filePath.toAbsolutePath() + "\"");
    }

    return hasResource ?
        ResourceUtils.textContent(fileOrResourcePath) :
        FileUtils.fileTextContent(filePath);
  }
}

代码示例来源:origin: com.twosigma.webtau/webtau-data

private String textContent(String fileOrResourcePath) {
    Path filePath = WebTauConfig.getCfg().getWorkingDir().resolve(fileOrResourcePath);

    boolean hasResource = ResourceUtils.hasResource(fileOrResourcePath);
    boolean hasFile = Files.exists(filePath);

    if (!hasResource && ! hasFile) {
      throw new IllegalArgumentException("Can't find resource \"" + fileOrResourcePath + "\" or " +
          "file \"" + filePath.toAbsolutePath() + "\"");
    }

    return hasResource ?
        ResourceUtils.textContent(fileOrResourcePath) :
        FileUtils.fileTextContent(filePath);
  }
}

代码示例来源:origin: com.twosigma.webtau/webtau-browser

private static void initState(WebDriver driver) {
  // setting size for headless chrome crashes chrome
  if (! getCfg().isHeadless()) {
    driver.manage().window().setSize(new Dimension(getCfg().getWindowWidth(), getCfg().getWindowHeight()));
  }
}

代码示例来源:origin: twosigma/webtau

private void createScreenshot(String screenshotName) {
  Screenshot screenshot = new Screenshot(screenshotTaker);
  screenshot.save(getCfg().getDocArtifactsPath().resolve(screenshotName + ".png"));
}

代码示例来源:origin: twosigma/webtau

private static void initState(WebDriver driver) {
  // setting size for headless chrome crashes chrome
  if (! getCfg().isHeadless()) {
    driver.manage().window().setSize(new Dimension(getCfg().getWindowWidth(), getCfg().getWindowHeight()));
  }
}

代码示例来源:origin: com.twosigma.webtau/webtau-browser

private void createScreenshot(String screenshotName) {
  Screenshot screenshot = new Screenshot(screenshotTaker);
  screenshot.save(getCfg().getDocArtifactsPath().resolve(screenshotName + ".png"));
}

代码示例来源:origin: twosigma/webtau

public void generate(Report report) {
  Path reportPath = getCfg().getReportPath().toAbsolutePath();
  FileUtils.writeTextContent(reportPath, generateHtml(report));
  ConsoleOutputs.out(Color.BLUE, "report is generated: ", Color.PURPLE, " ", reportPath);
}

代码示例来源:origin: com.twosigma.webtau/webtau-browser

private String createFullUrl(String url) {
  if (UrlUtils.isFull(url)) {
    return url;
  }
  return UrlUtils.concat(getCfg().getBaseUrl(), url);
}

代码示例来源:origin: twosigma/webtau

private String createFullUrl(String url) {
  if (UrlUtils.isFull(url)) {
    return url;
  }
  return UrlUtils.concat(getCfg().getBaseUrl(), url);
}

代码示例来源:origin: twosigma/webtau

@Override
public String fullUrl(String url) {
  if (UrlUtils.isFull(url)) {
    return url;
  }
  return UrlUtils.concat(getCfg().getBaseUrl(), url);
}

代码示例来源:origin: twosigma/webtau

public JavaBasedTest(String id, String name) {
  reportTestEntry = new ReportTestEntry(getCfg().getWorkingDir());
  reportTestEntry.setId(id);
  reportTestEntry.setScenario(name);
}

代码示例来源:origin: twosigma/webtau

private void renderResponse(HttpValidationResult result) {
  if (getCfg().getVerbosityLevel() <= TestStep.getCurrentStep().getNumberOfParents() + 1) {
    return;
  }
  if (result.getResponse().isBinary()) {
    ConsoleOutputs.out(Color.YELLOW, "[binary content]");
  } else if (!result.hasResponseContent()) {
    ConsoleOutputs.out(Color.YELLOW, "[no content]");
  } else {
    new DataNodeAnsiPrinter().print(result.getBodyNode());
  }
}

相关文章