Exemple #1
0
def testcase1():
    #step 1: start web and go to link anotepad.com
    try:
        tc1 = WebInterface()
        tc1.start_browser(link)
        #verify 1: verify login button is exist:
        if tc1.check_element_exist(ObjectPage.login_span()):
            print("Passed: Login span is existed")
        else:
            print("Failed: Login span does not exist")
    except:
        print("Failed: Something wrong, please check this function")
    finally:
        tc1.close_browser()
Exemple #2
0
def testcase3():
    try:
        tc3 = WebInterface()
        tc3.start_browser(link)
        # verify 1: verify login button is exist:
        if tc3.check_element_exist(ObjectPage.login_span()):
            print("Passed: Login span is existed")
        else:
            print("Failed: Login span does not exist")
        # step 2: click on login span:
        tc3.click_on_xpath(ObjectPage.login_span())
        # step 2: verify all information is displays after click login
        if tc3.check_element_exist(ObjectPage.login_password()):
            print("Passed: Login span is existed")
        else:
            print("Failed: Element does not exist")
        if tc3.check_element_exist(ObjectPage.login_email()):
            print("Passed: Element is existed")
        else:
            print("Failed: Login span does not exist")
        if tc3.check_element_exist(ObjectPage.login_button()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")
        if tc3.check_element_exist(ObjectPage.remember_check()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")
        if tc3.check_element_exist(ObjectPage.forgot_password_button()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")

        #step 3: input all information
        tc3.send_key_on_element(ObjectPage.login_email(),loginEmail)
        tc3.send_key_on_element(ObjectPage.login_password(),loginPassword)
        tc3.click_on_xpath(ObjectPage.login_button())

        #Verify 3: Verify can login in this page (notepad login failed)
        if tc3.check_element_exist(ObjectPage.verify_login_success()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")
    except:
        print("Failed: Something wrong, please check this function")
    finally:
        tc3.close_browser()
Exemple #3
0
def testcase2():
    try:
        tc2 = WebInterface()
        tc2.start_browser(link)
        # verify 1: verify login button is exist:
        if tc2.check_element_exist(ObjectPage.login_span()):
            print("Passed: Login span is existed")
        else:
            print("Failed: Login span does not exist")
        # step 2: click on login span:
        tc2.click_on_xpath(ObjectPage.login_span())
        # step 2: verify all information is displays after click login
        if tc2.check_element_exist(ObjectPage.login_password()):
            print("Passed: Login span is existed")
        else:
            print("Failed: Element does not exist")
        if tc2.check_element_exist(ObjectPage.login_email()):
            print("Passed: Element is existed")
        else:
            print("Failed: Login span does not exist")
        if tc2.check_element_exist(ObjectPage.login_button()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")
        if tc2.check_element_exist(ObjectPage.remember_check()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")
        if tc2.check_element_exist(ObjectPage.forgot_password_button()):
            print("Passed: Element is existed")
        else:
            print("Failed: Element does not exist")
    except:
        print("Failed: Something wrong, please check this function")
    finally:
        tc2.close_browser()