/tests/src/test/java/org/sigmah/endtoend/xpath/XPathTest.java

http://sigma-h.googlecode.com/ · Java · 40 lines · 26 code · 10 blank · 4 comment · 0 complexity · 0da0b19c105959c690253c822958b97a MD5 · raw file

  1. /*
  2. * All Sigmah code is released under the GNU General Public License v3
  3. * See COPYRIGHT.txt and LICENSE.txt.
  4. */
  5. package org.sigmah.endtoend.xpath;
  6. import org.junit.Test;
  7. import static org.hamcrest.CoreMatchers.is;
  8. import static org.hamcrest.core.IsEqual.equalTo;
  9. import static org.junit.Assert.assertThat;
  10. import static org.sigmah.endtoend.xpath.XPath.*;
  11. import static org.sigmah.endtoend.xpath.ext.GxtXPath.*;
  12. public class XPathTest {
  13. @Test
  14. public void within() {
  15. System.err.println(
  16. relative(
  17. descendant(isAPanel().withHeaderText("Monthly Reports")),
  18. descendant(isAGrid())));
  19. }
  20. @Test
  21. public void grid() {
  22. System.err.println(relative(gridRow(3), gridCell(1)));
  23. }
  24. @Test
  25. public void multiplePredicates() {
  26. String xpath = XPath.relative(
  27. descendant(attribute("visible").equalTo("true"), position(3)));
  28. assertThat(xpath, is(equalTo("descendant::*[@visible = 'true'][position() = 3]")));
  29. }
  30. }