// Record videos for failed tests:
BrowserContext context = browser.newContext(new Browser.NewContextOptions()
.setRecordVideoDir(Paths.get("videos/"))
.setRecordVideoSize(1280, 720));Page page = context.newPage();
// Run test...
// Save video path on test failure:
context.close();
System.out.println("Video saved to: " + page.video().path());
public class TestResultSummary {
private final int total;
private final int passed;
private final int failed;public TestResultSummary(int total, int passed, int failed) {
this.total = total;
this.passed = passed;
this.failed = failed;
}
public double getPassRate() {
return total == 0 ? 0 : ((double) passed / total) * 100.0;
}
}