diff --git a/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java b/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java index 18c01a42c..bdd5a6d74 100644 --- a/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java +++ b/tools/junit/src/main/java/org/teavm/junit/TeaVMTestRunner.java @@ -228,8 +228,8 @@ public class TeaVMTestRunner extends Runner implements Filterable { private Process chromeBrowser(String url) { return browserTemplate("chrome", url, (profile, params) -> { + addChromeCommand(params); params.addAll(Arrays.asList( - "google-chrome-stable", "--headless", "--disable-gpu", "--remote-debugging-port=9222", @@ -241,8 +241,8 @@ public class TeaVMTestRunner extends Runner implements Filterable { private Process firefoxBrowser(String url) { return browserTemplate("firefox", url, (profile, params) -> { + addFirefoxCommand(params); params.addAll(Arrays.asList( - "firefox", "--headless", "--profile", profile @@ -250,6 +250,30 @@ public class TeaVMTestRunner extends Runner implements Filterable { }); } + private void addChromeCommand(List params) { + if (isWindows()) { + params.add("cmd.exe"); + params.add("start"); + params.add("/C"); + params.add("chrome"); + } else { + params.add("google-chrome-stable"); + } + } + + private void addFirefoxCommand(List params) { + if (isWindows()) { + params.add("cmd.exe"); + params.add("/C"); + params.add("start"); + } + params.add("firefox"); + } + + private boolean isWindows() { + return System.getProperty("os.name").toLowerCase().startsWith("windows"); + } + private Process browserTemplate(String name, String url, BiConsumer> paramsBuilder) { File temp; try {