def test_signup(): browser.open('/') page = Page() assert page.offers_signup_link page.click_signup_link() page = Signup() assert page.offers_signup_form foo = page.signup_form foo.fill(dict(username='******', password='******')) foo.submit() assert not page.offers_signup_link
def test_home_loads(): browser.open('/') page = Page() assert 'Cockerel' in page.title assert page.offers_signup_link assert page.offers_login_link
class UserDetailsPage(Page): PATH = "/users/{0}" ROOT = {"method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="user-page"]')} def __init__(self, driver, nickname): Page.__init__(self, driver) self.open(nickname) @property def form(self): return UserDetailsSubscribeForm(self.driver)
def test_login(): browser.open('/') page = Page() assert page.offers_login_link page.click_login_link() page = Login() assert page.offers_login_form login = page.login_form login.fill(dict(username='******', password='******')) page.click_submit() assert not page.offers_login_form
class BoardPage(Page): PATH = "/board/{0}" ROOT = { "method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="board-page"]'), } def __init__(self, driver, board_id): Page.__init__(self, driver) self.open(board_id) @property def form(self): return BoardForm(self.driver)
class PinDetailsPage(Page): PATH = "/pin/{0}" ROOT = { "method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="viewpin-page"]'), } def __init__(self, driver, open=True, pin_id=""): Page.__init__(self, driver) if open: self.open(pin_id) @property def form(self): return PinForm(self.driver)
class GlobalSearchPage(Page): ROOT = { "method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="search-page"]'), } def __init__(self, driver, open=True): Page.__init__(self, driver) if open: self.open() @property def search_form(self): return HeaderSearchForm(self.driver) @property def result_form(self): return SearchResultsForm(self.driver)
class CreatePinPage(Page): PATH = "/create_pin" ROOT = { "method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="createpin-page"]'), } def __init__(self, driver): Page.__init__(self, driver) self.open() @property def form_list(self): return FindCreatePinForm(self.driver) @property def form_concrete(self): return ConcreteUserMessagesForm(self.driver)
class ChatPage(Page): PATH = "/dialog" ROOT = { "method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="dialogview-page"]'), } def __init__(self, driver): Page.__init__(self, driver) self.open() @property def form_list(self): return FindCompanyForm(self.driver) @property def form_concrete(self): return ConcreteUserMessagesForm(self.driver)
class EditPinPage(Page): PATH = "/pin_change/{0}" ROOT = { "method": By.XPATH, "key": Page.get_xpath_visible('//div[@id="pinediting-page"]'), } def __init__(self, driver, pin_id): Page.__init__(self, driver) self.open(pin_id) @property def form_list(self): return FindEditPinForm(self.driver) @property def form_concrete(self): return ConcreteUserMessagesForm(self.driver)
def __init__(self, driver, pin_id): Page.__init__(self, driver) self.open(pin_id)
def __init__(self, driver, board_id): Page.__init__(self, driver) self.open(board_id)
def __init__(self, driver, open=True): Page.__init__(self, driver) if open: self.open()
def __init__(self, driver): Page.__init__(self, driver) self.open()
def __init__(self, driver, nickname): Page.__init__(self, driver) self.open(nickname)
def __init__(self, driver, open=True, pin_id=""): Page.__init__(self, driver) if open: self.open(pin_id)