Example #1
0
def match_history_switch(driver):
    elements.MatchHistoryButton(driver).click()
    if elements.MatchHistoryStartMatchButton(driver):
        match_from_match_history(driver)
        elements.MatchHistoryButton(driver).click()
    head_ele = elements.MatchHistoryUserHeadImage(driver).element
    if head_ele:
        ele_point = head_ele.location
        ele_size = head_ele.size
        right_move_point = (ele_point['x'] + ele_size['width'],
                            ele_point['y'] + ele_size['height'] // 2,
                            ele_point['x'],
                            ele_point['y'] + ele_size['height'] // 2, 500)
        left_move_point = (ele_point['x'],
                           ele_point['y'] + ele_size['height'] // 2,
                           ele_point['x'] + ele_size['width'],
                           ele_point['y'] + ele_size['height'] // 2, 500)
        match_time = elements.MatchHistoryMatchTime(driver).text
        driver.swipe(*right_move_point)
        ret = match_time != elements.MatchHistoryMatchTime(driver).text
        if ret:
            driver.swipe(*left_move_point)
            ret = match_time == elements.MatchHistoryMatchTime(driver).text
        return ActionResult(ret, "test left and right swipe screen")
    else:
        return ActionResult(False, "test left and right swipe screen")
Example #2
0
def match_from_match_history(driver):
    elements.MatchHistoryStartMatchButton(driver).click()
    friends_list = []
    ctime = time.time()
    while time.time() < (ctime + 600):
        match_popup_handle(driver)
        if elements.VideoingObjectUserName(driver):
            logger.info("match success.")
            logger.info("UserName: %s,UserFavoriteNumber: %s,UserLocation: %s"%(elements.VideoingObjectUserName(driver).text,\
                                                                                elements.VideoingObjectFavoriteNumber(driver).text,\
                                                                                elements.VideoingObjectLocation(driver).text))
            friends_list.append(elements.VideoingObjectUserName(driver).text)
            time.sleep(10)
            # quit current match
            elements.VideoingQuit(driver).click()

        if len(friends_list) >= 10:
            break
    if not elements.MatchHistoryButton(driver):
        driver.back()
        elements.MatchStopEnsureButton(driver).click()

    ret = elements.MatchHistoryButton(driver)

    return ActionResult(ret, "match friends if match history page is empty")
Example #3
0
def verify_match_history(driver):
    elements.MatchHistoryButton(driver).click()
    if elements.MatchHistoryStartMatchButton(driver):
        match_from_match_history(driver)
        elements.MatchHistoryButton(driver).click()
    logger.info("name: %s ,favorite: %s ,location: %s ,time: %s"%(elements.MatchHistoryUserName(driver).text,\
                                                       elements.MatchHistoryUserPraiseCount(driver).text,\
                                                       elements.MatchHistoryUserLocation(driver).text,\
                                                       elements.MatchHistoryMatchTime(driver).text))

    return ActionResult(elements.MatchHistoryUserHeadImage(driver),
                        "verify match history user information")
Example #4
0
def match_history_report(driver):
    elements.MatchHistoryButton(driver).click()
    if elements.MatchHistoryStartMatchButton(driver):
        match_from_match_history(driver)
        elements.MatchHistoryButton(driver).click()
    match_time = elements.MatchHistoryMatchTime(driver).text
    elements.MatchHistoryCardReportButton(driver).click()
    elements.MatchHistoryReportFakeGender(driver).click()

    return ActionResult(
        match_time != elements.MatchHistoryMatchTime(driver).text,
        "report from match history")
Example #5
0
def delete_match_history(driver):
    elements.MatchHistoryButton(driver).click()
    if elements.MatchHistoryStartMatchButton(driver):
        match_from_match_history(driver)
        elements.MatchHistoryButton(driver).click()
    if elements.MatchHistoryStartMatchButton(driver):
        return ActionResult(False,
                            "delete a match history - Match history is empty")

    match_time = elements.MatchHistoryMatchTime(driver).text
    for _ in range(3):
        if elements.MatchHistoryMatchTime(driver):
            elements.MatchHistoryCardDeleteButton(driver).click()
            elements.EnsureButton(driver).click()
        else:
            break

    ret = False
    if elements.MatchHistoryMatchTime(driver):
        ret = match_time != elements.MatchHistoryMatchTime(driver).text
    elif elements.MatchHistoryStartMatchButton(driver):
        ret = True
    return ActionResult(ret, "delete a match history")
Example #6
0
def match_history_sendmessage(driver):
    elements.MatchHistoryButton(driver).click()
    if elements.MatchHistoryStartMatchButton(driver):
        match_from_match_history(driver)
        elements.MatchHistoryButton(driver).click()
    elements.MatchHistoryCardSendMessaeButton(driver).click()
    ret = False
    # don't have enough coins
    if elements.MatchHistorySendMessageSpendCoinsTips(driver):
        elements.CancelButton(driver).click()
        ret = True
    # have enough coins
    elif elements.MessageFriendsChatInput(driver):
        ret = True
    else:
        ret = False
    return ActionResult(ret, "send message from match history")