Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Commit

Permalink
Move videoRecorder into @after step
Browse files Browse the repository at this point in the history
  • Loading branch information
clicman committed Feb 20, 2017
1 parent 66bc165 commit d0caf86
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
13 changes: 11 additions & 2 deletions src/main/java/ru/sbtqa/tag/pagefactory/stepdefs/SetupStepDefs.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.reflections.Reflections;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.sbtqa.tag.allurehelper.ParamsHelper;
import ru.sbtqa.tag.pagefactory.Page;
import ru.sbtqa.tag.pagefactory.PageFactory;
import ru.sbtqa.tag.pagefactory.annotations.ElementTitle;
Expand All @@ -23,6 +24,7 @@
import ru.sbtqa.tag.qautils.properties.Props;
import ru.sbtqa.tag.qautils.reflect.ClassUtilsExt;
import ru.sbtqa.tag.qautils.reflect.FieldUtilsExt;
import ru.sbtqa.tag.videorecorder.VideoRecorder;
import ru.yandex.qatools.allure.cucumberjvm.AllureReporter;
import ru.yandex.qatools.htmlelements.element.HtmlElement;

Expand All @@ -32,10 +34,10 @@ public class SetupStepDefs {

@Before()
public void setUp() {

//Apply failure callback
AllureReporter.applyFailureCallback(OnFailureScheduler.class);

//try to connect logger property file if exists
String path = "src/test/resources/config/log4j.properties";
if (new File(path).exists()) {
Expand Down Expand Up @@ -103,6 +105,13 @@ public void setUp() {

@After
public void tearDown() {
if (VideoRecorder.getInstance().isVideoStarted()) {
String videoPath = VideoRecorder.getInstance().stopRecording();
if (videoPath != null) {
ParamsHelper.addVideoParameter(VideoRecorder.getInstance().getVideoPath());
VideoRecorder.getInstance().resetVideoRecorder();
}
}
PageFactory.dispose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

public class OnFailureScheduler implements OnFailureCallback {

private void addVideoParameter(String videoPath) {
ParamsHelper.addParam("Video url", videoPath);
}

private void takeScreenshot() {
String screenshotStrategy = Props.get("screenshot.strategy", "raw");

Expand All @@ -26,14 +22,7 @@ private void takeScreenshot() {
}

@Override
public Object call() {
if (VideoRecorder.getInstance().isVideoStarted()) {
String videoPath = VideoRecorder.getInstance().stopRecording();
if (videoPath != null) {
addVideoParameter(VideoRecorder.getInstance().getVideoPath());
VideoRecorder.getInstance().resetVideoRecorder();
}
}
public Object call() {
takeScreenshot();
return null;
}
Expand Down

0 comments on commit d0caf86

Please sign in to comment.