Skip to content

Provide convenience methods to find RNodes and Nodes that will fail if nothing is found. #22

@MarceloRuiz

Description

@MarceloRuiz

Users can easily the Optional values when searching either for a Node or RNode and are forced to interact with the Optional value. Sometimes it might be useful to just fail the test when the expected element is not present.

Consider adding the following convenience methods like the following ones:

protected <T extends Node> T find(final String searchTerm) {
	final Optional<RNode<T>> optional = rc().cssFirst(searchTerm);
	
	if (!optional.isPresent()) {
		fail("Unable to find Node with search term: '" + searchTerm + "'");
	}
	return optional.get().node();
}

protected <T extends Node> RNode<T> rNode(final String searchTerm) {
	final Optional<RNode<T>> optional = rc().cssFirst(searchTerm);
	
	if (!optional.isPresent()) {
		fail("Unable to find RNode with search term: '" + searchTerm + "'");
	}
	return optional.get();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions