Skip to content

Instantly share code, notes, and snippets.

@djmunro
Created April 13, 2016 19:05
Show Gist options
  • Save djmunro/38b25e4c35d14be517e15e5c7eece16f to your computer and use it in GitHub Desktop.
Save djmunro/38b25e4c35d14be517e15e5c7eece16f to your computer and use it in GitHub Desktop.
from pageobjects.basepageobject import BasePageObject
from pageobjects.basepageelement import BasePageElement
class BrowseElement(BasePageElement):
def __init__(self, type="all", driver):
self.driver = driver
if type.lower() is "all":
self.all()
elif type.lower() is "presets":
self.presets()
def all(self):
self.driver.click(RadioScreen.Browse.Refresh)
return '@TODO'
def presets(self):
self.driver.click(RadioScreen.Browse.Presets)
return '@TODO'
def refresh(self):
self.driver.click(RadioScreen.Browse.Refresh)
return '@TODO'
class TuneElement(BasePageElement):
def __init__(self, type="all", driver):
self.driver = driver
def enter_station(self, station):
for num in station:
self.driver.click(RadioScreen.Tune.THENUMBER)
time.sleep(.5)
return '@TODO'
def tune_up(self):
self.driver.click(RadioScreen.Tune.Up)
def tune_down(self):
self.driver.click(RadioScreen.Tune.Down)
class RadioPageObject(BasePageObject):
def __init__(self, driver):
self.driver = driver
#self.assertTrue(self.driver.connected) #need to implment this
# Navigate to radio screen
try:
self.assertEqual("RadioScreen", self.driver.screen_name())
except AssertionError:
self.driver.click(RadioScreen)
self.driver.wait_for(RadioScreen, timeout=10)
self.assertEqual("RadioScreen", self.driver.current_screen())
self.browse = BrowseElement(self.driver)
self.tune = TuneElement(self.driver)
def tune(self):
return self.tune
def browse(self):
return self.browse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment