11*** Settings ***
22Documentation Tests to test javafxlibrary.keywords.AdditionalKeywords.Find related keywords
33Library JavaFXLibrary
4- Suite Setup Setup all tests
54Suite Teardown Teardown all tests
65Force Tags set-find
76
87*** Variables ***
9- ${TEST_APPLICATION } javafxlibrary.testapps.TestBoundsLocation
8+ ${CURRENT_APPLICATION } NOT SET
9+ ${BOUNDS_APP } javafxlibrary.testapps.TestBoundsLocation
10+ ${WINDOW_APP } javafxlibrary.testapps.TestMultipleWindows
1011
1112*** Test Cases ***
1213Find With TestFX Query
1314 [Tags] smoke
15+ Set Test App ${BOUNDS_APP }
1416 ${rectangle } Find \#green
1517 ${text } Find .whiteText
1618 Should Contain ${rectangle } Rectangle[id=green, x=300.0, y=0.0, width=150.0, height=150.0, fill=0x00a000ff]
1719 Should Contain ${text } Text[text="75x75", x=0.0, y=0.0, alignment=CENTER, origin=BASELINE
1820
1921Find With XPath
2022 [Tags] smoke
23+ Set Test App ${BOUNDS_APP }
2124 ${rect_by_id } Find xpath=//Rectangle[@id="lime"]
2225 ${rect_by_fill } Find xpath=//Rectangle[@fill="0xff1493ff"]
2326 ${text } Find xpath=//Text[@text="75x75"]
@@ -27,50 +30,58 @@ Find With XPath
2730
2831Find With Class
2932 [Tags] smoke
33+ Set Test App ${BOUNDS_APP }
3034 ${rectangle } Find class=javafx.scene.shape.Rectangle
3135 ${text } Find class=javafx.scene.text.Text
3236 Should Contain ${rectangle } Rectangle[id=red, x=0.0, y=0.0, width=300.0, height=300.0, fill=0xff0000ff]
3337 Should Contain ${text } Text[text="300x300", x=0.0, y=0.0, alignment=CENTER, origin=BASELINE
3438
3539Find With CSS Query
3640 [Tags] smoke
41+ Set Test App ${BOUNDS_APP }
3742 ${rectangle } Find css=\#violet
3843 ${text } Find css=VBox HBox StackPane Text.whiteText
3944 Should Contain ${rectangle } Rectangle[id=violet, x=525.0, y=0.0, width=75.0, height=75.0, fill=0x9400d3ff]
4045 Should Contain ${text } Text[text="75x75", x=0.0, y=0.0, alignment=CENTER, origin=BASELINE
4146
4247Find With ID
4348 [Tags] smoke
49+ Set Test App ${BOUNDS_APP }
4450 ${rectangle } Find id=darkblue
4551 Should Contain ${rectangle } Rectangle[id=darkblue, x=300.0, y=150.0, width=300.0, height=150.0, fill=0x00008bff]
4652
4753Find With Chained Selectors
4854 [Tags] smoke
55+ Set Test App ${BOUNDS_APP }
4956 ${lime } Find css=VBox HBox Pane id=lime
5057 ${blue } Find css=VBox HBox Pane xpath=//Rectangle[@width="600.0"]
5158 Should Contain ${lime } Rectangle[id=lime, x=500.0, y=200.0, width=75.0, height=75.0, fill=0x00ff00ff]
5259 Should Contain ${blue } Rectangle[id=blue, x=0.0, y=0.0, width=600.0, height=300.0, fill=0x00bfffff]
5360
5461Find With Root
5562 [Tags] smoke
63+ Set Test App ${BOUNDS_APP }
5664 ${root } Find css=Pane
5765 ${rectangle } Find id=lime true ${root }
5866 Should Contain ${rectangle } Rectangle[id=lime, x=500.0, y=200.0, width=75.0, height=75.0, fill=0x00ff00ff]
5967
6068Find All With TestFX Query
6169 [Tags] smoke
70+ Set Test App ${BOUNDS_APP }
6271 @{nodes } Find All .whiteText
6372 Length Should Be ${nodes } 3
6473
6574Find All With XPath
6675 [Tags] smoke
76+ Set Test App ${BOUNDS_APP }
6777 @{all_rectangles } Find All xpath=//Rectangle
6878 @{text_nodes } Find All xpath=//Text[@text="75x75"]
6979 Length Should Be ${all_rectangles } 9
7080 Length Should Be ${text_nodes } 6
7181
7282Find All With CSS query
7383 [Tags] smoke
84+ Set Test App ${BOUNDS_APP }
7485 @{nodes1 } Find All css=VBox HBox > StackPane Rectangle
7586 @{nodes2 } Find All css=Pane Rectangle
7687 @{nodes3 } Find All css=Pane > Rectangle
@@ -80,13 +91,15 @@ Find All With CSS query
8091
8192Find All With Chained Selectors
8293 [Tags] smoke
94+ Set Test App ${BOUNDS_APP }
8395 @{nodes1 } Find All css=VBox HBox xpath=//Rectangle
8496 @{nodes2 } Find All css=VBox HBox xpath=//Rectangle[@width="75.0"]
8597 Length Should Be ${nodes1 } 6
8698 Length Should Be ${nodes2 } 4
8799
88100Find All With Root
89101 [Tags] smoke
102+ Set Test App ${BOUNDS_APP }
90103 ${xroot } Find css=VBox HBox VBox HBox
91104 ${croot } Find css=Pane
92105 @{xpath } Find All xpath=//Rectangle[@width="75.0"] false ${xroot }
@@ -96,6 +109,7 @@ Find All With Root
96109
97110Find Nth Node With XPath
98111 [Tags] smoke
112+ Set Test App ${BOUNDS_APP }
99113 ${node1 } Find xpath=/VBox/HBox/VBox/HBox/VBox/HBox/StackPane
100114 ${node2 } Find xpath=/VBox/HBox/VBox/HBox/VBox/HBox/StackPane[2]
101115 ${child1 } Find css=Rectangle true ${node1 }
@@ -105,6 +119,7 @@ Find Nth Node With XPath
105119
106120Find With Pseudo Class
107121 [Tags] smoke
122+ Set Test App ${BOUNDS_APP }
108123 ${root } Find css=VBox HBox VBox HBox StackPane
109124 ${target } Find xpath=//Text[@text="150x150"]
110125 Move To ${target }
@@ -113,6 +128,7 @@ Find With Pseudo Class
113128
114129Find All With Pseudo Class
115130 [Tags] smoke
131+ Set Test App ${BOUNDS_APP }
116132 ${node } Find xpath=//Text[@text="300x300"]
117133 Move To ${node }
118134 @{hovered } Find All pseudo=hover
@@ -124,48 +140,87 @@ Find All With Pseudo Class
124140
125141Nothing Is Found
126142 [Tags] smoke negative
143+ Set Test App ${BOUNDS_APP }
127144 ${node } Find css=NoSuchSelector
128145 Should Be Empty ${node }
129146
130147Nothing Is Found When failIfNotFound Is True
131148 [Tags] smoke negative
149+ Set Test App ${BOUNDS_APP }
132150 ${msg } Run Keyword And Expect Error * Find css=NoSuchSelector true
133151 Should Be Equal ${msg } Unable to find anything with query: "css=NoSuchSelector"
134152
135153Nothing Is Found With Find All
136154 [Tags] smoke negative
155+ Set Test App ${BOUNDS_APP }
137156 ${nodes } Find All css=NoSuchSelector
138157 Should Be Empty ${nodes }
139158
140159Nothing Is Found With Find All When failIfNotFound Is True
141160 [Tags] smoke negative
161+ Set Test App ${BOUNDS_APP }
142162 ${msg } Run Keyword And Expect Error * Find All css=NoSuchSelector true
143163 Should Be Equal ${msg } Unable to find anything with query: "css=NoSuchSelector"
144164
145165Previous Query Returns Nothing In Chained Selector
146166 [Tags] smoke negative
167+ Set Test App ${BOUNDS_APP }
147168 ${node } Find css=VBox css=ZBox Pane id=lime
148169 Should Be Empty ${node }
149170
150171Previous Query Returns Nothing In Chained Selector With Find All
151172 [Tags] smoke negative
173+ Set Test App ${BOUNDS_APP }
152174 ${nodes } Find All css=VBox css=ZBox Pane id=lime
153175 Should Be Empty ${nodes }
154176
155177Previous Query Returns Nothing In Chained Selector When failIfNotFound Is True
156178 [Tags] smoke negative
179+ Set Test App ${BOUNDS_APP }
157180 ${msg } Run Keyword And Expect Error * Find css=VBox css=ZBox Pane id=lime true
158181 Should Be Equal ${msg } Unable to find anything with query: "css=VBox css=ZBox Pane id=lime"
159182
160183Previous Query Returns Nothing In Chained Selector With Find All When failIfNotFound Is True
161184 [Tags] smoke negative
185+ Set Test App ${BOUNDS_APP }
162186 ${msg } Run Keyword And Expect Error * Find All css=VBox css=ZBox Pane id=lime true
163187 Should Be Equal ${msg } Unable to find anything with query: "css=VBox css=ZBox Pane id=lime"
164188
189+ Find From Another Window
190+ [Tags] smoke
191+ Set Test App ${WINDOW_APP }
192+ ${node } Find id=thirdWindowLabel
193+ Should End With ${node } Label[id=thirdWindowLabel, styleClass=label]'Third window'
194+
195+ Find From Another Window Using Chained Selector
196+ [Tags] smoke
197+ Set Test App ${WINDOW_APP }
198+ ${node } Find css=HBox id=thirdWindowLabel
199+ Should End With ${node } Label[id=thirdWindowLabel, styleClass=label]'Third window'
200+
201+ Find All From Multiple Windows
202+ [Tags] smoke
203+ Set Test App ${WINDOW_APP }
204+ ${nodes } Find All css=.label
205+ Length Should Be ${nodes } 3
206+
207+ Find All From Multiple Windows Using Chained Selector
208+ [Tags] smoke
209+ Set Test App ${WINDOW_APP }
210+ ${nodes } Find All css=HBox css=.label
211+ Length Should Be ${nodes } 3
212+
165213*** Keywords ***
166- Setup all tests
167- Launch Javafx Application ${TEST_APPLICATION }
168- Set Screenshot Directory ${OUTPUT_DIR }${/ } report-images
214+ Set Test App
215+ [Arguments] ${APPLICATION }
216+ Run Keyword Unless '${CURRENT_APPLICATION } ' == '${APPLICATION } ' Change Current Application ${APPLICATION }
217+
218+ Change Current Application
219+ [Arguments] ${APPLICATION }
220+ Run Keyword Unless '${CURRENT_APPLICATION } ' == 'NOT SET' Close Javafx Application
221+ Set Suite Variable ${CURRENT_APPLICATION } ${APPLICATION }
222+ Launch Javafx Application ${APPLICATION }
223+ Set Screenshot Directory ${OUTPUT_DIR }${/ } report-images
169224
170225Teardown all tests
171226 Close Javafx Application
0 commit comments