I am new to Playwright and cucumber. I have setup a simple project where I am taking a screenshot of the Home Page when login is successful on a website. Screenshot is getting generated in TestScreenshots folder but with 2 screenshots. One is the name which I am giving using Playwright and Second is generated automatically. How to stop Cucumber to auto generate this embedded1.png? I am not able to find the exact issue. I am using Junit4 as runner
Method in Step Class:
@Then("User verifies the Sign In button on the website")
public void user_verifies_the_sign_in_button_on_the_website() {
assertThat(page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("sign in menu")).first());
byte[] screenshot=page.screenshot(new Page.ScreenshotOptions()
.setPath(Paths.get("./TestScreenshots/Login.png")));
scenario.attach(screenshot, "image/png", screenshot.toString());
// scenario.attach(screenshot, "image/png", "Login");--- Giving same issue
}
I am using Cucumber Extent Report Adapter 7. Below is my extent.properties file
extent.reporter.spark.start=true
extent.reporter.spark.out=target/Cucumber-Reports/extent-Report.html
extent.reporter.spark.config=src/test/resources/spark-config.xml
screenshot.dir=TestScreenshots/
screenshot.rel.path=../.././TestScreenshots/
RunnerFile:
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/resources/features",
glue = {"stepdefinitions"},
plugin = {"pretty", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"})
public class PageRunnerTest {
}
I have tried to debug the issue and look over internet for similar issues but no success.