Details
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!