[SO] SO release image for CSIT testing
[integration/csit.git] / tests / portal / testsuites / browser_setup.robot
1 *** Settings ***
2 Documentation     The main interface for interacting with VID. It handles low level stuff like managing the selenium request library and VID required steps
3 Library           Collections
4 Library           OperatingSystem
5 Library           ExtendedSelenium2Library
6 Resource          global_properties.robot
7
8 *** Variables ***
9
10 *** Keywords ***
11 Setup Browser
12     [Documentation]   Sets up browser based upon the value of ${GLOBAL_SELENIUM_BROWSER}
13     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'firefox'    Setup Browser Firefox
14     Run Keyword If    '${GLOBAL_SELENIUM_BROWSER}' == 'chrome'    Setup Browser Chrome
15     Log    Running with ${GLOBAL_SELENIUM_BROWSER}
16
17 Setup Browser Firefox
18     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.FIREFOX  sys, selenium.webdriver
19     Set To Dictionary   ${dc}   elementScrollBehavior    1
20     Create Webdriver    Firefox    desired_capabilities=${dc}
21     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
22
23  Setup Browser Chrome
24     ${chrome options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys
25     Call Method    ${chrome options}    add_argument    no-sandbox
26     ${dc}   Evaluate    sys.modules['selenium.webdriver'].DesiredCapabilities.CHROME  sys, selenium.webdriver
27     Set To Dictionary   ${dc}   elementScrollBehavior    1
28     Create Webdriver    Chrome   chrome_options=${chrome_options}    desired_capabilities=${dc}
29     Set Global Variable    ${GLOBAL_SELENIUM_BROWSER_CAPABILITIES}    ${dc}
30
31 Handle Proxy Warning
32     [Documentation]    Handle Intermediate Warnings from Proxies
33     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_TITLE}
34     Return From Keyword if    '${status}' != 'PASS'
35     ${status}    ${data}=    Run Keyword And Ignore Error   Variable Should Exist    \${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}
36     Return From Keyword if    '${status}' != 'PASS'
37     Return From Keyword if    "${GLOBAL_PROXY_WARNING_TITLE}" == ''
38     Return From Keyword if    "${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}" == ''
39     ${test}    ${value}=    Run keyword And Ignore Error    Title Should Be     ${GLOBAL_PROXY_WARNING_TITLE}
40     Run Keyword If    '${test}' == 'PASS'    Click Element    xpath=${GLOBAL_PROXY_WARNING_CONTINUE_XPATH}