Search in sources :

Example 16 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class ImagesTest method testImages.

/**
 * Test page.
 *
 * @throws Exception
 */
@Test
public void testImages() throws Exception {
    WicketTester tester = new WicketTester(new ImagesApplication());
    try {
        tester.startPage(Home.class);
        tester.assertContains("Wicket Examples - images");
    } finally {
        tester.destroy();
    }
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 17 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class LibraryTest method test_1.

/**
 * Test page.
 *
 * @throws Exception
 */
@Test
public void test_1() throws Exception {
    WicketTester tester = new WicketTester(new LibraryApplication());
    try {
        tester.startPage(SignIn.class);
        tester.assertContains("Wicket Examples - library");
        tester.assertContains("Username and password are both");
        FormTester formTester = tester.newFormTester("signInPanel:signInForm");
        formTester.setValue("username", "wicket");
        formTester.setValue("password", "wicket");
        formTester.submit();
        tester.assertRenderedPage(Home.class);
        tester.assertContains("Wicket Examples - library");
        tester.assertLabel("books:0:author", "Effective Java (Joshua Bloch)");
    } finally {
        tester.destroy();
    }
}
Also used : FormTester(org.apache.wicket.util.tester.FormTester) WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 18 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class NiceUrlTest method before.

/**
 */
@Before
public void before() {
    tester = new WicketTester(new NiceUrlApplication());
    tester.startPage(Home.class);
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Before(org.junit.Before)

Example 19 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class VelocityJavaScriptContributorTest method testRenderHead.

/**
 * Test that the header contribution is added correctly.
 */
@Test
public void testRenderHead() {
    WicketTester tester = new WicketTester();
    try {
        tester.startPage(VelocityJavaScriptPage.class);
        System.out.println(tester.getLastResponseAsString());
        tester.assertContains("msg1: " + VelocityJavaScriptPage.MSG1);
    } finally {
        tester.destroy();
    }
}
Also used : WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Example 20 with WicketTester

use of org.apache.wicket.util.tester.WicketTester in project wicket by apache.

the class SignInPanelTest method instantiateJustOnce.

/**
 * https://issues.apache.org/jira/browse/WICKET-3980
 */
@Test
public void instantiateJustOnce() {
    final AtomicInteger constructorsCalls = new AtomicInteger(0);
    WicketTester tester = new WicketTester(new TestApplication());
    assertEquals(0, constructorsCalls.get());
    tester.startPage(new TestPage(constructorsCalls));
    assertEquals(1, constructorsCalls.get());
    tester.assertRenderedPage(TestPage.class);
    assertEquals(1, constructorsCalls.get());
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) WicketTester(org.apache.wicket.util.tester.WicketTester) Test(org.junit.Test)

Aggregations

WicketTester (org.apache.wicket.util.tester.WicketTester)89 Test (org.junit.Test)54 Before (org.junit.Before)26 FormTester (org.apache.wicket.util.tester.FormTester)14 WebApplication (org.apache.wicket.protocol.http.WebApplication)9 MockApplication (org.apache.wicket.mock.MockApplication)6 AbstractDeploymentTest (org.apache.wicket.arquillian.testing.deployment.AbstractDeploymentTest)5 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)5 IPageManagerProvider (org.apache.wicket.IPageManagerProvider)4 IPageManagerContext (org.apache.wicket.page.IPageManagerContext)4 DummyApplication (org.apache.wicket.resource.DummyApplication)4 Component (org.apache.wicket.Component)3 Response (org.apache.wicket.request.Response)3 WicketApplication (sandbox.WicketApplication)3 TestWicketJavaEEApplication (org.apache.wicket.arquillian.testing.TestWicketJavaEEApplication)2 IAuthorizationStrategy (org.apache.wicket.authorization.IAuthorizationStrategy)2 RoleAuthorizationStrategy (org.apache.wicket.authroles.authorization.strategies.role.RoleAuthorizationStrategy)2 MockPageManager (org.apache.wicket.mock.MockPageManager)2 IManageablePage (org.apache.wicket.page.IManageablePage)2 IPageManager (org.apache.wicket.page.IPageManager)2