Wicket
  1. Wicket
  2. WICKET-1264

assertComponentOnAjaxResponse does not work with WicketTester.clickLink

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.0-final
    • Fix Version/s: 1.3.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      mac osx 10.4

      Description

      assertComponentOnAjaxResponse does not work with clickLink. Workaround are to call wickettester..executeAjaxEvent(ajaxLink,"onclick"); instead.

      Reason why this fails has something todo with that clickLink creates a servlet response which are empty hence this will always fail:

      // Get the AJAX response
      String ajaxResponse = getServletResponse().getDocument();

      // Test that the previous response was actually a AJAX response
      failMessage = "The Previous response was not an AJAX response. "
      + "You need to execute an AJAX event, using clickLink, before using this assert";
      boolean isAjaxResponse = ajaxResponse.startsWith("<?xml version=\"1.0\" encoding=\"UTF-8\"?><ajax-response>");

      proposed fix are to rewrite wicketTester.clicklink(string path,boolean ajax) to call executeAjaxEvent instead if possible?

        Activity

        Hide
        Anton Vodonosov added a comment -

        The solution - disabling buffered responses to make tests passing - is problematic.

        My application relies on the fact the requests are buffered. In result the code that expects the buffering fails during tests, because the MockWebApplication.init() disables buffering (overriding my changes).

        Also, I should say, disabling buffering to fix the problem means the wicket doesn't support buffered mode. Is it true?

        Show
        Anton Vodonosov added a comment - The solution - disabling buffered responses to make tests passing - is problematic. My application relies on the fact the requests are buffered. In result the code that expects the buffering fails during tests, because the MockWebApplication.init() disables buffering (overriding my changes). Also, I should say, disabling buffering to fix the problem means the wicket doesn't support buffered mode. Is it true?
        Igor Vaynberg made changes -
        Assignee Gerolf Seitz [ seitz ]
        Hide
        Nino Martinez added a comment -

        Cool!

        Show
        Nino Martinez added a comment - Cool!
        Hide
        Gerolf Seitz added a comment -

        i committed the change to trunk.
        if you click on "Subversion Commits" here in jira, you can see the associated commits.

        Show
        Gerolf Seitz added a comment - i committed the change to trunk. if you click on "Subversion Commits" here in jira, you can see the associated commits.
        Hide
        Nino Martinez added a comment -

        Hi, is it a patch or something you must do manually?If so how?

        Show
        Nino Martinez added a comment - Hi, is it a patch or something you must do manually?If so how?
        Gerolf Seitz made changes -
        Assignee Gerolf Seitz [ seitz ]
        Fix Version/s 1.3.1 [ 12312500 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Gerolf Seitz added a comment -

        the fix was just to set the WebApplication to not buffer the response.

        Show
        Gerolf Seitz added a comment - the fix was just to set the WebApplication to not buffer the response.
        Nino Martinez made changes -
        Field Original Value New Value
        Attachment WicketTesterAjaxTrouble.zip [ 12372613 ]
        Hide
        Nino Martinez added a comment -

        displays mentioned bug and workaround.

        Show
        Nino Martinez added a comment - displays mentioned bug and workaround.
        Nino Martinez created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Nino Martinez
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development