Exemplo n.º 1
0
class UserHandle(BaseHandle):
    def __init__(self, driver):
        self.driver = driver
        self.userpage = UserPage()

    def to_orderpage(self):
        element = self.driver.set_sigle_wait(self.userpage.get_myorder())
        self.click_element(element)
Exemplo n.º 2
0
    def setUp(self):
        """登录"""
        self.driver = webdriver.Chrome()
        self.driver.get(self.url)
        self.driver.maximize_window()
        # 设置隐式等待
        self.driver.implicitly_wait(30)

        # # 初始化要用到的页面
        self.login_page = LoginPage(self.driver)
        self.user_page = UserPage(self.driver)
        self.merchant_manage_page = MerchantPage(self.driver)

        # 登录
        # 步骤一:输入手机号和密码,登录
        self.login_page.login(test_data_success['username'],
                              test_data_success['pwd'])
        time.sleep(2)
        # 步骤二:获取实际结果
        actual = self.user_page.get_username_text().text

        # 步骤三:断言
        self.assertEqual(actual, test_data_success['expected'])
Exemplo n.º 3
0
def manage_driver():
    """管理浏览器"""
    # 步骤一:初始化浏览器
    driver = webdriver.Chrome()
    # 浏览器最大化
    driver.maximize_window()

    # 步骤二:初始化页面:
    # 申明login_page相关的信息
    login_page = LoginPage(driver)
    user_page=UserPage(driver)

    # 步骤三:通过yield保存manage_browser返回过来的参数
    yield driver, login_page,user_page

    # 步骤四:关闭浏览器
    driver.quit()
Exemplo n.º 4
0
def invest_setup():
    driver = create_dirver()
    driver.maximize_window()
    driver.implicitly_wait(15)
    driver.get(conf.get('env', 'base_url') + conf.get('env', 'url_path'))
    login_page = LoginPage(driver)
    # 登录
    login_page.login(conf.get("test_data", "phone"),
                     conf.get("test_data", "pwd"))
    # 创建首页对象
    index_page = IndexPage(driver)
    # 点击抢投标
    index_page.click_invest_loan()
    # 进入投资页面
    invest_page = InvestPage(driver)
    user_page = UserPage(driver)
    yield invest_page, user_page
    driver.quit()
Exemplo n.º 5
0
 def __init__(self, driver):
     self.driver = driver
     self.userpage = UserPage()
Exemplo n.º 6
0
class TestMerchantManage(unittest.TestCase):
    url = MyConf(url_conf_filename).get_str('url', 'url_login')

    def setUp(self):
        """登录"""
        self.driver = webdriver.Chrome()
        self.driver.get(self.url)
        self.driver.maximize_window()
        # 设置隐式等待
        self.driver.implicitly_wait(30)

        # # 初始化要用到的页面
        self.login_page = LoginPage(self.driver)
        self.user_page = UserPage(self.driver)
        self.merchant_manage_page = MerchantPage(self.driver)

        # 登录
        # 步骤一:输入手机号和密码,登录
        self.login_page.login(test_data_success['username'],
                              test_data_success['pwd'])
        time.sleep(2)
        # 步骤二:获取实际结果
        actual = self.user_page.get_username_text().text

        # 步骤三:断言
        self.assertEqual(actual, test_data_success['expected'])

    def tearDown(self):
        self.driver.quit()

    @ddt.data(*merchant_data_success)
    def test_add_merchant_success(self, test_data_success):
        """新增商户成功"""
        self.merchant_manage_page.add_merchant(
            test_data_success['merchant_name'],
            test_data_success['organ_code'], test_data_success['lega_lName'],
            test_data_success['legal_Idcard'],
            test_data_success['merchant_type'])

        time.sleep(2)
        res_msg = self.merchant_manage_page.get_tis_msg()
        print(res_msg)
        self.assertEqual(test_data_success['expected'], res_msg)

        time.sleep(2)
        # 点击最后一页
        self.merchant_manage_page.click_last_page_button()
        time.sleep(2)

        res_merchant_name = self.merchant_manage_page.get_new_merchant_name()
        print(res_merchant_name)
        self.assertEqual(res_merchant_name, test_data_success['merchant_name'])
        time.sleep(2)

        # 点击修改按钮
        self.merchant_manage_page.get_revise_button()
        # for li in merchant_data_success:
        #     e2 = self.driver.find_element_by_xpath("//a[@data-merchantname='{}']".format(li['merchant_name']))
        #     e2.click()
        #     time.sleep(6)
        time.sleep(6)
 def __init__(self):
     self.user_page = UserPage()
class UserPageHandler:
    def __init__(self):
        self.user_page = UserPage()

    def touch_user_head(self):
        self.user_page.get_user_head().click()