Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node assertions? #1

Open
wimdeblauwe opened this issue Sep 2, 2016 · 3 comments
Open

Node assertions? #1

wimdeblauwe opened this issue Sep 2, 2016 · 3 comments

Comments

@wimdeblauwe
Copy link

It would be nice to be able to do things like:

NodeAssert.assertThat(find("#startMachineButton")).isDisabled();
NodeAssert.assertThat(find("#statusText")).isText().hasText("Machine stopped");
NodeAssert.assertThat(find("#startMachineButton")).isButton().hasText("Start");

(Note that the find method is a little helper method in my TestFX bases abstract base class I use in my UI tests to find a Node)

Are there any plans to provide node assertions?

@manuel-mauky
Copy link
Owner

Hi,
yes this sounds like a great idea. I hadn't had the time to implement something like this in the past.
One of the problems was what you solved with your find method: assertThat("#statusText") is actually a string matcher and not a node matcher. For such situations Hamcrest (which is used by TestFX) works better.
However, your example with the find method looks good to me. If you could contribute the find-method we could start to develop a NodeAssert class.

@manuel-mauky
Copy link
Owner

I assume the find method is heavily dependent on TestFX, isn't it?
This would be a problem because I want assertj-javafx to be independent from TestFX.

@wimdeblauwe
Copy link
Author

The asserts only depend on JavaFX Node, so that could be part of this library. How to find a Node is dependent on the testing framework used. We could just document how to do it with various frameworks. So for instance, show the code for the find method that uses TestFX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants