Search in sources :

Example 21 with Document

use of org.apache.tapestry5.dom.Document 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 22 with Document

use of org.apache.tapestry5.dom.Document 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 23 with Document

use of org.apache.tapestry5.dom.Document 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 24 with Document

use of org.apache.tapestry5.dom.Document 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)

Example 25 with Document

use of org.apache.tapestry5.dom.Document 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)

Aggregations

Document (org.apache.tapestry5.dom.Document)20 Test (org.testng.annotations.Test)19 PageTester (org.apache.tapestry5.test.PageTester)11 Element (org.apache.tapestry5.dom.Element)8 MarkupWriter (org.apache.tapestry5.MarkupWriter)4 Document (elemental2.dom.Document)2 Element (elemental2.dom.Element)2 XMLMarkupModel (org.apache.tapestry5.dom.XMLMarkupModel)2 IOException (java.io.IOException)1 DocumentBuilder (javax.xml.parsers.DocumentBuilder)1 XPathExpressionException (javax.xml.xpath.XPathExpressionException)1 TestPageForActionLinkWithStream (org.apache.tapestry5.integration.app2.pages.TestPageForActionLinkWithStream)1 TestPageForHttpHeaders (org.apache.tapestry5.integration.app2.pages.TestPageForHttpHeaders)1 Page (org.apache.tapestry5.internal.structure.Page)1 RenderCommand (org.apache.tapestry5.runtime.RenderCommand)1 ComponentLibraryInfo (org.apache.tapestry5.services.ComponentLibraryInfo)1 Test (org.junit.Test)1 Document (org.w3c.dom.Document)1