示例#1
0
def select_view(view):

    #Selects a view inside a list
    if view != "":
        if Config.find_element([By.CSS_SELECTOR, "a#" + view]).get_attribute("class") != "view topbar-icon selected":
            close_task()
            Config.find_element([By.CSS_SELECTOR, "a#" + view]).click()
示例#2
0
def close_task():
    counter = 0
    while Config.is_element_present(Config.task_closeButton):
        try: Config.find_element(Config.task_closeButton).click()
        except ElementNotClickableException: break
        counter+=1
        if counter >=3: break
示例#3
0
def task_options(taskOption):

    #If you want to keep a task expanded, specify a page to open: "note", "subtasks", "files", "share".
    # To automatically collapse the task, leave empty
    if Config.is_element_present(Config.task_editTitle) == False:
        Config.find_element(Config.taskTitle).click()
    if taskOption == "open":
      pass
    elif Config.find_element([By.CSS_SELECTOR, "span#" + taskOption]).get_attribute("class") != "tab-header selected":
        Config.find_element([By.CSS_SELECTOR, "span#" + taskOption]).click()
示例#4
0
def create_a_task(name, section=None):
    taskList = Config.find_elements(Config.task)

    if section == None:
        Config.find_element(Config.list_addTask).click()
    else:
        Config.find_element(Config.list_addTaskToSectionByName, section).click()

    Config.wait_for_element(Config.taskCreate_InputBox)

    Config.find_element(Config.taskCreate_InputBox).clear()
    Config.find_element(Config.taskCreate_InputBox).send_keys(name)
    time.sleep(2)
    Config.find_element(Config.taskCreate_PlusButton).click()
    time.sleep(1)

    newTaskList = Config.find_elements(Config.task)
    for task in taskList:
        newTaskList.remove(task)
    taskID = newTaskList[0].get_attribute("data-task-id")
    return taskID
示例#5
0
def init_case(menu="", view="", taskOption="", taskNo = 1):
    taskIDs = None

    # a series of actions to ensure you are not starting the test with an unwanted lightbox
    counter=0
    while Config.find_element(Config.overlay).is_displayed():
        try: Config.find_element(Config.overlay).click()
        except ElementNotVisibleException: break
        counter+=1
        if counter >= 3: raise ElementNotClickableException
    if Config.is_element_present(Config.confirmDialog) == True:
        try: Config.find_element(Config.confirmDialog_cancel).click()
        except NoSuchElementException: pass
    if taskOption == "": close_task()



    # Sends you to the screen you want to be in for any test
    if menu != "": select_menu(menu)
    if menu != "MAIN" and taskNo is not None: taskIDs = add_tasks_as_needed(taskNo)
    if view != "": select_view(view)
    if taskOption != "": task_options(taskOption)
    return taskIDs
示例#6
0
def clear_all_tasks():
    #Sync
    Config.sync()

    #Check if there are any recurring tasks
    tasks = Config.find_elements(Config.task)
    for t in tasks:
        if Config.find_element(Config.taskRecurringByID, t.get_attribute("data-task-id")).is_displayed():
            Config.find_element(Config.taskTitleID, t.get_attribute("data-task-id")).click()
            Config.find_element(Config.task_recurrence).click()
            Config.find_element(Config.recurrenceByType, "OFF").click()
            Config.find_element(Config.recurrence_ok).click()
            Config.find_element(Config.task_closeButton).click()
            time.sleep(1)

    #Find all check buttons
    activeList = Config.find_elements(Config.taskCheck)
    #If they are available to be pressed (not hidden) press them
    for active in activeList:
        time.sleep(1)
        try: active.click()
        except ElementNotVisibleException: pass

    time.sleep(2)
    delList = Config.find_elements(Config.taskMarkDone)

    for dlt in delList:
        dlt.click()
示例#7
0
def select_menu(menu):

    #Selects a menu for you to be in, "ALL" / "MAIN" / or list ID to enter a specific list
    if menu == "ALL":
        if Config.is_element_present(Config.list):
            if Config.find_element(Config.listTitle).text != "ALL":
                close_task()
                Config.find_element(Config.goToMainGrid).click()
                time.sleep(2)
                Config.find_element(Config.main_AllTasks).click()
        else: Config.find_element(Config.main_AllTasks).click()

    elif menu == "MAIN":
        close_task()
        try: Config.find_element(Config.goToMainGrid).click()
        except NoSuchElementException: pass

    else:
        if Config.is_element_present(Config.list):
            if Config.find_element(Config.main_ListNameID, menu).text != Config.find_element(Config.listTitle).text:
                close_task()
                Config.find_element(Config.goToMainGrid).click()
                time.sleep(2)
                Config.find_element(Config.main_ListNameID, menu).click()
        else: Config.find_element(Config.main_ListNameID, menu).click()
def create_loaded_task():

    InitCase.task_options(taskOption="subtasks")
    Config.find_element(Config.subtasks_newTitle).clear()
    Config.find_element(Config.subtasks_newTitle).send_keys("subtask")
    Config.find_element(Config.subtasks_plusButton).click()

    InitCase.task_options("note")
    noteText = "test test test test test test test test test test test test test test test test test test test test test test "
    Config.find_element(Config.note).send_keys(noteText)

    InitCase.task_options("files")
    Config.find_element(Config.files_addFromComputer).send_keys("C:\\Users\\Eidan Wasser\\PycharmProjects\\Suite1\\Files\\2015-03-29.png")
    Config.wait_for_element(Config.files_progressBar, present=False)

    InitCase.task_options("open")
    Config.wait_for_element(Config.task_PrioritySelector)
    Config.find_element(Config.task_PrioritySelector).click()