Created
January 13, 2012 19:14
-
-
Save els-pnw/1608188 to your computer and use it in GitHub Desktop.
troubleshooting name not found exception.
This file contains 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
<div id="system_97" class="block tall" data-ajax_url="/headpin/systems/97/edit" style="width: 358px;"> | |
<div> | |
<div class="column_2"> | |
<div class="product"> | |
<div class="one-line-ellipsis" style="padding-top: 2px;"> newsystem2820 </div> | |
</div> | |
<div class="column_2"> Never checked in. </div> | |
</div> | |
<div> | |
<div class="arrow-right"></div> | |
</div> |
This file contains 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
#!/usr/bin/env python | |
... | |
class Systems(Base): | |
_systems_search_form_locator = (By.XPATH, "//form[@id='search_form']") | |
_systems_search_input_locator = (By.XPATH, "//input[@id='search']") | |
_systems_search_button_locator = (By.XPATH, "//button[@id='search_button']") | |
_systems_create_new_locator = (By.XPATH, "//a[@id='new']") | |
_systems_list_box_locator = (By.XPATH, "//div[@id='list']") | |
_systems_server_name_locator = (By.XPATH, "//div[@class='one-line-ellipsis']") | |
_new_systemname_field_locator = (By.XPATH, "//input[@id='name_field']") | |
_new_system_arch_select_locator = (By.XPATH, "//select[@id='arch_arch_id']") | |
_new_system_sockets_field_locator = (By.XPATH, "//input[@id='sockets_field']") | |
_new_system_virt_select_locator = (By.XPATH, "//input[@value='virtual']") | |
_new_system_physical_select_locator = (By.XPATH, "//input[@value='physical']") | |
## Need to add Environment elements here | |
_new_system_save_locator = (By.XPATH, "//input[@id='system_save']") | |
_facts_tab_locator = (By.XPATH, "//a[.='Facts']") | |
_details_tab_locator = (By.XPATH, "//a[.='Details']") | |
_software_tab_locator = (By.XPATH, "//a[.='Software']") | |
_subscriptions_tab_locator = (By.XPATH, "//a[.='Subscriptions']") | |
_system_details_name_locator = "" | |
_success_message = (By.XPATH, "//div[contains(@class,'jnotify-notification-message')]") | |
_system_list_locator = (By.CSS_SELECTOR, "div.block.tall") | |
def system(self, value): | |
for system in self.systems: | |
print system | |
if system.name == value: | |
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.XPATH, "//div[@class='one-line-ellipsis']") | |
def __init__(self, testsetup, element): | |
Page.__init__(self, testsetup) | |
self._root_element = element | |
@property | |
def name(self): | |
return self._root_element.find_element(*self._name_locator).text |
This file contains 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
#!/usr/bin/env python | |
import pytest | |
from unittestzero import Assert | |
from pages.home import Home | |
from pages.systems import Systems | |
import time | |
import sys | |
nondestructive = pytest.mark.nondestructive | |
destructive = pytest.mark.destructive | |
class TestSystems: | |
@nondestructive | |
def test_create_new_virt_system(self, mozwebqa): | |
home_page = Home(mozwebqa) | |
home_page.login() | |
Assert.true(home_page.header.is_user_logged_in) | |
home_page.tabs.click_tab("systems_tab") | |
Assert.true(home_page.is_the_current_page) | |
systems = Systems(mozwebqa) | |
new_system_name = systems.unique_system_name() | |
systems.create_new_virt_system(new_system_name) | |
Assert.true(systems.system(new_system_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
============================= test session starts ==============================
platform linux2 -- Python 2.7.1 -- pytest-2.1.3
collecting ... collected 1 items
tests/test_systems.py F
=================================== FAILURES ===================================
___________________ TestSystems.test_create_new_virt_system ____________________
self = <tests.test_systems.TestSystems instance at 0x1fd3950>
mozwebqa = <mozwebqa.mozwebqa.TestSetup instance at 0x1fdcb90>
tests/test_systems.py:32: AssertionError
------------------------------- Captured stdout --------------------------------
['newsystem41465']
[<pages.systems.Systems object at 0x1fdbc90>]
[u'newsystem41465', u'newsystem1015', u'newsystem1364', u'newsystem1648', u'newsystem1972', u'newsystem19907', u'newsystem22200', u'newsystem25472', u'newsystem2820', u'newsystem31362', u'newsystem34533', u'newsystem38110', u'newsystem39604', u'newsystem40151', u'newsystem41958', u'newsystem43378', u'newsystem43523', u'newsystem45583', u'newsystem4706', u'newsystem48514', u'newsystem51033', u'newsystem51161', u'newsystem51327', u'newsystem56143', u'newsystem58093', u'newsystem59016']
========================== 1 failed in 37.69 seconds ===========================
============================= test session starts ==============================
platform linux2 -- Python 2.7.1 -- pytest-2.1.3
collecting ... collected 1 items
tests/test_systems.py F
=================================== FAILURES ===================================
___________________ TestSystems.test_create_new_virt_system ____________________
self = <tests.test_systems.TestSystems instance at 0x1fd3950>
mozwebqa = <mozwebqa.mozwebqa.TestSetup instance at 0x1fdcb90>
tests/test_systems.py:32: AssertionError
------------------------------- Captured stdout --------------------------------
['newsystem41465']
[<pages.systems.Systems object at 0x1fdbc90>]
[u'newsystem41465', u'newsystem1015', u'newsystem1364', u'newsystem1648', u'newsystem1972', u'newsystem19907', u'newsystem22200', u'newsystem25472', u'newsystem2820', u'newsystem31362', u'newsystem34533', u'newsystem38110', u'newsystem39604', u'newsystem40151', u'newsystem41958', u'newsystem43378', u'newsystem43523', u'newsystem45583', u'newsystem4706', u'newsystem48514', u'newsystem51033', u'newsystem51161', u'newsystem51327', u'newsystem56143', u'newsystem58093', u'newsystem59016']
========================== 1 failed in 37.69 seconds ===========================