mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6015 add Apache license header
Signed-off-by: Sebastien Goasguen <runseb@gmail.com>
This commit is contained in:
parent
3800728df7
commit
58a3e75058
|
|
@ -0,0 +1,16 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
|
@ -1,3 +1,20 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from selenium import webdriver
|
||||
import time
|
||||
from selenium.common.exceptions import WebDriverException
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ serviceOfferings_xpath = "//div[@id='navigation']/ul/li[12]/span[2]"
|
|||
################################################################################################################################################################################################
|
||||
|
||||
## Instances Page
|
||||
## Instances Main page
|
||||
## Instances Main page
|
||||
|
||||
|
||||
# Add Instance Button on top right corner of Instances page
|
||||
|
|
@ -166,7 +166,7 @@ Offering_edit_css = "a[alt=\"Edit\"] > span.icon"
|
|||
Offering_editname_name = "name"
|
||||
|
||||
# Edit description box
|
||||
Offering_editdescription_name = "displaytext"
|
||||
Offering_editdescription_name = "displaytext"
|
||||
|
||||
# Edit finished click ok
|
||||
Offering_editdone_css="div.button.done"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
|
@ -1,3 +1,20 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
#!/usr/bin/python
|
||||
# coding: latin-1
|
||||
|
||||
|
|
@ -29,7 +46,7 @@ def try_except_decor(func):
|
|||
print repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
|
||||
|
||||
return try_except
|
||||
|
||||
|
||||
class Shared(object):
|
||||
|
||||
@staticmethod
|
||||
|
|
@ -58,8 +75,8 @@ class Shared(object):
|
|||
|
||||
if len(wait_element_type) > 0 and len(wait_element_name) > 0:
|
||||
Shared.wait_for_element(browser, wait_element_type, wait_element_name)
|
||||
return ret
|
||||
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
@try_except_decor
|
||||
def flash_message(browser):
|
||||
|
|
@ -107,28 +124,28 @@ class Shared(object):
|
|||
wait.until(EC.presence_of_element_located((By.XPATH, name)))
|
||||
elif element_type.lower() == 'link_text':
|
||||
wait.until(EC.presence_of_element_located((By.LINK_TEXT, name)))
|
||||
|
||||
|
||||
#feed the string through directly
|
||||
else:
|
||||
wait.until(EC.presence_of_element_located(element_type, name))
|
||||
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
def playing_around(self):
|
||||
from threading import Timer
|
||||
t = Timer(20,self.wait_for_invisible)
|
||||
t.start()
|
||||
|
||||
|
||||
@staticmethod
|
||||
#wait until something disappears
|
||||
#wait until something disappears
|
||||
def wait_for_invisible(browser, element_type, name, waittime=30):
|
||||
wait = WebDriverWait(browser, waittime)
|
||||
|
||||
|
||||
# the code base uses underscores, but the real string doesn't have em.
|
||||
final_type = re.sub('_',' ',element_type)
|
||||
|
||||
|
||||
wait.until(EC.invisibility_of_element_located((final_type, name)))
|
||||
|
||||
|
||||
#this method isn't as slick as I hoped :(
|
||||
time.sleep(1)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import *
|
||||
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
|
||||
from selenium.webdriver.common.action_chains import ActionChains as action
|
||||
from common import Global_Locators
|
||||
|
||||
from common.shared import *
|
||||
|
||||
class DashboardPage(object):
|
||||
|
||||
def __init__(self, browser):
|
||||
self.browser = browser
|
||||
self.active_item = ""
|
||||
self.items = []
|
||||
|
||||
@try_except_decor
|
||||
def get_active_item(self):
|
||||
self.active_item = ""
|
||||
lis = self.browser.find_elements_by_xpath("//*[@id='navigation']/ul/li")
|
||||
for li in lis:
|
||||
if li.get_attribute('class').find('active') > 0:
|
||||
self.active_item = li.get_attribute('class')[:(li.get_attribute('class').index(' active'))]
|
||||
return self.active_item
|
||||
|
||||
@try_except_decor
|
||||
def get_items(self):
|
||||
lis = self.browser.find_elements_by_xpath("//*[@id='navigation']/ul/li")
|
||||
for li in lis:
|
||||
item = li.get_attribute('class')[len('navigation-item '):]
|
||||
if item.find('active') > 0:
|
||||
item = item[:(item.index(' active'))]
|
||||
if item.find('first') > 0:
|
||||
item = item[:(item.index(' first'))]
|
||||
if item.find('last') > 0:
|
||||
item = item[:(item.index(' last'))]
|
||||
self.items.append(item.lower())
|
||||
return self.items
|
||||
# import pdb
|
||||
# pdb.set_trace()
|
||||
|
||||
@try_except_decor
|
||||
def navigate_to(self, item_name):
|
||||
if len(self.items) == 0:
|
||||
self.get_items()
|
||||
if item_name is None or len(item_name) == 0 or \
|
||||
item_name.lower() not in self.items or \
|
||||
(len(self.active_item) > 0 and self.active_item.lower().find(item_name.lower()) > 0):
|
||||
return
|
||||
|
||||
lis = self.browser.find_elements_by_xpath("//*[@id='navigation']/ul/li")
|
||||
for li in lis:
|
||||
if li.get_attribute('class').lower().find(item_name.lower()) > 0:
|
||||
li.click()
|
||||
time.sleep(3)
|
||||
return
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import *
|
||||
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
|
||||
from selenium.webdriver.common.action_chains import ActionChains as action
|
||||
from common import Global_Locators
|
||||
|
||||
from common.shared import *
|
||||
|
||||
import pdb
|
||||
|
||||
class LoginPage(object):
|
||||
def __init__(self, browser):
|
||||
self.browser = browser
|
||||
self.username = ""
|
||||
self.password = ""
|
||||
self.language = ""
|
||||
|
||||
@try_except_decor
|
||||
def set_username(self, username):
|
||||
self.username = username
|
||||
usernameElement = self.browser.find_element_by_css_selector(Global_Locators.login_username_css)
|
||||
usernameElement.send_keys(self.username)
|
||||
|
||||
@try_except_decor
|
||||
def set_password(self, password):
|
||||
self.password = password
|
||||
passwordElement = self.browser.find_element_by_css_selector(Global_Locators.login_password_css)
|
||||
passwordElement.send_keys(self.password)
|
||||
self.pwelement = passwordElement
|
||||
|
||||
@try_except_decor
|
||||
def set_language(self, language):
|
||||
self.language = language
|
||||
options = self.browser.find_elements_by_xpath('/html/body/div[3]/form/div[2]/div[4]/select/option')
|
||||
for option in options:
|
||||
if len(option.get_attribute('text')) > 0 and option.get_attribute('text').lower() == language.lower():
|
||||
option.click()
|
||||
break
|
||||
|
||||
@try_except_decor
|
||||
def login(self, expect_fail = False):
|
||||
if self.username == "" or self.password == "":
|
||||
print "Must set email and password before logging in"
|
||||
return
|
||||
loginElement = self.browser.find_element_by_css_selector(Global_Locators.login_submit_css)
|
||||
loginElement.click()
|
||||
|
||||
time.sleep(3)
|
||||
try:
|
||||
# in case we have that "Hello and Welcome to CloudStack" page
|
||||
ele = None
|
||||
ele = self.browser.find_element_by_xpath("//input[@type='submit' and @class='button goTo advanced-installation' and @value='I have used CloudStack before, skip this guide']")
|
||||
if ele is not None:
|
||||
ele.click()
|
||||
time.sleep(2)
|
||||
except NoSuchElementException as err:
|
||||
pass
|
||||
|
||||
@try_except_decor
|
||||
def logout(self, directly_logout = False):
|
||||
|
||||
self.browser.set_window_size(1200,980)
|
||||
Shared.wait_for_element(self.browser, 'id', 'user')
|
||||
|
||||
# must click this icon options first
|
||||
# pdb.set_trace()
|
||||
if directly_logout == False:
|
||||
try:
|
||||
ele = self.browser.find_element_by_xpath("//div[@id='user-options' and @style='display: block;']")
|
||||
if ele is None:
|
||||
ele1 = self.browser.find_element_by_xpath("//div[@id='user' and @class='button']/div[@class='icon options']/div[@class='icon arrow']").click()
|
||||
except NoSuchElementException as err:
|
||||
ele1 = self.browser.find_element_by_xpath("//div[@id='user' and @class='button']/div[@class='icon options']/div[@class='icon arrow']").click()
|
||||
|
||||
# this is for cs 4.2.0-2
|
||||
# ele2 = self.browser.find_element_by_xpath("//div[@id='header']/div[@id='user-options']")
|
||||
# this is for cs 4.4.0
|
||||
ele2 = self.browser.find_element_by_xpath("//div[@id='user' and @class='button']/div[@id='user-options']/a[1]").click()
|
||||
|
||||
Shared.wait_for_element(self.browser, 'class_name', 'login')
|
||||
|
||||
@try_except_decor
|
||||
def get_error_msg(self, loginpage_url):
|
||||
if loginpage_url is not None and len(loginpage_url) > 0 and \
|
||||
(self.browser.current_url.find(loginpage_url) > -1 or loginpage_url.find(self.browser.current_url) > -1):
|
||||
ele = self.browser.find_element_by_id('std-err')
|
||||
return ele.text
|
||||
else:
|
||||
return ""
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
import sys, os, time
|
||||
import json
|
||||
|
||||
sys.path.append('./')
|
||||
|
||||
import browser.firefox as firefox
|
||||
import common.shared as shared
|
||||
from cstests.smoketests.smokecfg import smokecfg
|
||||
import cspages.login.loginpage as loginpage
|
||||
import cspages.dashboard.dashboardpage as dashboardpage
|
||||
|
||||
# from cstests.smoketests import smokecfg as smokecfg
|
||||
|
||||
class TestCSGlobalSettings(unittest.TestCase):
|
||||
def setUp(self):
|
||||
# Create a new instance of the Firefox browser
|
||||
self.browser = firefox.Firefox('firefox')
|
||||
|
||||
def tearDown(self):
|
||||
self.browser.quit_browser()
|
||||
|
||||
def test_success(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['username'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login()
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'id', 'navigation')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
self.dashboardpage = dashboardpage.DashboardPage(self.browser.get_browser())
|
||||
active_item = self.dashboardpage.get_active_item()
|
||||
print "active item: ", active_item
|
||||
|
||||
self.loginpage.logout()
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login')
|
||||
|
||||
def xtest_failure_8(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_5'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -1,3 +1,20 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
import sys, os, time
|
||||
import json
|
||||
|
|
@ -5,7 +22,7 @@ import json
|
|||
sys.path.append('./')
|
||||
|
||||
import browser.firefox as firefox
|
||||
import cspages.loginpage as loginpage
|
||||
import cspages.login.loginpage as loginpage
|
||||
import common.shared as shared
|
||||
from cstests.smoketests.smokecfg import smokecfg
|
||||
|
||||
|
|
@ -22,69 +39,93 @@ class TestCSLoginLogout(unittest.TestCase):
|
|||
def test_success(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
|
||||
# wait for at most 5 minutes, in case we have an anoyingly slow server
|
||||
shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language', waittime = 300)
|
||||
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
|
||||
shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields', waittime = 300)
|
||||
|
||||
self.loginpage.set_username(smokecfg['username'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
# self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.login()
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'id', 'navigation')
|
||||
shared.Shared.wait_for_element(self.browser.get_browser(), 'id', 'navigation', waittime = 300)
|
||||
|
||||
time.sleep(5)
|
||||
|
||||
self.loginpage.logout()
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login')
|
||||
self.loginpage.logout(directly_logout = True)
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login', waittime = 300)
|
||||
|
||||
def test_failure_1(self):
|
||||
def xtest_failure_1(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['badusername'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_2(self):
|
||||
def xtest_failure_2(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['username'])
|
||||
self.loginpage.set_password(smokecfg['badpassword'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_3(self):
|
||||
def xtest_failure_3(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['badusername'])
|
||||
self.loginpage.set_password(smokecfg['badpassword'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_4(self):
|
||||
def xtest_failure_4(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_1'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_5(self):
|
||||
def xtest_failure_5(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_2'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_6(self):
|
||||
def xtest_failure_6(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_3'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_7(self):
|
||||
def xtest_failure_7(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_4'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
def test_failure_8(self):
|
||||
def xtest_failure_8(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_5'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import unittest
|
||||
import sys, os, time
|
||||
import json
|
||||
|
||||
sys.path.append('./')
|
||||
|
||||
import browser.firefox as firefox
|
||||
import common.shared as shared
|
||||
from cstests.smoketests.smokecfg import smokecfg
|
||||
import cspages.login.loginpage as loginpage
|
||||
import cspages.dashboard.dashboardpage as dashboardpage
|
||||
|
||||
# from cstests.smoketests import smokecfg as smokecfg
|
||||
|
||||
class TestCSnavigation(unittest.TestCase):
|
||||
def setUp(self):
|
||||
# Create a new instance of the Firefox browser
|
||||
self.browser = firefox.Firefox('firefox')
|
||||
|
||||
def tearDown(self):
|
||||
self.browser.quit_browser()
|
||||
|
||||
def test_success(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
|
||||
# wait for at most 5 minutes, in case we have an anoyingly slow server
|
||||
shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'select-language', waittime = 300)
|
||||
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
|
||||
shared.Shared.wait_for_element(self.browser.get_browser(), 'class_name', 'fields', waittime = 300)
|
||||
|
||||
self.loginpage.set_username(smokecfg['username'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login()
|
||||
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'id', 'navigation')
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
self.dashboardpage = dashboardpage.DashboardPage(self.browser.get_browser())
|
||||
|
||||
items = self.dashboardpage.get_items()
|
||||
[self.dashboardpage.navigate_to(item) for item in items]
|
||||
|
||||
self.loginpage.logout()
|
||||
|
||||
shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login')
|
||||
|
||||
def xtest_failure_8(self):
|
||||
self.browser.set_url(smokecfg['cssite'])
|
||||
self.loginpage = loginpage.LoginPage(self.browser.get_browser())
|
||||
# language selection must be done before username and password
|
||||
self.loginpage.set_language(smokecfg['language'])
|
||||
self.loginpage.set_username(smokecfg['sqlinjection_5'])
|
||||
self.loginpage.set_password(smokecfg['password'])
|
||||
self.loginpage.login(expect_fail = True)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
@ -1,11 +1,30 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
#!/usr/bin/python
|
||||
# coding: latin-1
|
||||
|
||||
smokecfg = {
|
||||
'browser': 'Firefox',
|
||||
'window position': '10, 10', # upper left coordinates
|
||||
'window size': '1200, 1000',
|
||||
'cssite': 'http://10.88.91.68:8080/client/',
|
||||
# 'window position': '10, 10', # upper left coordinates
|
||||
# 'window size': '2000, 1500',
|
||||
# 'cssite': 'http://127.0.0.1:8080/client/',
|
||||
# 'cssite': 'http://10.88.91.68:8080/client/',
|
||||
'cssite': 'http://192.168.1.31:8080/client/',
|
||||
'username': 'admin',
|
||||
'password': 'password',
|
||||
'badusername': 'badname',
|
||||
|
|
|
|||
Loading…
Reference in New Issue