Search code examples
javaseleniumjenkinscucumberjenkins-plugins

Captured screenshots are attached to local cucumber reports, but not to Jenkins report


    @After
    public void afterScenario() {
    if (ScenarioManager.getScenario().isFailed()) {
        ScenarioManager.saveScreenshot();
    }

    public static void saveScreenshot() {
    byte[] screenshot = DriverProvider.getScaledScreenshot(2);

    if (screenshot != null) {
        scenario.get().embed(screenshot, "image/png");
    }
    }

Selenium takes screenshots whenever my scenario fails, it shows up locally in my cucumber report (located at target/cucumber/html/full/screenshotfoo.png) and is visualised nice in the index.html report.

However, these very same reports are uploaded to Jenkins, but without the screenshots. I am not sure what I am doing wrong.

I have the latest cucumber reports plugin installed on jenkins as well. The only reason I can think about is the post-build actions on jenkins refers to my .json report location but there are also screenshots in my .json file?

Is it a jenkins issue? Can i just reinstall the cucumber plugin for example?

Thanks


Solution

  • Well, there was nothing wrong. The screenshots were showing just fine, in the After collapsed tab which I didnt open until now.