Created
April 25, 2012 22:26
-
-
Save els-pnw/2493988 to your computer and use it in GitHub Desktop.
program.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
self = <pages.home.Home object at 0x1be4190> | |
@property | |
def is_the_current_page(self): | |
> myProject = BaseProductFactory.get(self.project) | |
E TypeError: get() takes exactly 2 arguments (1 given) | |
pages/page.py:75: TypeError | |
======================================= 6 tests deselected by '-ktest_Verify_HomePage_Details' ======================================== | |
1 failed, 6 deselected in 3.33 seconds |
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
class BaseProductFactory(object): | |
''' | |
Factory for products | |
''' | |
@staticmethod | |
def get(self, project): | |
projectClass = None | |
if project == "sam": | |
projectClass = SamProduct() | |
if project == "headpin": | |
projectClass = HeadpinProduct() | |
if project == "katello": | |
projectClass = KatelloProduct() | |
return projectClass | |
class BaseProduct(object): | |
''' | |
Base class for all Products | |
''' | |
def __init__(self): | |
''' do nothing ''' | |
pass | |
class SamProduct(BaseProduct): | |
_page_title = "Subscription Asset Manager - Subscription Management" | |
class HeadpinProduct(BaseProduct): | |
_page_title = "Headpin - Open Source Subscription Management" | |
class KatelloProduct(BaseProduct): | |
_page_title = "Katello - Open Source Systems Management" | |
class Page(object): | |
''' | |
Base class for all Pages | |
''' | |
def __init__(self, testsetup): | |
''' | |
Constructor | |
''' | |
self.testsetup = testsetup | |
#if not os.environ.get("APP_SERVER"): | |
# raise EnvironmentNotSetException('APP_SERVER environment variable not set!') | |
#sys.exit(-1) | |
#testsetup.base_url = os.environ.get("APP_SERVER") | |
self.base_url = testsetup.base_url | |
self.selenium = testsetup.selenium | |
self.timeout = testsetup.timeout | |
self.project = testsetup.project | |
@property | |
def is_the_current_page(self): | |
myProject = BaseProductFactory.get(self.project) | |
if self._page_title: | |
WebDriverWait(self.selenium, 10).until(lambda s: self.selenium.title) | |
Assert.equal(self.selenium.title, self._page_title, | |
"Expected page title: %s. Actual page title: %s" % (self._page_title, self.selenium.title)) | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment