Remove test/selenium/ test/src-not-used/ (#11013)

This commit is contained in:
Wei Zhou 2025-06-16 09:02:35 +02:00 committed by GitHub
parent e83a347ace
commit ea7919b0c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 0 additions and 3955 deletions

View File

@ -117,8 +117,6 @@
<cs.junit.jupiter.version>5.9.1</cs.junit.jupiter.version>
<cs.guava-testlib.version>18.0</cs.guava-testlib.version>
<cs.mockito.version>5.16.1</cs.mockito.version>
<cs.selenium.server.version>1.0-20081010.060147</cs.selenium.server.version>
<cs.selenium-java-client-driver.version>1.0.1</cs.selenium-java-client-driver.version>
<cs.testng.version>7.1.0</cs.testng.version>
<cs.wiremock.version>2.27.2</cs.wiremock.version>
<cs.xercesImpl.version>2.12.2</cs.xercesImpl.version>

View File

@ -44,16 +44,6 @@
<groupId>org.jenkins-ci</groupId>
<artifactId>trilead-ssh2</artifactId>
</dependency>
<dependency>
<groupId>org.openqa.selenium.server</groupId>
<artifactId>selenium-server</artifactId>
<version>${cs.selenium.server.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium.client-drivers</groupId>
<artifactId>selenium-java-client-driver</artifactId>
<version>${cs.selenium-java-client-driver.version}</version>
</dependency>
</dependencies>
<build>
<defaultGoal>compile</defaultGoal>

View File

@ -1,66 +0,0 @@
##############################################
Questions? Post'em @ dev@cloudstack.apache.org
##############################################
This files contains following:
1) Installation requirements
2) Testing pre-requisites
3) Running the Tests and Generating the report
##############################################
##########################################################################################################################################
1) Installation Requirements
---------------------------
1) Firefox depending on your OS (Good to have Firebug and Selenium IDE for troubleshooting and dev work)
2) Install Python 2.7.
3) Now Open CMD/Terminal and type all of following
- pip install pycrypto (Installs Pycrypto)
- pip install paramiko (Install paramiko)
- pip install unittest-xml-reporting (Install XML Test Runner)
- pip install -U selenium (Installs Selenium)
4) Get PhoantomJS for your OS from http://phantomjs.org/
- PhantomJS will run selenium test in headless mode. Follow the instruction on PhantomJS.org.
- Make sure the executable is in PATH. (TIP: Drop it in Python27 folder :-))
5) Now get the HTMLTestRunner for nice looking report generation.
- http://tungwaiyip.info/software/HTMLTestRunner.html
- Download and put this file into Lib of your python installation.
##########################################################################################################################################
2) Test Prerequisites
---------------------
- Download and install CS. /cwiki.apache.org has links to Installation Guide and API reference.
- Log into the management server and Add a Zone. (Must be Advance Zone and Hypervisor type must be Xen)
##########################################################################################################################################
3) Running the Test and Generating the report
---------------------------------------------
- Folder smoke contains main.py
- main.py is the file where all the tests are serialized.
- main.py supports HTML and XML reporting. Please refer to end of file to choose either.
- Typical usage is: python main.py 10.1.1.10 >> result.xml for XML Reporting
- And python main.py 10.1.1.10 >> result.html for HTML Reporting.
- 10.1.1.10 (your management server IP) is an argument required for main.
##########################################################################################################################################

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,55 +0,0 @@
# 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
from selenium.common.exceptions import NoSuchElementException
class Firefox(object):
def __init__(self, x_pos = 0, y_pos = 0, x_size = 1024, y_size = 768, timeout = 30):
self.browser = None
self.browser = webdriver.Firefox()
self.browser.set_page_load_timeout(timeout)
self.browser.set_window_position(x_pos, y_pos)
self.browser.set_window_size(x_size, y_size)
def get_browser(self):
return self.browser
def set_url(self, url):
if url == None or url == "":
print "A valid url is required"
return
self.url = url
self.browser.get(url)
def quit_browser(self):
try:
self.browser.quit()
except NoSuchElementException as err:
print "Element error({0})".format(err.msg)
except WebDriverException as err:
print "WebDriver error({0})".format(err.msg)
if __name__ == "__main__":
# Create a new instance of the Firefox driver
browser = Firefox("Firefox")
browser.set_url("http://10.88.90.84:8080/client/")
time.sleep(3)
browser.quit_browser()

View File

@ -1,230 +0,0 @@
# 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.
'''
Variable Names are as follows
Logical Page Descriptor_____What Element Represents and/or where it is_____LocatorType
For Example ::
instances_xpath = "//div[@id='navigation']/ul/li[2]/span[2]"
Means this is:: xpath link for Instances which is present on Dashboard.
Any test cases that requires to go into Instances from Dashboard can use this variable now.
This may not be intuitive as you go deep into the tree.
for example
stopinstanceforce_id
The best way to know what this represents is to track by variable name
Under Instances / any instance is click on any instance (applies to any instance) / stop instance has a force stop check box when you click.
This link represents that.
Steps below do not have global locators.
PF rule steps including and after filling port numbers. (Refer to vmLifeAndNetwork.py / def test_PF)
FW rule steps including and after filling port numbers. (Refer to vmLifeAndNetwork.py / def test_PF)
ADD Disk Offering page has Names, description, storage type etc etc
ADD Compute Offering page has Names, description, CPU Cores, CPU clocks type etc etc
Create Acc, Delete Acc, Login and Logout are for test flow and are not test cases. They do not have global Locators.
Such and many more data entry points that appear only once and hence we do not need glonal names for them. They are hard coded as and when needed in the scripts.
'''
################################################################################################################################################################################################
## Links on the Main UI page (Dash board). Listed in the order they appear on screen
dashboard_xpath = "//div[@id='navigation']/ul/li"
instances_xpath = "//div[@id='navigation']/ul/li[2]/span[2]" # Link for Instance and following as self explanatory
storage_xpath = "//div[@id='navigation']/ul/li[3]/span[2]"
network_xpath = "//div[@id='navigation']/ul/li[4]/span[2]"
templates_xpath = "//div[@id='navigation']/ul/li[5]/span[2]"
events_xpath = "//div[@id='navigation']/ul/li[6]/span[2]"
projects_xpath = "//div[@id='navigation']/ul/li[7]/span[2]"
accounts_xpath = "//div[@id='navigation']/ul/li[8]/span[2]"
domains_xpath = "//div[@id='navigation']/ul/li[9]/span[2]"
infrastructure_xpath = "//div[@id='navigation']/ul/li[10]/span[2]"
globalSettings_xpath = "//div[@id='navigation']/ul/li[11]/span[2]"
serviceOfferings_xpath = "//div[@id='navigation']/ul/li[12]/span[2]"
################################################################################################################################################################################################
## Instances Page
## Instances Main page
# Add Instance Button on top right corner of Instances page
add_instance_xpath = "//div[2]/div/div[2]/div/div[2]/span"
# Add Instance Wizard next button
add_instance_next_xpath = "//div[4]/div[2]/div[3]/div[3]/span"
# Table that lists all VM's under Instances page; General usage is to traverse through this table and search for the VM we are interested in.
instances_table_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div[2]/table/tbody/tr/td/span"
# Click any instance and following are available
# Click ok on confirmation pop-up box for most actions listed below
actionconfirm_xpath = ("//button[@type='button']")
# status of VM running. Click on VM > 3rd row in table
state_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/div/div[2]/div/table/tbody/tr[3]/td[2]/span"
# Stop instance icon
stopinstance_css = "a[alt=\"Stop Instance\"] > span.icon"
# stop instance forcefully check box available after stop instance is executed in separate pop up
stopinstanceforce_id = ("force_stop")
# start instance icon
startinstance_css = "a[alt=\"Start Instance\"] > span.icon"
yesconfirmation_xapth = "(//button[@type='button'])[2]"
# Destroy instance icon
destroyinstance_css = "a[alt=\"Destroy Instance\"] > span.icon"
#Restore Instance icon
restoreinstance_css = "a[alt=\"Restore Instance\"] > span.icon"
# Reboot instance
rebootinstance_css = "a[alt=\"Reboot Instance\"] > span.icon"
################################################################################################################################################################################################
## Network Page
# Table that lists all Networks under Network page; General usage is to traverse through this table and search for the network we are interested in.
network_networktable_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div[3]/div[2]/div/div[2]/table/tbody/tr/td/span"
# View IP addresses button on each network page
viewIp_css="div.view-all > a > span"
# Acquire a new ip
acquireIP_xpath="//div[2]/div/div/div[2]/span"
# List of IP's within a netork table
network_iptables_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div[3]/div[2]/div/div[2]/table/tbody/tr/td/span"
# Configuration tab for each IP
ipConfiguration_text="Configuration"
# PF under configuration for each IP
ip_PF = "li.portForwarding > div.view-details"
################################################################################################################################################################################################
## Servivce Offering Page
# Selects Compute offering from drop down menu
Offering_compute_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[1]"
# Selects System offering from drop down menu
Offering_system_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[2]"
# Selects Disk offering from drop down menu
Offering_disk_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[3]"
# Selects Network offering from drop down menu
Offering_network_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[4]"
# Add Offering
Offering_add_xpath ="//div[3]/span"
# Points to tbale that lists Offerings
Offering_table_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div[2]/table/tbody/tr/td/span"
# Edit Button
Offering_edit_css = "a[alt=\"Edit\"] > span.icon"
# Edit name box
Offering_editname_name = "name"
# Edit description box
Offering_editdescription_name = "displaytext"
# Edit finished click ok
Offering_editdone_css="div.button.done"
# delete offering button for Disk only
Offering_delete_css = "a[alt=\"Delete Disk Offering\"] > span.icon"
# delete offering button for Compute only
Offering_deletecompute_css = "a[alt=\"Delete Service Offering\"] > span.icon"
################################################################################################################################################################################################
#### Templates Page
# Selects Templates from drop down
template_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[1]"
# Selects ISO from drop down
iso_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[2]"
# Add Template
AddTemplate_xpath = "//div[3]/span"
# Points to table where all templates are
template_table_xpath ="/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div[2]/table/tbody/tr/td/span"
# Edit Template Button
template_edit_css = "a[alt=\"Edit\"] > span.icon"
# Edit finished click OK
template_editdone_css = "div.button.done"
# Delete Template button
template_delete_css = "a[alt=\"Delete Template\"] > span.icon"
################################################################################################################################################################################################
## Login Page
# Username box
login_username_css = "body.login > div.login > form > div.fields > div.field.username > input[name=\"username\"]" # Login>Username TextBox
# Password Box
login_password_css = "body.login > div.login > form > div.fields > div.field.password > input[name=\"password\"]" # LoginPassword TextBox
# Click ok to login
login_submit_css = "body.login > div.login > form > div.fields > input[type=\"submit\"]" # Login>Login Button (Submit button)
################################################################################################################################################################################################
## Logout
logout_css = "div.cloudstack3-container > div.container > div.header > div.controls div.user > div.user-options > a[text=\"Logout\"]" # Logout
# logout_css = "div#header > div#user-options > a[href='#']"

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,148 +0,0 @@
# 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
from selenium.selenium import selenium
from selenium.common.exceptions import NoSuchElementException
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import WebDriverException
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as EC # available since 2.26.0
from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0
import re, sys, time, traceback
def try_except_decor(func):
def try_except(*args, **kwargs):
try:
return func(*args, **kwargs)
except WebDriverException as err:
exc_type, exc_value, exc_traceback = sys.exc_info()
print "WebDriver error. Function: {0}, error: {1}".format(func.func_code, err)
print repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
except NoSuchElementException as err:
exc_type, exc_value, exc_traceback = sys.exc_info()
print "Element error. Function: {0}, error: {1}".format(func.func_code, err)
print repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
except TimeoutException as err:
exc_type, exc_value, exc_traceback = sys.exc_info()
print "Timeout error. Function: {0}, error: {1}".format(func.func_code, err)
print repr(traceback.format_exception(exc_type, exc_value,exc_traceback))
return try_except
class Shared(object):
@staticmethod
@try_except_decor
def option_selection(browser, element_type, element_name, option_text, wait_element_type = '', wait_element_name = ''):
ret = False
Shared.wait_for_element(browser, element_type, element_name)
if element_type == 'id':
ele = browser.find_element_by_id(element_name)
elif element_type == 'class_name':
ele = browser.find_element_by_class_name(element_name)
options = ele.find_elements_by_tag_name('option')
option_names = [option.text for option in options]
if option_text not in option_names:
return ret
for option in options:
if option.text.find(option_text) > -1:
option.click()
ret = True
time.sleep(1)
break
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
@staticmethod
@try_except_decor
def flash_message(browser):
try:
ele1 = browser.find_element_by_id('flashMessageArea')
except NoSuchElementException:
ele1 = None
if ele1 != None:
ele2 = ele1.find_element_by_class_name('flash_message')
if ele2 != None and ele2.text != None and len(ele2.text) > 0:
return ele2.text
else:
return ''
else:
return ''
@staticmethod
@try_except_decor
def string_selection(browser, key, value, index = 0):
element = browser.find_elements_by_id(key)[index]
element.clear()
element.send_keys(value)
@staticmethod
def wait_until_title_text(browser, text, waittime = 30):
wait = WebDriverWait(browser, waittime)
wait.until(lambda browser: browser.title.lower().find(text.lower()) > -1)
@staticmethod
def wait_until_find_id(browser, element_id, waittime = 10):
wait = WebDriverWait(browser, waittime)
wait.until(lambda browser: browser.find_element_by_id(element_id))
@staticmethod
# the name should exist in the newer page, but not in older one
def wait_for_element(browser, element_type, name, waittime = 30):
wait = WebDriverWait(browser, waittime)
if element_type.lower() == 'id':
wait.until(EC.presence_of_element_located((By.ID, name)))
elif element_type.lower() == 'tag_name':
wait.until(EC.presence_of_element_located((By.TAG_NAME, name)))
elif element_type.lower() == 'class_name':
wait.until(EC.presence_of_element_located((By.CLASS_NAME, name)))
elif element_type.lower() == 'xpath':
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
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)

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,175 +0,0 @@
# 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 cspages.cspage import CloudStackPage
from common.shared import *
class AccountsPage(CloudStackPage):
def __init__(self, browser):
self.browser = browser
self.accounts = []
@try_except_decor
def get_accounts(self):
rows = self.browser.find_elements_by_xpath("//div[@class='data-table']/table[@class='body']/tbody/tr")
for row in rows:
account = {}
columes = row.find_elements_by_tag_name('td')
account['Name'] = columes[0].get_attribute('title').lower()
account['Role'] = columes[1].get_attribute('title').lower()
account['Domain'] = columes[2].get_attribute('title').lower()
account['State'] = columes[3].get_attribute('title').lower()
self.accounts.append(account)
@try_except_decor
def account_exists(self, name):
if len(self.accounts) == 0:
self.get_accounts()
account = [acct for acct in self.accounts if acct['Name'] == name.lower()]
if len(account) > 0:
return True
else:
return False
@try_except_decor
def add_account(self, username = "", password = "", email = "", firstname = "", lastname = "", domain = "", account = "", type = "", timezone = "", network_domain = ""):
# type = role
if len(username) == 0 or len(password) == 0 or len(email) == 0 or len(firstname) == 0 or len(lastname) == 0 or len(domain) == 0 or len(type) == 0:
return;
if type not in ('User', 'Admin'):
print "Account type must be either User or Admin."
return;
if self.account_exists(username):
return
# click Add Account
ele = self.browser.find_element_by_xpath("//div[@class='toolbar']")
ele1 = ele.find_element_by_xpath("//div[3]/span")
ele1.click()
Shared.wait_for_element(self.browser, 'id', 'label_username')
ele = self.browser.find_element_by_xpath("(//input[@name='username' and @type='text' and @id='label_username'])")
ele.send_keys(username)
ele = self.browser.find_element_by_xpath("(//input[@name='password' and @type='password' and @id='password'])")
ele.send_keys(password)
ele = self.browser.find_element_by_xpath("(//input[@name='password-confirm' and @type='password' and @id='label_confirm_password'])")
ele.send_keys(password)
ele = self.browser.find_element_by_xpath("(//input[@name='email' and @type='text' and @id='label_email'])")
ele.send_keys(email)
ele = self.browser.find_element_by_xpath("(//input[@name='firstname' and @type='text' and @id='label_first_name'])")
ele.send_keys(firstname)
ele = self.browser.find_element_by_xpath("(//input[@name='lastname' and @type='text' and @id='label_last_name'])")
ele.send_keys(lastname)
Shared.option_selection(self.browser, 'id', 'label_domain', 'ROOT')
if len(account) > 0:
ele = self.browser.find_element_by_xpath("(//input[@name='account' and @type='text' and @id='label_account'])")
ele.send_keys(account)
Shared.option_selection(self.browser, 'id', 'label_type', type)
Shared.option_selection(self.browser, 'id', 'label_timezone', timezone)
if len(network_domain) > 0:
ele = self.browser.find_element_by_xpath("(//input[@name='networkdomain' and @type='text' and @id='label_network_domain'])")
ele.send_keys(network_domain)
self.button_add()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def select_account(self, username = "", domain = "", type = ""):
if len(username) == 0 or len(domain) == 0 or len(type) == 0:
return False;
if self.account_exists(username) == False:
print "The account does not exist"
return False
# select the account
ele = self.browser.find_element_by_xpath("//div[@class='data-table']/div[@class='fixed-header']/table")
ele1 = ele.find_element_by_xpath("//tbody")
ele2 = ele1.find_elements_by_tag_name('tr')
for e in ele2:
ele3 = e.find_elements_by_tag_name('td')
# move mouse to quickview
if len(ele3) > 4 and \
ele3[0].text == username and \
ele3[1].text == type and \
ele3[2].text == domain and \
ele3[3].text == 'enabled':
ele3[4].find_element_by_tag_name('span').click()
Shared.wait_for_element(self.browser, 'class_name', 'details')
# select account
ele = self.browser.find_element_by_xpath("//div[@id='details-tab-details']/div[@class='details']/div/table/tbody/tr/td[@class='view-all']")
ele1 = ele.find_element_by_tag_name('a').find_element_by_tag_name('span').click()
break
Shared.wait_for_element(self.browser, 'class_name', 'view-all')
@try_except_decor
def delete_account(self, username = "", domain = "", type = ""):
if len(username) == 0 or len(domain) == 0 or len(type) == 0:
return False;
if self.account_exists(username) == False:
print "The account does not exist"
return False
# find the account
ele = self.browser.find_element_by_xpath("//div[@class='data-table']/div[@class='fixed-header']/table")
ele1 = ele.find_element_by_xpath("//tbody")
ele2 = ele1.find_elements_by_tag_name('tr')
for e in ele2:
ele3 = e.find_elements_by_tag_name('td')
# move mouse to quickview
if len(ele3) > 4 and \
ele3[0].text == username and \
ele3[1].text == type and \
ele3[2].text == domain and \
ele3[3].text == 'enabled':
ele3[4].find_element_by_tag_name('span').click()
Shared.wait_for_element(self.browser, 'class_name', 'details')
# delete account
ele = self.browser.find_element_by_xpath("//div[@id='details-tab-details']/div[@class='details']/div/table/tbody/tr/td/div[@class='buttons']")
ele1 = ele.find_element_by_xpath("//div[@class='action remove single text' and @title='Delete account']/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'ui-dialog-buttonset')
self.button_yes()
break
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_cancel(self):
ele = self.browser.find_element_by_xpath("/html/body/div[4]/div[2]/div/button[1]/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_add(self):
ele = self.browser.find_element_by_xpath("/html/body/div[4]/div[2]/div/button[2]/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_no(self):
ele = self.browser.find_element_by_xpath("/html/body/div[4]/div[10]/div/button[1]/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_yes(self):
ele = self.browser.find_element_by_xpath("/html/body/div[4]/div[10]/div/button[2]/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')

View File

@ -1,146 +0,0 @@
# 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 cspages.cspage import CloudStackPage
from common.shared import *
class UsersPage(CloudStackPage):
def __init__(self, browser):
self.browser = browser
self.users = []
@try_except_decor
def get_users(self):
ele = self.browser.find_element_by_xpath("//div[@class='container cloudStack-widget cloudBrowser']")
rows = ele.find_elements_by_xpath("//div[@class='panel']/div[2]/div[@class='view list-view']/div[@class='data-table']/table[@class='body']/tbody/tr")
for row in rows:
user = {}
columes = row.find_elements_by_tag_name('td')
user['username'] = columes[0].get_attribute('title').lower()
user['firstname'] = columes[1].get_attribute('title').lower()
user['lastname'] = columes[2].get_attribute('title').lower()
self.users.append(user)
@try_except_decor
def user_exists(self, username):
if len(self.users) == 0:
self.get_users()
users = [u for u in self.users if u['username'] == username.lower()]
if len(users) > 0:
return True
else:
return False
@try_except_decor
def add_user(self, username = "", password = "", email = "", firstname = "", lastname = "", timezone = ""):
if len(username) == 0 or len(password) == 0 or len(email) == 0 or len(firstname) == 0 or len(lastname) == 0:
return;
if self.user_exists(username):
return
# click Add User
ele = self.browser.find_element_by_xpath("//div[@class='container cloudStack-widget cloudBrowser']")
ele1 = ele.find_element_by_xpath("//div[@class='panel']/div[2]/div[@class='view list-view']/div[@class='toolbar']/div[@class='button action add reduced-hide']/span")
ele1.click()
Shared.wait_for_element(self.browser, 'id', 'label_username')
ele = self.browser.find_element_by_xpath("(//input[@name='username' and @type='text' and @id='label_username'])")
ele.send_keys(username)
ele = self.browser.find_element_by_xpath("(//input[@name='password' and @type='password' and @id='password'])")
ele.send_keys(password)
ele = self.browser.find_element_by_xpath("(//input[@name='password-confirm' and @type='password' and @id='label_confirm_password'])")
ele.send_keys(password)
ele = self.browser.find_element_by_xpath("(//input[@name='email' and @type='text' and @id='label_email'])")
ele.send_keys(email)
ele = self.browser.find_element_by_xpath("(//input[@name='firstname' and @type='text' and @id='label_first_name'])")
ele.send_keys(firstname)
ele = self.browser.find_element_by_xpath("(//input[@name='lastname' and @type='text' and @id='label_last_name'])")
ele.send_keys(lastname)
Shared.option_selection(self.browser, 'id', 'label_timezone', timezone)
self.button_ok()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def delete_user(self, username = "", firstname = "", lastname = ""):
if len(username) == 0 or len(firstname) == 0 or len(lastname) == 0:
return False;
if self.user_exists(username) == False:
print "The user does not exist"
return False
# find the user
ele = self.browser.find_element_by_xpath("//div[@class='container cloudStack-widget cloudBrowser']")
ele1 = ele.find_element_by_xpath("//div[@class='panel']/div[2]/div[@class='view list-view']/div[@class='data-table']/table[@class='body']/tbody")
ele2 = ele1.find_elements_by_tag_name('tr')
for e in ele2:
ele3 = e.find_elements_by_tag_name('td')
# move mouse to quickview
if len(ele3) > 3 and \
ele3[0].text == username and \
ele3[1].text == firstname and \
ele3[2].text == lastname:
ele3[3].find_element_by_tag_name('span').click()
Shared.wait_for_element(self.browser, 'class_name', 'details')
# delete user
ele = self.browser.find_element_by_xpath("//div[@id='details-tab-details']/div[@class='details']/div/table/tbody/tr/td/div[@class='buttons']")
ele1 = ele.find_element_by_xpath("//div[@class='action remove single text' and @title='Delete User']/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'ui-dialog-buttonset')
self.button_yes()
break
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_yes(self):
eles = self.browser.find_elements_by_xpath("//div[@class='ui-dialog-buttonset']/button[@type='button' and @role='button']")
for e in eles:
ele = e.find_element_by_class_name('ui-button-text')
if e.text == 'Yes':
e.click()
break
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_no(self):
ele = self.browser.find_element_by_xpath("/html/body/div[4]/div[10]/div/button[1]/span").click()
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_ok(self):
eles = self.browser.find_elements_by_xpath("//button[@type='button' and @role='button']")
for e in eles:
if e.text == 'OK':
e.click()
break
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')
@try_except_decor
def button_cancel(self):
eles = self.browser.find_elements_by_xpath("//button[@type='button' and @role='button']")
for e in eles:
if e.text == 'Cancel':
e.click()
break
Shared.wait_for_element(self.browser, 'class_name', 'fixed-header')

View File

@ -1,20 +0,0 @@
# 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.
class CloudStackPage(object):
def __init__():
self.browser = None

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,73 +0,0 @@
# 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 cspages.cspage import CloudStackPage
from common.shared import *
class DashboardPage(CloudStackPage):
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

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,103 +0,0 @@
# 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 cspages.cspage import CloudStackPage
from common.shared import *
import pdb
class LoginPage(CloudStackPage):
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):
Shared.wait_for_element(self.browser, 'id', 'user')
# must click this icon options first
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()
time.sleep(1)
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 ""

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,16 +0,0 @@
# 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.

View File

@ -1,103 +0,0 @@
# 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
import cspages.accounts.accountspage as accountspage
import cspages.accounts.userspage as userspage
# from cstests.smoketests import smokecfg as smokecfg
class TestCSAddUser(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())
# navigate to Accounts page
self.dashboardpage.navigate_to('accounts')
# make sure we are on Accounts page
activeitem = self.dashboardpage.get_active_item()
if activeitem.find('accounts') < 0:
self.assertRaises(ValueError, self.dashboardpage.get_active_item(), activeitem)
# now we are at Accounts page
self.accountspage = accountspage.AccountsPage(self.browser.get_browser())
self.accountspage.select_account(username = smokecfg['account']['username'],
domain = smokecfg['account']['domain'],
type = smokecfg['account']['type'],
)
# now we are at users page
self.userspage = userspage.UsersPage(self.browser.get_browser())
self.userspage.add_user(username = smokecfg['new user']['username'],
password = smokecfg['new user']['password'],
email = smokecfg['new user']['email'],
firstname = smokecfg['new user']['firstname'],
lastname = smokecfg['new user']['lastname'],
timezone = smokecfg['new user']['timezone'],
)
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()

View File

@ -1,96 +0,0 @@
# 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
import cspages.accounts.accountspage as accountspage
# from cstests.smoketests import smokecfg as smokecfg
class TestCSAddUserAccount(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())
# navigate to Accounts page
self.dashboardpage.navigate_to('accounts')
# make sure we are on Accounts page
activeitem = self.dashboardpage.get_active_item()
if activeitem.find('accounts') < 0:
self.assertRaises(ValueError, self.dashboardpage.get_active_item(), activeitem)
# now we are at Accounts page
self.accountspage = accountspage.AccountsPage(self.browser.get_browser())
self.accountspage.add_account(username = smokecfg['new user account']['username'],
password = smokecfg['new user account']['password'],
email = smokecfg['new user account']['email'],
firstname = smokecfg['new user account']['firstname'],
lastname = smokecfg['new user account']['lastname'],
domain = smokecfg['new user account']['domain'],
type = smokecfg['new user account']['type'],
timezone = smokecfg['new user account']['timezone'],
)
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()

View File

@ -1,100 +0,0 @@
# 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
import cspages.accounts.accountspage as accountspage
import cspages.accounts.userspage as userspage
# from cstests.smoketests import smokecfg as smokecfg
class TestCSDeleteUser(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())
# navigate to Accounts page
self.dashboardpage.navigate_to('accounts')
# make sure we are on Accounts page
activeitem = self.dashboardpage.get_active_item()
if activeitem.find('accounts') < 0:
self.assertRaises(ValueError, self.dashboardpage.get_active_item(), activeitem)
# now we are at Accounts page
self.accountspage = accountspage.AccountsPage(self.browser.get_browser())
self.accountspage.select_account(username = smokecfg['account']['username'],
domain = smokecfg['account']['domain'],
type = smokecfg['account']['type'],
)
# now we are at users page
self.userspage = userspage.UsersPage(self.browser.get_browser())
self.userspage.delete_user(username = smokecfg['new user']['username'],
firstname = smokecfg['new user']['firstname'],
lastname = smokecfg['new user']['lastname'],
)
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()

View File

@ -1,91 +0,0 @@
# 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
import cspages.accounts.accountspage as accountspage
# from cstests.smoketests import smokecfg as smokecfg
class TestCSDeleteAccount(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())
# navigate to Accounts page
self.dashboardpage.navigate_to('accounts')
# make sure we are on Accounts page
activeitem = self.dashboardpage.get_active_item()
if activeitem.find('accounts') < 0:
self.assertRaises(ValueError, self.dashboardpage.get_active_item(), activeitem)
# now we are at Accounts page
self.accountspage = accountspage.AccountsPage(self.browser.get_browser())
self.accountspage.delete_account(username = smokecfg['new user account']['username'],
domain = smokecfg['new user account']['domain'],
type = smokecfg['new user account']['type'],
)
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()

View File

@ -1,69 +0,0 @@
# 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()

View File

@ -1,61 +0,0 @@
# 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 cspages.login.loginpage as loginpage
import common.shared as shared
from cstests.smoketests.smokecfg import smokecfg
# from cstests.smoketests import smokecfg as smokecfg
class TestCSLoginLogout(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['new user account']['username'])
self.loginpage.set_password(smokecfg['new user account']['password'])
self.loginpage.login()
time.sleep(5)
self.loginpage.logout(directly_logout = True)
shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login', waittime = 300)
if __name__ == '__main__':
unittest.main()

View File

@ -1,190 +0,0 @@
# 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 cspages.login.loginpage as loginpage
import common.shared as shared
from cstests.smoketests.smokecfg import smokecfg
# from cstests.smoketests import smokecfg as smokecfg
class TestCSLoginLogout(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.get_browser(), 'id', 'navigation', waittime = 300)
time.sleep(5)
self.loginpage.logout(directly_logout = True)
shared.Shared.wait_for_element(self.browser.browser, 'class_name', 'login', waittime = 300)
def test_failure_1(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['badusername'])
self.loginpage.set_password(smokecfg['password'])
self.loginpage.login(expect_fail = True)
def test_failure_2(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['badpassword'])
self.loginpage.login(expect_fail = True)
def test_failure_3(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['badusername'])
self.loginpage.set_password(smokecfg['badpassword'])
self.loginpage.login(expect_fail = True)
def test_failure_4(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['sqlinjection_1'])
self.loginpage.set_password(smokecfg['password'])
self.loginpage.login(expect_fail = True)
def test_failure_5(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['sqlinjection_2'])
self.loginpage.set_password(smokecfg['password'])
self.loginpage.login(expect_fail = True)
def test_failure_6(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['sqlinjection_3'])
self.loginpage.set_password(smokecfg['password'])
self.loginpage.login(expect_fail = True)
def test_failure_7(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['sqlinjection_4'])
self.loginpage.set_password(smokecfg['password'])
self.loginpage.login(expect_fail = True)
def test_failure_8(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['sqlinjection_5'])
self.loginpage.set_password(smokecfg['password'])
self.loginpage.login(expect_fail = True)
if __name__ == '__main__':
unittest.main()

View File

@ -1,79 +0,0 @@
# 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()

View File

@ -1,62 +0,0 @@
# 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': '2000, 1500',
'cssite': 'http://127.0.0.1:8080/client/',
# 'cssite': 'http://192.168.1.31:8080/client/',
'username': 'admin',
'password': 'password',
'badusername': 'badname',
'badpassword': 'badpassword',
'sqlinjection_1': '\' or 1=1 --\'',
'sqlinjection_2': '\' union select 1, badusername, badpassword, 1--\'',
'sqlinjection_3': '\' union select @@version,1,1,1--\'',
'sqlinjection_4': '\'; drop table user--\'',
'sqlinjection_5': '\'OR\' \'=\'',
'language': 'English',
# add a new user account
'new user account':{'username': 'JohnD',
'password': 'password',
'email': 'johndoe@aol.com',
'firstname': 'John',
'lastname': 'Doe',
'domain': 'ROOT',
'type': 'User', # either 'User' or 'Admin'
'timezone': 'US/Eastern [Eastern Standard Time]',
},
# add a new user under JohnD
'account': {'username': 'JohnD',
'domain': 'ROOT',
'type': 'User',
},
# add a new user
'new user': {'username': 'JaneD',
'password': 'password',
'email': 'janedoe@aol.com',
'firstname': 'Jane',
'lastname': 'Doe',
'timezone': 'US/Eastern [Eastern Standard Time]',
},
}

View File

@ -1,222 +0,0 @@
# 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.
'''
Variable Names are as follows
Logical Page Descriptor_____What Element Represents and/or where it is_____LocatorType
For Example ::
instances_xpath = "//div[@id='navigation']/ul/li[2]/span[2]"
Means this is:: xpath link for Instances which is present on Dashboard.
Any test cases that requires to go into Instances from Dashboard can use this variable now.
This may not be intuitive as you go deep into the tree.
for example
stopinstanceforce_id
The best way to know what this represents is to track by variable name
Under Instances / any instance is click on any instance (applies to any instance) / stop instance has a force stop check box when you click.
This link represents that.
Steps below do not have global locators.
PF rule steps including and after filling port numbers. (Refer to vmLifeAndNetwork.py / def test_PF)
FW rule steps including and after filling port numbers. (Refer to vmLifeAndNetwork.py / def test_PF)
ADD Disk Offering page has Names, description, storage type etc etc
ADD Compute Offering page has Names, description, CPU Cores, CPU clocks type etc etc
Create Acc, Delete Acc, Login and Logout are for test flow and are not test cases. They do not have global Locators.
Such and many more data entry points that appear only once and hence we do not need glonal names for them. They are hard coded as and when needed in the scripts.
'''
################################################################################################################################################################################################
## Links on the Main UI page (Dash board). Listed in the order they appear on screen
dashboard_xpath = "//div[@id='navigation']/ul/li"
instances_xpath = "//div[@id='navigation']/ul/li[2]/span[2]" # Link for Instance and following as self explanatory
storage_xpath = "//div[@id='navigation']/ul/li[3]/span[2]"
network_xpath = "//div[@id='navigation']/ul/li[4]/span[2]"
templates_xpath = "//div[@id='navigation']/ul/li[5]/span[2]"
events_xpath = "//div[@id='navigation']/ul/li[6]/span[2]"
projects_xpath = "//div[@id='navigation']/ul/li[7]/span[2]"
accounts_xpath = "//div[@id='navigation']/ul/li[8]/span[2]"
domains_xpath = "//div[@id='navigation']/ul/li[9]/span[2]"
infrastructure_xpath = "//div[@id='navigation']/ul/li[10]/span[2]"
globalSettings_xpath = "//div[@id='navigation']/ul/li[11]/span[2]"
serviceOfferings_xpath = "//div[@id='navigation']/ul/li[12]/span[2]"
################################################################################################################################################################################################
## Instances Page
## Instances Main page
# Add Instance Button on top right corner of Instances page
add_instance_xpath = "//div[2]/div/div[2]/div/div[2]/span"
# Add Instance Wizard next button
add_instance_next_xpath = "//div[4]/div[2]/div[3]/div[3]/span"
# Table that lists all VM's under Instances page; General usage is to traverse through this table and search for the VM we are interested in.
instances_table_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div[2]/table/tbody/tr/td/span"
# Click any instance and following are available
# Click ok on confirmation pop-up box for most actions listed below
actionconfirm_xpath = ("//button[@type='button']")
# status of VM running. Click on VM > 3rd row in table
state_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div[2]/div[2]/div/div/div[2]/div/table/tbody/tr[3]/td[2]/span"
# Stop instance icon
stopinstance_css = "a[alt=\"Stop Instance\"] > span.icon"
# stop instance forcefully check box available after stop instance is executed in separate pop up
stopinstanceforce_id = ("force_stop")
# start instance icon
startinstance_css = "a[alt=\"Start Instance\"] > span.icon"
yesconfirmation_xapth = "(//button[@type='button'])[2]"
# Destroy instance icon
destroyinstance_css = "a[alt=\"Destroy Instance\"] > span.icon"
#Restore Instance icon
restoreinstance_css = "a[alt=\"Restore Instance\"] > span.icon"
# Reboot instance
rebootinstance_css = "a[alt=\"Reboot Instance\"] > span.icon"
################################################################################################################################################################################################
## Network Page
# Table that lists all Networks under Network page; General usage is to traverse through this table and search for the network we are interested in.
network_networktable_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div[3]/div[2]/div/div[2]/table/tbody/tr/td/span"
# View IP addresses button on each network page
viewIp_css="div.view-all > a > span"
# Acquire a new ip
acquireIP_xpath="//div[2]/div/div/div[2]/span"
# List of IP's within a netork table
network_iptables_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div[3]/div[2]/div/div[2]/table/tbody/tr/td/span"
# Configuration tab for each IP
ipConfiguration_text="Configuration"
# PF under configuration for each IP
ip_PF = "li.portForwarding > div.view-details"
################################################################################################################################################################################################
## Servivce Offering Page
# Selects Compute offering from drop down menu
Offering_compute_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[1]"
# Selects System offering from drop down menu
Offering_system_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[2]"
# Selects Disk offering from drop down menu
Offering_disk_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[3]"
# Selects Network offering from drop down menu
Offering_network_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[4]"
# Add Offering
Offering_add_xpath ="//div[3]/span"
# Points to tbale that lists Offerings
Offering_table_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div[2]/table/tbody/tr/td/span"
# Edit Button
Offering_edit_css = "a[alt=\"Edit\"] > span.icon"
# Edit name box
Offering_editname_name = "name"
# Edit description box
Offering_editdescription_name = "displaytext"
# Edit finished click ok
Offering_editdone_css="div.button.done"
# delete offering button for Disk only
Offering_delete_css = "a[alt=\"Delete Disk Offering\"] > span.icon"
# delete offering button for Compute only
Offering_deletecompute_css = "a[alt=\"Delete Service Offering\"] > span.icon"
################################################################################################################################################################################################
#### Templates Page
# Selects Templates from drop down
template_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[1]"
# Selects ISO from drop down
iso_xpath = "/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div/div/div/select/option[2]"
# Add Template
AddTemplate_xpath = "//div[3]/span"
# Points to table where all templates are
template_table_xpath ="/html/body/div/div/div[2]/div[2]/div[2]/div/div[2]/div[2]/table/tbody/tr/td/span"
# Edit Template Button
template_edit_css = "a[alt=\"Edit\"] > span.icon"
# Edit finished click OK
template_editdone_css = "div.button.done"
# Delete Template button
template_delete_css = "a[alt=\"Delete Template\"] > span.icon"
################################################################################################################################################################################################
## Login Page
# Username box
login_username_css = "body.login > div.login > form > div.fields > div.field.username > input[name=\"username\"]" # Login>Username TextBox
# Password Box
login_password_css = "body.login > div.login > form > div.fields > div.field.password > input[name=\"password\"]" # LoginPassword TextBox
# Click ok to login
login_submit_css = "body.login > div.login > form > div.fields > input[type=\"submit\"]" # Login>Login Button (Submit button)

View File

@ -1,46 +0,0 @@
# 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.
'''
This will help pass webdriver (Browser instance) across our test cases.
'''
from selenium import webdriver
import sys
DRIVER = None
MS_ip = None
def getOrCreateWebdriver():
global DRIVER
DRIVER = DRIVER or webdriver.PhantomJS('phantomjs') # phantomjs executable must be in PATH.
return DRIVER
def getMSip():
global MS_ip
if len(sys.argv) >= 3:
sys.exit("Only One argument is required .. Enter your Management Server IP")
if len(sys.argv) == 1:
sys.exit("Atleast One argument is required .. Enter your Management Server IP")
for arg in sys.argv[1:]:
MS_ip = arg
return MS_ip

View File

@ -1,254 +0,0 @@
# 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 sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/'+'../lib'))
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time
import Global_Locators
import initialize
class login(unittest.TestCase):
def setUp(self):
MS_URL = initialize.getMSip()
self.driver = initialize.getOrCreateWebdriver()
self.base_url = "http://"+ MS_URL +":8080/" # Your management Server IP goes here
self.verificationErrors = []
def test_login(self):
# Here we will clear the test box for Username and Password and fill them with actual login data.
# After that we will click Login (Submit button)
driver = self.driver
driver.maximize_window()
driver.get(self.base_url + "client/")
driver.find_element_by_css_selector(Global_Locators.login_username_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_username_css).send_keys("admin")
driver.find_element_by_css_selector(Global_Locators.login_password_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_password_css).send_keys("password")
driver.find_element_by_css_selector(Global_Locators.login_submit_css).click()
time.sleep(5)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
################################################################################################################################################
class logout(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.driver.implicitly_wait(100)
self.verificationErrors = []
def test_logout(self):
# Here we will clear the test box for Username and Password and fill them with actual login data.
# After that we will click Login (Submit button)
driver = self.driver
driver.find_element_by_xpath("//div[@id='navigation']/ul/li").click()
driver.find_element_by_css_selector("div.icon.options").click()
driver.find_element_by_link_text("Logout").click()
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
################################################################################################################################################
class login_test(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_logintest(self):
# Here we will clear the test box for Username and Password and fill them with actual login data.
# After that we will click Login (Submit button)
driver = self.driver
driver.find_element_by_css_selector(Global_Locators.login_username_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_username_css).send_keys("test")
driver.find_element_by_css_selector(Global_Locators.login_password_css).clear()
driver.find_element_by_css_selector(Global_Locators.login_password_css).send_keys("password")
driver.find_element_by_css_selector(Global_Locators.login_submit_css).click()
time.sleep(5)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
################################################################################################################################################
class createAcc(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_createacc(self):
driver = self.driver
self.driver.implicitly_wait(100)
driver.find_element_by_xpath("//div[@id='navigation']/ul/li[8]/span[2]").click()
driver.find_element_by_xpath("//div[3]/span").click()
driver.find_element_by_id("label_username").clear()
driver.find_element_by_id("label_username").send_keys("test")
driver.find_element_by_id("password").clear()
driver.find_element_by_id("password").send_keys("password")
driver.find_element_by_id("label_confirm_password").clear()
driver.find_element_by_id("label_confirm_password").send_keys("password")
driver.find_element_by_id("label_email").clear()
driver.find_element_by_id("label_email").send_keys("test@citrix.com")
driver.find_element_by_id("label_first_name").clear()
driver.find_element_by_id("label_first_name").send_keys("test")
driver.find_element_by_id("label_last_name").clear()
driver.find_element_by_id("label_last_name").send_keys("test")
driver.find_element_by_id("label_domain").click()
Select(driver.find_element_by_id("label_type")).select_by_visible_text("Admin")
Select(driver.find_element_by_id("label_timezone")).select_by_visible_text("[UTC-08:00] Pacific Standard Time")
driver.find_element_by_xpath("//button[@type='button']").click()
# Go to Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(30)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
################################################################################################################################################
class tearAcc(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_tearacc(self):
driver = self.driver
driver.find_element_by_css_selector("li.navigation-item.accounts").click()
driver.find_element_by_css_selector("tr.odd > td.name.first").click()
driver.find_element_by_css_selector("a[alt=\"Delete account\"] > span.icon").click()
driver.find_element_by_xpath("(//button[@type='button'])[2]").click()
# Go to Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(30)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.driver.quit()
self.assertEqual([], self.verificationErrors)
################################################################################################################################################

View File

@ -1,426 +0,0 @@
# 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 sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/'+'../lib'))
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time
import initialize
import Global_Locators
class Disk_offering_Add(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_diskadd(self):
driver = self.driver
self.driver.implicitly_wait(200)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
#Select Disk offering
driver.find_element_by_xpath(Global_Locators.Offering_disk_xpath).click()
# Add offering
driver.find_element_by_xpath(Global_Locators.Offering_add_xpath).click()
# Following have names.. so they do not have their global entries.
driver.find_element_by_name("name").clear()
driver.find_element_by_name("name").send_keys("Test Disk Name")
driver.find_element_by_name("description").clear()
driver.find_element_by_name("description").send_keys("Test Disk Description")
driver.find_element_by_name("disksize").clear()
driver.find_element_by_name("disksize").send_keys("1")
driver.find_element_by_xpath("//button[@type='button']").click()
time.sleep(20)
##Verification will be if this offering shows up into table and we can actually edit it.
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
class Disk_offering_Edit(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_diskedit(self):
driver = self.driver
self.driver.implicitly_wait(200)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
#Select Disk offering
driver.find_element_by_xpath(Global_Locators.Offering_disk_xpath).click()
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
for link in linkclass:
if link.text == "Test Disk Name":
link.click()
time.sleep(2)
# Click Edit
driver.find_element_by_css_selector(Global_Locators.Offering_edit_css).click()
#Change name
driver.find_element_by_name(Global_Locators.Offering_editname_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editname_name).send_keys("Test Name")
# Change Description
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).send_keys("Test Description")
#Click Done
driver.find_element_by_css_selector(Global_Locators.Offering_editdone_css).click()
time.sleep(10)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
# Now we will find this offering and delete it!!
class Disk_offering_Delete(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_diskdelete(self):
driver = self.driver
self.driver.implicitly_wait(200)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
#Select Disk offering
driver.find_element_by_xpath(Global_Locators.Offering_disk_xpath).click()
## Action part
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
for link in linkclass:
if link.text == "Test Name":
link.click()
time.sleep(2)
# Click Delete
driver.find_element_by_css_selector(Global_Locators.Offering_delete_css).click()
time.sleep(2)
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(20)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
class Compute_offering_Add(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_computeadd(self):
driver = self.driver
self.driver.implicitly_wait(200)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
#Select Compute offering
driver.find_element_by_xpath(Global_Locators.Offering_compute_xpath).click()
## Action part
# Add offering
driver.find_element_by_xpath(Global_Locators.Offering_add_xpath).click()
# Following do not have Global locators
driver.find_element_by_id("label_name").clear()
driver.find_element_by_id("label_name").send_keys("Test Compute Name")
driver.find_element_by_id("label_description").clear()
driver.find_element_by_id("label_description").send_keys("Test Compute Description")
driver.find_element_by_id("label_num_cpu_cores").clear()
driver.find_element_by_id("label_num_cpu_cores").send_keys("2")
driver.find_element_by_id("label_cpu_mhz").clear()
driver.find_element_by_id("label_cpu_mhz").send_keys("2000")
driver.find_element_by_id("label_memory_mb").clear()
driver.find_element_by_id("label_memory_mb").send_keys("2048")
driver.find_element_by_id("label_network_rate").clear()
driver.find_element_by_id("label_network_rate").send_keys("10")
driver.find_element_by_id("label_offer_ha").click()
driver.find_element_by_xpath("//button[@type='button']").click()
time.sleep(2)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(30)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
class Compute_offering_Edit(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_computeedit(self):
driver = self.driver
self.driver.implicitly_wait(200)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
## Action part
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
#Select Compute offering
driver.find_element_by_xpath(Global_Locators.Offering_compute_xpath).click()
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
for link in linkclass:
if link.text == "Test Compute Name":
link.click()
time.sleep(2)
# Click Edit
driver.find_element_by_css_selector(Global_Locators.Offering_edit_css).click()
#Change name
driver.find_element_by_name(Global_Locators.Offering_editname_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editname_name).send_keys("Test Name")
# Change Description
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).clear()
driver.find_element_by_name(Global_Locators.Offering_editdescription_name).send_keys("Test Description")
#Click Done
driver.find_element_by_css_selector(Global_Locators.Offering_editdone_css).click()
time.sleep(10)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
class Compute_offering_Delete(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_computedelete(self):
driver = self.driver
self.driver.implicitly_wait(200)
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Service Offerings
driver.find_element_by_xpath(Global_Locators.serviceOfferings_xpath).click()
#Select Compute offering
driver.find_element_by_xpath(Global_Locators.Offering_compute_xpath).click()
## Action part
# We will be searching for our disk offering into the table
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.Offering_table_xpath) # This returns a list of all Offerings in table
for link in linkclass:
if link.text == "Test Name":
link.click()
time.sleep(2)
# Click Delete
driver.find_element_by_css_selector(Global_Locators.Offering_deletecompute_css).click()
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(20)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)

View File

@ -1,244 +0,0 @@
# 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.
'''
ISO PART YET TO BE ADDED:: remove this after adding it.
'''
import sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/'+'../lib'))
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time
import initialize
import Global_Locators
class Template_Add(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_templateadd(self):
driver = self.driver
## Action part
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Templates
driver.find_element_by_xpath(Global_Locators.templates_xpath).click()
#Select Template from drop down list
driver.find_element_by_xpath(Global_Locators.template_xpath).click()
# Add Template
driver.find_element_by_xpath(Global_Locators.AddTemplate_xpath).click()
# Following have names.. so they do not have their global entries.
driver.find_element_by_id("label_name").clear()
driver.find_element_by_id("label_name").send_keys("Test Template Ubuntu")
driver.find_element_by_id("label_description").clear()
driver.find_element_by_id("label_description").send_keys("Ubuntu 10.04")
driver.find_element_by_id("URL").clear()
driver.find_element_by_id("URL").send_keys("http://nfs1.lab.vmops.com/templates/Ubuntu/Ubuntuu-10-04-64bit-server.vhd")
Select(driver.find_element_by_id("label_os_type")).select_by_visible_text("Ubuntu 10.04 (64-bit)")
driver.find_element_by_id("label_public").click()
driver.find_element_by_id("label_featured").click()
driver.find_element_by_xpath("//button[@type='button']").click()
time.sleep(2)
# Go to Dash Board
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(600)
##Verification will be if this offering shows up into table and we can actually edit it.
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
class Template_Edit(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_templateedit(self):
driver = self.driver
## Action part
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Templates
driver.find_element_by_xpath(Global_Locators.templates_xpath).click()
#Select Template from drop down list
driver.find_element_by_xpath(Global_Locators.template_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.template_table_xpath) # This returns a list
for link in linkclass:
if link.text == "Test Template Ubuntu": # We will search for our VM in this table
link.click()
time.sleep(2)
# Change name
driver.find_element_by_name("name").clear()
driver.find_element_by_name("name").send_keys("Test template")
# Change Description
driver.find_element_by_name("displaytext").clear()
driver.find_element_by_name("displaytext").send_keys("ubuntu")
driver.find_element_by_css_selector(Global_Locators.template_editdone_css).click()
time.sleep(2)
#Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(10)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
# Now we will find this offering and delete it!!
class Template_Delete(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_templatedelete(self):
driver = self.driver
## Action part
#Make sure you are on Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
# Go to Templates
driver.find_element_by_xpath(Global_Locators.templates_xpath).click()
#Select Template from drop down list
driver.find_element_by_xpath(Global_Locators.template_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.template_table_xpath) # This returns a list
for link in linkclass:
if link.text == "Test Template": # We will search for our VM in this table
link.click()
time.sleep(2)
driver.find_element_by_css_selector(Gloabl_Locators.template_delete_css).click()
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(2)
#Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(20)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)

View File

@ -1,613 +0,0 @@
# 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 sys, os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/'+'../lib'))
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time
import initialize
import Global_Locators
class deployVM(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_deployvm(self):
## Action Part
# VM will be named Auto-VM and this VM will be used in all subsequent tests.
# Deploy an Instance named Auto-VM Default CentOS no GUI Template
driver = self.driver
self.driver.implicitly_wait(30)
driver.refresh() ## Most Important step. Failure to do this will change XPATH location and Scripts will fail.
# Click on Instances link
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
# Click on add Instance on Instances page
driver.find_element_by_xpath(Global_Locators.add_instance_xpath).click()
# Following select template action will fire automatically... ignore it. And leave following commented.
# driver.find_element_by_xpath("(//input[@name='select-template'])[3]").click()
#Click on Next button on Instances Wizard.
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
# Nothing to do here as we will be using all default settings. (Default CentOS no GUI template should be highlighted here. Click Next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
# Nothing to do here. Medium Instance compute offering should be selected here. Click Next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
# Nothing to do here. Data Disk Offering : No Thanks!!. Click Next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
# Since this is our first instance; we must provide a network name. We will use Test-Network as out network name.
driver.find_element_by_xpath("(//input[@name='new-network-name'])[2]").click()
driver.find_element_by_xpath("(//input[@name='new-network-name'])[2]").clear()
driver.find_element_by_xpath("(//input[@name='new-network-name'])[2]").send_keys("Test-Network")
#Click next
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
# Give our VM a name here. Use Auto-VM as name
driver.find_element_by_xpath("(//input[@name='displayname'])[2]").click()
driver.find_element_by_xpath("(//input[@name='displayname'])[2]").clear()
driver.find_element_by_xpath("(//input[@name='displayname'])[2]").send_keys("Auto-VM")
# All data filled. Click Launch VM. (It has the same xpath as Next button. So we will use Next Variable here.
driver.find_element_by_xpath(Global_Locators.add_instance_next_xpath).click()
print '\n' + '\n' + "VM Deployment is complete... wait for 5 mins to check deployment status" + '\n' + '\n'
## Verification Part
## Now we must wait for some random time (Educated guess based on experience) and check if VM has been deployed and if it is in running state.
## Should take about 4 min to deploy VM.. but we will wait 5 mins and check the status , we will do this twice. So total 2 check within 10 mins with first check occuring at 5th min.
driver.refresh() # Refresh UI Page; This polls latest status.
# Click on Instances link
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
count = 1
while (count > 0):
time.sleep(300)
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
print "found VM in table .. checking status..." + '\n' + '\n'
link.click()
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
if status == "Running" :
print "VM is in running state... continuing with other tests."+ '\n' + '\n'
break
else:
print "Need to check one more time after 5 mins"
continue
count = count - 1
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
################################################################################################################################################################################################
class destroyVM(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_destroyvm(self):
driver = self.driver
self.driver.implicitly_wait(100)
## Action part
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
time.sleep(2)
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
# Click on Destroy Instance button and confirm
time.sleep(2)
driver.find_element_by_css_selector(Global_Locators.destroyinstance_css).click()
time.sleep(2)
# Click ok on confirmation
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(2)
# Go to Dashboard
# driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
driver.refresh()
## Verification part
time.sleep(60)
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
time.sleep(2)
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
if status == "Destroyed" :
print "VM is Destroyed...."+ '\n' + '\n'
else:
print "Something went wrong"
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
################################################################################################################################################################################################
class rebootVM(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_rebootvm(self):
driver = self.driver
self.driver.implicitly_wait(30)
print "Verify this test manually for now"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vmLifeAndNetwork.Server_Ip, username='root', password='password')
print '\n' + '\n' + "Before Reboot ...Executing command date ... " + '\n' + '\n'
stdin, stdout, stderr = ssh.exec_command('date')
print stdout.readlines()
print '\n' + '\n' + "Before Reboot ...Executing command last reboot | head -1 ..." + '\n' + '\n'
stdin, stdout, stderr = ssh.exec_command('last reboot | head -1')
print '\n' + '\n' + "Before Reboot ...Executing command uptime..." + '\n' + '\n'
stdin, stdout, stderr = ssh.exec_command('uptime')
print stdout.readlines()
ssh.close()
driver.refresh()
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
count = 1
while (count > 0):
#time.sleep(300)
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
print "found VM in table .. Rebooting now..." + '\n' + '\n'
link.click()
driver.find_element_by_css_selector(Global_Locators.rebootinstance_css).click()
driver.find_element_by_xpath(Global_Locators.actionconfirm_xpath).click()
# Sleep for 5 mins to ensure system gets rebooted.
time.sleep(300)
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(vmLifeAndNetwork.Server_Ip, username='root', password='password')
print '\n' + '\n' + "After Reboot ...Executing command date ... " + '\n' + '\n'
stdin, stdout, stderr = ssh.exec_command('date')
print stdout.readlines()
print '\n' + '\n' + "After Reboot ...Executing command last reboot | head -1 ..." + '\n' + '\n'
stdin, stdout, stderr = ssh.exec_command('last reboot | head -1')
print '\n' + '\n' + "After Reboot ...Executing command uptime..." + '\n' + '\n'
stdin, stdout, stderr = ssh.exec_command('uptime')
print stdout.readlines()
ssh.close()
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
#########################################################################################################################################################
class restoreVM(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_restorevm(self):
driver = self.driver
self.driver.implicitly_wait(100)
## Action part
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
# Click on Destroy Instance button and confirm
driver.find_element_by_css_selector(Global_Locators.restoreinstance_css).click()
# Click ok on confirmation
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
# Go to Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
## Verification part
time.sleep(60)
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
if status == "Stopped" :
print "VM is Restored. but in stopped state.. will start now."+ '\n' + '\n'
else:
print "Something went wrong"
#VM will be in stop state so we must start it now
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
# Click on Start Instance.
driver.find_element_by_css_selector(Global_Locators.startinstance_css).click()
time.sleep(2)
# Dismiss confirmation by clicking Yes
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(2)
# Go to Dashboard
driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
time.sleep(2)
print "VM is Started."+ '\n' + '\n'
# status = None
time.sleep(60)
# Dismiss the Start Instance information box.
driver.find_element_by_xpath(Global_Locators.actionconfirm_xpath).click()
time.sleep(2)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
#########################################################################################################################################################
class startVM(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_startvm(self):
driver = self.driver
self.driver.implicitly_wait(100)
## Action part
#driver.refresh() ## Most Important step. Failure to do this will change XPATH location and Scripts will fail.
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
print "found VM in table .. checking status..." + '\n' + '\n'
link.click()
# Click on Start Instance.
driver.find_element_by_css_selector(Global_Locators.startinstance_css).click()
time.sleep(2)
# Dismiss confirmation by clicking Yes
driver.find_element_by_xpath(Global_Locators.yesconfirmation_xapth).click()
time.sleep(2)
# Go to Dashboard
#driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
driver.refresh()
## Verification part
# status = None
time.sleep(60)
# Dismiss the Start Instance information box.
driver.find_element_by_xpath(Global_Locators.actionconfirm_xpath).click()
time.sleep(2)
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
time.sleep(2)
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
if status == "Running" :
print "VM is in Running state..."+ '\n' + '\n'
else:
print "Something went wrong"
# Go to Dashboard
driver.refresh()
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
#########################################################################################################################################################
class stopVM(unittest.TestCase):
def setUp(self):
self.driver = initialize.getOrCreateWebdriver()
self.verificationErrors = []
def test_stopvm(self):
driver = self.driver
self.driver.implicitly_wait(100)
## Action part
driver.refresh() ## Important step.
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
print "found VM in table .. checking status..." + '\n' + '\n'
link.click()
# HWe are on our VM information page.
driver.find_element_by_css_selector(Global_Locators.stopinstance_css).click()
time.sleep(2)
# a Pop up must appear; below we will check the force stop check box and then we will click ok.
driver.find_element_by_id(Global_Locators.stopinstanceforce_id).click()
driver.find_element_by_xpath(Global_Locators.actionconfirm_xpath).click()
time.sleep(2)
# Go to Dahsboard
#driver.find_element_by_xpath(Global_Locators.dashboard_xpath).click()
driver.refresh()
# Should take less than min to stop the instance. We will check twice at interval of 45 seconds o be safe.
## Verification part
time.sleep(60)
# Click on Instances link and find our instance
driver.find_element_by_xpath(Global_Locators.instances_xpath).click()
linkclass = None
linkclass = driver.find_elements_by_xpath(Global_Locators.instances_table_xpath) # This returns a list of all VM names in tables
for link in linkclass:
if link.text == "Auto-VM": # We will search for our VM in this table
link.click()
status = driver.find_element_by_xpath(Global_Locators.state_xpath).text ## get the status of our VM
if status == "Stopped" :
print "VM is in Stopped state...."+ '\n' + '\n'
else:
print "Something went wrong"
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.assertEqual([], self.verificationErrors)
#########################################################################################################################################################

View File

@ -1,142 +0,0 @@
# 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 HTMLTestRunner
import xmlrunner
global DRIVER
global MS_ip
# Import test cases
##################################
from Login_and_Accounts import *
from Service_Offering import *
from TemplatesAndISO import *
from VM_lifeCycle import *
###################################
# Following are BVT Tests
# serialize the test cases
suite = unittest.TestSuite() # setup new test suite
####################################################################################################
# Following logs admin user in and creates test account then logs admin user out and logs in as test to run tests.
# You should leave this as is for all the tests.
suite.addTest(unittest.makeSuite(login)) #Login Admin
time.sleep(5)
suite.addTest(unittest.makeSuite(createAcc)) # Create an Account test. We will use test account for all our tests
time.sleep(5)
suite.addTest(unittest.makeSuite(logout)) #Logout Admin
time.sleep(5)
suite.addTest(unittest.makeSuite(login_test)) # Login Test
####################################################################################################
time.sleep(5)
suite.addTest(unittest.makeSuite(Disk_offering_Add))
time.sleep(5)
suite.addTest(unittest.makeSuite(Disk_offering_Edit))
time.sleep(5)
suite.addTest(unittest.makeSuite(Disk_offering_Delete))
time.sleep(5)
suite.addTest(unittest.makeSuite(Compute_offering_Add))
time.sleep(5)
suite.addTest(unittest.makeSuite(Compute_offering_Edit))
time.sleep(5)
suite.addTest(unittest.makeSuite(Compute_offering_Delete))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(deployVM))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(stopVM))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(startVM))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(destroyVM))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(restoreVM))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(Template_Add))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(Template_Edit))
# time.sleep(5)
# suite.addTest(unittest.makeSuite(Template_Delete))
####################################################################################################
# Following logs test user out and logs back in as Admin and tears down the test account.
# You should leave this as is for all the tests.
suite.addTest(unittest.makeSuite(logout)) #Logout test
time.sleep(5)
suite.addTest(unittest.makeSuite(login)) #Login Admin
time.sleep(5)
suite.addTest(unittest.makeSuite(tearAcc)) # Delete Account test
####################################################################################################
# If XML reports compatible with junit's XML output are desired then leave folowing code as is.
# If HTML reports are desired follow instructions
#Comment following line for HTML and uncomment for XML
runner = xmlrunner.XMLTestRunner(output='test-reports')
#Comment following line for XML and uncomment for HTML
#runner = HTMLTestRunner.HTMLTestRunner()
#header is required for displaying the website
#Comment following line for XML and uncomment for HTML
#print "content-type: text/html\n"
# Leave following as is for either XML or HTML
runner.run(suite)

View File

@ -88,7 +88,6 @@ COPY test/conf /root/test/conf
COPY test/metadata /root/test/metadata
COPY test/pom.xml /root/test/pom.xml
COPY test/scripts /root/test/scripts
COPY test/selenium /root/test/selenium
COPY test/systemvm /root/test/systemvm
COPY test/target /root/test/target
COPY tools/pom.xml /root/tools/pom.xml