コード例 #1
0
ファイル: test_02_bootstrap.py プロジェクト: zlmone/EasyTest
 def test_01_login(self):
     """登录"""
     login.LoginPage().wait_page()
     self.set_fastinput_ime()
     login.LoginPage().input_phone(self.test_data['user_name'])
     login.LoginPage().input_password(self.test_data['password'])
     login.LoginPage().click_login_btn()
コード例 #2
0
ファイル: conftest.py プロジェクト: lin2005da/prac_web
def init_driver():
    print("begin driver")
    driver = webdriver.Chrome()
    login_page = login.LoginPage(driver)
    login_page.get()
    yield (login_page, driver)
    print("quit driver")
    driver.quit()
コード例 #3
0
 def test_01_install_apk(self):
     """安装启动android_app_bootstrap"""
     self.d.app_uninstall(pkg_name)
     # self.d.app_install(apk_url)
     self.local_install(apk_path)
     self.d.app_start(pkg_name)
     time.sleep(3)
     login.LoginPage().wait_page()
コード例 #4
0
ファイル: test_02_bootstrap.py プロジェクト: zlmone/EasyTest
 def test_06_Bar_click(self):
     """主页操作并退出"""
     HomePage().click_tab(1)
     HomePage().click_tab(2)
     HomePage().click_tab(3)
     HomePage().click_tab(4)
     HomePage().click_logout_btn()
     login.LoginPage().wait_page()
コード例 #5
0
ファイル: conftest.py プロジェクト: lin2005da/prac_web
def baselogin():
    driver = webdriver.Chrome()
    login_page = login.LoginPage(driver)
    login_page.get()
    login_page.submit(cf.get_value('page', 'user1'),
                      cf.get_value('page', 'pwd'))
    bid_page = bid.Bid(driver)
    bid_page.option_click()
    yield (bid_page, driver)
    driver.quit()
コード例 #6
0
class AbTemplate(BaseCase):
    step = "prepare to start"
    # Running times
    # If timeout,
    # This is used to determine whether to run setUp again.
    flag = 1

    # Tester account login info
    login_account = "*****@*****.**"
    login_password = "******"
    # This should pass any validate code
    login_captcha = "eu3hfs7envhs8#"

    # case value
    username_value = "林嘉敏"

    # Define login page and index page
    login_page = login.LoginPage()
    index_page = index.IndexPage()

    def get_browser_img(self):
        if not os.path.exists(UrlUtil.image_dir):
            os.makedirs(UrlUtil.image_dir)

        self.driver.get_screenshot_as_file(UrlUtil.image_dir + "\\" +
                                           self.case_id + ".png")

    # utils load
    def util_load(self, file):
        file_name = os.path.basename(file)
        file_name = file_name.replace(".pyc", "_case").replace(".py", "_case")
        name_info = file_name.split("_", 1)

        self.case_id = name_info[0]
        self.case_name = name_info[1]
        self.logger = Logger(self.case_id)
        self.case_info = CaseInfo(self.case_id, self.case_name,
                                  "Functional testing")
        self.case_info.set_log_path(self.logger.log_file_rel_report)

    def timeout_method(self):
        self.flag += 1
        self.case_info.step = self.step
        self.logger.error("time out exception")
        self.case_info.error_info = "time out exception"
        self.get_browser_img()
        raise TimeoutException

    def exception_method(self, err):
        self.case_info.step = self.step
        self.logger.error(err)
        self.case_info.error_info = err
        self.get_browser_img()

    def finally_method(self):
        self.case_info.end_time = DateUtil.get_date_to_second()
        time.sleep(2)
        self.driver.quit()

    #

    def setUp(self):
        self.driver = CaseUtil.get_driver()

        self.step = "convert to login page"
        self.convert_to_url(UrlUtil.get_login_page_url())

        self.step = "fill login_name"
        self.fill(self.login_page.account_box, self.login_account)

        self.step = "fill password"
        self.fill(self.login_page.password_box, self.login_password)

        self.step = "fill verification_code"
        self.fill(self.login_page.captcha_box, self.login_captcha)

        self.step = "click login button"
        self.enter(self.login_page.submit_button)
        self.find_element(self.index_page.username_info)

    def tearDown(self):
        ReportUtil.write_to_report(self.case_info)
コード例 #7
0
ファイル: test_02_bootstrap.py プロジェクト: zlmone/EasyTest
 def test_07_login_again(self):
     """再次登录"""
     login.LoginPage().click_login_btn()
コード例 #8
0
        return self.btn().click()


if __name__ == '__main__':
    # a='2553577255.48元'
    # print(type(a))
    # print(a[0:-1])
    #
    from page import login
    from selenium import webdriver
    from common import read_conf
    cf = read_conf.Config()
    from page import asserty_index

    driver = webdriver.Chrome()
    login_page = login.LoginPage(driver)
    login_page.get()
    login_page.submit(cf.get_value('page', 'user1'),
                      cf.get_value('page', 'pwd'))
    bid_page = Bid(driver)
    # 首页点击项目
    bid_page.option_click()
    x = bid_page.ori_money()
    print(x)
    bid_page.invest_send('100')

    bid_page.submit_click()
    # 校验成功
    asserty_index.index(driver).success_bidinfo
    bid_page.btn_click()
    y = bid_page.up_money()