Beta3 clicking on command Button is broken
kragoth Aug 28, 2008 3:35 AMI've just downloaded and build the latest version of JSFUnit. And now I'm getting an error when clicking on a command button. I end up with the page:
HtmlPage(javascript:'')@742012
Here are the relevant snippets of my test and xhtml
The xhtml (note I removed our custom tags to see if they were the problem, but....I'm still having the issue.
<?xml version="1.0" encoding="UTF-8"?> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="https://ajax4jsf.dev.java.net/ajax" xmlns:s="http://jboss.com/products/seam/taglib" xmlns:gekko="http://gekkoTagLibs.com" template="/layout/template.xhtml"> <ui:define name="body"> <ui:insert name="formheading" /> <gekko:summaryPanel id="summaryPanel"> <gekko:summaryData id="userData" label="User" value="#{UserMaintenanceDataBean.userFullName}" /> <gekko:summaryData id="loginData" label="Login ID" value="#{UserMaintenanceController.user.loginId}" /> </gekko:summaryPanel> <gekko:tabGroup id="tabGroup"> <!--<gekko:tabButton id="detailsTab" action="#{UserMaintenanceController.gotoUserDetailsTab()}" value="Details" disabled="#{UserMaintenanceController.isTabDisabled()}"/> <gekko:tabButton id="rolesTab" action="#{UserMaintenanceController.gotoUserRolesTab()}" value="Roles" disabled="#{UserMaintenanceController.isTabDisabled()}" /> <gekko:tabButton id="workgroupsTab" action="#{UserMaintenanceController.gotoUserWorkgroupsTab()}" value="Workgroups" disabled="#{UserMaintenanceController.isTabDisabled()}" /> <gekko:tabButton id="districtsTab" action="#{UserMaintenanceController.gotoUserDistrictsTab()}" value="Districts" disabled="#{UserMaintenanceController.isTabDisabled()}" />--> <h:commandButton id="detailsTab" action="#{UserMaintenanceController.gotoUserDetailsTab()}" value="Details" /> <h:commandButton id="rolesTab" action="#{UserMaintenanceController.gotoUserRolesTab()}" value="Roles" /> <h:commandButton id="workgroupsTab" action="#{UserMaintenanceController.gotoUserWorkgroupsTab()}" value="Workgroups" /> <h:commandButton id="districtsTab" action="#{UserMaintenanceController.gotoUserDistrictsTab()}" value="Districts" /> </gekko:tabGroup> <ui:insert name="formcontents" /> <h:panelGroup layout="block" styleClass="mainButtonGroup"> <gekko:commandButton id="userCancelButton" buttonType="submit" action="#{UserMaintenanceController.doCancel()}" value="CANCEL" rendered="#{false}" /> <gekko:commandButton id="userSaveButton" buttonType="submit" action="#{UserMaintenanceController.doSave()}" value="SAVE" rendered="#{UserMaintenanceController.canSave()}" /> <gekko:commandButton id="userSaveReturnButton" buttonType="submit" action="#{UserMaintenanceController.doSaveReturn()}" value="SAVE/RETURN" rendered="#{UserMaintenanceController.canSaveReturn()}" /> <gekko:commandButton id="userEditButton" buttonType="submit" action="#{UserMaintenanceController.doEdit()}" value="EDIT" rendered="#{UserMaintenanceController.canEdit()}" /> </h:panelGroup> </ui:define> </ui:composition>
Now the test.... part that fails.
log.debug("Click search for users"); searchPage.clickSearch(); assertTrue("No results returned from search.", searchPage.getNumberOfResults() > 0); searchPage.clickMaintainUserLink(0); maintenancepage = getPageDriver(UserDetailsMaintenancePageDriver.class); log.debug("Assert we have gone to the maintenance page."); assertTrue("User Maintenance (view mode) page was not displayed.", maintenancepage.isDisplayed()); maintenancepage.clickEdit(); log.debug("Change to edit mode."); assertTrue("User Maintenance page (edit mode) was not displayed.", maintenancepage.isDisplayed()); String newName = "UserTestFirstname:" + DateFormatUtils.formatDate(dateSvc.getCurrentDateTime(), DateFormatUtils.ISO_FULL_DATETIME_FORMAT); maintenancepage.setAccountLocked(true); maintenancepage.setGivenName(newName); maintenancepage.setSurname("UserMaintenanceTestSurname"); maintenancepage.setPosition("UserMaintenanceTestPosition"); maintenancepage.clickSave(); templatepage.clickRolesTab();
Everything is fine up until that last line. The page content is correct and everything is going well. When that last line is executed any further attempts to do anything fail because my HtmlPage is corrupt.
Here is the contents of the clickRolesTab() method:
public void clickRolesTab() { click("rolesTab"); }
Which delegates to.... (Yes I've abstracted all the other devs from the api :P)
public void click(String id) { try { testContext.getClient().click(id); validateNoErrorsFound(); } catch (IOException e) { ExceptionUtils.createLogged(IllegalStateException.class, log, "Error when clicking on component with id: " + id, e); } }
testContext of course is this:
public class GekkoJSFTestContext { private JSFSession session; private JSFClientSession client; private JSFServerSession server; public JSFSession getSession() { return session; } public void setSession(JSFSession session) { this.session = session; client = this.session.getJSFClientSession(); server = this.session.getJSFServerSession(); } public JSFClientSession getClient() { return client; } public void setClient(JSFClientSession client) { this.client = client; } public JSFServerSession getServer() { return server; } public void setServer(JSFServerSession server) { this.server = server; } }
This seems to be a bug that we had a long time ago and it has come back again. Strangely enough this doesn't happen on "all" my command buttons. So, I'm very confused! I'd like to not have to go back to beta 2 if possible :)
Thanks for any tips/help anyone can give.
On a side note though, JSFUnit is really coming along! Nice job!