Пример #1
0
 def test_03(self):
     login_action = LoginAction(self.base_page.driver)
     main_page = login_action.default_login()
     quit_action = QuitAction(main_page.driver)
     login_page = quit_action.quit()
     actual_result = login_page.get_title()
     self.assertEqual(actual_result.__contains__('用户登录'), True, 'test_quit 用例不通过')
    def test_login_fail(self):
        test_function_data = self.test_class_data['test_login_fail']
        self._testMethodDoc = test_function_data['test_name']

        login_action = LoginAction(self.base_page.driver)
        actual_result = login_action.login_fail(
            test_function_data['test_parameter'].get('username'),
            test_function_data['test_parameter'].get('password'))
        print('actual_result:%s' % actual_result)
        self.assertEqual(actual_result, test_function_data['excepted_result'])
    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'))
        # self.assertEqual('测试人员1','测试人员1','test01登录失败')
        self.assertEqual(main_page.get_username(),
                         test_function_data['excepted_result'], 'test01登录失败')
    def test_quit(self):
        test_function_data = self.test_class_data['test_quit']
        self._testMethodDoc = test_function_data['test_name']

        login_action = LoginAction(self.base_page.driver)
        main_page = login_action.default_login()

        quit_action = QuitAction(main_page.driver)
        login_page = quit_action.quit()
        actual_result = login_page.get_title()
        self.assertEqual(
            actual_result.__contains__(test_function_data['excepted_result']),
            True, 'test_quit 用例不通过')
# encoding: utf-8
#@author: newdream_daliu
#@file: test_main_page.py
#@time: 2020-08-09 16:22
from common.browser import Browser
from actions.login_ation import LoginAction

if __name__ == "__main__":
    driver = Browser().get_driver()
    driver.get('http://47.107.178.45/zentao/www/index.php?m=user&f=login')
    main_page = LoginAction(driver).login_success('test01', 'newdream123')
    value = main_page.get_username()
    print(value)