Search in sources :

Example 11 with PageTester

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

the class PageTesterTest method application_path_is_defined_as_a_symbol.

@Test(dataProvider = "testers")
public void application_path_is_defined_as_a_symbol(PageTester tester) {
    SymbolSource source = tester.getRegistry().getService(SymbolSource.class);
    assertEquals(source.valueForSymbol(TapestryHttpInternalSymbols.APP_PACKAGE_PATH), "org/apache/tapestry5/integration/app2");
}
Also used : SymbolSource(org.apache.tapestry5.ioc.services.SymbolSource) Test(org.testng.annotations.Test)

Example 12 with PageTester

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

the class ActionLinkTest method click_link.

@Test
public void click_link() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage("TestPageForActionLink");
    Element link = doc.getElementById("link1");
    doc = tester.clickLink(link);
    assertTrue(doc.toString().contains("You chose: 123"));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Element(org.apache.tapestry5.dom.Element) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 13 with PageTester

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

the class AssetTest method submit_context_asset.

@Test
public void submit_context_asset() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME, "src/test/app2");
    Document doc = tester.renderPage("TestPageForAsset");
    assertTrue(doc.toString().contains("test.css"));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 14 with PageTester

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

the class FormTest method submit_form.

@Test
public void submit_form() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage("TestPageForForm");
    Element form = doc.getElementById("form1");
    Map<String, String> fieldValues = CollectionFactory.newMap();
    fieldValues.put("t1", "hello");
    doc = tester.submitForm(form, fieldValues);
    assertTrue(doc.toString().contains("You entered: hello"));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Element(org.apache.tapestry5.dom.Element) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.Test)

Example 15 with PageTester

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

the class IfTest method render.

@Test
public void render() {
    tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
    Document doc = tester.renderPage("TestPageForIf");
    assertNotNull(doc.getElementById("1"));
    assertNotNull(doc.getElementById("3"));
    assertNotNull(doc.getElementById("5"));
    assertNotNull(doc.getElementById("8"));
    assertNotNull(doc.getElementById("9"));
    assertNotNull(doc.getElementById("10"));
    assertNotNull(doc.getElementById("13"));
    assertNull(doc.getElementById("2"));
    assertNull(doc.getElementById("4"));
    assertNull(doc.getElementById("6"));
    assertNull(doc.getElementById("7"));
    assertNull(doc.getElementById("11"));
    assertNull(doc.getElementById("12"));
}
Also used : PageTester(org.apache.tapestry5.test.PageTester) Document(org.apache.tapestry5.dom.Document) Test(org.testng.annotations.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