PageRenderTime 42ms CodeModel.GetById 27ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/src/test/java/org/sigmah/endtoend/xpath/ext/GxtXPath.java

http://sigma-h.googlecode.com/
Java | 64 lines | 43 code | 17 blank | 4 comment | 0 complexity | 6dc8d1d3b7c496a8072926e31fff9ad1 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
 6package org.sigmah.endtoend.xpath.ext;
 7
 8import org.sigmah.endtoend.xpath.Conjunction;
 9import org.sigmah.endtoend.xpath.Predicate;
10import org.sigmah.endtoend.xpath.Step;
11
12import static org.sigmah.endtoend.xpath.XPath.*;
13import static org.sigmah.endtoend.xpath.ext.HtmlXPath.ofClass;
14
15public class GxtXPath {
16
17    public static PanelPredicateBuilder isAPanel() {
18        return new PanelPredicateBuilder();
19    }
20
21    public static Predicate isAGrid() {
22        return ofClass("x-grid3");
23    }
24
25    public static Predicate isComboBox() {
26        return new Conjunction(
27                ofClass("x-form-field-wrap"),
28                having(descendant(isFormTrigger())));
29    }
30
31    public static Predicate isFormTrigger() {
32        return ofClass("x-form-trigger");
33    }
34
35    public static Predicate isToolbar() {
36        return ofClass("x-toolbar");
37    }
38
39    public static Step gridRow(int index) {
40        return descendant(isGridRow(), position(index));
41    }
42
43    private static Predicate isGridRow() {
44        return ofClass("x-grid3-row");
45    }
46
47    public static Step gridCell(int index) {
48        return descendant(ofClass("x-grid3-cell"), position(index));
49    }
50
51    public static class PanelPredicateBuilder extends Conjunction {
52
53        public PanelPredicateBuilder() {
54            add(ofClass("x-panel"));
55        }
56
57        public PanelPredicateBuilder withHeaderText(String heading) {
58            add(having(descendant(ofClass("x-panel-header-text"), havingTextEqualTo(heading))));
59            return this;
60        }
61    }
62
63
64}