Fix CSIT for CLAMP as UI was reworked
[integration/csit.git] / tests / clamp / UIs / 02__Create_TCA_model.robot
1 *** Settings ***
2 Library     Collections
3 Library     RequestsLibrary
4 Library     OperatingSystem
5 Library     json
6 Library     ../../../scripts/clamp/python-lib/CustomSeleniumLibrary.py
7 Library     XvfbRobot
8
9 *** Variables ***
10 ${login}                     admin
11 ${passw}                     password
12 ${SELENIUM_SPEED_FAST}       .2 seconds
13 ${SELENIUM_SPEED_SLOW}       .5 seconds
14 ${BASE_URL}                  https://localhost:8443
15
16 *** Test Cases ***
17 Get Requests health check ok
18     ${resp}=    Get Request    ${clamp_session}   /restservices/clds/v1/healthcheck
19     Should Be Equal As Strings  ${resp.status_code}     200
20
21 Open Browser
22 # Next line is to be enabled for Headless tests only (jenkins?). To see the tests disable the line.
23     Start Virtual Display    1920    1080
24     Set Selenium Speed      ${SELENIUM_SPEED_SLOW}
25     Open Browser    ${BASE_URL}/designer/index.html    browser=firefox
26
27 Reply to authentication popup
28     Run Keyword And Ignore Error    Insert into prompt    ${login} ${passw}
29     Confirm action
30
31 Good Login to Clamp UI and Verify logged in
32     Set Window Size    1920    1080
33     ${title}=    Get Title
34     Should Be Equal    CLDS    ${title}
35     Wait Until Element Is Visible       xpath=//*[@class="navbar-brand logo_name ng-binding"]       timeout=60
36     Element Text Should Be      xpath=//*[@class="navbar-brand logo_name ng-binding"]       expected=Hello:admin
37
38 Create Model from Menu
39     Wait Until Element Is Visible       xpath=//*[@id="navbar"]/ul/li[2]/a       timeout=60
40     Click Element    xpath=//*[@id="navbar"]/ul/li[1]/a
41     Wait Until Element Is Visible       locator=Create CL       timeout=60
42     Click Element    locator=Create CL
43     Input Text      locator=modelName       text=TCAModel1
44     Select From List By Label       id=templateName      templateTCA1
45     Click Button    locator=Create
46
47 Set Properties for TCAModel1
48     Wait Until Element Is Visible       xpath=//*[@id="navbar"]/ul/li[1]/a       timeout=60
49     Click Element    xpath=//*[@id="navbar"]/ul/li[1]/a
50     Wait Until Element Is Visible       locator=Properties CL       timeout=60
51     Click Element    locator=Properties CL
52     Select From List By Label       id=service       vLoadBalancer
53     Select From List By Label       id=vf       vLoadBalancer 0
54     Select From List By Label       id=actionSet      VNF
55     Select From List By Label       id=location      Data Center 1      Data Center 3
56     Input Text      locator=deployParameters       text={}
57     Click Button    locator=Save
58
59 Set Policy Box properties for TCAModel1
60     Wait Until Element Is Visible       xpath=//*[@data-element-id="Policy_12lup3h"]      timeout=60
61     Click Element    xpath=//*[@data-element-id="Policy_12lup3h"]
62     Click Button    locator=New Policy
63     Input Text      locator=//*[@id="pname"]      text=Policy2
64     Select From List By Label       id=recipe      Restart
65     Input Text      locator=maxRetries      text=6
66     Input Text      locator=retryTimeLimit      text=280
67     Input Text      locator=timeout      text=400
68     Click Button    locator=Close
69
70 Set TCA Box properties for TCAModel1
71     Wait Until Element Is Visible       xpath=//*[@data-element-id="Policy_12lup3h"]      timeout=60
72     Click Element    xpath=//*[@data-element-id="TCA_1d13unw"]
73     Input Text      xpath=(//input[@id='tname'])[2]      text=TCA1
74     Select From List By Label       xpath=//*[@id="tcaPol"]      Policy2
75     Select From List By Label       xpath=//*[@id="eventName"]      vLoadBalancer
76 ### Cannot set all TCA box attributes due to element not interractable with Selenium
77 #    Select From List By Label       xpath=//*[@id="controlLoopSchemaType"]       VNF
78 #    Select From List By Index       xpath=//*[@id="controlLoopSchemaType"]       1
79     Click Element    xpath=(//button[@id='createNewThresh'])[2]
80     Input Text      xpath=(//input[@id='threshold'])[2]          6
81 #    Select From List By Label       xpath=//*[@id="closedLoopEventStatus"]        ONSET
82     Click Button    id=savePropsBtn
83
84 Save Model from Menu
85     Wait Until Element Is Visible       xpath=//*[@id="navbar"]/ul/li[1]/a      timeout=60
86     Click Element    xpath=//*[@id="navbar"]/ul/li[1]/a
87     Wait Until Element Is Visible       locator=Save CL      timeout=60
88     Set Selenium Speed      ${SELENIUM_SPEED_FAST}
89     Click Element    locator=Save CL
90     Wait Until Element Is Visible       xpath=//*[@id="alert_message_"]      timeout=60
91     Element Text Should Be      xpath=//*[@id="alert_message_"]       expected=Action Successful: save
92     Set Selenium Speed      ${SELENIUM_SPEED_SLOW}
93
94 Close Browser
95     Close Browser