I am trying to run an asynchronous test and need to send a request to my server, which has a REST-API. So my problem is that the tests are executed on the local machine, but this obviously violates the same origin policy and I get a RuntimeError if I try to run the GWTtestCase:
com.google.gwt.http.client.RequestPermissionException: The URL http://<url-to-my-rest-service> is invalid or violates the same-origin security restriction
at com.google.gwt.http.client.RequestBuilder.doSend(RequestBuilder.java:394)
at com.google.gwt.http.client.RequestBuilder.send(RequestBuilder.java:242)
...
I know that I can run these tests manually, but with the latest updates of my browser (chromium), the GWT-Plugin was removed. So I don't know how to launch the tests in SuperDevMode.
Questions:
- Is there a way to ignore the same-origin policy for the GWT JUnit Tests?
- Can I change the browser which is used for the test to Chrome/Chromium?
- How can I manually run the tests with SuperDevMode in a browser?
Edit:
If I want to run the tests manually I write the following into the terminal:
mvn gwt:test -Dgwt.args="-prod -userAgents safari -runStyle Manual:1"
Maven then will print an URL to the terminal which I should enter into the browser to execute the tests:
http://127.0.1.1:57818/<my-package>.JUnit/junit-standards.html?gwt.codesvr=127.0.1.1:40387
But if I enter this URL into my browser (Chromium) it will notify me that the GWT-Plugin is currently not installed. If I remove the part behind the question mark (like I do if I want to run the GWT-Code in SuperDevMode on the localhost) ?gwt.codesvr=127.0.1.1:40387
then the browser will show only a blank page, and also if I started the codeserver with:
mvn process-classes gwt:run-codeserver
the codeserver-bookmarks (Dev Mode On
) are not working and GWT is not able to detect a module which is "compilable".
Question:
So how excatly do I compile the JUnit-Test-Module with the SuperDevMode?