Search in sources :

Example 16 with PageTester

use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.

the class LoopTest method render.

@Test
public void render() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage("TestPageForLoop");
    assertTrue(doc.toString().contains("abcabcabc"));
    assertEquals(doc.getElementById("1").getChildMarkup(), "xyz");
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 17 with PageTester

use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.

the class OverrideMethodsTest method override_abstract_methods.

/**
 * TAP5-901
 */
@Test
public void override_abstract_methods() {
    PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    try {
        Document doc = tester.renderPage("OverrideAbstractMethods");
        assertEquals("6", doc.getElementById("length").getChildMarkup());
    } finally {
        tester.shutdown();
    }
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 18 with PageTester

use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.

the class SubmitTest method before.

@BeforeMethod
public void before() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    doc = tester.renderPage("TestPageForSubmit");
    fieldValues = CollectionFactory.newMap();
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 19 with PageTester

use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.

the class KaptchaUnitTest method cache_control_header.

@SuppressWarnings("unchecked")
@Test
public void cache_control_header() {
    PageTester tester = new PageTester("kaptcha.demo", "app");
    final TestableResponse response = tester.renderPageAndReturnResponse("KaptchaDemo");
    final List<String> headers = (List<String>) response.getHeaders("Cache-Control");
    assert "no-store, no-cache, must-revalidate".equals(headers.get(0));
    assert "post-check=0, pre-check=0".equals(headers.get(1));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) TestableResponse(org.apache.tapestry5.internal.test.TestableResponse) List(java.util.List) Test(org.junit.Test)

Aggregations

PageTester (org.apache.tapestry5.test.PageTester)16 Test (org.testng.annotations.Test)14 Document (org.apache.tapestry5.dom.Document)12 Element (org.apache.tapestry5.dom.Element)2 BeforeClass (org.testng.annotations.BeforeClass)2 List (java.util.List)1 ContentType (org.apache.tapestry5.http.ContentType)1 ResponseCompressionAnalyzer (org.apache.tapestry5.http.services.ResponseCompressionAnalyzer)1 TestableResponse (org.apache.tapestry5.internal.test.TestableResponse)1 Contribute (org.apache.tapestry5.ioc.annotations.Contribute)1 SymbolSource (org.apache.tapestry5.ioc.services.SymbolSource)1 Test (org.junit.Test)1 BeforeMethod (org.testng.annotations.BeforeMethod)1