Esempio n. 1
0
def click_on_screen(x, y):
    """
    Clicks the specified coordinates.
    :param x: the x coordinate
    :param y: the y coordinate
    """
    get_solo().click_on_screen(x, y)
Esempio n. 2
0
def click_text(text):
    """
    Clicks a View or WebElement displaying the specified text. Will automatically scroll when needed.
    :param text:the text to click. The parameter will be interpreted as a regular expression
    :return:
    """
    get_solo().click_on_text(text)
Esempio n. 3
0
def scroll_view_to_left(view):
    """
    scroll view to left
    :param view:
    :return:
    """
    get_solo().scroll_view_to_left(view)
Esempio n. 4
0
def scroll_view_to_right(view):
    """
    scroll view to right
    :param view:
    :return:
    """
    get_solo().scroll_view_to_right(view)
Esempio n. 5
0
def scroll_view_to_left(view):
    """
    scroll view to left
    :param view:
    :return:
    """
    get_solo().scroll_view_to_left(view)
Esempio n. 6
0
def sleep(milliseconds):
    """
    Robotium will sleep for the specified time.
    :param milliseconds:the time in milliseconds that Robotium should sleep
    :return:
    """
    get_solo().sleep(milliseconds)
Esempio n. 7
0
def click_on_screen(x, y):
    """
    Clicks the specified coordinates.
    :param x: the x coordinate
    :param y: the y coordinate
    """
    get_solo().click_on_screen(x, y)
Esempio n. 8
0
def sleep(milliseconds):
    """
    Robotium will sleep for the specified time.
    :param milliseconds:the time in milliseconds that Robotium should sleep
    :return:
    """
    get_solo().sleep(milliseconds)
Esempio n. 9
0
def set_edit_text(edit_text_view, text):
    """
    Enters text in the specified EditText.
    :param edit_text_view: the {@link EditText} to enter text in
    :param text: the text to enter in the {@link EditText} field
    """
    get_solo().enter_text(edit_text_view, text)
Esempio n. 10
0
def scroll_view_to_right(view):
    """
    scroll view to right
    :param view:
    :return:
    """
    get_solo().scroll_view_to_right(view)
Esempio n. 11
0
def click_long_on_view(view):
    """
    Long clicks the specified View.
    :param view:the {@link View} to long click
    :return:
    """
    get_solo().click_long_on_view(view)
Esempio n. 12
0
def set_edit_text(edit_text_view, text):
    """
    Enters text in the specified EditText.
    :param edit_text_view: the {@link EditText} to enter text in
    :param text: the text to enter in the {@link EditText} field
    """
    get_solo().enter_text(edit_text_view, text)
Esempio n. 13
0
def click_long_on_view(view):
    """
    Long clicks the specified View.
    :param view:the {@link View} to long click
    :return:
    """
    get_solo().click_long_on_view(view)
Esempio n. 14
0
def click_text(text):
    """
    Clicks a View or WebElement displaying the specified text. Will automatically scroll when needed.
    :param text:the text to click. The parameter will be interpreted as a regular expression
    :return:
    """
    get_solo().click_on_text(text)
Esempio n. 15
0
def set_screen_landscape():
    """
    set screen landscape
    :return:
    """
    solo = get_solo()
    call(solo, "setActivityOrientation", SCREEN_ORIENTATION_LANDSCAPE)
Esempio n. 16
0
def get_displayed_views(id):
    """
    get views in window rect by view id str
    :param res_id:
    :return:
    """
    return get_solo().get_displayed_views(id)
Esempio n. 17
0
def scroll_list_to_bottom(list_view):
    """
    Scrolls to the bottom of the specified AbsListView.
    :param list_view: the AbsListView to scroll
    :return: True if more scrolling can be performed
    """
    return get_solo().scroll_list_to_bottom(list_view)
Esempio n. 18
0
def wait_for_view(class_name):
    """
     Waits for a View matching the specified class. Default timeout is 20 seconds.
    :param class_name:the {@link View} class to wait for
    :return:{@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout
    """
    return get_solo().wait_for_view(class_name)
Esempio n. 19
0
def scroll_list_to_bottom(list_view):
    """
    Scrolls to the bottom of the specified AbsListView.
    :param list_view: the AbsListView to scroll
    :return: True if more scrolling can be performed
    """
    return get_solo().scroll_list_to_bottom(list_view)
Esempio n. 20
0
def set_screen_landscape():
    """
    set screen landscape
    :return:
    """
    solo = get_solo()
    call(solo, "setActivityOrientation", SCREEN_ORIENTATION_LANDSCAPE)
Esempio n. 21
0
def get_displayed_views(id):
    """
    get views in window rect by view id str
    :param res_id:
    :return:
    """
    return get_solo().get_displayed_views(id)
Esempio n. 22
0
def wait_for_view(class_name):
    """
     Waits for a View matching the specified class. Default timeout is 20 seconds.
    :param class_name:the {@link View} class to wait for
    :return:{@code true} if the {@link View} is displayed and {@code false} if it is not displayed before the timeout
    """
    return get_solo().wait_for_view(class_name)
Esempio n. 23
0
def wait_text_in_list(list_view, text):
    """
     Scroll list one screen by one. Not scroll line by line
     :param list_view:
     :param text:
     :return: True if found the text
     """
    return get_solo().wait_text_in_list(list_view, text)
Esempio n. 24
0
def wait_text_in_list(list_view, text):
    """
     Scroll list one screen by one. Not scroll line by line
     :param list_view:
     :param text:
     :return: True if found the text
     """
    return get_solo().wait_text_in_list(list_view, text)
Esempio n. 25
0
def set_screen_portrait():
    """
    set screen portrait
    :return:
    """
    solo = get_solo()
    current_activity = solo.get_current_activity()
    call(current_activity, "setRequestedOrientation", SCREEN_ORIENTATION_PORTRAIT)
Esempio n. 26
0
def get_view(view_id, index=0):
    """
    Returns a View matching the specified resource id and index.
    :param view_id:the view_id of the {@link View}
    :param index:the index of the {@link View}. {@code 0} if only one is available
    :return:a {@link View} matching the specified id and index
    """
    return get_solo().get_view(res_id=view_id, index=index)
Esempio n. 27
0
def get_view(view_id, index=0):
    """
    Returns a View matching the specified resource id and index.
    :param view_id:the view_id of the {@link View}
    :param index:the index of the {@link View}. {@code 0} if only one is available
    :return:a {@link View} matching the specified id and index
    """
    return get_solo().get_view(res_id=view_id, index=index)
Esempio n. 28
0
def get_view_from_parent(parent, res_id):
    """
    get View from parent view's children by view id string
    :param parent:
    :param res_id:
    :param index:
    :return:
    """
    return get_solo().get_view_from_parent(parent, res_id)
Esempio n. 29
0
def get_view_from_parent(parent, res_id):
    """
    get View from parent view's children by view id string
    :param parent:
    :param res_id:
    :param index:
    :return:
    """
    return get_solo().get_view_from_parent(parent, res_id)
Esempio n. 30
0
def set_screen_portrait():
    """
    set screen portrait
    :return:
    """
    solo = get_solo()
    current_activity = solo.get_current_activity()
    call(current_activity, "setRequestedOrientation",
         SCREEN_ORIENTATION_PORTRAIT)
Esempio n. 31
0
def get_view_text(view_id, index=0):
    """
    Returns a TextView matching the specified index.
    :param view_id:the view_id of the {@link View}
    :param index:the index of the {@link TextView}. {@code 0} if only one is available
    :return:a {@link TextView} matching the specified index
    """
    view = get_solo().get_view(res_id=view_id, index=index)
    return call(view, "getText")
Esempio n. 32
0
def get_view_text(view_id, index=0):
    """
    Returns a TextView matching the specified index.
    :param view_id:the view_id of the {@link View}
    :param index:the index of the {@link TextView}. {@code 0} if only one is available
    :return:a {@link TextView} matching the specified index
    """
    view = get_solo().get_view(res_id=view_id, index=index)
    return call(view, "getText")
def switch_tab(tab_name):
    """
    切换栏目
    :param tab_name:"首页"、"直播"、""订阅、"我的"
    :return:
    """
    solo = get_solo()
    tab_view = get_view("android:id/tabs")
    view = call(tab_view, "getChildTabViewAt", tab_view_pos[tab_name])
    solo.click_on_view(view)
def check_video_state(state):
    """
    功能 检查播放器状态
    :param state: "playing"、"pause"
    :return:
    """
    solo = get_solo()
    video_skin = solo.get_view("com.ifeng.newvideo:id/video_skin")
    description = call(video_skin, "getContentDescription")
    assert description == state, "视频状态非{}".format(state)
Esempio n. 35
0
def assert_text_not_exist(text):
    """
    assert text is not existed
    :param text:
    :return:
    """
    solo = get_solo()
    exist = solo.wait_for_text(text)
    if exist:
        raise AssertionError('%s is exist' % text)
def check_player_type(player_type):
    """
    确定当前播放器类型
    :param player_type: video  视频播放器;audio  音频播放器
    :return:
    """
    solo = get_solo()
    video_skin = solo.get_view("com.ifeng.newvideo:id/video_skin")
    description = call(video_skin, "getContentDescription")
    assert  player_type in description, "播放器类型非{}".format(player_type)
Esempio n. 37
0
def assert_text_not_exist(text):
    """
    assert text is not existed
    :param text:
    :return:
    """
    solo = get_solo()
    exist = solo.wait_for_text(text)
    if exist:
        raise AssertionError('%s is exist' % text)
def check_current_page(page_name):
    """
    功能:判断当前是否为某页
    :param player_type:"自媒体" 、"登录"、"点播底页"
    :return:
    """
    solo = get_solo()
    expect_page = page_name_ui_controller[page_name]
    current_activity = solo.get_current_activity()
    result = expect_page == current_activity.class_name
    assert result, "非{}页面".format(page_name)
def get_current_progress(index=0):
    """
    功能:获取s播放器播放进度
    :param index:"0"
    :return:
    """
    seekbar_id = "com.ifeng.newvideo:id/control_seekBar"
    solo = get_solo()
    view = solo.get_view(res_id=seekbar_id, index=index)
    mSeekBarView = get_field(view, "mSeekBarView")
    progress = call(mSeekBarView, "getProgress")
    return progress
Esempio n. 40
0
def get_text_from_parent(view, text, index=0):
    """
    获取父级view下的指定文本,返回TextView

    用法示例:
    get_text_from_parent parent_view text 1
    
    注:index不输入时,默认为0
    :param view:
    :param text:
    :param index:
    :return:
    """
    return get_solo().get_text_from_parent(view, text, index)
Esempio n. 41
0
def get_text_from_parent(view, text, index=0):
    """
    获取父级view下的指定文本,返回TextView

    用法示例:
    get_text_from_parent parent_view text 1
    
    注:index不输入时,默认为0
    :param view:
    :param text:
    :param index:
    :return:
    """
    return get_solo().get_text_from_parent(view, text, index)
Esempio n. 42
0
def perform_click_view(view):
    get_solo().perform_click_on_view(view)
Esempio n. 43
0
def get_web_url():
    """
    Returns the current web page URL.
    :return:the current web page URL
    """
    return call(get_solo(), "getWebUrl")
Esempio n. 44
0
def finish_app():
    """
    finish app
    :return:
    """
    get_solo().finish_opened_activities()
Esempio n. 45
0
def clear_edit_text(edit_text_view):
    """
    Clears the value of an EditText.
    :param edit_text_view: the {@link EditText} to clear
    """
    get_solo().clear_edit_text(edit_text_view)
Esempio n. 46
0
def scroll_up():
    """
    Scrolls up the screen.
    :return: True if more scrolling can be performed and False if it is at the top of the screen
    """
    return get_solo().scroll_up()
Esempio n. 47
0
def scroll_to_bottom():
    """
    Scrolls to the bottom of the screen.
    """
    return get_solo().scroll_to_bottom()
Esempio n. 48
0
def scroll_to_bottom():
    """
    Scrolls to the bottom of the screen.
    """
    return get_solo().scroll_to_bottom()
Esempio n. 49
0
def clear_edit_text(edit_text_view):
    """
    Clears the value of an EditText.
    :param edit_text_view: the {@link EditText} to clear
    """
    get_solo().clear_edit_text(edit_text_view)
Esempio n. 50
0
def get_web_url():
    """
    Returns the current web page URL.
    :return:the current web page URL
    """
    return call(get_solo(), "getWebUrl")
Esempio n. 51
0
def scroll_to_right():
    """
    scroll to right
    :return:
    """
    get_solo().scroll_to_right()
Esempio n. 52
0
def scroll_down():
    """
    Scrolls down the screen.
    :return True if more scrolling can be performed and False if it is at the end of the screen
    """
    return get_solo().scroll_down()
Esempio n. 53
0
def scroll_to_left():
    """
    scroll to left
    :return:
    """
    get_solo().scroll_to_left()
Esempio n. 54
0
def perform_click_view(view):
    get_solo().perform_click_on_view(view)
def drag_progress_bar(view, start_x, end_x, step_count):
    solo = get_solo()
    solo.drag_in_view(view, start_x, 50, end_x, 50, step_count)
Esempio n. 56
0
def go_back():
    """
    Simulates pressing the hardware back key.
    :return:
    """
    get_solo().go_back()
Esempio n. 57
0
def go_back():
    """
    Simulates pressing the hardware back key.
    :return:
    """
    get_solo().go_back()
Esempio n. 58
0
def finish_app():
    """
    finish app
    :return:
    """
    get_solo().finish_opened_activities()
Esempio n. 59
0
def scroll_to_top():
    """
    Scrolls to the top of the screen.
    """
    return get_solo().scroll_to_top()