Skip to content

Instantly share code, notes, and snippets.

View martinschneider's full-sized avatar
🇹🇼

Martin Schneider martinschneider

🇹🇼
View GitHub Profile
package qa.justtestlah.log;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.LoggerContextListener;
import ch.qos.logback.core.Context;
import ch.qos.logback.core.spi.ContextAwareBase;
import ch.qos.logback.core.spi.LifeCycle;
import qa.justtestlah.configuration.PropertiesHolder;
public WebDriver getWebDriver() {
return registerListener(WebDriverRunner.getWebDriver());
}
private WebDriver registerListener(WebDriver driver) {
EventFiringWebDriver eventFiringDriver = new EventFiringWebDriver(driver);
eventFiringDriver.register(new WebDriverLogEnricher());
eventFiringDriver.register(new WebDriverServerLogEnricher());
return eventFiringDriver;
}
14:45:13.979 Scenario: Use the search function (file:///.../features/stackoverflow/Search.feature:24)
14:45:18.963 ██ Step: I am on the homepage
14:45:20.080 ██ Step: I search for "selenium"
14:45:22.775 ██ Step: I select the first question
14:45:23.355 ██ Step: the question is tagged with "selenium"
14:45:28.374 [FAILED] Scenario "Use the search function" finished after 14 seconds with error "Element not found {By.xpath: //A[contains(@class,'post-tag') and contains(text(),'selenium')]} Expected: visible Screenshot: file:/.../build/reports/tests/1585291160888.0.png Page source: file:/.../build/reports/tests/1585291160888.0.html Timeout: 4 s. Caused by: NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//A[contains(@class,'post-tag') and contains(text(),'selenium')]"}"
14:45:19.797 ██▓▓▒▒ Navigating to https://www.stackoverflow.com
14:45:19.863 ██▓▓▒▒ Finding element By.xpath: //div[@id='js-gdpr-consent-banner']//a[contains(@aria-label,'notice-dismiss')]
14:45:19.956 ██▓▓▒▒ Finding element By.xpath: //div[@id='js-gdpr-consent-banner']//a[contains(@aria-label,'notice-dismiss')]
14:45:20.010 ██▓▓▒▒ Clicking on [[ChromeDriver: chrome on MAC] -> xpath: //div[@id='js-gdpr-consent-banner']//a[contains(@aria-label,'notice-dismiss')]]
14:45:20.088 ██▓▓▒▒ Finding element By.cssSelector: input[name=q]
14:45:20.112 ██▓▓▒▒ Typing [selenium] in [[ChromeDriver: chrome on MAC] -> css selector: input[name=q]]
14:45:22.796 ██▓▓▒▒ Finding element By.cssSelector: .result-link a, #questions .summary a.question-hyperlink
14:45:22.872 ██▓▓▒▒ Clicking on [[ChromeDriver: chrome on MAC] -> css selector: .result-link a, #questions .summary a.question-hyperlink]
14:45:23.371 ██▓▓▒▒ Finding element By.xpath: //A[contains(@class,'post-tag') and contains(text(),'selenium')]
14:45:23.644 ██▓▓▒▒
package qa.justtestlah.log;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.events.WebDriverEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import qa.justtestlah.utils.SpringContext;
16:39:20.385 ██▓▓ Entering WebDriverBuilder:getWebDriver
16:39:20.402 ██▓▓ Exiting WebDriverBuilder:getWebDriver after 17 ms
@EntryExitLogging
public WebDriver getWebDriver() {
// create WebDriver
}
14:45:18.978 ██▓▓ Entering HomeSteps:homepage
14:45:18.990 ██▓▓ Entering HomePage:load
14:45:20.076 ██▓▓ Exiting HomePage:load after 1086 ms
14:45:20.076 ██▓▓ Exiting HomeSteps:homepage after 1098 ms
14:45:20.081 ██▓▓ Entering HomeSteps:search [arg0=selenium]
14:45:20.081 ██▓▓ Entering HomePage:search [arg0=selenium]
14:45:22.774 ██▓▓ Exiting HomePage:search after 2693 ms
14:45:22.774 ██▓▓ Exiting HomeSteps:search after 2693 ms
14:45:22.780 ██▓▓ Entering QuestionSteps:selectFirstQuestion
14:45:22.787 ██▓▓ Entering QuestionsPage:openFirstQuestion
package qa.justtestlah.aop;
import org.springframework.aop.aspectj.AspectJExpressionPointcutAdvisor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
/**
* AOP Logging Spring configuration. Enables entry-exit logging for all public methods in steps and
package qa.justtestlah.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotation to mark methods for which entry/exit logging should be enabled.
*