public void testAjaxTagEventAttribute() throws Exception {
    getPage("/faces/ajax/ajaxTagEventAttribute.xhtml");
    System.out.println("Start ajax tag event attribute test");

    // Check initial values
    checkTrue("out1", "0");
    checkTrue("out2", "1");
    checkTrue("out3", "");
    checkTrue("checkedvalue1", "false");
    checkTrue("checkedvalue2", "false");

    // Press Count
    HtmlSubmitInput button = (HtmlSubmitInput) lastpage.getHtmlElementById("button");
    lastpage = (HtmlPage) button.click();

    checkTrue("out1", "0");
    checkTrue("out2", "0");

    HtmlInput input = (HtmlInput) lastpage.getHtmlElementById("in1");
    lastpage = (HtmlPage) input.setValueAttribute("test");

    checkTrue("out3", "test");

    // Check ajax checkbox
    HtmlCheckBoxInput checked = ((HtmlCheckBoxInput) lastpage.getHtmlElementById("checkbox1"));
    lastpage = (HtmlPage) checked.click();

    checkTrue("checkedvalue1", "true");

    // Check ajax checkbox
    checked = ((HtmlCheckBoxInput) lastpage.getHtmlElementById("checkbox2"));
    lastpage = (HtmlPage) checked.click();

    checkTrue("checkedvalue2", "true");

    // Check ajax checkbox
    checked = ((HtmlCheckBoxInput) lastpage.getHtmlElementById("checkbox3"));
    lastpage = (HtmlPage) checked.click();

    checkTrue("checkedvalue3", "true");

    // Check that all ajax requests didn't result in a reload
    checkTrue("out4", "2");
  }
  public void testAjaxTagEventWrapping() throws Exception {
    getPage("/faces/ajax/ajaxTagEventWrapping.xhtml");
    System.out.println("Start ajax tag event wrapping test");

    // Check initial values
    checkTrue("out1", "0");
    checkTrue("say", "init");
    checkTrue("paramOut", "");
    checkTrue("out2", "1");

    // Press Count
    HtmlSubmitInput button = (HtmlSubmitInput) lastpage.getHtmlElementById("button1");
    lastpage = (HtmlPage) button.click();

    checkTrue("out1", "2");
    checkTrue("out2", "1");

    // Press Say
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("button2");
    lastpage = (HtmlPage) button.click();

    checkTrue("say", "1");
    checkTrue("out1", "2");
    checkTrue("out2", "1");

    // Press Count and Say
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("button3");
    lastpage = (HtmlPage) button.click();

    checkTrue("say", "2");
    checkTrue("out1", "3");
    checkTrue("out2", "1");

    // Press Param
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("button4");
    lastpage = (HtmlPage) button.click();

    checkTrue("say", "init");
    checkTrue("out1", "4");
    checkTrue("out2", "5");
    checkTrue("paramOut", "testval");

    // Reset Page
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("reset");
    lastpage = (HtmlPage) button.click();
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("reload");
    lastpage = (HtmlPage) button.click();

    // Check initial values
    checkTrue("out1", "0");
    checkTrue("say", "init");
    checkTrue("paramOut", "");
    checkTrue("out2", "1");

    // Press Count and Param
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("button5");
    lastpage = (HtmlPage) button.click();

    checkTrue("out1", "2");
    checkTrue("say", "init");
    checkTrue("paramOut", "testval");
    checkTrue("out2", "1");

    // Reset Page
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("reset");
    lastpage = (HtmlPage) button.click();
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("reload");
    lastpage = (HtmlPage) button.click();

    // Check initial values
    checkTrue("out1", "0");
    checkTrue("say", "init");
    checkTrue("paramOut", "");
    checkTrue("out2", "1");

    // Press Count and Say and Param
    /*  Test is faulty - commenting out - race to see if say is actually set

    button = (HtmlSubmitInput) lastpage.getHtmlElementById("button6");
    lastpage = (HtmlPage) button.click();

    checkTrue("out1","2");
    checkTrue("say","1");
    checkTrue("paramOut","testval");
    checkTrue("out2","1");
    */
    // leaving out button 7

    // Reset Page
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("reset");
    lastpage = (HtmlPage) button.click();
    button = (HtmlSubmitInput) lastpage.getHtmlElementById("reload");
    lastpage = (HtmlPage) button.click();

    // Check initial values
    checkTrue("out1", "0");
    checkTrue("say", "init");
    checkTrue("paramOut", "");
    checkTrue("out2", "1");

    // Check ajax checkbox
    HtmlCheckBoxInput checked = ((HtmlCheckBoxInput) lastpage.getHtmlElementById("checkbox1"));
    lastpage = (HtmlPage) checked.click();

    System.out.println(getText("checkedvalue1"));
    checkTrue("checkedvalue1", "true");
    checkTrue("out2", "1");

    // Check ajax + userwrap checkbox
    checked = ((HtmlCheckBoxInput) lastpage.getHtmlElementById("checkbox2"));
    lastpage = (HtmlPage) checked.click();

    checkTrue("checkedvalue2", "true");
    checkTrue("say", "1");
    checkTrue("out2", "1");

    // Check user onchange checkbox
    checked = ((HtmlCheckBoxInput) lastpage.getHtmlElementById("checkbox3"));
    lastpage = (HtmlPage) checked.click();

    checkTrue("checkedvalue3", "false");
    checkTrue("say", "2");
    checkTrue("out2", "1");
  }