getImage() treats absolute URL as relative
Brought to you by:
henryju
My site has a page "/en/admin/43/pictures", and on that page there is an img tag with an absolute URL: "/pictures/1/1/200x200.jpg". In the following code, the assertImagePresent() call succeeds, but getImage() fails:
beginAt("/en/admin/43/pictures");
assertImagePresent("/pictures/1/1/200x200.jpg", null);
Image img = getImage("/pictures/1/1/200x200.jpg", null); // AssertionFailedError: Could not load image from http://localhost:8080/en/admin/43/pictures/1/1/200x200.jpg
Looking at the code, I see the problem is in the WebTester.createURL() method, which treats this as a relative URL and tacks it onto the current directory (i.e. /en/admin/43/), giving a nonexistent URL "/en/admin/43/pictures/1/1/200x200.jpg".
Same issue while testing our project for image presence.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Also seeing this same issue with our tests. Any time-frame for a fix or a workaround for this?
If someone can provide a patch with a JUnit test and the fix, I will be happy to apply it for next release.
What is the value you set to getTestContext().setBaseUrl(xxx)?
OK, should be fixed in next release (2.5).