/** * Convenience method delegating to {@link GaleniumReportUtil#getLogger()}. * @return current logger */ public Logger getLogger() { return GaleniumReportUtil.getLogger(); }
@Override public void beforeConfiguration(ITestResult tr) { getLogger().trace("+++LISTENER: beforeConfiguration(ITestResult tr)"); for (ITestListener listener : listeners) { if (listener instanceof IConfigurationListener2) { getLogger().trace("{}: beforeConfiguration(ITestResult tr)", listener.getClass()); ((IConfigurationListener2)listener).beforeConfiguration(tr); } } super.beforeConfiguration(tr); }
/** * Gets a logger which marks every entry with the passed {@link Marker}. * @param marker to use with this logger * @return a {@link MarkedLogger} using the marker */ public static Logger getMarkedLogger(Marker marker) { return new MarkedLogger(getLogger(), marker); }
/** * Load URL in browser. * @param url to load */ public static void loadUrl(String url) { getLogger().trace("loading URL: '" + url + "'"); getDriver().get(url); }
@Override protected boolean checkForEquality(Dimension value1, Dimension value2) { GaleniumReportUtil.getLogger().trace("comparing sizes: '" + value1 + "' <> '" + value2 + "'"); return value1.equals(value2); }
/** * Load URL in browser. * @param url to load */ public static void load(String url) { getLogger().info("loading URL: '" + url + "'"); getDriver().get(url); }
private VerifiableExpectedCondition(Verifiable condition) { this.condition = condition; if (condition instanceof CanCache) { CanCache verification = (CanCache)condition; getLogger().debug("disable caching for '" + verification + "' verification"); verification.setCaching(false); if (verification.isCaching()) { getLogger().warn("waiting for a caching verification is not a sensible thing to do. Offending verification: '" + verification + "'"); } } }
private static boolean loginToAuthorViaBrowser(String authorUser, String authorPass) { if (isAuthorLogin()) { getLogger().debug("Attempting login in to author instance"); FormElement.clearAndEnterText(SELECTOR_AUTHOR_INPUT_USERNAME, authorUser); FormElement.clearAndEnterText(SELECTOR_AUTHOR_INPUT_PASSWORD, authorPass); Element.click(SELECTOR_AUTHOR_LOGIN_BUTTON); getLogger().info(MARKER_PASS, "Logging in to author instance."); return true; } getLogger().debug("Not logging in to author instance."); return false; }
private void logResult(Marker marker, ITestResult result, String message) { Reporter.log(message, true); getLogger().info(marker, message); Throwable throwable = result.getThrowable(); if (throwable != null) { String throwableMessage = StringEscapeUtils.escapeHtml4(throwable.getMessage()); getLogger().info(marker, result.getTestName() + ": " + throwableMessage); getLogger().debug(marker, result.getTestName(), throwable); } }
private void createDummyIfSampleDoesNotExist(String fullFilePath) { if (isExpectedImageSampleMissing(fullFilePath)) { GaleniumReportUtil.getLogger().info("Cannot find sample. Substituting dummy for '" + fullFilePath + "'"); // if image is missing, we'll substitute a dummy to force Galen to at least sample the page File targetFile = new File(fullFilePath); ImageComparisonUtil.writeDummySample(targetFile); } }
private static ValidationListener getValidationListener() { if (getLogger().isTraceEnabled()) { return new TracingValidationListener(); } return new DummyValidationListener(); }
/** * Click at current position. */ public static void click() { getLogger().debug("Clicking at current position."); getActions().click().perform(); }
/** * Navigate back. */ public static void back() { getLogger().info("navigating back"); getDriver().navigate().back(); }
/** * Navigate forward. */ public static void forward() { getLogger().info("navigating forward"); getDriver().navigate().forward(); }
/** * Refresh browser. */ public static void refresh() { getLogger().info("refreshing browser"); getDriver().navigate().refresh(); } }
private Spec getSpecForText(String specText) { try { return new SpecReader().read(specText); } catch (IllegalArgumentException | SyntaxException ex) { String msg = "when parsing spec text: '" + specText + "'"; GaleniumReportUtil.getLogger().error(msg); throw new GaleniumException(msg, ex); } }
/** * Navigate to URL. * @param url URL to navigate to */ public static void navigateTo(String url) { getLogger().info("navigating to URL: '" + url + "'"); getDriver().navigate().to(url); }
/** * Navigate to URL. * @param url to navigate to */ public static void navigateTo(URL url) { getLogger().info("navigating to URL: '" + url + "'"); getDriver().navigate().to(url); }
protected void fetchItems(WebDriver driver) { for (F storageFetcher : getFetchers()) { getLogger().debug("fetching items for profile '" + getProfileName() + "': " + storageFetcher.getFetcherName()); assignCategory(getCategoryPrefixFetcher() + storageFetcher.getFetcherName()); handleFetcher(driver, storageFetcher); } }