/**
 * Created with IntelliJ IDEA.
 * User: jhasmanyquiroz
 * Date: 11/25/15
 * Time: 12:12 PM
 * To change this template use File | Settings | File Templates.
 */
package steps.hooks;

import cucumber.api.Scenario;
import cucumber.api.java.After;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriverException;

import static framework.BrowserManager.getInstance;

public class GlobalHooks {
    @After
    public void embedScreenShot(Scenario scenario) {
        if (scenario.isFailed()) {
            try {
                System.out.println("#########################Take a snapshot#######################");
                byte[] screenshot = ((TakesScreenshot)getInstance().getDriver()).getScreenshotAs(OutputType.BYTES);
                scenario.embed(screenshot, "image/png");
                System.out.println("#######SCENARIO: "+scenario.getName());
            } catch (WebDriverException somePlatformsDontSupportScreenshots) {
                System.err.println(somePlatformsDontSupportScreenshots.getMessage());
            }
        }

        //if (scenario.getName().equalsIgnoreCase(""))
    }
}

@@ -573,111 +573,8 @@
 y %7B%0A
-                System.out.println(%22#########################Take a snapshot#######################%22);%0A
     
@@ -746,84 +746,8 @@
 %22);%0A
-                System.out.println(%22#######SCENARIO: %22+scenario.getName());%0A
     

Refactor the Global hooks file