Menu

#117 getImage() treats absolute URL as relative

Release_2.5
closed-fixed
Core API (28)
5
2010-10-20
2010-03-15
Todd Owen
No

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".

Discussion

  • Alexandre CESARI

    Same issue while testing our project for image presence.

     
  • Anonymous

    Anonymous - 2010-08-12

    Also seeing this same issue with our tests. Any time-frame for a fix or a workaround for this?

     
  • Julien HENRY

    Julien HENRY - 2010-08-12

    If someone can provide a patch with a JUnit test and the fix, I will be happy to apply it for next release.

     
  • Julien HENRY

    Julien HENRY - 2010-10-19

    What is the value you set to getTestContext().setBaseUrl(xxx)?

     
  • Julien HENRY

    Julien HENRY - 2010-10-19
    • assigned_to: nobody --> henryju
     
  • Julien HENRY

    Julien HENRY - 2010-10-20

    OK, should be fixed in next release (2.5).

     
  • Julien HENRY

    Julien HENRY - 2010-10-20
    • milestone: --> Release_2.5
    • status: open --> closed-fixed
     

Log in to post a comment.