blob: 969baac3dc1c73387c382673131428eb64f637b7 [file] [log] [blame]
Sathyajith M Se6956c02017-08-16 01:50:17 -05001*** Settings ***
2Documentation This is a resource file of OpenBMC ASMI It contains the
3... user-defined keywords which are available to all gui modules
4
5Library String
6Library Collections
7Library DateTime
8Library XvfbRobot
9Library OperatingSystem
10Library Selenium2Library 120 120
11Library AngularJSLibrary
12Library SSHLibrary 30 Seconds
13Library Process
14Library supporting_libs.py
15Library ../../../lib/gen_print.py
16Library ../../../lib/gen_robot_print.py
17Library ../../../lib/gen_valid.py
18Library ../../../lib/gen_robot_ssh.py
19Library ../../../lib/bmc_ssh_utils.py
Sathyajith M Se6956c02017-08-16 01:50:17 -050020Variables ../data/resource_variables.py
Sivas SRR40c1f042018-01-05 11:00:02 -060021Resource ../../../lib/resource.txt
Sathyajith M Se6956c02017-08-16 01:50:17 -050022
23*** Variables ***
24# TO Do: Change the variable once the code finally switches to the OpenBMC.
Sivas SRR40c1f042018-01-05 11:00:02 -060025${openbmc_gui_url} http://localhost:8080/#/login
Sathyajith M Se6956c02017-08-16 01:50:17 -050026# Default Browser.
27${default_browser} chrome
28
29*** Keywords ***
30Launch OpenBMC GUI Browser
31 [Documentation] Launch the OpenBMC GUI URL on a browser.
32 # By default uses headless mode, otherwise, the GUI browser.
33 ${op_system}= Get Operating System
34 Run Keyword If '${op_system}' == 'windows'
35 ... Launch Browser in Windows Platform
36 ... ELSE
37 ... Launch Headless Browser
38
39Get Operating System
40 [Documentation] Identify platform/OS.
41 ${curdir_lower_case}= Convert To Lowercase ${CURDIR}
42 ${windows_platform}= Run Keyword And Return Status
43 ... Should Contain ${curdir_lower_case} c:\
44 ${op_system}= Run Keyword If '${windows_platform}' == 'True'
45 ... Set Variable windows
46 ... ELSE
47 ... Set Variable linux
48 [Return] ${op_system}
49
50Launch Browser in Windows Platform
51 [Documentation] Open the browse with the URL and login on windows platform.
Sivas SRR40c1f042018-01-05 11:00:02 -060052 ${BROWSER_ID}= Open Browser ${openbmc_gui_url} ${default_browser}
Sathyajith M Se6956c02017-08-16 01:50:17 -050053 Maximize Browser Window
54 Set Global Variable ${BROWSER_ID}
55
56Launch Headless Browser
57 [Documentation] Launch headless browser.
58 Start Virtual Display 1920 1080
Sivas SRR40c1f042018-01-05 11:00:02 -060059 ${BROWSER_ID}= Open Browser ${openbmc_gui_url}
Sathyajith M Se6956c02017-08-16 01:50:17 -050060 Set Global Variable ${BROWSER_ID}
61 Set Window Size 1920 1080
62
63OpenBMC Test Setup
64 [Documentation] Verify all the preconditions to be tested.
65 Rprint Timen ${TEST NAME}:${TESTDOCUMENTATION} ==> [STARTED]
66 Print Dashes 0 100 1 =
67 Login OpenBMC GUI
68
69Login OpenBMC GUI
70 [Documentation] Perform login to open BMC GUI.
71 [Arguments] ${username}=${OPENBMC_USERNAME}
72 ... ${password}=${OPENBMC_PASSWORD}
73 # Description of argument(s):
74 # username The username.
75 # password The password.
Sivas SRR40c1f042018-01-05 11:00:02 -060076
77 Register Keyword To Run On Failure Reload Page
78 Log ${openbmc_gui_url}
79 Open Browser With URL ${openbmc_gui_url} gc
80 Page Should Contain Button login__submit
Sivas SRR40c1f042018-01-05 11:00:02 -060081 Input Text ${xpath_openbmc_ip} ${OPENBMC_HOST}
Sathyajith M Se6956c02017-08-16 01:50:17 -050082 Input Text ${xpath_textbox_username} ${username}
83 Input Password ${xpath_textbox_password} ${password}
Sivas SRR40c1f042018-01-05 11:00:02 -060084 Click Element login__submit
Sathyajith M Se6956c02017-08-16 01:50:17 -050085 Wait Until Element Is Enabled ${xpath_button_logout}
Sivas SRR40c1f042018-01-05 11:00:02 -060086 Page Should Contain Server information
Sathyajith M Se6956c02017-08-16 01:50:17 -050087
88LogOut OpenBMC GUI
89 [Documentation] Log out of OpenBMC GUI.
90 SSHLibrary.Close All Connections
91 click button ${xpath_button_logout}
92 Wait Until Page Contains Element ${xpath_button_login}
93
94OpenBMC Test Closure
95 [Documentation] Do final closure activities of test case execution.
96 Rprint Pgm Footer
97 Print Dashes 0 100 1 =
98 LogOut OpenBMC GUI
99
Sivas SRR40c1f042018-01-05 11:00:02 -0600100Open Browser With URL
101 [Documentation] Open browser with specified URL and returns browser id.
102 [Arguments] ${URL} ${browser}=gc
103 # Description of argument(s):
104 # URL Openbmc GUI URL to be open
105 # (e.g. https://openbmc-test.mybluemix.net/#/login )
106 # browser browser used to open above URL
107 # (e.g. gc for google chrome, ff for firefox)
108 ${browser_ID}= Open Browser ${URL} ${browser}
109 [Return] ${browser_ID}
110
111Model Server Power Click Button
112 [Documentation] Click main server power in the header section.
113 [Arguments] ${div_element} ${anchor_element}
114 # Description of argument(s):
115 # div_element Server power header divisional element
116 # (e.g. header_wrapper.)
117 # anchor_element Server power header anchor element
118 # (e.g. header_wrapper_elt.)
119 Wait Until Element Is Visible
120 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
121 Click Element
122 ... //*[@id='header__wrapper']/div/div[${div_element}]/a[${anchor_element}]/span
123
124Controller Server Power Click Button
125 [Documentation] Click main server power in the header section.
126 [Arguments] ${controller_element}
127 # Description of argument(s):
128 # controller_element Server power controller element
129 # (e.g. power__power-on.)
130
131 Wait Until Element Is Visible ${controller_element}
132 Click Element ${controller_element}
133
134Controller Power Operations Confirmation Click Button
135 [Documentation] Click Common Power Operations Confirmation.
136 [Arguments] ${main_element} ${sub_element} ${confirm_msg_elt} ${confirmation}
137 # Description of argument(s):
138 # main_element Server power operations element
139 # (e.g. power_operations.)
140 # sub_element Server power operations sub element
141 # (e.g. warm_boot, shut_down.)
142 # confirm_msg_elt Server power operations confirm message element
143 # (e.g. confirm_msg.)
144 # confirmation Server power operations confirmation
145 # (e.g. yes.)
146
147 Click Element
148 ... //*[@id='power-operations']/div[${main_element}]/div[${sub_element}]/confirm/div/div[${confirm_msg_elt}]/button[${confirmation}]
149
150GUI Power On
151 [Documentation] Power on the Host using GUI.
152
153 Model Server Power Click Button ${header_wrapper} ${header_wrapper_elt}
154 Page Should Contain Attempts to power on the server
155 Controller Server Power Click Button power__power-on
156 Page Should Contain Running
157