Add 'create demo service' dashboard test

Change-Id: I8acdaa98b1270d18143f56769287d237ea091756
This commit is contained in:
Sergey Murashov
2014-01-27 12:24:13 +04:00
parent 642a5ec3d1
commit 804eb6f3cb
6 changed files with 70 additions and 15 deletions

View File

@@ -11,11 +11,11 @@ from muranoclient.client import Client as mclient
class UITestCase(testtools.TestCase):
elements = ConfigParser.RawConfigParser()
elements.read('common.ini')
@classmethod
def setUpClass(cls):
super(UITestCase, cls).setUpClass()
keystone_client = ksclient.Client(username=cfg.common.user,
@@ -26,6 +26,13 @@ class UITestCase(testtools.TestCase):
cls.murano_client = mclient('1', endpoint=cfg.common.murano_url,
token=keystone_client.auth_token)
cls.demo_image = cfg.common.demo_image
cls.linux_image = cfg.common.linux_image
cls.windows_image = cfg.common.windows_image
cls.elements = ConfigParser.RawConfigParser()
cls.elements.read('common.ini')
def setUp(self):
super(UITestCase, self).setUp()
self.driver = webdriver.Firefox()
@@ -42,7 +49,7 @@ class UITestCase(testtools.TestCase):
def log_in(self):
self.find_clean_send(by.By.ID, 'id_username', cfg.common.user)
self.find_clean_send(by.By.ID, 'id_password', cfg.common.password)
sign_in = UITestCase.elements.get('button', 'ButtonSubmit')
sign_in = self.elements.get('button', 'ButtonSubmit')
self.driver.find_element_by_xpath(sign_in).click()
self.navigate_to_environments()
@@ -51,13 +58,14 @@ class UITestCase(testtools.TestCase):
self.driver.find_element(by=by_find, value=find_element).send_keys(send)
def confirm_deletion(self):
confirm_deletion = UITestCase.elements.get('button', 'ConfirmDeletion')
confirm_deletion = self.elements.get('button', 'ConfirmDeletion')
self.driver.find_element_by_xpath(confirm_deletion).click()
def create_environment(self, env_name):
self.driver.find_element_by_id('murano__action_CreateEnvironment').click()
self.driver.find_element_by_id(
'murano__action_CreateEnvironment').click()
self.find_clean_send(by.By.ID, 'id_name', env_name)
create = UITestCase.elements.get('button', 'InputSubmit')
create = self.elements.get('button', 'InputSubmit')
self.driver.find_element_by_xpath(create).click()
def delete_environment(self):
@@ -70,18 +78,18 @@ class UITestCase(testtools.TestCase):
self.click_on_more()
self.click_on_edit()
self.find_clean_send(by.By.ID, 'id_name', new_name)
save = UITestCase.elements.get('button', 'InputSubmit')
save = self.elements.get('button', 'InputSubmit')
self.driver.find_element_by_xpath(save).click()
def click_on_more(self):
more = UITestCase.elements.get('button', 'More')
more = self.elements.get('button', 'More')
self.driver.find_element_by_xpath(more).click()
def click_on_edit(self):
self.driver.find_element_by_link_text('Edit Environment').click()
def click_on_delete(self):
delete = UITestCase.elements.get('button', 'ButtonSubmit')
delete = self.elements.get('button', 'ButtonSubmit')
self.driver.find_element_by_xpath(delete).click()
def navigate_to_environments(self):
@@ -93,7 +101,9 @@ class UITestCase(testtools.TestCase):
self.driver.find_element_by_link_text('Images').click()
def select_from_list(self, list_name, value):
self.driver.find_element_by_xpath("//select[@name='%s']/option[text()='%s']" % (list_name, value)).click()
self.driver.find_element_by_xpath(
"//select[@name='%s']/option[text()='%s']" %
(list_name, value)).click()
def check_element_on_page(self, method, value):
try:
@@ -101,3 +111,19 @@ class UITestCase(testtools.TestCase):
except NoSuchElementException:
return False
return True
def create_demo_service(self, service_name):
self.driver.find_element_by_link_text('Services').click()
self.driver.find_element_by_id('services__action_CreateService').click()
self.select_from_list('service_choice-service', 'Demo Service')
Next = self.elements.get('button', 'Next')
self.driver.find_element_by_xpath(Next).click()
self.find_clean_send(by.By.ID, 'id_demoService-0-name', service_name)
Next = self.elements.get('button', 'Next2')
self.driver.find_element_by_xpath(Next).click()
self.select_from_list('demoService-1-osImage', self.demo_image)
Next = self.elements.get('button', 'Create')
self.driver.find_element_by_xpath(Next).click()

View File

@@ -3,4 +3,7 @@ ButtonSubmit=//button[@type='submit']
InputSubmit=//input[@type='submit']
ConfirmDeletion=.//*[@id='modal_wrapper']/div/div[3]/a[1]
More=/html/body/div/div[2]/div[3]/form/table/tbody/tr/td[4]/div/a[2]
Next=/html/body/div[3]/div/form/div[2]/button
Next2=/html/body/div[3]/div/form/div[2]/input[2]
Create=/html/body/div[3]/div/form/div[2]/input[2]

View File

@@ -21,7 +21,16 @@ CommonGroup = [
help='keystone url'),
cfg.StrOpt('murano_url',
default='http://127.0.0.1:8082',
help='murano url')
help='murano url'),
cfg.StrOpt('demo_image',
default='demo',
help='image for demo service'),
cfg.StrOpt('linux_image',
default='linux',
help='image for linux services'),
cfg.StrOpt('windows_image',
default='windows',
help='image for windows services')
]

View File

@@ -5,3 +5,6 @@ user = WebTestUser
password = swordfish
tenant = WebTestProject
keystone_url = http://127.0.0.1:5000/v2.0/
demo_image = demo_image
linux_image = linux_image
windows_image = windows_image

View File

@@ -12,6 +12,7 @@ class UISanityTests(UITestCase):
self.create_environment('test_create_del_env')
self.driver.find_element_by_link_text('test_create_del_env').click()
self.delete_environment()
self.assertFalse(self.check_element_on_page(by.By.LINK_TEXT,
'test_create_del_env'))
@@ -21,14 +22,27 @@ class UISanityTests(UITestCase):
self.create_environment('test_edit_env')
self.driver.find_element_by_link_text('test_edit_env')
self.edit_environment(new_name='edited_env')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT, 'edited_env'))
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'edited_env'))
def test_rename_windows_image(self):
self.log_in()
self.navigate_to_images()
self.driver.find_element_by_id('marked_images__action_mark_image').click()
self.driver.find_element_by_id(
'marked_images__action_mark_image').click()
self.select_from_list('image', 'ws-2012-std')
self.find_clean_send(by.By.ID, 'id_title', 'Windows Server 2012 Standard')
self.find_clean_send(by.By.ID, 'id_title',
'Windows Server 2012 Standard')
self.select_from_list('type', ' Windows Server 2012')
mark = UITestCase.elements.get('button', 'ButtonSubmit')
mark = self.elements.get('button', 'ButtonSubmit')
self.driver.find_element_by_xpath(mark).click()
def test_create_demo_service(self):
self.log_in()
self.navigate_to_environments()
self.create_environment('test')
self.create_demo_service('DemoService')
self.assertTrue(self.check_element_on_page(by.By.LINK_TEXT,
'DemoService'))

View File