def test_task_journey(driver: Firefox, test_app):
    #check board created
    driver.get(_TODO_URL)
    assert driver.title == 'To-Do App'

    #check item added
    elem_form_task_title = driver.find_element_by_name("name")
    elem_form_task_title.send_keys('my very own task')
    elem_form_task_due = driver.find_element_by_name("due")
    elem_form_task_due.send_keys('07/07/2022')
    elem_form_task_desc = driver.find_element_by_name("desc")
    elem_form_task_desc.send_keys('a test description')
    
    driver.find_element_by_id("todoform").submit()
    driver.get(_TODO_URL)
    driver.refresh()
    assert ('a test description' in driver.page_source)
    
    #check item status change to Doing
    select = Select(driver.find_element_by_id('status_select_1'))
    select.select_by_index(1)
    driver.get(_TODO_URL)
    driver.refresh()
    assert ('/static/status_1.png' in driver.page_source)
    

    #check item deleted
    driver.find_element_by_id("delete_1").click()
    driver.get(_TODO_URL)
    driver.refresh()
    assert ('a test description' not in driver.page_source)
    
Exemple #2
0
def main():
    iqname = str(input("Enter iqtools name: "))
    classid = str(input("Enter class id: "))
    name = str(input("Enter name: "))
    password = str(input("Enter pass: "******"https://iqtools-{iqname}.intrtl.com/validate?klass_id={classid}&lots_id&size_id&confirm=&page=1&proposal=false&limit=0&klass_search="
    base_url = f"https://iqtools-{iqname}.intrtl.com/validate?confirm=&page=1&proposal=false&limit=0"

    #profile = webdriver.FirefoxProfile()
    #profile.accept_untrusted_certs = True
    #options = webdriver.FirefoxOptions()
    #options.add_argument('--headless')

    driver = Firefox(
        executable_path=r'C:\Users\elili\Documents\Python\geckodriver')
    #driver = webdriver.Chrome(executable_path=r'C:\Users\elili\Documents\Python\chromedriver')
    driver.get(base_url)
    try:
        element_present = EC.presence_of_element_located(
            (By.NAME, 'login-button'))
        WebDriverWait(driver, 10).until(element_present)
    except TimeoutException:
        print("Timed out waiting for page to load")

    driver.find_element_by_id("loginform-name").send_keys(name)
    driver.find_element_by_id("loginform-password").send_keys(password)
    driver.find_element_by_name("login-button").click()

    try:
        element_present = EC.presence_of_element_located(
            (By.CLASS_NAME, 'klass-wrapper'))
        WebDriverWait(driver, 10).until(element_present)
    except TimeoutException:
        print("Timed out waiting for page to load")

    # Create payload
    payload = {
        "confirm": "",
        "klass_id": classid,
        #"klass_search": "",
        #"limit": "0",
        #"lots_id": "null",
        #"page": 1,
        #"proposal": "false",
        #"size_id": "null"
    }

    driver.request('POST', base_url, data=payload)

    try:
        element_present = EC.presence_of_element_located(
            (By.CLASS_NAME, 'klass-wrapper'))
        WebDriverWait(driver, 10).until(element_present)
    except TimeoutException:
        print("Timed out waiting for page to load")

    classes = driver.find_elements_by_class_name('klass-wrapper')

    for clas in classes:
        image = clas.find_element_by_tag_name('img')
        print(image.get_attribute('src'))
        markup = clas.find_element_by_tag_name('a')
        print(markup.get_attribute('href'))

    while (True):
        pass
# ['-a', '-u','http://192.168.127.178/dvwa/login.php']

# load what you want to test with (change to phantomjs later)
driver = Firefox()
driver.set_window_size(1000,500)
# uncomment to reparse args
# my_opt()
# args-url location
# driver.get(my_opt.URL)


#Testing Delete later
#Testing Auth____ Comment IN TO autologin Bwap
driver.get("http://192.168.127.144/bWAPP/login.php")
select = Select(driver.find_element_by_name('security_level'))
select.select_by_visible_text("medium")
username = driver.find_element_by_id("login")
password = driver.find_element_by_name("password")
submit = driver.find_element_by_xpath("//button[@type='submit']")
username.send_keys("bee")
password.send_keys("bug"),
# click on the submit button
submit.click()

#BWAPP TEST Start
# XXS GET TEST
driver.get("http://192.168.127.144/bWAPP/xss_get.php?")


# Testing Auth____ Comment IN TO autologin DVWA