I am testing an application that starts with a login page. After logging in the user is taken to the home page.
@Test public void test() { QuickStartApplication app = new QuickStartApplication(); Class clazz = app.getHomePage(); WicketTester tester = new WicketTester(new QuickStartApplication()); WebPage loginPage = null; try { loginPage = (WebPage) app.getHomePage().newInstance(); } catch (Exception e) { e.printStackTrace(); } // Start out with the login Page tester.startPage(loginPage); tester.assertRenderedPage(LoginPage.class); tester.assertComponent("form:name", TextField.class); tester.assertComponent("form:password", PasswordTextField.class); // login form FormTester formTester = tester.newFormTester("form"); formTester.setValue("name", "1"); formTester.setValue("password", "1"); // click button to login tester.executeAjaxEvent("form:submit", "onclick"); formTester.submit("submit"); // Successfully logged in. On the HomePage now tester.assertRenderedPage(HomePage.class); tester.assertComponent("form:text1", TextField.class); formTester = tester.newFormTester("form"); formTester.setValue("text1", "1"); // submit the home page form tester.executeAjaxEvent("form:submit", "onclick"); formTester.submit("submit"); tester.assertRenderedPage(HomePage.class); // Fails here. // junit.framework.AssertionFailedError: expected:<HomePage> but was:<LoginPage> // Why is that? It has already asserted earlier that it is the home page.. } Am I doing this thing right? Do I understand the Wicket tester right. I am attaching a quickstart project that includes the above test. As always, I would appreciate any help. Thanks. -Mohammad http://apache-wicket.1842946.n4.nabble.com/file/n3568766/WicketTesterTest.zip WicketTesterTest.zip -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/WicketTester-and-the-rendered-page-tp3568766p3568766.html Sent from the Users forum mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org