mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fix running multi-configuration tests in HTMLUnit
This commit is contained in:
parent
2a07e67423
commit
d3134d3941
|
@ -59,7 +59,7 @@ class HtmlUnitRunStrategy implements TestRunStrategy {
|
|||
throw new RuntimeException(e);
|
||||
}
|
||||
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "runtime.js")));
|
||||
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), "test.js")));
|
||||
page.get().executeJavaScript(readFile(new File(run.getBaseDirectory(), run.getFileName())));
|
||||
|
||||
AsyncResult asyncResult = new AsyncResult();
|
||||
Function function = (Function) page.get().executeJavaScript(readResource("teavm-htmlunit-adapter.js"))
|
||||
|
|
|
@ -32,7 +32,6 @@ class SeleniumRunStrategy implements TestRunStrategy {
|
|||
private URL url;
|
||||
private ThreadLocal<WebDriver> webDriver = new ThreadLocal<>();
|
||||
private ThreadLocal<Integer> commandsSent = new ThreadLocal<>();
|
||||
private int rebootRate = Integer.getInteger("teavm.junit.js.selenium.rebootAfter", 1000);
|
||||
|
||||
public SeleniumRunStrategy(URL url) {
|
||||
this.url = url;
|
||||
|
@ -68,7 +67,7 @@ class SeleniumRunStrategy implements TestRunStrategy {
|
|||
return (String) js.executeAsyncScript(
|
||||
readResource("teavm-selenium.js"),
|
||||
readFile(new File(run.getBaseDirectory(), "runtime.js")),
|
||||
readFile(new File(run.getBaseDirectory(), "test.js")),
|
||||
readFile(new File(run.getBaseDirectory(), run.getFileName())),
|
||||
readResource("teavm-selenium-adapter.js"));
|
||||
} catch (Throwable e) {
|
||||
run.getCallback().error(e);
|
||||
|
|
|
@ -332,7 +332,7 @@ public class TeaVMTestRunner extends Runner implements Filterable {
|
|||
|
||||
return new TestRun(compileResult.file.getParentFile(), child,
|
||||
new MethodReference(testClass.getName(), getDescriptor(child)),
|
||||
description, callback);
|
||||
description, compileResult.file.getName(), callback);
|
||||
}
|
||||
|
||||
private void submitRun(TestRun run) {
|
||||
|
@ -402,6 +402,11 @@ public class TeaVMTestRunner extends Runner implements Filterable {
|
|||
.setClassLoader(classLoader)
|
||||
.setClassSource(classSource)
|
||||
.build();
|
||||
|
||||
Properties properties = new Properties();
|
||||
applyProperties(method.getDeclaringClass(), properties);
|
||||
vm.setProperties(properties);
|
||||
|
||||
vm.setIncremental(false);
|
||||
configuration.apply(vm);
|
||||
vm.installPlugins();
|
||||
|
@ -409,10 +414,6 @@ public class TeaVMTestRunner extends Runner implements Filterable {
|
|||
new TestExceptionPlugin().install(vm);
|
||||
new TestEntryPointTransformer(runnerType.getName(), methodHolder.getReference()).install(vm);
|
||||
|
||||
Properties properties = new Properties();
|
||||
applyProperties(method.getDeclaringClass(), properties);
|
||||
vm.setProperties(properties);
|
||||
|
||||
MethodReference exceptionMsg = new MethodReference(ExceptionHelper.class, "showException",
|
||||
Throwable.class, String.class);
|
||||
vm.entryPoint("runTest", new MethodReference(TestEntryPoint.class, "run", void.class)).async();
|
||||
|
|
|
@ -26,14 +26,16 @@ class TestRun {
|
|||
private MethodReference reference;
|
||||
private Description description;
|
||||
private TestRunCallback callback;
|
||||
private String fileName;
|
||||
|
||||
TestRun(File baseDirectory, Method method, MethodReference reference, Description description,
|
||||
TestRun(File baseDirectory, Method method, MethodReference reference, Description description, String fileName,
|
||||
TestRunCallback callback) {
|
||||
this.baseDirectory = baseDirectory;
|
||||
this.method = method;
|
||||
this.reference = reference;
|
||||
this.description = description;
|
||||
this.callback = callback;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public File getBaseDirectory() {
|
||||
|
@ -55,4 +57,8 @@ class TestRun {
|
|||
public TestRunCallback getCallback() {
|
||||
return callback;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user