1*** Settings ***
2
3Documentation   Test OpenBMC GUI "Network" sub-menu of "Settings".
4
5Resource        ../../lib/gui_resource.robot
6Resource        ../../../lib/bmc_network_utils.robot
7
8Suite Setup     Suite Setup Execution
9Suite Teardown  Close Browser
10
11
12*** Variables ***
13
14${xpath_network_heading}                 //h1[text()="Network"]
15${xpath_interface_settings}              //h2[text()="Interface settings"]
16${xpath_network_settings}                //h2[text()="Network settings"]
17${xpath_static_ipv4}                     //h2[text()="IPv4"]
18${xpath_static_dns}                      //h2[text()="Static DNS"]
19${xpath_domain_name_toggle}              //*[@data-test-id="networkSettings-switch-useDomainName"]
20${xpath_dns_servers_toggle}              //*[@data-test-id="networkSettings-switch-useDns"]
21${xpath_ntp_servers_toggle}              //*[@data-test-id="networkSettings-switch-useNtp"]
22${xpath_add_static_ipv4_address_button}  //button[contains(text(),"Add static IPv4 address")]
23${xpath_add_dns_ip_address_button}       //button[contains(text(),"Add IP address")]
24${xpath_hostname}                        //*[@title="Edit hostname"]
25${xpath_hostname_input}                  //*[@id="hostname"]
26${xpath_input_ip_address}                //*[@id="ipAddress"]
27${xpath_input_gateway}                   //*[@id="gateway"]
28${xpath_input_subnetmask}                //*[@id="subnetMask"]
29${xpath_input_static_dns}                //*[@id="staticDns"]
30${xpath_cancel_button}                   //button[contains(text(),'Cancel')]
31${xpath_add_button}                      //button[contains(text(),'Add')]
32
33
34*** Test Cases ***
35
36Verify Navigation To Network Page
37    [Documentation]  Login to GUI and navigate to the settings sub-menu network page.
38    [Tags]  Verify_Navigation_To_Network_Page
39
40    Page Should Contain Element  ${xpath_network_heading}
41
42
43Verify Existence Of All Sections In Network Page
44    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
45    ...  and confirm the page contains sections that should be accessible.
46    [Tags]  Verify_Existence_Of_All_Sections_In_Network_Page
47
48    Wait Until Page Contains Element  ${xpath_network_settings}  timeout=1min
49    Page Should Contain Element  ${xpath_interface_settings}
50    Page Should Contain Element  ${xpath_static_ipv4}
51    Page Should Contain Element  ${xpath_static_dns}
52
53
54Verify Existence Of All Buttons In Network Page
55    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
56    ...  and confirm the page contains basic features button that should be accessible.
57    [Tags]  Verify_Existence_Of_All_Buttons_In_Network_Page
58
59    Page Should Contain Button  ${xpath_add_static_ipv4_address_button}
60    Page Should Contain Button  ${xpath_add_dns_ip_address_button}
61    Page Should Contain Button  ${xpath_domain_name_toggle}
62    Page Should Contain Button  ${xpath_dns_servers_toggle}
63    Page Should Contain Button  ${xpath_ntp_servers_toggle}
64
65
66Verify Existence Of All Fields In Hostname
67    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
68    ...  and confirm hostname contains all the fields.
69    [Tags]  Verify_Existence_Of_All_Fields_In_Hostname
70    [Teardown]  Run Keywords  Click Button  ${xpath_cancel_button}  AND
71    ...  Wait Until Keyword Succeeds  10 sec  5 sec
72    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
73
74    Click Element  ${xpath_hostname}
75    Wait Until Page Contains  Edit hostname  timeout=1min
76    Page Should Contain Textfield  ${xpath_hostname_input}
77    Page Should Contain Button  ${xpath_cancel_button}
78    Page Should Contain Button  ${xpath_add_button}
79
80
81Verify Existence Of All Fields In Static IP Address
82    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
83    ...  and confirm section static IPv4 contains all the fields.
84    [Tags]  Verify_Existence_Of_All_Fields_In_Static_IP_Address
85    [Teardown]  Run Keywords  Click Button  ${xpath_cancel_button}  AND
86    ...  Wait Until Keyword Succeeds  10 sec  5 sec
87    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
88
89    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_static_ipv4_address_button}
90    Wait Until Page Contains  Add static IPv4 address  timeout=15s
91    Page Should Contain Textfield  ${xpath_input_ip_address}
92    Page Should Contain Textfield  ${xpath_input_gateway}
93    Page Should Contain Textfield  ${xpath_input_subnetmask}
94    Page Should Contain Button  ${xpath_cancel_button}
95    Page Should Contain Button  ${xpath_add_button}
96
97
98Verify Existence Of All Fields In Static DNS
99    [Documentation]  Login to GUI and navigate to the settings sub-menu network page
100    ...  and confirm section static DNS contains all the fields.
101    [Tags]  Verify_Existence_Of_All_Fields_In_Static_DNS
102    [Teardown]  Run Keywords  Click Button  ${xpath_cancel_button}  AND
103    ...  Wait Until Keyword Succeeds  10 sec  5 sec
104    ...  Refresh GUI And Verify Element Value  ${xpath_network_heading}  Network
105
106    Wait Until Keyword Succeeds  30 sec  10 sec  Click Element  ${xpath_add_dns_ip_address_button}
107    Wait Until Page Contains  Add IP address  timeout=11s
108    Page Should Contain Textfield  ${xpath_input_static_dns}
109    Page Should Contain Button  ${xpath_cancel_button}
110    Page Should Contain Button  ${xpath_add_button}
111
112
113*** Keywords ***
114
115Suite Setup Execution
116    [Documentation]  Do suite setup tasks.
117
118    Launch Browser And Login GUI
119    Click Element  ${xpath_settings_menu}
120    Click Element  ${xpath_network_sub_menu}
121    Wait Until Keyword Succeeds  30 sec  10 sec  Location Should Contain  network
122