Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-5989

BaseWicketTester#startComponentInPage fails for pages with <wicket:header-items></wicket:header> placeholder

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 6.20.0
    • 6.21.0, 7.1.0
    • wicket
    • None
    • Windows 7, Java 7

    Description

      I am using the BaseWicketTester.html#startComponentInPage(C) to validate individual components/panels.

      I am overriding the BaseWicketTester.html#createPage() and BaseWicketTester.html#createPageMarkup(java.lang.String) methods to return a dummy page that contains a placeholder for components-to-be-tested. The dummy page extends my base page class.

      My base page class makes use of the <wicket:header-items/> placeholder tag.

      When attempting to use BaseWicketTester.html#createPage() method, the method fails with the following error message:

      Error while parsing the markup for the autogenerated page: More than one <wicket:header-items/> detected in the <head> element. Only one is allowed.

      If I remove the <wicket:header-items/> placeholder tag from my base page class, the test runs successfully.

      The test only fails when using the BaseWicketTester.html#startComponentInPage(C), which only accepts one argument. If I use the BaseWicketTester.html#startComponentInPage(C, org.apache.wicket.markup.IMarkupFragment) and pass in the MarkupFragment of the test class as the second argument, then the test runs successfully, e.g.

      tester.startComponentInPage(new MyPanel(DummyPanelPage.TEST_PANEL_ID),  new MyDummyPanelPage(new PageParameters()).getMarkup());
      

      It would seem that the <wicket:header-items/> placeholder tag clashes with the ContainerInfo class used by the testing framework, but this is by no means my area of expertise.

      I am attaching a quick-start app with a TestHomePage test class that reproduces the issue.

      Thank you in advance!

      Attachments

        1. myproject.zip
          63 kB
          Ephraim Rosenfeld

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            ephraimrosenfeld Ephraim Rosenfeld
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: