diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 3558591..20d7bf5 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -9,7 +9,7 @@ quarkus-playwright-integration-tests Quarkus Playwright - Integration Tests - 3.10.1 + 3.12.0 @@ -30,7 +30,7 @@ io.quarkiverse.web-bundler quarkus-web-bundler - 1.5.0.CR2 + 1.6.0 io.quarkiverse.qute.web diff --git a/pom.xml b/pom.xml index fa1c185..18d501d 100644 --- a/pom.xml +++ b/pom.xml @@ -23,12 +23,12 @@ HEAD - 3.12.1 + 3.13.0 11 UTF-8 UTF-8 3.3.1 - 1.41.2 + 1.44.0 @@ -75,4 +75,4 @@ - + \ No newline at end of file diff --git a/testing/src/main/java/io/quarkiverse/playwright/QuarkusPlaywrightManager.java b/testing/src/main/java/io/quarkiverse/playwright/QuarkusPlaywrightManager.java index 9b4b3e6..97385e1 100644 --- a/testing/src/main/java/io/quarkiverse/playwright/QuarkusPlaywrightManager.java +++ b/testing/src/main/java/io/quarkiverse/playwright/QuarkusPlaywrightManager.java @@ -1,10 +1,13 @@ package io.quarkiverse.playwright; +import java.nio.file.Paths; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import org.apache.commons.lang3.StringUtils; + import com.microsoft.playwright.Browser; import com.microsoft.playwright.BrowserContext; import com.microsoft.playwright.BrowserType; @@ -51,7 +54,12 @@ public Map start() { .setArgs(Arrays.asList(this.options.args())); this.playwrightBrowser = browser(playwright, this.options.browser()).launch( launchOptions); - this.playwrightContext = playwrightBrowser.newContext(); + + final Browser.NewContextOptions contextOptions = new Browser.NewContextOptions(); + if (StringUtils.isNotBlank(this.options.recordVideoDir())) { + contextOptions.setRecordVideoDir(Paths.get(this.options.recordVideoDir())); + } + this.playwrightContext = playwrightBrowser.newContext(contextOptions); return Collections.emptyMap(); } @@ -69,6 +77,10 @@ private static BrowserType browser(Playwright playwright, WithPlaywright.Browser @Override public void stop() { + if (this.playwrightContext != null) { + this.playwrightContext.close(); + this.playwrightContext = null; + } if (playwright != null) { playwright.close(); playwright = null; diff --git a/testing/src/main/java/io/quarkiverse/playwright/WithPlaywright.java b/testing/src/main/java/io/quarkiverse/playwright/WithPlaywright.java index 0c0a7d0..fc66eba 100644 --- a/testing/src/main/java/io/quarkiverse/playwright/WithPlaywright.java +++ b/testing/src/main/java/io/quarkiverse/playwright/WithPlaywright.java @@ -52,6 +52,11 @@ */ double slowMo() default 0; + /** + * Enables video recording for all pages into the specified directory. If not specified videos are not recorded. + */ + String recordVideoDir() default ""; + /** * Args for use to launch the browser */ @@ -63,4 +68,4 @@ enum Browser { WEBKIT } -} +} \ No newline at end of file