Пример #1
0
 def test_login_success(self):
     test_function_data = self.test_class_data['test_login_success']   #  把登录成功的参数传入进来
     self._testMethodDoc = test_function_data['test_name']
     login_action = LoginAction( self.base_page.driver )
     main_page = login_action.login_success(test_function_data['test_parameter'].get('username'),test_function_data['test_parameter'].get('password'))
     actual_result = main_page.get_username()
     self.assertEqual(actual_result,test_function_data['excepted_result'],'test_login_success用例执行失败')
Пример #2
0
 def test_login_success(self):
     login_action = LoginAction(self.base_page.driver)
     main_page = login_action.login_success('admin', 'Lrh19960912')
     a = main_page.get_usename()
     print(a)
     self.assertEqual(main_page.get_usename(), 'admin',
                      'test_login_success用例执行失败')
Пример #3
0
 def test_login_success(self):
     test_function_data = self.test_class_info['test_login_success']
     login_action = LoginAction(self.base_page.driver)
     main_page = login_action.login_success(
         test_function_data['test_parameter'].get('user_name'),
         test_function_data['test_parameter'].get('password'))
     self.assertEqual(main_page.get_user_name(),
                      (test_function_data['excepted_result']),
                      test_function_data['fail_information'])
Пример #4
0
 def test_login_success(self):
     print(self.test_data_utils.get_is_run('test_login_success'))
     test_case_data = self.test_data['test_login_success']
     self._testMethodDoc = test_case_data['test_case_name']  # 测试用例名称
     login_action = LoginAction(self.base_page.driver)
     # 从测试用例数据中取出相应的字段(测试数据,期望结果等)
     main_page = login_action.login_success(
         test_case_data['test_parameter'].get('username'),
         test_case_data['test_parameter'].get('password'))
     actual_result = main_page.get_username()
     self.assertEqual(actual_result, test_case_data['expect_result'],
                      'test_login_success执行失败')
     self.base_page.screenshot_as_file()
Пример #5
0
    def test_goto_add_product(self):
        test_function_data = self.test_class_data['test_goto_add_product']
        login_action = LoginAction(self.base_page.driver)
        main_page = login_action.login_success(
            test_function_data['test_parameter'].get('username'),
            test_function_data['test_parameter'].get('password'))
        product_action = ProductAction(main_page.driver)
        product_page = product_action.goto_product()
        add_product_action = AddProductAction(product_page.driver)
        add_product_page = add_product_action.goto_add_product()
        actual_result = add_product_page.get_title()
        self.assertEqual(
            actual_result.__contains__(test_function_data['excepted_result']),
            True, 'test_goto_add_product用例测试不通过')

        # def test_add_product_name_null(self):
        #     test_function_data = self.test_class_data['test_add_product_name_null']
        #     self.login_action = LoginAction(self.base_page.driver)
        #     main_page = self.login_action.login_success(test_function_data['test_parameter'].get('username'),
        #                                                 test_function_data['test_parameter'].get('password'))
        product_action = main_page.goto_product()
Пример #6
0
 def test_login_success(self):
     login_action = LoginAction(self.base_page.driver)
     main_page = login_action.login_success('test01', 'newdream123')
     actual_result = main_page.get_username()
     self.assertEqual(actual_result, '测试人员1', 'test_login_success执行失败')
Пример #7
0
 def test_login_success(self):
     login_action = LoginAction(self.base_page.driver)
     main_page = login_action.login_success(config.user_name,
                                            config.password)
     self.assertEqual(main_page.get_user_name(), config.user_name,
                      '测试用例-登录成功:执行失败')
    def goto_product(self):
        self.main_page.goto_product()
        return ProductPage(self.product_page.driver)


class AddProductAction(ProductAction):
    def goto_add_product(self):
        self.add_product_page.click_add_product_button()
        return AddProductPage(self.product_page.driver)

    def add_product_succeed(self, product_name, product_code):
        add_product_page = self.add_product_action.goto_add_product()
        add_product_page.sendkeys_product_name_input(product_name)
        add_product_page.sendkeys_product_code_input(product_code)
        add_product_page.target_locator()
        add_product_page.click_save_button()


if __name__ == '__main__':
    driver = Browser().get_driver()
    login = LoginAction(driver)
    bp = BasePage(driver)
    bp.set_browser_max()
    bp.open_url(local_config.url)
    login.login_success('chenjianglin', '1q2w3e4r,')
    # pna = ProductAction(driver)
    # pna.goto_product()
    ad = AddProductAction(driver)
    # ad.goto_add_product()
    ad.add_product_succeed('', '1q2w3e4r,')
Пример #9
0
 def test_login_success(self):
     test_data = self.testdata['test_login_success']
     self._testMethodDoc = test_data['test_name']
     login_action = LoginAction(self.base_page.driver)
     result = login_action.login_success(test_data['test_para']['username'], test_data['test_para']['password'])
     self.assertEqual(result, test_data['export'], '登陆断言失败')