Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 0.3
-
Component/s: None
-
Labels:None
Description
I have been using the Canoo WebTest plugin for functional testing of Grails application.
When I run following test method:
def testLoginLogOutListNewDelete() {
webtest('teLoginLogOut basic operations: view list, create new entry, view, edit, dele, view') {
invoke(url: "http://localhost:8080/LIFT/auth/login")
}
}
I get the following errors:
[java] INFO (com.canoo.webtest.steps.request.TargetHelper) - getting response for url: http://localhost:8080/LIFT/auth/login
2007-12-18 15:07:41.192:/LIFT:INFO: GSP servlet initialized
2007-12-18 15:07:44.926:/LIFT:INFO: Initializing Spring FrameworkServlet 'grails-errorhandler'
[java] ERROR (com.gargoylesoftware.htmlunit.html.HtmlPage) - Error loading javascript from [http://localhost:8080/LIFT/plugins/jsecurity-0.1.1/j
/application.js] status=[404 Not Found]
[java] ERROR (com.gargoylesoftware.htmlunit.html.HtmlPage) - Error loading javascript from [http://localhost:8080/LIFT/plugins/jsecurity-0.1.1/j
/application.js]:
[java] com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found for http://localhost:8080/LIFT/plugins/jsecurity-0.1.1/js/app
ication.js
[java] at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:845)
[java] at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:775)
[java] at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:229)
The tag below
<g:javascript library="application"/>
are resolving as
<script type="text/javascript" src="/lift//plugins/jsecurity-0.1.1/js/application.js"></script>
but actually, the path to JS file should be like that
<script type="text/javascript" src="/lift/js/application.js"></script>
So, just for test I've copied JS files from the original location to the web-apps/plugins/jsecurity-0.1.1/ location (where Grails/Canoo is looking for them)
and after that the test was successful.
This is actually a tricky problem: the view is in the plugin, but the layout is in the application. So, somehow the plugin context path must be cleared once rendering reaches the layout - easier said than done I think.
In the meantime, I would simply copy login.gsp from the plugin to your grails-app/views/auth directory. This also enables you to customise the look of it.