Add ping test in aclrecovery suite
[integration/test.git] / csit / libraries / YangmanKeywords.robot
1 *** Settings ***
2 Documentation     A resource file containing all global keywords to help
3 ...               Yangman GUI and functional testing.
4 Library           Collections
5 Library           Selenium2Library    timeout=30    implicit_wait=30    run_on_failure=Selenium2Library.Log Source
6 Resource          ../variables/Variables.robot
7 Resource          GUIKeywords.robot
8 Resource          ../variables/YangmanGUIVariables.robot
9
10 *** Keywords ***
11 Open DLUX And Login And Navigate To Yangman URL
12     [Documentation]    Launches DLUX page using PhantomJS, or Xvfb, or real browser and navigates to yangman url.
13     GUIKeywords.Open Or Launch DLUX Page And Log In To DLUX
14     GUIKeywords.Navigate To URL    ${YANGMAN_SUBMENU_URL}
15
16 Return List Of Operation IDs
17     [Documentation]    Returns list of IDs of Get, Put, Post and Delete options in expanded operation select menu.
18     ${list}=    BuiltIn.Create List    ${GET_OPTION}    ${PUT_OPTION}    ${POST_OPTION}    ${DELETE_OPTION}
19     [Return]    ${list}
20
21 Return List Of Operation Names
22     [Documentation]    Returns list of operations names.
23     ${list}=    BuiltIn.Create List    GET    PUT    POST    DELETE
24     [Return]    ${list}
25
26 Expand Operation Select Menu
27     [Documentation]    Clicks operation select menu to expand it.
28     GUIKeywords.Patient Click    ${OPERATION_SELECT_INPUT}    ${OPERATION_SELECT_MENU_EXPANDED}
29
30 Exit Opened Application Dialog
31     [Documentation]    Closes opened/ expanded dialogs/ menus by clicking the backdrop.
32     Selenium2Library.Click Element    ${SELECT_BACKDROP}
33
34 Select Operation
35     [Arguments]    ${operation_id}
36     [Documentation]    Selects chosen operation from expanded operation select menu.
37     ${status}=    BuiltIn.Run Keyword And Return Status    GUIKeywords.Page Should Contain Element With Wait    ${OPERATION_SELECT_MENU_EXPANDED}
38     BuiltIn.Run Keyword If    "${status}"=="False"    Expand Operation Select Menu    ${OPERATION_SELECT_INPUT}
39     GUIKeywords.Focus And Click Element    ${operation_id}
40
41 Verify Selected Operation Is Displayed
42     [Arguments]    ${selected_operation_name}
43     [Documentation]    Verifies that the selected operation is now displayed in collapsed operation select menu.
44     ${selected_operation_xpath}=    BuiltIn.Set Variable    ${OPERATION_SELECT_INPUT}//span/div[contains(text(), "${selected_operation_name}")]
45     GUIKeywords.Page Should Contain Element With Wait    ${selected_operation_xpath}
46
47 Select Operation And Verify Operation Has Been Selected
48     [Arguments]    ${operation_id}    ${selected_operation_name}
49     [Documentation]    Selects chosen operation from expanded operation select menu and verifies the operation has been selected.
50     ${status}=    BuiltIn.Run Keyword And Return Status    GUIKeywords.Page Should Contain Element With Wait    ${OPERATION_SELECT_MENU_EXPANDED}
51     BuiltIn.Run Keyword If    "${status}"=="False"    Expand Operation Select Menu    ${OPERATION_SELECT_INPUT}
52     ${selected_operation_xpath}=    BuiltIn.Set Variable    ${OPERATION_SELECT_INPUT}//span/div[contains(text(), "${selected_operation_name}")]
53     GUIKeywords.Patient Click    ${operation_id}    ${selected_operation_xpath}
54
55 Expand Operation Select Menu And Select Operation
56     [Arguments]    ${operation_id}    ${selected_operation_name}
57     [Documentation]    Expands operation select menu and select operation provided as an argument.
58     Expand Operation Select Menu
59     Select Operation And Verify Operation Has Been Selected    ${operation_id}    ${selected_operation_name}
60
61 Send Request
62     [Documentation]    Clicks Send request button and waits until progression bar disappears.
63     Selenium2Library.Click Element    ${SEND_BUTTON}
64     Selenium2Library.Wait Until Page Contains Element    ${HEADER_LINEAR_PROGRESSION_BAR_HIDDEN}
65
66 Verify Request Status Code Matches Desired Code
67     [Arguments]    ${desired_code_regexp}
68     [Documentation]    Verifies that execution status code matches regexp provided as an argument.
69     ${request_status}=    BuiltIn.Wait Until Keyword Succeeds    30 s    5 s    Selenium2Library.Get Text    ${STATUS_VALUE}
70     BuiltIn.Should Match Regexp    ${request_status}    ${desired_code_regexp}
71
72 Verify Request Execution Time Is Present
73     [Documentation]    Verifies that execution time value is present.
74     ${time_value}=    BuiltIn.Wait Until Keyword Succeeds    30 s    5 s    Selenium2Library.Get Text    ${TIME_VALUE}
75     BuiltIn.Should Contain    ${time_value}    ${MILLISECONDS_LABEL}
76
77 Verify Request Execution Time Is Threedots
78     [Documentation]    Verifies that execution time value is threedots.
79     ${time_value}=    BuiltIn.Wait Until Keyword Succeeds    30 s    5 s    Selenium2Library.Get Text    ${TIME_VALUE}
80     BuiltIn.Should Contain    ${time_value}    ${THREE_DOTS_DEFAULT_STATUS_AND_TIME}
81
82 Send Request And Verify Request Status Code Matches Desired Code
83     [Arguments]    ${desired_code_regexp}
84     [Documentation]    Sends request and verifies that execution status code matches regexp provided as an argument.
85     Send Request
86     Verify Request Status Code Matches Desired Code    ${desired_code_regexp}
87     Verify Request Execution Time Is Present
88
89 Execute Chosen Operation From Form
90     [Arguments]    ${operation_id}    ${selected_operation_name}    ${selected_true_false}
91     [Documentation]    Selects operation, selects or unselects fill form with received data after execution checkbox.
92     Expand Operation Select Menu And Select Operation    ${operation_id}    ${selected_operation_name}
93     Select Fill Form With Received Data After Execution Checkbox    ${selected_true_false}
94     Send Request
95
96 Execute Chosen Operation From Form And Check Status Code
97     [Arguments]    ${operation_id}    ${selected_operation_name}    ${selected_true_false}    ${desired_code_regexp}
98     [Documentation]    Selects operation, selects or unselects fill form with received data after execution checkbox and
99     ...    verifies that execution status matches regexp provided as an argument.
100     Expand Operation Select Menu And Select Operation    ${operation_id}    ${selected_operation_name}
101     Select Fill Form With Received Data After Execution Checkbox    ${selected_true_false}
102     Send Request
103     BuiltIn.Run Keyword If    "${desired_code_regexp}"=="${THREE_DOTS_DEFAULT_STATUS_AND_TIME}"    BuiltIn.Run Keywords    Verify Request Status Code Matches Desired Code    ${THREE_DOTS_DEFAULT_STATUS_AND_TIME}
104     ...    AND    Verify Request Execution Time Is Threedots
105     BuiltIn.Run Keyword If    "${desired_code_regexp}"!="${THREE_DOTS_DEFAULT_STATUS_AND_TIME}"    BuiltIn.Run Keywords    Verify Request Status Code Matches Desired Code    ${desired_code_regexp}
106     ...    AND    Verify Request Execution Time Is Present
107
108 Return Labelled Api Path Input
109     [Arguments]    ${branch_label_without_curly_braces_part}
110     [Documentation]    Returns Xpath of labelled API path input field.
111     ${labelled_api_path_input}=    BuiltIn.Set Variable    ${API_PATH}//span[contains(text(), "/${branch_label_without_curly_braces_part}")]//parent::md-input-container//following-sibling::md-input-container[last()]/input
112     [Return]    ${labelled_api_path_input}
113
114 Verify Yangman Home Page Elements
115     [Documentation]    Verifies presence of Yangman home page elements.
116     Selenium2Library.Wait Until Page Contains Element    ${YANGMAN_LOGO}
117     Selenium2Library.Log Location
118     Modules Tab Is Selected
119     Selenium2Library.Page Should Contain Element    ${TOGGLE_MENU_BUTTON}
120     Selenium2Library.Page Should Contain Element    ${LOGOUT_BUTTON}
121     Verify Selected Operation Is Displayed    GET
122     Selenium2Library.Page Should Contain Element    ${REQUEST_URL_INPUT}
123     Selenium2Library.Page Should Contain Element    ${SEND_BUTTON}
124     Selenium2Library.Page Should Contain Element    ${SAVE_BUTTON}
125     Selenium2Library.Page Should Contain Element    ${PARAMETERS_BUTTON}
126     Selenium2Library.Page Should Contain Element    ${FORM_RADIOBUTTON_UNSELECTED}
127     Selenium2Library.Page Should Contain Element    ${JSON_RADIOBUTTON_SELECTED}
128     Selenium2Library.Page Should Contain Element    ${SHOW_SENT_DATA_CHECKBOX_UNSELECTED}
129     Selenium2Library.Page Should Contain Element    ${SHOW_RECEIVED_DATA_CHECKBOX_SELECTED}
130     Selenium2Library.Page Should Contain Element    ${RECEIVED_DATA_CODE_MIRROR_DISPLAYED}
131     Selenium2Library.Page Should Contain Element    ${RECEIVED_DATA_ENLARGE_FONT_SIZE_BUTTON}
132     Selenium2Library.Page Should Contain Element    ${RECEIVED_DATA_REDUCE_FONT_SIZE_BUTTON}
133     Selenium2Library.Page Should Not Contain Element    ${SENT_DATA_CODE_MIRROR_DISPLAYED}
134
135 Select Form View
136     [Documentation]    Click Form radiobutton to display form view.
137     ${status}=    BuiltIn.Run Keyword And Return Status    Selenium2Library.Page Should Contain Element    ${FORM_RADIOBUTTON_SELECTED}
138     BuiltIn.Run Keyword If    "${status}"=="False"    GUIKeywords.Patient Click    ${FORM_RADIOBUTTON_UNSELECTED}    ${FORM_RADIOBUTTON_SELECTED}
139
140 Select Json View
141     [Documentation]    Click Json radiobutton to display json view.
142     ${status}=    BuiltIn.Run Keyword And Return Status    Selenium2Library.Page Should Contain Element    ${JSON_RADIOBUTTON_SELECTED}
143     BuiltIn.Run Keyword If    "${status}"=="False"    GUIKeywords.Patient Click    ${JSON_RADIOBUTTON_UNSELECTED}    ${JSON_RADIOBUTTON_SELECTED}
144
145 Modules Tab Is Selected
146     [Documentation]    Verifies that module tab is selected and history and collection tabs are unselected.
147     Selenium2Library.Page Should Contain Element    ${MODULES_TAB_SELECTED}
148     Selenium2Library.Page Should Contain Element    ${MODULE_SEARCH_INPUT}
149     Selenium2Library.Page Should Contain Element    ${HISTORY_TAB_UNSELECTED}
150     Selenium2Library.Page Should Contain Element    ${COLLECTIONS_TAB_UNSELECTED}
151
152 Return Number Of Modules Loaded
153     [Arguments]    ${module_xpath}
154     [Documentation]    Returns number of modules loaded in Modules tab.
155     ${number_of_modules}=    Selenium2Library.Get Matching Xpath Count    ${module_xpath}
156     [Return]    ${number_of_modules}
157
158 Verify Any Module Is Loaded
159     [Documentation]    Verifies that at least one module has been loaded in Modules tab.
160     ${number_of__modules_loaded}=    Return Number Of Modules Loaded    ${MODULE_LIST_ITEM}
161     BuiltIn.Should Be True    ${number_of_modules_loaded}>0
162
163 Return Module List Indexed Module
164     [Arguments]    ${index}
165     [Documentation]    Returns indexed Xpath of the module. ${index} is a number.
166     ${module_index}=    BuiltIn.Set Variable    ${MODULE_ID_LABEL}${index}
167     ${module_list_item_indexed}=    BuiltIn.Set Variable    ${MODULE_TAB_CONTENT}//md-list-item[@id="${module_index}"]//div[@class="pointer title layout-align-center-center layout-row"]
168     [Return]    ${module_list_item_indexed}
169
170 Return Indexed Module Operations Label
171     [Arguments]    ${index}
172     [Documentation]    Returns Xpath of the indexed module's operations item in Modules tab.
173     ${module_list_item_indexed}=    Return Module List Indexed Module    ${index}
174     ${indexed_module_operations_label}=    BuiltIn.Set Variable    ${module_list_item_indexed}//following-sibling::md-list[@aria-hidden="false"]//p[contains(., "${OPERATIONS_LABEL}")]
175     [Return]    ${indexed_module_operations_label}
176
177 Return Indexed Module Operational Label
178     [Arguments]    ${index}
179     [Documentation]    Returns Xpath of the indexed module`s operational in Modules tab.
180     ${module_list_item_indexed}=    Return Module List Indexed Module    ${index}
181     ${indexed_module_operational_label}=    BuiltIn.Set Variable    ${module_list_item_indexed}//following-sibling::md-list[@aria-hidden="false"]//p[contains(., "${OPERATIONAL_LABEL}")]
182     [Return]    ${indexed_module_operational_label}
183
184 Return Indexed Module Config Label
185     [Arguments]    ${index}
186     [Documentation]    Returns Xpath of the indexed module`s config in Modules tab.
187     ${module_list_item_indexed}=    Return Module List Indexed Module    ${index}
188     ${indexed_module_config_label}=    BuiltIn.Set Variable    ${module_list_item_indexed}//following-sibling::md-list[@aria-hidden="false"]//p[contains(., "${CONFIG_LABEL}")]
189     [Return]    ${indexed_module_config_label}
190
191 Click Indexed Module Operations To Load Module Detail Operations Tab
192     [Arguments]    ${index}
193     [Documentation]    Clicks indexed module`s operations to load module detail operations tab.
194     ${indexed_module_operations}=    Return Indexed Module Operations Label    ${index}
195     Selenium2Library.Wait Until Page Contains Element    ${indexed_module_operations}
196     GUIKeywords.Focus And Click Element    ${indexed_module_operations}
197     Selenium2Library.Wait Until Page Contains Element    ${MODULE_DETAIL_OPERATIONS_TAB_SELECTED}
198
199 Click Indexed Module Operational To Load Module Detail Operational Tab
200     [Arguments]    ${index}
201     [Documentation]    Clicks indexed module`s operational to load module detail operational tab.
202     ${indexed_module_operational}=    Return Indexed Module Operational Label    ${index}
203     Selenium2Library.Wait Until Page Contains Element    ${indexed_module_operational}
204     GUIKeywords.Focus And Click Element    ${indexed_module_operational}
205     Selenium2Library.Wait Until Page Contains Element    ${MODULE_DETAIL_OPERATIONAL_TAB_SELECTED}
206
207 Click Indexed Module Config To Load Module Detail Config Tab
208     [Arguments]    ${index}
209     [Documentation]    Clicks indexed module`s config to load module detail config tab.
210     ${indexed_module_config}=    Return Indexed Module Config Label    ${index}
211     Selenium2Library.Wait Until Page Contains Element    ${indexed_module_config}
212     GUIKeywords.Focus And Click Element    ${indexed_module_config}
213     Selenium2Library.Wait Until Page Contains Element    ${MODULE_DETAIL_CONFIG_TAB_SELECTED}
214
215 Return Module ID Index From Module Name
216     [Arguments]    ${module_name}
217     [Documentation]    Returns number - module id index from module name.
218     ${testing_module_xpath}=    BuiltIn.Set Variable    ${MODULE_TAB_CONTENT}//p[contains(., "${module_name}")]//ancestor::md-list-item[contains(@id, "${MODULE_ID_LABEL}")]
219     ${module_id}=    Selenium2Library.Get Element Attribute    ${testing_module_xpath}@id
220     ${module_id_index}=    String.Fetch From Right    ${module_id}    ${MODULE_ID_LABEL}
221     [Return]    ${module_id_index}
222
223 Return Indexed Module From Module Name
224     [Arguments]    ${module_name}
225     [Documentation]    Returns indexed Xpath of the module from the module`s name.
226     ${module_id_index}=    Return Module ID Index From Module Name    ${module_name}
227     ${module_list_item_indexed}=    Return Module List Indexed Module    ${module_id_index}
228     [Return]    ${module_list_item_indexed}
229
230 Return Module List Item Collapsed Indexed
231     [Arguments]    ${index}
232     [Documentation]    Returns Xpath of collapsed indexed module.
233     ${indexed_module}=    Return Module List Indexed Module    ${index}
234     ${module_list_item_collapsed_indexed}=    BuiltIn.Set Variable    ${indexed_module}//following-sibling::md-list[@aria-hidden="true"]
235     [Return]    ${module_list_item_collapsed_indexed}
236
237 Return Module List Item Expanded Indexed
238     [Arguments]    ${index}
239     [Documentation]    Returns Xpath of expanded indexed module.
240     ${indexed_module}=    Return Module List Indexed Module    ${index}
241     ${module_list_item_expanded_indexed}=    BuiltIn.Set Variable    ${indexed_module}//following-sibling::md-list[@aria-hidden="false"]
242     [Return]    ${module_list_item_expanded_indexed}
243
244 Return Indexed Module Expander Icon
245     [Arguments]    ${index}
246     [Documentation]    Returns xpath of indexed module expander icon.
247     ${indexed_module}=    Return Module List Indexed Module    ${index}
248     ${indexed_module_expander_icon}=    BuiltIn.Set Variable    ${indexed_module}/md-icon
249     [Return]    ${indexed_module_expander_icon}
250
251 Expand Module
252     [Arguments]    ${module_name}    ${module_id_index}
253     [Documentation]    Clicks module list item in modules tab to expand the item and display its operations/ operational/ config items.
254     ...    Arguments are either module name, or module id index, that is a number, or ${EMPTY}, if the option is not used.
255     ${module_list_item_indexed}=    BuiltIn.Run Keyword If    "${module_name}"!= "${EMPTY}"    Return Indexed Module From Module Name    ${module_name}
256     ${module_list_item_indexed}=    BuiltIn.Run Keyword If    "${module_id_index}"!= "${EMPTY}"    Return Module List Indexed Module    ${module_id_index}
257     ${module_list_item_expanded_indexed}=    BuiltIn.Set Variable    ${module_list_item_indexed}//following-sibling::md-list[@aria-hidden="false"]
258     GUIKeywords.Mouse Down And Mouse Up Click Element    ${module_list_item_indexed}
259     Selenium2Library.Wait Until Page Contains Element    ${module_list_item_expanded_indexed}
260
261 Expand Module And Click Module Operational Item
262     [Arguments]    ${module_name}    ${module_id_index}
263     [Documentation]    Clicks module list item in modules tab and then clicks its operational item to load operational tab in module detail.
264     ...    Arguments are either module name, or module id index, that is a number, or ${EMPTY}, if the option is not used.
265     Expand Module    ${module_name}    ${module_id_index}
266     Click Indexed Module Operational To Load Module Detail Operational Tab    ${module_id_index}
267
268 Expand Module And Click Module Config Item
269     [Arguments]    ${module_name}    ${module_id_index}
270     [Documentation]    Clicks module list item in modules tab and then clicks its config item to load operational tab in module detail.
271     ...    Arguments are either module name, or module id index, that is a number, or ${EMPTY}, if the option is not used.
272     Expand Module    ${module_name}    ${module_id_index}
273     Click Indexed Module Config To Load Module Detail Config Tab    ${module_id_index}
274
275 Navigate From Yangman Submenu To Testing Module Operational Tab
276     [Arguments]    ${testing_module_name}
277     [Documentation]    Navigates from loaded Yangman URL to testing module detail operational tab.
278     ${module_id_index}=    YangmanKeywords.Return Module ID Index From Module Name    ${testing_module_name}
279     Selenium2Library.Wait Until Page Does Not Contain Element    ${MODULES_WERE_LOADED_ALERT}
280     Expand Module And Click Module Operational Item    ${EMPTY}    ${module_id_index}
281
282 Navigate From Yangman Submenu To Testing Module Config Tab
283     [Arguments]    ${testing_module_name}
284     [Documentation]    Navigates from loaded Yangman URL to testing module detail config tab.
285     ${module_id_index}=    YangmanKeywords.Return Module ID Index From Module Name    ${testing_module_name}
286     Selenium2Library.Wait Until Page Does Not Contain Element    ${MODULES_WERE_LOADED_ALERT}
287     Expand Module And Click Module Config Item    ${EMPTY}    ${module_id_index}
288
289 Compose Branch Id
290     [Arguments]    ${index}
291     [Documentation]    Composes and returns string - branch id in the format branch-${index}.
292     BuiltIn.Return From Keyword    ${BRANCH_ID_LABEL}${index}
293
294 Toggle Module Detail To Modules Or History Or Collections Tab
295     [Documentation]    Click toggle module detail button to toggle from module detail to modules or history or collections tab.
296     Selenium2Library.Wait Until Element Is Visible    ${TOGGLE_MODULE_DETAIL_BUTTON_LEFT}
297     GUIKeywords.Focus And Click Element    ${TOGGLE_MODULE_DETAIL_BUTTON_LEFT}
298
299 Select Module Detail Operational Tab
300     [Documentation]    Selects operational tab in module detail.
301     ${status}=    BuiltIn.Run Keyword And Return Status    Selenium2Library.Page Should Contain Element    ${MODULE_DETAIL_OPERATIONAL_TAB_SELECTED}
302     BuiltIn.Run Keyword If    "${status}"=="False"    Selenium2Library.Click Element    ${MODULE_DETAIL_OPERATIONAL_TAB_DESELECTED}
303     Selenium2Library.Wait Until Page Contains Element    ${MODULE_DETAIL_OPERATIONAL_TAB_SELECTED}
304
305 Select Module Detail Config Tab
306     [Documentation]    Selects config tab in module detail.
307     ${status}=    BuiltIn.Run Keyword And Return Status    Selenium2Library.Page Should Contain Element    ${MODULE_DETAIL_CONFIG_TAB_SELECTED}
308     BuiltIn.Run Keyword If    "${status}"=="False"    Selenium2Library.Click Element    ${MODULE_DETAIL_CONFIG_TAB_DESELECTED}
309     Selenium2Library.Wait Until Page Contains Element    ${MODULE_DETAIL_CONFIG_TAB_SELECTED}
310
311 Expand All Branches In Module Detail Content Active Tab
312     [Documentation]    Expands all branches in module detail active operations or operational or config tab.
313     Selenium2Library.Wait Until Element Is Visible    ${MODULE_DETAIL_EXPAND_BRANCH_BUTTON}
314     : FOR    ${i}    IN RANGE    1    1000
315     \    ${count}=    Selenium2Library.Get Matching Xpath Count    ${MODULE_DETAIL_EXPAND_BRANCH_BUTTON}
316     \    BuiltIn.Exit For Loop If    ${count}==0
317     \    BuiltIn.Wait Until Keyword Succeeds    30 s    5 s    GUIKeywords.Focus And Click Element    ${MODULE_DETAIL_EXPAND_BRANCH_BUTTON}
318     Selenium2Library.Wait Until Page Does Not Contain Element    ${MODULE_DETAIL_EXPAND_BRANCH_BUTTON}
319
320 Collapse All Branches In Module Detail Content Active Tab
321     [Documentation]    Collapses all branches in module detail active operations or operational or config tab.
322     Selenium2Library.Wait Until Element Is Visible    ${MODULE_DETAIL_COLLAPSE_BRANCH_BUTTON}
323     : FOR    ${i}    IN RANGE    1    1000
324     \    ${count}=    Selenium2Library.Get Matching Xpath Count    ${MODULE_DETAIL_COLLAPSE_BRANCH_BUTTON}
325     \    BuiltIn.Exit For Loop If    ${count}==0
326     \    BuiltIn.Wait Until Keyword Succeeds    30 s    5 s    GUIKeywords.Focus And Click Element    ${MODULE_DETAIL_COLLAPSE_BRANCH_BUTTON}
327     Selenium2Library.Wait Until Page Does Not Contain Element    ${MODULE_DETAIL_COLLAPSE_BRANCH_BUTTON}
328
329 Return Module Detail Labelled Branch Xpath
330     [Arguments]    ${branch_label}
331     [Documentation]    Returns xpath of module detail labelled branch.
332     ${labelled_branch_xpath}=    BuiltIn.Set Variable    ${MODULE_DETAIL_BRANCH}//span[contains(@class, "indented tree-label ng-binding flex") and contains(text(), "${branch_label}")]
333     [Return]    ${labelled_branch_xpath}
334
335 Return Module Detail Branch ID From Branch Label
336     [Arguments]    ${branch_label}
337     [Documentation]    Returns string - module detail branch id in the format branch-${index}.
338     ${labelled_branch_xpath}=    Return Module Detail Labelled Branch Xpath    ${branch_label}
339     ${branch_id}=    Selenium2Library.Get Element Attribute    ${labelled_branch_xpath}//ancestor::md-list-item[contains(@id, "${BRANCH_ID_LABEL}")]@id
340     [Return]    ${branch_id}
341
342 Return Module Detail Branch Indexed
343     [Arguments]    ${branch_id}
344     [Documentation]    Returns indexed Xpath of the module detail branch. Argument is ${branch_id} in the form "branch-"${index}"".
345     ${module_detail_branch_indexed}=    BuiltIn.Set Variable    ${MODULE_DETAIL_ACTIVE_TAB_CONTENT}//md-list-item[contains(@id, "${branch_id}")]
346     [Return]    ${module_detail_branch_indexed}
347
348 Return Indexed Branch Label
349     [Arguments]    ${module_detail_branch_indexed}
350     [Documentation]    Returns string - label of indexed branch in module detail.
351     ${branch_label}=    Selenium2Library.Get Text    ${module_detail_branch_indexed}//span[@class="indented tree-label ng-binding flex"]
352     [Return]    ${branch_label}
353
354 Return Branch Label Without Curly Braces Part
355     [Arguments]    ${branch_label}
356     [Documentation]    Returns string - part of label of indexed branch in module detail without curly braces part.
357     ${branch_label_without_curly_braces_part}=    String.Fetch From Left    ${branch_label}    ${SPACE}
358     [Return]    ${branch_label_without_curly_braces_part}
359
360 Return Branch Label Curly Braces Part Without Braces
361     [Arguments]    ${branch_label}
362     [Documentation]    Returns string - curly braces part of label of indexed branch in module detail without curly braces.
363     ${branch_label_curly_braces_part}=    String.Fetch From Right    ${branch_label}    ${SPACE}
364     ${branch_label_curly_braces_part}=    String.Strip String    ${branch_label_curly_braces_part}    characters={}
365     [Return]    ${branch_label_curly_braces_part}
366
367 Return Labelled Branch Toggle Button
368     [Arguments]    ${labelled_branch_xpath}
369     [Documentation]    Returns xpath of toggle button of labelled branch in module detail.
370     ${labelled_branch_toggle_button}=    BuiltIn.Set Variable    ${labelled_branch_xpath}//preceding-sibling::md-icon[contains(@id, "toggle-branch-")]
371     [Return]    ${labelled_branch_toggle_button}
372
373 Return Branch Toggle Button From Branch Label And Click
374     [Arguments]    ${branch_label}
375     [Documentation]    Returns xpath toggle button of labelled branch in module detail and clicks it.
376     ${labelled_branch_xpath}=    Return Module Detail Labelled Branch Xpath    ${branch_label}
377     ${labelled_branch_toggle_button}=    Return Labelled Branch Toggle Button    ${labelled_branch_xpath}
378     Selenium2Library.Page Should Contain Element    ${labelled_branch_toggle_button}
379     Selenium2Library.Click Element    ${labelled_branch_toggle_button}
380
381 Click Module Detail Branch Indexed
382     [Arguments]    ${module_detail_branch_indexed}
383     [Documentation]    Click indexed branch in module detail.
384     Selenium2Library.Page Should Contain Element    ${module_detail_branch_indexed}
385     GUIKeywords.Mouse Down And Mouse Up Click Element    ${module_detail_branch_indexed}
386
387 Return And Click Module Detail Branch Indexed
388     [Arguments]    ${branch_label}
389     [Documentation]    Returns and click Click indexed branch in module detail.
390     ${branch_id}=    Return Module Detail Branch ID From Branch Label    ${branch_label}
391     ${module_detail_branch_indexed}=    Return Module Detail Branch Indexed    ${branch_id}
392     Click Module Detail Branch Indexed    ${module_detail_branch_indexed}
393
394 Verify Module Detail Branch Is List Branch
395     [Arguments]    ${module_detail_branch_indexed}
396     [Documentation]    Returns status "True" if module detail branch is a list branch and "False" if module detail branch is not a list brnach.
397     ${branch_label}=    Return Indexed Branch Label    ${module_detail_branch_indexed}
398     ${branch_is_list_evaluation}=    BuiltIn.Run Keyword And Return Status    BuiltIn.Should Contain    ${branch_label}    {
399     [Return]    ${branch_is_list_evaluation}
400
401 Return Form Top Element Label
402     [Documentation]    Returns string - form top element label.
403     ${form_top_element_label}=    Selenium2Library.Get Text    ${FORM_TOP_ELEMENT_LABEL_XPATH}
404     [Return]    ${form_top_element_label}
405
406 Return Form Top Element Labelled
407     [Arguments]    ${label}
408     [Documentation]    Returns xpath of form top element with label.
409     ${form_top_element_labelled}=    BuiltIn.Set Variable    ${FORM_TOP_ELEMENT_POINTER}//span[contains(@class, "ng-binding ng-scope") and contains(text(), "${label}")]
410     [Return]    ${form_top_element_labelled}
411
412 Return Form List Item With Index Or Key
413     [Arguments]    ${branch_label}    ${branch_label_curly_braces_part}    ${index_or_key}
414     [Documentation]    Returns string - catenated branch label and index, in the form "label [${index_or_key}]" or "label <${branch_label_curly_braces_part}:${index_or_key}>".
415     ${branch_label_without_curly_braces_part}=    Return Branch Label Without Curly Braces Part    ${branch_label}
416     ${key_part}=    BuiltIn.Set Variable    <${branch_label_curly_braces_part}:${index_or_key}>
417     ${list_item_with_index_or_key}=    BuiltIn.Set Variable If    "${branch_label_curly_braces_part}"=="${EMPTY}"    ${FORM_TOP_ELEMENT_LIST_ITEM_LABEL}[contains(text(), "${branch_label_without_curly_braces_part}") and contains(text(), "[${index_or_key}]")]    ${FORM_TOP_ELEMENT_LIST_ITEM_LABEL}[contains(text(), "${branch_label_without_curly_braces_part}") and contains(text(), "${key_part}")]
418     [Return]    ${list_item_with_index_or_key}
419
420 Click Form List Item With Index Or Key
421     [Arguments]    ${branch_label}    ${id/ref/prefix_part}    ${index/key}
422     [Documentation]    Clicks form list item with given index or key is visible.
423     ${list_item_with_index_or_key}=    Return Form List Item With Index Or Key    ${branch_label}    ${id/ref/prefix_part}    ${index/key}
424     Selenium2Library.Click Element    ${list_item_with_index_or_key}
425
426 Verify List Item With Index Or Key Is Visible
427     [Arguments]    ${branch_label}    ${branch_label_curly_braces_part}    ${index_or_key}
428     [Documentation]    Verifies that form list item with given index or key is visible.
429     ${list_item_with_index_or_key}=    Return Form List Item With Index Or Key    ${branch_label}    ${branch_label_curly_braces_part}    ${index_or_key}
430     Selenium2Library.Wait Until Element Is Visible    ${list_item_with_index_or_key}
431
432 Load And Expand Network Topology In Form
433     [Documentation]    Loads and expands network-topology top element container.
434     Select Form View
435     YangmanKeywords.Return And Click Module Detail Branch Indexed    ${Network_Topology_Branch_Label}
436     Selenium2Library.Page Should Contain Element    ${FORM_TOP_ELEMENT_CONTAINER}
437     Selenium2Library.Click Element    ${FORM_TOP_ELEMENT_POINTER}
438
439 Load Topology Topology Id Node In Form
440     [Documentation]    Expands network-topology branch in testing module detail and clicks topology {topology-id} branch to load topology list node in form.
441     Select Form View
442     ${topology_topology_id_branch}=    Return Module Detail Labelled Branch Xpath    ${TOPOLOGY_TOPOLOGY_ID_LABEL}
443     ${status}=    BuiltIn.Run Keyword And Return Status    Selenium2Library.Element Should Be Visible    ${topology_topology_id_branch}
444     BuiltIn.Run Keyword If    "${status}"=="False"    Return Branch Toggle Button From Branch Label And Click    ${NETWORK_TOPOLOGY_LABEL}
445     YangmanKeywords.Return Branch Toggle Button From Branch Label And Click    ${TOPOLOGY_TOPOLOGY_ID_LABEL}
446     Verify List Item With Index Or Key Is Visible    ${TOPOLOGY_TOPOLOGY_ID_LABEL}    ${EMPTY}    0
447
448 Load Node Node Id Node In Form
449     [Documentation]    Expands network-topology branch in testing module detail and clicks topology {topology-id} branch to load topology list node in form.
450     Select Form View
451     ${node_node_id_branch}=    Return Module Detail Labelled Branch Xpath    ${NODE_NODE_ID_LABEL}
452     ${node_branch_is_visible}=    BuiltIn.Run Keyword And Return Status    Selenium2Library.Element Should Be Visible    ${node_node_id_branch}
453     BuiltIn.Run Keyword If    "${node_branch_is_visible}"=="False"    Run Keywords    Load Topology Topology Id Node In Form
454     ...    AND    Return Branch Toggle Button From Branch Label And Click    ${TOPOLOGY_TOPOLOGY_ID_LABEL}
455     YangmanKeywords.Return And Click Module Detail Branch Indexed    ${NODE_NODE_ID_LABEL}
456     Verify List Item With Index Or Key Is Visible    ${NODE_NODE_ID_LABEL}    ${EMPTY}    0
457
458 Return Labelled Element Yangmenu
459     [Arguments]    ${label}
460     [Documentation]    Returns xpath of labelled element yangmenu in form.
461     ${form_top_element_labelled}=    Return Form Top Element Labelled    ${label}
462     ${form_labelled_element_yangmenu}=    BuiltIn.Set Variable    ${form_top_element_labelled}//following::yang-form-menu
463     [Return]    ${form_labelled_element_yangmenu}
464
465 Return And Click Labelled Element Yangmenu
466     [Arguments]    ${label}
467     [Documentation]    Returns xpath of labelled element yangmenu in form and clicks the yangmenu.
468     ${form_labelled_element_yangmenu}=    Return Labelled Element Yangmenu    ${label}
469     Selenium2Library.Element Should Be Visible    ${form_labelled_element_yangmenu}
470     GUIKeywords.Mouse Down And Mouse Up Click Element    ${form_labelled_element_yangmenu}
471
472 Return Labelled Element Show Previous Item Arrow
473     [Arguments]    ${label}
474     [Documentation]    Returns xpath of labelled element show previous list item icon in form.
475     ${form_top_element_labelled}=    Return Form Top Element Labelled    ${label}
476     ${labelled_show_previous_item_arrow}=    BuiltIn.Set Variable    ${form_top_element_labelled}//following::md-prev-button[@aria-label="Previous Page"]
477     [Return]    ${labelled_show_previous_item_arrow}
478
479 Return Labelled Element Show Next Item Arrow
480     [Arguments]    ${label}
481     [Documentation]    Returns xpath of labelled element show next list item icon.
482     ${form_top_element_labelled}=    Return Form Top Element Labelled    ${label}
483     ${labelled_show_next_item_arrow}=    BuiltIn.Set Variable    ${form_top_element_labelled}//following::md-next-button[@aria-label="Next Page"]
484     [Return]    ${labelled_show_next_item_arrow}
485
486 Return Labelled Form Input Field
487     [Arguments]    ${branch_label_curly_braces_part}
488     [Documentation]    Returns xpath of labelled form input field.
489     ${labelled_input_field}=    BuiltIn.Set Variable    ${FORM_CONTENT}//span[contains(@class, "ng-binding ng-scope") and contains(text(), "${branch_label_curly_braces_part}")]//following::input
490     [Return]    ${labelled_input_field}
491
492 Return Labelled Form Select
493     [Arguments]    ${branch_label_curly_braces_part}
494     [Documentation]    Returns labelled form input field.
495     ${labelled_select}=    BuiltIn.Set Variable    ${FORM_CONTENT}//span[contains(@class, "ng-binding ng-scope") and contains(text(), "${branch_label_curly_braces_part}")]//following::md-select
496     [Return]    ${labelled_select}
497
498 Input Text To Labelled Form Input Field
499     [Arguments]    ${branch_label_curly_braces_part}    ${text}
500     [Documentation]    Returns labelled form input field and inputs the text provided as an argument into it.
501     ${labelled_input_field}=    Return Labelled Form Input Field    ${branch_label_curly_braces_part}
502     Selenium2Library.Input Text    ${labelled_input_field}    ${text}
503
504 Verify Form Contains Error Message
505     [Arguments]    ${error_message}
506     [Documentation]    Verifies that the form contains error message that is provided as an argument.
507     ${form_error_message}=    BuiltIn.Set Variable    //p[contains(@id, "form-error-message") and contains (text(), "${error_message}")]
508     Selenium2Library.Page Should Contain Element    ${form_error_message}
509
510 Verify No Data Are Displayed In Code Mirror Code
511     [Arguments]    ${code_mirror_code}
512     [Documentation]    Verifies that there are no data displayed in either sent or received data code mirror.
513     ...    Value for ${code_mirror_code} is either ${SENT_DATA_CODE_MIRROR_CODE} or ${RECEIVED_DATA_CODE_MIRROR_CODE}.
514     ${number_of_lines_in_code_mirror}=    Selenium2Library.Get Matching Xpath Count    ${code_mirror_code}/div
515     BuiltIn.Should Be Equal    ${number_of_lines_in_code_mirror}    1
516
517 Verify Sent Data CM Is Displayed
518     [Documentation]    Verifies that sent data code mirror is displayed.
519     Selenium2Library.Wait Until Element Is Visible    ${SENT_DATA_CODE_MIRROR_DISPLAYED}
520
521 Verify Sent Data CM Is Not Displayed
522     [Documentation]    Verifies that sent data code mirror is not displayed.
523     Selenium2Library.Wait Until Element Is Not Visible    ${SENT_DATA_CODE_MIRROR_DISPLAYED}
524
525 Verify Received Data CM Is Displayed
526     [Documentation]    Verifies that received data code mirror is displayed.
527     Selenium2Library.Wait Until Element Is Visible    ${RECEIVED_DATA_CODE_MIRROR_DISPLAYED}
528
529 Verify Received Data CM Is Not Displayed
530     [Documentation]    Verifies that received data code mirror is not displayed.
531     Selenium2Library.Wait Until Element Is Not Visible    ${RECEIVED_DATA_CODE_MIRROR_DISPLAYED}