2017-10-05 19:41:17 +00:00
|
|
|
from views.base_view import *
|
2018-02-07 13:18:55 +00:00
|
|
|
import pytest
|
2017-10-05 19:41:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ProgressBarIcon(BaseElement):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(ProgressBarIcon, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//android.widget.ProgressBar")
|
|
|
|
|
|
|
|
|
2018-02-13 17:22:41 +00:00
|
|
|
class WebLinkEditBox(BaseEditBox):
|
|
|
|
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(WebLinkEditBox, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector("//android.widget.EditText")
|
|
|
|
|
|
|
|
|
|
|
|
class BackToHomeButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(BackToHomeButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.xpath_selector('(//android.view.ViewGroup[@content-desc="icon"])[1]')
|
|
|
|
|
|
|
|
|
2018-04-27 10:13:29 +00:00
|
|
|
class BrowserPreviousPageButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(BrowserPreviousPageButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('previou-page-button')
|
|
|
|
|
|
|
|
|
|
|
|
class BrowserNextPageButton(BaseButton):
|
|
|
|
def __init__(self, driver):
|
|
|
|
super(BrowserNextPageButton, self).__init__(driver)
|
|
|
|
self.locator = self.Locator.accessibility_id('next-page-button')
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-01-03 09:34:40 +00:00
|
|
|
class BaseWebView(BaseView):
|
2017-10-05 19:41:17 +00:00
|
|
|
|
|
|
|
def __init__(self, driver):
|
2018-01-03 09:34:40 +00:00
|
|
|
super(BaseWebView, self).__init__(driver)
|
2017-10-05 19:41:17 +00:00
|
|
|
self.driver = driver
|
|
|
|
|
|
|
|
self.progress_bar_icon = ProgressBarIcon(self.driver)
|
|
|
|
|
2018-02-13 17:22:41 +00:00
|
|
|
self.web_link_edit_box = WebLinkEditBox(self.driver)
|
|
|
|
self.back_to_home_button = BackToHomeButton(self.driver)
|
2018-04-27 10:13:29 +00:00
|
|
|
self.browser_previous_page_button = BrowserPreviousPageButton(self.driver)
|
|
|
|
self.browser_next_page_button = BrowserNextPageButton(self.driver)
|
2018-02-13 17:22:41 +00:00
|
|
|
|
2018-02-07 13:18:55 +00:00
|
|
|
def wait_for_d_aap_to_load(self, wait_time=35):
|
2017-10-05 19:41:17 +00:00
|
|
|
counter = 0
|
|
|
|
while self.progress_bar_icon.is_element_present(5):
|
|
|
|
time.sleep(1)
|
|
|
|
counter += 1
|
|
|
|
if counter > wait_time:
|
|
|
|
pytest.fail("Page is not loaded during %s seconds" % wait_time)
|