Created
January 16, 2012 16:31
-
-
Save els-pnw/1621652 to your computer and use it in GitHub Desktop.
Proposed change to systems.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_system_list_locator = (By.CSS_SELECTOR, "div.block.tall") | |
def create_new_virt_system(self, system_name): | |
''' Create a new system ''' | |
new_system_link_locator = self.selenium.find_element(*self._systems_create_new_locator) | |
ActionChains(self.selenium).move_to_element(new_system_link_locator).\ | |
click().perform() | |
system_name_locator = self.selenium.find_element(*self._new_systemname_field_locator) | |
system_name_locator.send_keys(system_name) | |
sockets_locator = self.selenium.find_element(*self._new_system_sockets_field_locator) | |
sockets_locator.send_keys(str(random.randint(0,32))) | |
virt_locator = self.selenium.find_element(*self._new_system_virt_select_locator) | |
ActionChains(self.selenium).move_to_element(virt_locator).\ | |
click().perform() | |
save_button_locator = self.selenium.find_element(*self._new_system_save_locator) | |
ActionChains(self.selenium).move_to_element(save_button_locator).\ | |
click().perform() | |
@property | |
def is_system_facts_tab_present(self): | |
return self.is_element_present(*self._facts_tab_locator) | |
@property | |
def is_system_details_tab_present(self): | |
return self.is_element_present(*self._details_tab_locator) | |
@property | |
def is_system_software_tab_present(self): | |
return self.is_element_present(*self._software_tab_locator) | |
@property | |
def is_system_subscriptions_tab_present(self): | |
return self.is_element_present(*self._subscriptions_tab_locator) | |
@property | |
def is_success_message_present(self): | |
return self.is_element_present(*self._success_message) | |
def is_system_details_name_present(self, name): | |
self._system_details_name_locator = (By.XPATH, "//div[text() = '" + name + "']") | |
return self.is_element_present(*self._system_details_name_locator) | |
def unique_system_name(self, name="newsystem"): | |
system_name = name + str(random.randint(0,100000)) | |
return system_name | |
def system(self, value): | |
for system in self.systems: | |
if value in system.name: | |
return system | |
raise Exception('System not found: %s' % value) | |
@property | |
def systems(self): | |
return [self.Systems(self.testsetup, element) for element in self.selenium.find_elements(*self._system_list_locator)] | |
class Systems(Page): | |
#_name_locator = (By.CLASS_NAME, 'product') | |
_name_locator = (By.CLASS_NAME, 'one-line-ellipsis') | |
#_name_locator = (By.XPATH, "//div[@class='one-line-ellipsis']") | |
def __init__(self, testsetup, element): | |
Page.__init__(self, testsetup) | |
self._root_element = element | |
@property | |
def name(self): | |
name_text = self._root_element.find_element(*self._name_locator).text | |
return name_text | |
def is_displayed(self): | |
return self.is_element_visible(*self._name_locator) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment