renatoathaydes / Automaton

Simple framework which allows the testing of Swing and JavaFX2 applications.
Apache License 2.0
99 stars 20 forks source link

How to check components in a TableView javafx #36

Open matanbanin opened 8 years ago

matanbanin commented 8 years ago

Hi, i try to test a TableView, but i can only get the raw values from the table. How can i get the gui components using automathon like the tableCell2Component in the Swing section.

Thank you very much! Please continue on the great work!

renatoathaydes commented 8 years ago

Hi!

IF you can't do it right now, it's probably because TableView has some different way of keeping cells that I didn't account for, I will investigate this... if you know how to get what you want from the Node itself, let me know.

Regards.

renatoathaydes commented 8 years ago

I've had a look and it seems Automaton does already support selecting table headers and cells from a TableView.

I've added a test to prove that this works:

https://github.com/renatoathaydes/Automaton/commit/52c09f737bf8abd048440376717153491eaf9425

Isn't the Node you get by calling fxer.getAt( selector ) what you would expect?

Default cells usually have the type LabeledText, so I find it useful to filter with a complex selector:

Java:

LabeledText labelCell = fxer.getAt( matchingAll( "text:Jacob", "type:LabeledText" ) );

Groovy:

def labelCell = fxer[ matchingAll( 'text:Jacob', 'type:LabeledText' ) ]

See the docs for more details:

https://github.com/renatoathaydes/Automaton/blob/master/docs/getting-started-javafx.md