예제 #1
0
def step(context, subview, element, delay_msec):
    if subview not in possible_doors_ui_items.keys():
        app.fail("in vehicle doors view the subview '" + subview
                 + "' is not known!!")
        return

    # change context
    app.switch_to_app('vehicle')
    subview_bt_name = possible_doors_ui_items[subview]['button']
    subview_button = squish.waitForObject(subview_bt_name)
    squish.tapObject(subview_button)

    # now all subelementes
    for item_name in possible_doors_ui_items[subview].keys():
        # not interested in button or later view to check
        if item_name in ['button']:
            continue

        if item_name == element:
            item = possible_doors_ui_items[subview][item_name]
            # open now
            open_btn_name = item['open']
            close_btn_name = item['close']
            open_button = squish.waitForObject(open_btn_name)
            squish.tapObject(open_button)
            # wait given time
            squish.snooze(delay_msec / 1000)
            close_button = squish.waitForObject(close_btn_name)
            squish.tapObject(close_button)
            # wait same time for closing
            squish.snooze(delay_msec / 1000)
예제 #2
0
def step(context, view_name, entry_number):
    if not context.userData:
        context.userData = {}

    natural_number = entry_number - 1
    ui_item = None
    caller_prefix = qml.phone_contactView_prefix
    button_prefix = qml.phone_contactView_button_prefix
    name_prefix = qml.phone_contactView_caller_prefix
    if view_name == 'favorites':
        ui_item = names.favorites_phoneView_ContactsView
    elif view_name == 'contacts':
        ui_item = names.contacts_phoneView_ContactsView
    else:
        app.fail("from this view you cannot call directly: '"
                 + view_name + "'!!")
    # switch to app
    app.switch_to_app('phone')
    caller_view = squish.waitForObject(ui_item)

    if caller_view is not None:
        search_contact_name = caller_prefix + str(natural_number)
        caller_pointer = find_object_name_recursively(caller_view,
                                                      search_contact_name, 4)
        if caller_pointer is not None:
            search_contact_button_name = button_prefix + str(natural_number)
            button_pointer = find_object_name_recursively(caller_pointer,
                                                    search_contact_button_name,
                                                    4)
            if button_pointer is not None:
                # now store the name for comparison
                store_name = name_prefix + str(natural_number)
                name_obj = find_object_name_recursively(caller_pointer,
                                                        store_name,
                                                        4)
                if name_obj is not None:
                    full_name = str(name_obj.text)
                    context.userData['calling'] = full_name
                    # and finally hit 'call'
                    squish.tapObject(button_pointer)
                else:
                    app.fail("name for contact '"
                             + button_prefix
                             + str(natural_number)
                             + "' could not be found")
            else:
                app.fail("button for contact '"
                         + button_prefix
                         + str(natural_number)
                         + "' could not be found")
        else:
            app.fail("stackview item for '"
                     + view_name + str(natural_number)
                     + "' could not be found")
    else:
        app.fail("should not happen here!!!")

    # switch to main before new command
    app.switch_to_main_app()
    squish.snooze(0.2)
예제 #3
0
def step(context, number_sequence):
    button_sequence = []

    for i in range(len(number_sequence)):
        my_char = number_sequence[i]
        resolved_name = my_char if my_char >= '0' and my_char <= '9' else(
                    "asterisk" if my_char == "*" else (
                    "hash" if my_char == "#" else "error"))
        if resolved_name != "error":
            keypad_name = qml.phone_numpad_prefix + resolved_name
            button_sequence.append(keypad_name)
        else:
            app.fail("The character '" + my_char + "' cannot be dialed")
            return

    # switch to app
    app.switch_to_app('phone')
    squish.snooze(0.25)

    for elem in button_sequence:
        button_obj = {"container": names.container_phone, "objectName": elem,
                      "type": "KeypadButton", "visible": True}
        squish.waitForObject(button_obj)
        squish.snooze(0.1)
        squish.tapObject(button_obj)

    app.switch_to_main_app()
예제 #4
0
def step(context, button_name):
    if not context.userData:
        context.userData = {}

    if button_name not in top_buttons_calendar_ui.keys():
        app.fail("in calendar, the button '"
                 + button_name
                 + "' is not known!")
        return
    button = top_buttons_calendar_ui[button_name]
    month_delta = 1 if (top_buttons_calendar_ui.keys()[0]
                     == button_name) else -1

    app.switch_to_app('calendar')
    squish.snooze(0.25)

    squish.tapObject(button)

    squish.snooze(0.5)
    grid_for_info = squish.waitForObject(names.topCalendarGrid)

    month_now = __builtin__.int(str(grid_for_info.month))
    month_before = context.userData['month']

    month_change = (month_before + month_delta) % 12
    app.compare(str(month_change + 1), str(month_now + 1), " month changes")
예제 #5
0
def step(context, button_name):
    if button_name not in possible_view_buttons.keys():
        app.fail("in music view, button '" + button_name + "' is not known!")
        return

    app.switch_to_app('music')
    squish.snooze(0.25)
    button = squish.waitForObject(possible_view_buttons[button_name])
    squish.tapObject(button)
예제 #6
0
def step(context, button_name):
    if button_name not in possible_ui_elements.keys():
        app.fail("in downloads app view, button '"
                 + button_name
                 + "' is not known!")
        return

    #app.switch_to_app('downloads')
    squish.snooze(0.25)
    button = squish.waitForObject(possible_ui_elements[button_name])
    squish.tapObject(button)
예제 #7
0
def step(context, view_name):
    if view_name not in possible_views:
        app.fail("in phone the view '" + view_name
                 + "' is not known!!")

    view_obj_name = possible_views[view_name]
    # switch to app
    app.switch_to_app('vehicle')
    view_found = squish.waitForObject(view_obj_name)

    test.compare(view_found is not None, True, "view '"
                + view_name + "' in vehicle found")
예제 #8
0
def step(context, view_name):
    if view_name not in possible_view_buttons.keys():
        app.fail("in music view, list view '" + view_name + "' is not known!")
        return

    app.switch_to_app('music')
    squish.snooze(0.25)
    info_ui = squish.waitForObject(names.musicToolsColumn)

    currentView = str(info_ui.currentText)
    app.compare(currentView, view_name,
                "view stored is not what is changed to")
예제 #9
0
def step(context, view_name):
    if view_name not in variable_calendar_ui.keys():
        app.fail("in calendar, this view button '"
                 + view_name
                 + "' is not known!")
        return

    view_object_name = variable_calendar_ui[view_name]['button']
    app.switch_to_app('calendar')
    squish.snooze(0.25)

    events_button = waitForObject(view_object_name)
    tapObject(events_button)
예제 #10
0
def step(context, view_name):
    if view_name not in possible_ui_elements.keys():
        app.fail("in downloads app, view '"
                 + view_name
                 + "' is not known!")
        return

    #app.switch_to_app('downloads')
    squish.snooze(0.25)
    info_ui = squish.waitForObject(names.downloadsToolsColumn)

    currentView = str(info_ui.currentTool)
    app.compare(currentView, view_name,
                "view stored is not what is changed to")
예제 #11
0
def step(context, button_name):
    if button_name not in qml.viewPhoneButtons:
        test.fail("in phone the button '" + button_name
                 + "' is not known!!")
        return
    app.switch_to_app('phone')
    start_search = waitForObject(names.phoneViewChangeButtons_ToolsColumn)

    object_name = qml.viewPhoneButton_prefix + button_name
    object_pointer = find_object_name_recursively(start_search, object_name, 4)
    if object_pointer is not None:
        if object_pointer.visible:
            squish.tapObject(object_pointer)
        else:
            app.fail("phone button '" + button_name
                     + "' was found but is not visible!")
예제 #12
0
def step(context, view_name):
    if view_name not in variable_calendar_ui.keys():
        app.fail("in calendar, this view '"
                 + view_name
                 + "' is not known!")
        return

    compare_name = variable_calendar_ui[view_name]['view']

    app.switch_to_app('calendar')
    squish.snooze(0.25)

    view_stack_layout = squish.waitForObject(names.calendarViewContent)
    current_index = view_stack_layout.currentIndex
    stack_layouts = object.children(view_stack_layout)
    current_name = stack_layouts[current_index].objectName
    test.compare(current_name, compare_name, "calendar views")
예제 #13
0
def step(context, button_name, number_taps):
    ui_buttons = {
        'next': names.musicSongNext_ToolButton,
        'previous': names.musicSongPrevious_ToolButton,
        'play': names.musicSongPlayPause_ToolButton,
        'pause': names.musicSongPlayPause_ToolButton,
        'repeat': names.repeatMusicButton_ToolButton,
        'shuffle': names.shuffleMusicButton_ToolButton
    }

    if button_name not in ui_buttons.keys():
        app.fail("The music button '" + button_name + "' is not known!")
        return

    app.switch_to_app('music')
    for _i in range(number_taps):
        squish.snooze(0.25)
        squish.tapObject(ui_buttons[button_name])
예제 #14
0
def step(context, delay_time_ms):
    app.switch_to_app('vehicle')
    container_item = squish.waitForObject(names.vehicleSupportPanel_ListView)

    item_list = find_same_prefix_list(container_item,
                                      qml.vehicle_support_list_prefix, 4)

    if item_list is not None:
        for index, ui_item in enumerate(item_list):
            test.log(" trying %d)" % index)
            model_switch = find_object_name_recursively(ui_item,
                                            qml.vehicle_list_switch_name,
                                            6)
            if model_switch is not None:
                squish.snooze(delay_time_ms / 1000)
                squish.tapObject(model_switch)
            else:
                app.fail("'%s' not found", qml.vehicle_list_switch_name)
    else:
        app.fail("no list of '" + qml.vehicle_support_list_prefix
                   + "' found!")
예제 #15
0
def step(context, button_name):
    if button_name not in possible_views.keys():
        app.fail("in vehicle view the button '" + button_name
                 + "' is not known!!")
        return
    app.switch_to_app('vehicle')
    start_search = waitForObject(names.vehicleViewToolsColumn)

    object_name = qml.vehicle_view_button_prefix + button_name
    object_pointer = find_object_name_recursively(start_search, object_name, 3)
    if object_pointer is not None:
        if object_pointer.visible:
            squish.tapObject(object_pointer)
        else:
            app.fail("vehicle view button '" + button_name
                     + "' was found but is not visible!")
    else:
        app.fail("vehicle list view button '" + button_name
                 + "' could not be found!")
예제 #16
0
def step(context, view_name):
    if view_name not in qml.viewPhoneButtons:
        app.fail("in phone the view '" + view_name
                 + "' is not known!!")
    # recents and favorites so far not
    has_2_views = [qml.viewPhoneButtons[2:]]

    view_obj_name = None
    if view_name == 'contacts':
        view_obj_name = names.contacts_phoneView_ContactsView
    elif view_name == 'recents':
        view_obj_name = names.recents_phoneView_RecentCallsView
    elif view_name == 'favorites':
        view_obj_name = names.favorites_phoneView_ContactsView
    elif view_name == 'keypad':
        view_obj_name = names.keypad_phoneView_KeypadViewPanel
    else:
        app.fail("this should not happen, this view '"
                 + view_name + "'" is not known)

    view_found = squish.waitForObject(view_obj_name)
    # first test (since it is not the last no "app.compare()"
    test.compare(view_found is not None, True, "view '"
                + view_name + "' found!!")

    if view_name in has_2_views:
        if view_name == 'favorites':
            second_ui_item = names.phonefavoritesView_FavoritesWidgetView
        elif view_name == 'keypad':
            second_ui_item = names.phoneCallView_CallWidgetView
        else:
            app.fail("this should not happen here with '"
                     + view_name + "'!!")
        test_ui = squish.waitForObject(second_ui_item)
        app.compare(test_ui.visible, True, "2nd view item should be visible")

    # switch to main before new command
    app.switch_to_main_app()
    squish.snooze(0.2)
예제 #17
0
def step(context, command):
    possible_options = ['install', 'deinstall']
    if command not in possible_options:
        app.fail("in downloads, the command '"
                  + command + "' is not known!")
        return
    # what to do
    install = (command == possible_options[0])

    #app.switch_to_app('downloads')
    squish.snooze(0.25)
    app_list = squish.waitForObject(names.downloadAppList_DownloadAppList)
    number_of_app_in_view = app_list.count

    # store installable apps here
    just_changed_installation_apps = []

    for i in range(number_of_app_in_view):
        # this is a little bit old school without objectName
        # actually objectName is used to achieve
        # app information aka model.id
        # here we use index to find the item
        download_app_struct = {
                        "container": names.downloadAppList_DownloadAppList,
                        "index": i,
                        "type": "ListItemProgress",
                        "visible": True}
        model_ToolButton_ui = {"container": download_app_struct,
                                "type": "ToolButton",
                                "visible": True}
        test.log("download app index " + str(i)
                 + " was found! Trying ...")
        download_app = squish.waitForObject(download_app_struct)
        app_objectName = str(download_app.objectName)

        model_text = str(download_app.text)

        # delete prefix, if this works, string must be different
        model_name = app_objectName.replace(qml.app_downloads_prefix, "")
        if model_name != model_text:
            installed = download_app.isInstalled

            if install is not installed:
                test.log("Found: (" + str(i) + ") " + model_text + " as '"
                         + model_name + "' "
                         + ("installed" if installed
                                       else "not installed")
                         + "!")
                install_button = squish.waitForObject(model_ToolButton_ui)
                squish.tapObject(install_button)

                # wait a little and hope it installs during that time
                just_changed_installation_apps.append(model_name)
                squish.snooze(2)
            else:
                test.log("app '" + model_name + "' is already "
                        + ("installed" if not install else "not installed")
                        + "!")
        else:
            test.fail("in download test, a problem with model.id occurred.")

    # wait for last toast message to disappear
    squish.snooze(0.5)
    # now check in grid if just installed apps exist
    grid_view = squish.waitForObject(
                              names.neptune_UI_Center_Console_grid_GridView)
    launcher_bar = squish.waitForObject(
                    names.neptune_3_UI_Center_Console_gridButton_ToolButton)
    squish.tapObject(launcher_bar)

    if len(just_changed_installation_apps) == 0:
        test.passes("good, no apps to " +
                     ("install" if install else "uninstall")
                     + "!")
    else:
        for el in just_changed_installation_apps:
            object_name = qml.grid_delegate + el
            app_pointer = find_object_name_recursively(grid_view,
                                                       object_name,
                                                       3)
            # python .......
            found = (app_pointer is not None)
            app.compare(found, install,
                        ("app '" + str(el) + "' exists"))
    # tap again to close
    squish.tapObject(launcher_bar)
    # wait for toast message to disappear
    squish.snooze(0.5)