Merge "Added new method 'Check_element_on_page'"
This commit is contained in:
@@ -4,6 +4,7 @@ import ConfigParser
|
||||
from selenium import webdriver
|
||||
import selenium.webdriver.common.by as by
|
||||
import config.config as cfg
|
||||
from selenium.common.exceptions import NoSuchElementException
|
||||
|
||||
from keystoneclient.v2_0 import client as ksclient
|
||||
from muranoclient.client import Client as mclient
|
||||
@@ -94,5 +95,9 @@ class UITestCase(testtools.TestCase):
|
||||
def select_from_list(self, list_name, value):
|
||||
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:
|
||||
self.driver.find_element(method, value)
|
||||
except NoSuchElementException:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -12,12 +12,16 @@ 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'))
|
||||
|
||||
def test_edit_environment(self):
|
||||
self.log_in()
|
||||
self.navigate_to_environments()
|
||||
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'))
|
||||
|
||||
def test_rename_windows_image(self):
|
||||
self.log_in()
|
||||
@@ -28,14 +32,3 @@ class UISanityTests(UITestCase):
|
||||
self.select_from_list('type', ' Windows Server 2012')
|
||||
mark = UITestCase.elements.get('button', 'ButtonSubmit')
|
||||
self.driver.find_element_by_xpath(mark).click()
|
||||
|
||||
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.select_from_list('image', 'ws-2012-std')
|
||||
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')
|
||||
self.driver.find_element_by_xpath(mark).click()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user