use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.
the class NodeAndPointQueryTest method node_queryAll_returns_set_with_nodes.
@Test
public void node_queryAll_returns_set_with_nodes() {
// when:
NodeQuery query = fx.lookup(".button");
// then:
assertThat(query.queryAll(), hasItems(button0, button1));
}
use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.
the class NodeMatchersTest method hasText_filters_nodes.
@Test
public void hasText_filters_nodes() throws Exception {
// given:
List<Node> nodes = FxToolkit.setupFixture(() -> {
List<Node> temp = new ArrayList<>(3);
temp.add(new Region());
temp.add(new Button("foo"));
temp.add(new TextField("bar"));
return temp;
});
// then:
NodeQuery query1 = from(nodes).match(LabeledMatchers.hasText("foo"));
assertThat(query1.queryAll(), hasItems(nodes.get(1)));
NodeQuery query2 = from(nodes).match(TextInputControlMatchers.hasText("bar"));
assertThat(query2.queryAll(), hasItems(nodes.get(2)));
}
use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.
the class NodeAssertTest method hasText_filters_nodes.
@Test
public void hasText_filters_nodes() throws Exception {
// given:
List<Node> nodes = FxToolkit.setupFixture(() -> {
List<Node> temp = new ArrayList<>(3);
temp.add(new Region());
temp.add(new Button("foo"));
temp.add(new TextField("bar"));
return temp;
});
// then:
NodeQuery query1 = from(nodes).match(LabeledMatchers.hasText("foo"));
assertThat(query1.queryAll()).containsExactly(nodes.get(1));
NodeQuery query2 = from(nodes).match(TextInputControlMatchers.hasText("bar"));
assertThat(query2.queryAll()).containsExactly(nodes.get(2));
}
use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.
the class FxRobot method point.
@Override
public <T extends Node> PointQuery point(Predicate<T> predicate) {
NodeQuery nodeQuery = lookup(predicate);
Node node = queryNode(nodeQuery, "the predicate");
return point(node).atPosition(context.getPointPosition());
}
use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.
the class FxRobot method pointOfVisibleNode.
private PointQuery pointOfVisibleNode(String query) {
NodeQuery nodeQuery = lookup(query);
Node node = queryVisibleNode(nodeQuery, "the query \"" + query + "\"");
return point(node);
}
Aggregations