Esempio n. 1
0
 def test_case_search_002(self):
     Conf.CASE_NAME = "test_case_search_002"
     Log.start_test(Conf.CASE_NAME)
     
     POFS_OVERVIEW_SEARCH = Element.find_element(By.XPATH, u'//a[@id="b"][@href="overview/overview.jsp"]')
     POFS_OVERVIEW_SEARCH.click()
     
     POFS_EXPTYPE = Element.find_elements(By.XPATH, u'//select[@name="exportType"]/option')
     POFS_EXPTYPE_CONTENT = Element.get_spinner_values(By.XPATH, u'//select[@name="exportType"]/option')
     Element.choose_spinner_value(POFS_EXPTYPE, POFS_EXPTYPE_CONTENT, "LCL")
     
     POFS_PO_ISSUE_DATE = Element.find_element(By.XPATH, u'//img[@src="../images/cal.gif"]')
     POFS_PO_ISSUE_DATE.click()
     
     Browser.switch_to_new_window()
     Element.date_picker(31, 1, 2008)
     Browser.switch_to_default_window()
     
     POFS_SEARCH = Element.find_element(By.NAME, u'submit')
     POFS_SEARCH.click()
     
     POFS_DETAIL = Element.find_element(By.XPATH, u'//img[@src="../images/detail.gif"]')
     POFS_DETAIL.click()
     Browser.switch_to_new_window()
     POFS_PONUMBER = Element.find_element(By.XPATH, u'//*[@id="printable"]/table/tbody/tr[1]/td/table/tbody/tr[2]/td[2]')
     Assert().assert_equal(POFS_PONUMBER.text, "0000434")
     Browser.close_window()
     Browser.switch_to_default_window()
     
     Log.stop_test()
Esempio n. 2
0
    def test_case_search_002(self):
        Conf.CASE_NAME = "test_case_search_002"
        Log.start_test(Conf.CASE_NAME)

        POFS_OVERVIEW_SEARCH = Element.find_element(
            By.XPATH, u'//a[@id="b"][@href="overview/overview.jsp"]')
        POFS_OVERVIEW_SEARCH.click()

        POFS_EXPTYPE = Element.find_elements(
            By.XPATH, u'//select[@name="exportType"]/option')
        POFS_EXPTYPE_CONTENT = Element.get_spinner_values(
            By.XPATH, u'//select[@name="exportType"]/option')
        Element.choose_spinner_value(POFS_EXPTYPE, POFS_EXPTYPE_CONTENT, "LCL")

        POFS_PO_ISSUE_DATE = Element.find_element(
            By.XPATH, u'//img[@src="../images/cal.gif"]')
        POFS_PO_ISSUE_DATE.click()

        Browser.switch_to_new_window()
        Element.date_picker(31, 1, 2008)
        Browser.switch_to_default_window()

        POFS_SEARCH = Element.find_element(By.NAME, u'submit')
        POFS_SEARCH.click()

        POFS_DETAIL = Element.find_element(
            By.XPATH, u'//img[@src="../images/detail.gif"]')
        POFS_DETAIL.click()
        Browser.switch_to_new_window()
        POFS_PONUMBER = Element.find_element(
            By.XPATH,
            u'//*[@id="printable"]/table/tbody/tr[1]/td/table/tbody/tr[2]/td[2]'
        )
        Assert().assert_equal(POFS_PONUMBER.text, "0000434")
        Browser.close_window()
        Browser.switch_to_default_window()

        Log.stop_test()
    def test_tour_order_flight_001(self):
        u"""This is comment of test_case_login_001 shown in report"""
        Conf.CASE_NAME = "test_tour_order_flight_001"
         
        Log.start_test(Conf.CASE_NAME)
        
#         Element.find_element(By.NAME, u'userName').send_keys("a")
#         Element.find_element(By.NAME, u'password').send_keys("a")
#         Element.find_element(By.NAME, u'login').click()
        
        CommonMethod.test_tour_login_common()
        
        
        
        login_flag = Element.find_element(By.XPATH, u'//img[@src="/images/masts/mast_flightfinder.gif"]')
        if login_flag is not None:
            print "Login system successfully."
            Log.step_succ("Login system successfully.")
        else:
            print "Login system failed."
            Log.step_fail("Login system failed.")
            return None
        #### Flight Details
        Element.find_element(By.XPATH, u'//input[@value="oneway"]').click()
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="passCount"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="passCount"]/option'),
                                                  "4")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="fromPort"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromPort"]/option'),
                                                  "Paris")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="fromMonth"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromMonth"]/option'),
                                                  "September")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="fromDay"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromDay"]/option'),
                                                  "9")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="toPort"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="toPort"]/option'),
                                                  "London")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="toMonth"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromMonth"]/option'),
                                                  "October")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="toDay"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="fromDay"]/option'),
                                                  "19")
        
        #### Preferences
        Element.find_element(By.XPATH, u'//input[@value="Business"]').click()
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="airline"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="airline"]/option'),
                                                  "Unified Airlines")
        Element.find_element(By.NAME, "findFlights").click()
        
        #### DEPART
        if "DEPART" in Element.find_element(By.XPATH, u'//font[@color="#FF9900"][text()="DEPART"]').text:
            print "Navigate success, please choosing departure item."
            Log.step_succ("Navigate success, please choosing departure item.")
        else:
            print "Navigate failed, please check info in FLIGHT FINDER."
            Log.step_fail("Navigate failed, please check info in FLIGHT FINDER.")
            return None
        
        Element.find_element(By.XPATH, u'//input[@value="Pangea Airlines$362$274$9:17"][@name="outFlight"]').click()
        #### RETURN
        Element.find_element(By.XPATH, u'//input[@value="Blue Skies Airlines$631$273$14:30"][@name="inFlight"]').click()
        Element.find_element(By.NAME, u'reserveFlights').click()
        
        #### BOOK A FLIGHT
        book_flight = Element.find_element(By.XPATH, u'//img[@src="/images/masts/mast_book.gif"]')
        if book_flight is not None:
            print "Navigate success, please complete the form to book the flight online."
            Log.step_succ("Navigate success, please complete the form to book the flight online.")
        else:
            print "Navigate failed, please check DEPART/RETURN info in SELECT FLIGHT."
            Log.step_fail("Navigate failed, please check DEPART/RETURN info in SELECT FLIGHT.")
            return None
        
        Element.find_element(By.NAME, u'passFirst0').send_keys("Jiefeng")
        Element.find_element(By.NAME, u'passLast0').send_keys("Gao")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="pass.0.meal"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="pass.0.meal"]/option'),
                                                  "Diabetic")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="creditCard"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="creditCard"]/option'),
                                                  "Discover")
        Element.find_element(By.NAME, u'creditnumber').send_keys("0000000000000000000")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="cc_exp_dt_mn"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="cc_exp_dt_mn"]/option'),
                                                  "06")
        Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="cc_exp_dt_yr"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="cc_exp_dt_yr"]/option'),
                                                  "2008")
        Element.find_element(By.NAME, u'cc_frst_name').send_keys("Gao")
        Element.find_element(By.NAME, u'cc_mid_name').send_keys("Jie")
        Element.find_element(By.NAME, u'cc_last_name').send_keys("feng")
        Element.find_element(By.NAME, u'ticketLess').click()
        
        Element.checkbox_all(Element.find_elements(By.NAME, u'ticketLess'))
        
        Element.find_element(By.NAME, u'buyFlights').click()
        
        #### FLIGHT CONFIRMATION
        confirmation_message = Element.find_element(By.XPATH, u'//img[@src="/images/masts/mast_confirmation.gif"]')
        if confirmation_message is not None:
            print "Book a flight successfully."
            Log.step_succ("Book a flight successfully.")
        else:
            print "Book a flight failed."
            Log.step_fail("Book a flight failed.")
        
        Element.find_element(By.XPATH, u'//img[@ src="/images/forms/home.gif"]').click()
        
        """Here's something should do calculate :
                Total Taxes:      $44 USD
                Total Price (including taxes):      $584 USD
        """
        
        Browser.navigate_to(Conf.URL)
        Log.stop_test()
Esempio n. 4
0
    def test_tour_register_001(self):
        u"""This is comment of test_case_login_001 shown in report"""
        Conf.CASE_NAME = "test_tour_register_001"
        register_text = "000To create your account, we'll need some basic information about you. This information will be used to send reservation confirmation emails, mail tickets when needed and contact you if your travel arrangements change. Please fill in the form completely."
         
        Log.start_test(Conf.CASE_NAME)
        
        Element.find_element(By.LINK_TEXT, u'REGISTER').click()
        time.sleep(2)
        register_desc = Element.find_element(By.XPATH, u'html/body/div[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/p/font').text
        if "To create your account" in register_desc:
            Log.step_succ("Navigate to register page successfully.")
            Assert().assert_equal(register_text, register_desc)
            
            excel = Datadriver.ExcelSheet(r"Employee.xlsx", "Sheet2")
            
            for i in range(1, excel.nrows()):
                first_name       = excel.cell(i, "first")
                last_name        = excel.cell(i, "last")
                phone            = excel.cell(i, "phone")
                email            = excel.cell(i, "email")
                address1         = excel.cell(i, "address1")
                address2         = excel.cell(i, "address2")
                city             = excel.cell(i, "city")
                state            = excel.cell(i, "state")
                postal           = excel.cell(i, "postal")
                country          = excel.cell(i, "country")
                username         = excel.cell(i, "username")
                password         = excel.cell(i, "password")
                confirm_password = excel.cell(i, "confirm_password")
                
                if first_name !="":
                    Element.find_element(By.NAME, u'firstName').send_keys(first_name)
                if last_name != "":
                    Element.find_element(By.NAME, u'lastName').send_keys(last_name)
                if phone !="":
                    Element.find_element(By.NAME, u'phone').send_keys(phone)
                if email !="":
                    Element.find_element(By.NAME, u'userName').send_keys(email)
                if address1 !="":
                    Element.find_element(By.NAME, u'address1').send_keys(address1)
                if address2 !="":
                    Element.find_element(By.NAME, u'address2').send_keys(address2)
                if city !="":
                    Element.find_element(By.NAME, u'city').send_keys(city)
                if state !="":
                    Element.find_element(By.NAME, u'state').send_keys(state)
                if postal !="":
                    Element.find_element(By.NAME, u'postalCode').send_keys(postal)
                if country != "":
                    Element.choose_spinner_value(Element.find_elements(By.XPATH, u'//select[@name="country"]/option'),
                                                  Element.get_spinner_values(By.XPATH, u'//select[@name="country"]/option'),
                                                  "ANGOLA")
                if username != "":
                    Element.find_element(By.NAME, u'email').send_keys(username)
                if password != "":
                    Element.find_element(By.NAME, u'password').send_keys(password)
                if confirm_password != "":
                    Element.find_element(By.NAME, u'confirmPassword').send_keys(confirm_password)
                Element.find_element(By.NAME, u'register').click()
        else:
            Log.step_fail("Navigate to register page failed.")
        
        register_succ_desc = Element.find_element(By.XPATH, u'html/body/div[1]/table/tbody/tr/td[2]/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[3]/td/p[1]/font/b').text
        if "Dear" in register_succ_desc:
            Log.step_succ("Register for user %s successfully." % username)
        else:
            Log.step_fail("Register for user %s failed." % username)
        
#         Browser.navigate_to( Conf.URL)
        Log.stop_test()