/** * Triggers loading of all {@link AjaxLazyLoadPanel}'s content in the last rendered page. * * @param wt * the tester */ public static void executeAjaxLazyLoadPanel(final BaseWicketTester wt) { executeAjaxLazyLoadPanel(wt, wt.getLastRenderedPage()); }
/** * Renders a <code>Page</code> from its default constructor. * * @param pageClass * a test <code>Page</code> class with default constructor * @return the rendered <code>Page</code> */ public final Page startPage(Class pageClass) { processRequestCycle(pageClass); return getLastRenderedPage(); }
/** * Renders a <code>Page</code> from its default constructor. * * @param <C> * * @param pageClass * a test <code>Page</code> class with default constructor * @return the rendered <code>Page</code> */ public final <C extends Page> Page startPage(Class<C> pageClass) { processRequestCycle(pageClass); return getLastRenderedPage(); }
/** * Renders a <code>Page</code> from its default constructor. * * @param pageClass * a test <code>Page</code> class with default constructor * @param parameters * the parameters to use for the class. * @return the rendered <code>Page</code> */ public final Page startPage(Class pageClass, PageParameters parameters) { processRequestCycle(pageClass, parameters); return getLastRenderedPage(); }
/** * Renders a <code>Page</code> from its default constructor. * * @param <C> * * @param pageClass * a test <code>Page</code> class with default constructor * @param parameters * the parameters to use for the class. * @return the rendered <code>Page</code> */ public final <C extends Page> Page startPage(Class<C> pageClass, PageParameters parameters) { processRequestCycle(pageClass, parameters); return getLastRenderedPage(); }
/** * Dumps the <code>Component</code> trees to log. Show only the <code>Component</code>s whose * paths contain the filter <code>String</code>. * * @param filter * a filter <code>String</code> */ public void debugComponentTrees(String filter) { log.info("debugging ----------------------------------------------"); for (WicketTesterHelper.ComponentData obj : WicketTesterHelper.getComponentData(getLastRenderedPage())) { if (obj.path.matches(".*" + filter + ".*")) { log.info("[{}{}] path\t" + obj.path + " \t" + obj.type + " \t[" + obj.value + "]", obj.isEnabled?"E":"-", obj.isVisible?"V":"-"); } } }
/** * Dumps the <code>Component</code> trees to log. Show only the <code>Component</code>s * whose paths contain the filter <code>String</code>. * * @param filter * a filter <code>String</code> */ public void debugComponentTrees(String filter) { log.info("debugging ----------------------------------------------"); for (Iterator iter = WicketTesterHelper.getComponentData(getLastRenderedPage()).iterator(); iter.hasNext();) { WicketTesterHelper.ComponentData obj = (WicketTesterHelper.ComponentData)iter.next(); if (obj.path.matches(".*" + filter + ".*")) { log.info("path\t" + obj.path + " \t" + obj.type + " \t[" + obj.value + "]"); } } }
/** * Retrieves <code>FeedbackMessages</code>. * * @param filter * A filter that decides which messages to collect * @return <code>List</code> of messages (as <code>String</code>s) * @see FeedbackMessage */ public List<FeedbackMessage> getFeedbackMessages(final IFeedbackMessageFilter filter) { return new FeedbackCollector(getLastRenderedPage(), true).collect(filter); }
/** * Retrieves <code>FeedbackMessages</code>. * * @param filter * A filter that decides which messages to collect * @return <code>List</code> of messages (as <code>String</code>s) * @see FeedbackMessage */ public List<FeedbackMessage> getFeedbackMessages(final IFeedbackMessageFilter filter) { return new FeedbackCollector(getLastRenderedPage(), true).collect(filter); }
public Component assertExists(final String path) { Component component = getComponentFromLastRenderedPage(path); if (component == null) { fail("path: '" + path + "' does not exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); return null; } return component; }
public Component assertExists(final String path) { Component component = getComponentFromLastRenderedPage(path); if (component == null) { fail("path: '" + path + "' does not exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); return null; } return component; }
public void assertNotExists(final String path) { Component component = getComponentFromLastRenderedPage(path, true, false); if (component != null) { fail("path: '" + path + "' does exists for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } }
public void assertNotExists(final String path) { Component component = getComponentFromLastRenderedPage(path, true, false); if (component != null) { fail("path: '" + path + "' does exists for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } }
/** * assert component visible. * * @param path * path to component * @return a <code>Result</code> */ public Result isVisible(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isTrue("component '" + path + "' is not visible", component.isVisibleInHierarchy()); }
/** * assert component disabled. * * @param path * path to component * @return a <code>Result</code> */ public Result isDisabled(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isFalse("component '" + path + "' is enabled", component.isEnabledInHierarchy()); }
/** * assert component enabled. * * @param path * path to component * @return a <code>Result</code> */ public Result isEnabled(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isTrue("component '" + path + "' is disabled", component.isEnabledInHierarchy()); }
/** * assert component visible. * * @param path * path to component * @return a <code>Result</code> */ public Result isVisible(String path) { Component component = getLastRenderedPage().get(path); if (component == null) { fail("path: '" + path + "' does no exist for page: " + Classes.simpleName(getLastRenderedPage().getClass())); } return isTrue("component '" + path + "' is not visible", component.isVisibleInHierarchy()); }
/** * Renders the page specified by given {@link IPageProvider}. After render the page instance can * be retrieved using {@link #getLastRenderedPage()} and the rendered document will be available * in {@link #getLastResponse()}. * * Depending on {@link RenderStrategy} invoking this method can mean that a redirect will happen * before the actual render. * * @param pageProvider * @return last rendered page */ public Page startPage(final IPageProvider pageProvider) { // should be null for Pages componentInPage = null; // prepare request request.setURL(request.getContextPath() + request.getServletPath() + "/"); IRequestHandler handler = new RenderPageRequestHandler(pageProvider); // process request processRequest(request, handler); // The page rendered return getLastRenderedPage(); }
/** * Cleans up feedback messages given the specified filter. * * @param filter * filter used to cleanup messages, accepted messages will be removed */ protected void cleanupFeedbackMessages(IFeedbackMessageFilter filter) { ApplicationSettings applicationSettings = application.getApplicationSettings(); IFeedbackMessageFilter old = applicationSettings.getFeedbackMessageCleanupFilter(); applicationSettings.setFeedbackMessageCleanupFilter(filter); getLastRenderedPage().detach(); getSession().detach(); applicationSettings.setFeedbackMessageCleanupFilter(old); }
/** * Cleans up feedback messages given the specified filter. * * @param filter * filter used to cleanup messages, accepted messages will be removed */ protected void cleanupFeedbackMessages(IFeedbackMessageFilter filter) { ApplicationSettings applicationSettings = application.getApplicationSettings(); IFeedbackMessageFilter old = applicationSettings.getFeedbackMessageCleanupFilter(); applicationSettings.setFeedbackMessageCleanupFilter(filter); getLastRenderedPage().detach(); getSession().detach(); applicationSettings.setFeedbackMessageCleanupFilter(old); }