jenkinsci / allure-plugin

Allure Jenkins Plugin
https://plugins.jenkins.io/allure-jenkins-plugin/
Other
84 stars 62 forks source link

Attached screenshot looks weird ( grey content instead of actual website ) #365

Open art1988 opened 1 month ago

art1988 commented 1 month ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Win 10. I use Selenide 7.2.3, TestNG, maven.

I've installed Jenkins on local machine ( version Jenkins 2.452.2 ) and install Allure plugin: a6f8a0fff9685973ab34a44a7200023a42c70949

Reproduction steps

  1. I use the following code to attach screenshot:
import com.codeborne.selenide.Screenshots;
import com.google.common.io.Files;
import io.qameta.allure.Attachment;

import java.io.File;
import java.io.IOException;

public class Screenshoter
{
    @Attachment(value = "Page screenshot", type = "image/png")
    public static byte[] screenshot()
    {
        File screenshot = Screenshots.takeScreenShotAsFile();
        byte[] result = null;

        try
        {
            result = Files.toByteArray(screenshot);
        }
        catch (IOException e)
        {
            System.err.println(e);
        }

        return result;
    }
}
  1. The test itself looks like this:

    @Test(priority = 5)
    public void openByUsingEnvParam() throws IOException
    {
        Selenide.open("https://www.google.com/");
    
        $(withText("text")).shouldBe(Condition.visible, Condition.enabled);
        Screenshoter.screenshot();
    }

Expected Results

Attached screenshot in the Allure Report should be the homepage of Google.

Actual Results

What I want to see is actual content of web page, not the grey rectangle. Refer to screenshot: 43723e547c536002a0085187c3c1c00ffb107c0f

Anything else?

What's more interesting is that if I run the same test via mvn clean test and then run mvn allure:serve then screenshot looks fine.

So my guess is that the issue is in allure jenkins plugin.

Are you interested in contributing a fix?

No response

StasiukMarian commented 3 weeks ago

Hello. Same happens with me. Reported in #366