public static String getSummary() throws Exception { String summaryHTMLContent = _readResource("META-INF/resources/html/summary.html"); _summaryContentWrapperLoggerElement.addChildLoggerElement(_getSummaryContentLoggerElement()); summaryHTMLContent = StringUtil.replace( summaryHTMLContent, "<div id=\"summaryContentContainer\" />", _summaryContentContainerLoggerElement.toString()); LoggerElement summaryTestDescriptionLoggerElement = _getSummaryTestDescriptionLoggerElement(); summaryHTMLContent = StringUtil.replace( summaryHTMLContent, "<p id=\"summaryTestDescription\" />", summaryTestDescriptionLoggerElement.toString()); LoggerElement summaryTestNameLoggerElement = _getSummaryTestNameLoggerElement(); summaryHTMLContent = StringUtil.replace( summaryHTMLContent, "<h3 id=\"summaryTestName\" />", summaryTestNameLoggerElement.toString()); summaryHTMLContent = StringUtil.replace( summaryHTMLContent, "<ul id=\"summaryTitleContainer\" />", _summaryTitleContainerLoggerElement.toString()); return summaryHTMLContent; }
private static String _replaceCommandVars(String token, Element element) throws Exception { Matcher matcher = _pattern.matcher(token); while (matcher.find() && PoshiRunnerVariablesUtil.containsKeyInExecuteMap(matcher.group(1))) { String varName = matcher.group(1); String varValue = PoshiRunnerVariablesUtil.getValueFromExecuteMap(varName); if ((element.attributeValue("function") != null) && varName.startsWith("locator")) { varName = StringUtil.replace(varName, "locator", "locator-key"); String locatorKey = PoshiRunnerVariablesUtil.getValueFromExecuteMap(varName); if (Validator.isNotNull(locatorKey)) { StringBuilder sb = new StringBuilder(); sb.append("<em title=\""); sb.append(varValue); sb.append("\">"); sb.append(locatorKey); sb.append("</em>"); varValue = sb.toString(); } } token = StringUtil.replace(token, matcher.group(), varValue); } return token; }
public static void sikuliType(LiferaySelenium liferaySelenium, String image, String value) throws Exception { sikuliClick(liferaySelenium, image); liferaySelenium.pause("1000"); Keyboard keyboard = new DesktopKeyboard(); if (value.contains("${line.separator}")) { String[] tokens = StringUtil.split(value, "${line.separator}"); for (int i = 0; i < tokens.length; i++) { keyboard.type(tokens[i]); if ((i + 1) < tokens.length) { keyboard.type(Key.ENTER); } } if (value.endsWith("${line.separator}")) { keyboard.type(Key.ENTER); } } else { keyboard.type(value); } }
public static Map<String, String> runMacroCommandElement( String classCommandName, Element commandElement) throws Exception { PoshiRunnerStackTraceUtil.setCurrentElement(commandElement); PoshiRunnerVariablesUtil.pushCommandMap(); parseElement(commandElement); Map<String, String> macroReturns = new HashMap<>(); String returns = commandElement.attributeValue("returns"); if (Validator.isNotNull(returns)) { String[] returnNames = StringUtil.split(returns); for (String returnName : returnNames) { if (PoshiRunnerVariablesUtil.containsKeyInReturnMap(returnName)) { String returnValue = PoshiRunnerVariablesUtil.getValueFromReturnMap(returnName); macroReturns.put(returnName, returnValue); } } } PoshiRunnerVariablesUtil.popCommandMap(); return macroReturns; }
public static String getNumberIncrement(String value) { return StringUtil.valueOf(GetterUtil.getInteger(value) + 1); }