use of cucumber.api.event.TestStepFinished in project page-factory-2 by sbtqa.
the class ErrorHandlerAspect method sendStepFinished.
@Around("sendStepFinished(event)")
public void sendStepFinished(ProceedingJoinPoint joinPoint, Event event) throws Throwable {
TestStepFinished testStepFinished = (TestStepFinished) event;
if (testStepFinished.result.getStatus() == Result.Type.FAILED && !Environment.isDriverEmpty() && !stepText.get().equals(Allure.getLifecycle().getCurrentTestCaseOrStep().toString())) {
stepText.set(Allure.getLifecycle().getCurrentTestCaseOrStep().toString());
ErrorHandler.attachError(testStepFinished.result.getError());
ErrorHandler.attachScreenshot();
if (PROPERTIES.isReportXmlAttachEnabled()) {
try {
ParamsHelper.addAttachmentToRender(Environment.getDriverService().getDriver().getPageSource().getBytes(), "Page source", Type.XML);
} catch (InvalidElementStateException e) {
LOG.error("Can't attach page source", e);
}
}
}
joinPoint.proceed();
}
use of cucumber.api.event.TestStepFinished in project page-factory-2 by sbtqa.
the class PrintParameters method beforeSendStepFinished.
@Before("sendStepFinished(event)")
public void beforeSendStepFinished(JoinPoint joinPoint, Event event) {
TestStep testStep = ((TestStepFinished) event).testStep;
if (testStep instanceof PickleStepTestStep) {
this.testArguments.set(((PickleStepTestStep) testStep).getStepArgument());
addAllureArguments();
}
}
use of cucumber.api.event.TestStepFinished in project page-factory-2 by sbtqa.
the class CriticalStepCheckAspect method sendStepFinished.
@Around("sendStepFinished(event)")
public void sendStepFinished(ProceedingJoinPoint joinPoint, TestStepFinished event) throws Throwable {
PickleStep step = getDefinitionMatchStep(event.testStep);
if (hasError(step)) {
final Result result = new Result(Result.Type.AMBIGUOUS, event.result.getDuration(), ((PickleStepTag) step).getError());
event = new TestStepFinished(event.getTimeStamp(), event.getTimeStampMillis(), event.getTestCase(), event.testStep, result);
}
joinPoint.proceed(new Object[] { event });
}
Aggregations