jaroslav@1201: package ${package}; jaroslav@1201: jaroslav@1201: import org.apidesign.bck2brwsr.htmlpage.api.OnEvent; jaroslav@1201: import org.apidesign.bck2brwsr.vmtest.BrwsrTest; jaroslav@1201: import org.apidesign.bck2brwsr.vmtest.HtmlFragment; jaroslav@1201: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@1201: import org.testng.annotations.Factory; jaroslav@1201: jaroslav@1201: /** Sometimes it is useful to run tests inside of the real browser. jaroslav@1201: * To do that just annotate your method with {@link org.apidesign.bck2brwsr.vmtest.BrwsrTest} jaroslav@1201: * and that is it. If your code references elements on the HTML page, jaroslav@1201: * you can pass in an {@link org.apidesign.bck2brwsr.vmtest.HtmlFragment} which jaroslav@1201: * will be made available on the page before your test starts. jaroslav@1201: * jaroslav@1201: * @author Jaroslav Tulach jaroslav@1201: */ jaroslav@1201: public class IntegrationTest { jaroslav@1201: jaroslav@1201: /** Write to testing code here. Use assert (but not TestNG's jaroslav@1201: * Assert, as TestNG is not compiled with target 1.6 yet). jaroslav@1201: */ jaroslav@1201: @HtmlFragment( jaroslav@1201: "

Loading Bck2Brwsr's Hello World...

\n" + jaroslav@1201: "Your name: \n" + jaroslav@1201: "\n" + jaroslav@1201: "

\n" + jaroslav@1201: " \n" + jaroslav@1201: "

\n" jaroslav@1201: ) jaroslav@1201: @BrwsrTest jaroslav@1201: public void modifyValueAssertChangeInModel() { jaroslav@1201: Index m = new Index(); jaroslav@1201: m.setName("Joe Hacker"); jaroslav@1201: m.applyBindings(); jaroslav@1201: assert "Joe Hacker".equals(m.input.getValue()) : "Value is really Joe Hacker: " + m.input.getValue(); jaroslav@1201: m.input.setValue("Happy Joe"); jaroslav@1201: m.triggerEvent(m.input, OnEvent.CHANGE); jaroslav@1201: assert "Happy Joe".equals(m.getName()) : "Name property updated to Happy Joe: " + m.getName(); jaroslav@1201: } jaroslav@1201: jaroslav@1201: @Factory jaroslav@1201: public static Object[] create() { jaroslav@1201: return VMTest.create(IntegrationTest.class); jaroslav@1201: } jaroslav@1201: jaroslav@1201: }