@ -11,7 +11,7 @@ from selenium.webdriver.support import expected_conditions as EC
from selenium . webdriver . common . by import By
from selenium . webdriver . common . by import By
class test _logi n( unittest . TestCase ) :
class test ru n( unittest . TestCase ) :
def setUp ( self ) :
def setUp ( self ) :
profile = webdriver . FirefoxProfile ( )
profile = webdriver . FirefoxProfile ( )
profile . accept_untrusted_certs = True
profile . accept_untrusted_certs = True
@ -21,10 +21,10 @@ class test_login(unittest.TestCase):
capabilities = caps , firefox_profile = profile , log_path = ' /dev/null ' )
capabilities = caps , firefox_profile = profile , log_path = ' /dev/null ' )
self . driver . implicitly_wait ( 10 )
self . driver . implicitly_wait ( 10 )
self . driver . set_page_load_timeout ( 10 )
self . driver . set_page_load_timeout ( 10 )
Collections . create_subscriber ( self . driver )
def test_login ( self ) :
def test_login _logout ( self ) :
driver = self . driver
driver = self . driver
Collections . create_subscriber ( driver )
driver . find_element_by_link_text ( ' Expand Groups ' ) . click ( )
driver . find_element_by_link_text ( ' Expand Groups ' ) . click ( )
domainname = driver . find_element_by_xpath (
domainname = driver . find_element_by_xpath (
' //*[@id= " subscribers_table " ]//tr[1]/td[3] ' ) . text
' //*[@id= " subscribers_table " ]//tr[1]/td[3] ' ) . text
@ -37,6 +37,9 @@ class test_login(unittest.TestCase):
) . send_keys ( ' user ' )
) . send_keys ( ' user ' )
driver . find_element_by_xpath (
driver . find_element_by_xpath (
' //*[@id= " csc-login " ]//div//button ' ) . click ( )
' //*[@id= " csc-login " ]//div//button ' ) . click ( )
self . assertTrue ( driver . find_element_by_xpath (
' /html/body/div[contains(@class, " q-alert-container " )] ' )
. is_displayed ( ) , " Error Message was shown " )
driver . find_element_by_xpath (
driver . find_element_by_xpath (
' //*[@id= " csc-login-form " ]//div//input[@type= " text " ] '
' //*[@id= " csc-login-form " ]//div//input[@type= " text " ] '
) . send_keys ( Keys . CONTROL + " a " )
) . send_keys ( Keys . CONTROL + " a " )
@ -57,11 +60,16 @@ class test_login(unittest.TestCase):
) . send_keys ( ' testpasswd ' )
) . send_keys ( ' testpasswd ' )
driver . find_element_by_xpath (
driver . find_element_by_xpath (
' //*[@id= " csc-login " ]//div//button ' ) . click ( )
' //*[@id= " csc-login " ]//div//button ' ) . click ( )
self . assertEqual ( " testuser " , ( driver . find_element_by_xpath (
self . assertEqual ( " testuser " , driver . find_element_by_xpath (
' //*[@id= " csc-header-toolbar " ]//div//span[contains(text(), '
' //*[@id= " csc-header-toolbar " ]//div//span[contains(text(), '
' " testuser " )] ' ) . text )
' " testuser " )] ' ) . text , " Successfully logged in " )
)
driver . find_element_by_xpath (
WebDriverWait ( driver , 1 )
' //*[@id= " csc-header-toolbar " ]/div[1]/button ' ) . click ( )
driver . find_element_by_xpath (
' /html/body//div[contains(text(), " Logout " )] ' ) . click ( )
self . assertEqual (
driver . current_url , os . environ [ ' CATALYST_SERVER ' ] +
" /login/subscriber/#/login " , " Successfully logged out " )
def tearDown ( self ) :
def tearDown ( self ) :
driver = self . driver
driver = self . driver