use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.
the class TemplateInContextTest method template_in_web_context.
@Test
public void template_in_web_context() {
tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME, "src/test/app2");
Document doc = tester.renderPage("TestPageForTemplateInContext");
assertTrue(doc.toString().contains("How are you?"));
}
use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.
the class UnlessTest method render.
@Test
public void render() {
tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
Document doc = tester.renderPage("TestPageForUnless");
assertNotNull(doc.getElementById("2"));
assertNotNull(doc.getElementById("4"));
assertNotNull(doc.getElementById("6"));
assertNotNull(doc.getElementById("7"));
assertNull(doc.getElementById("1"));
assertNull(doc.getElementById("3"));
assertNull(doc.getElementById("5"));
assertNull(doc.getElementById("8"));
}
use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.
the class PageTesterTest method setup.
@BeforeClass
public void setup() {
nonEmptyAppNameTester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME, "src/test/app2");
emptyAppNameTester = new PageTester(TestConstants.APP2_PACKAGE, "", "src/test/app2");
}
use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.
the class PageTesterTest method on_activate_chain_is_followed.
@Test(dataProvider = "testers")
public void on_activate_chain_is_followed(PageTester tester) {
Document launchDoc = tester.renderPage("Launch");
Map<String, String> parameters = Collections.emptyMap();
// Submit the form, which will then skip through Intermediate and
// arrive at Final.
Document finalDoc = tester.submitForm(launchDoc.getElementById("form"), parameters);
assertEquals(finalDoc.getElementById("page-name").getChildMarkup(), "Final");
}
use of org.apache.tapestry5.test.PageTester in project tapestry-5 by apache.
the class DTDTest method verify_correct_dtds.
@Test(dataProvider = "dtd_page_provider")
public void verify_correct_dtds(String pageName, String expectedDTD, String checkText) {
PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
Document doc = tester.renderPage(pageName);
String txt = doc.toString();
// use startsWith to make sure the DTD is getting into the right spot.
assertTrue(txt.startsWith(expectedDTD));
// we should also make sure that the other DTD's don't appear anywhere else...
checkOtherDTD(txt, expectedDTD);
// spot check the body of the pages to make sure they correctly rendered...
// they should have, based on the unit tests for template rendering, but...
assertTrue(txt.contains(checkText));
}
Aggregations