Ejemplo n.º 1
0
 def test_deliver(self, password, name, region, status, source, name_2,
                  region_2, num, expect):
     try:
         deliver_data = {
             'passwd': password,
             'name': name,
             'region': region,
             'status': status,
             'source': source,
             'name_2': name_2,
             'region_2': region_2,
             'num': num
         }
         sql = f'select count(customer_id) from customer'
         result = Utility.query_one(path, sql)
         self.train.do_submit(path, deliver_data)
         new_result = Utility.query_one(path, sql)
         if new_result[0] - result[0] != 1:
             actual = 'success'
         else:
             actual = 'fail'
         self.assertEqual(actual, expect)
     except Exception as e:
         actual = 'fail'
         self.assertEqual(actual, expect)
Ejemplo n.º 2
0
 def get_driver(cls, path):
     contents = Utility.get_json(path)
     from selenium import webdriver
     driver = getattr(webdriver, contents['BROWSER'])()
     driver.implicitly_wait(10)
     driver.maximize_window()
     return driver
Ejemplo n.º 3
0
    def test_add(self, password, phone, name, condition, SOURCE, expect):

        add_data = {
            'passwd': password,
            'phone': phone,
            'name': name,
            'condition': condition,
            'SOURCE': SOURCE
        }
        #查询新增之前的总数
        sql = f'select count(customer_id) from customer'
        result = Utility.query_one(path, sql)
        self.train.add_student(path, add_data)
        new_result = Utility.query_one(path, sql)
        if new_result[0] - result[0] == 1:
            actual = 'success'
        else:
            actual = 'fail'
        self.assertEqual(actual, expect)
Ejemplo n.º 4
0
 def test_tail(self, password, state, priority, record, expect):
     tail_data = {
         'passwd': password,
         'state': state,
         'priority': priority,
         'record': record
     }
     sql = f'select count(customer_id) from customer'
     result = Utility.query_one(path, sql)
     self.train.do_tail(path, tail_data)
     new_result = Utility.query_one(path, sql)
     resp = self.driver.find_element_by_css_selector(
         '#personal-table > tbody:nth-child(2)')
     # print(resp.text)
     if new_result[0] - result[0] != 1 and record in resp.text:
         actual = 'success'
     else:
         actual = 'fail'
     self.assertEqual(actual, expect)
Ejemplo n.º 5
0
 def miss_login(cls, driver, base_config_path):
     cls.open_page(driver, base_config_path)
     # 通过字典方式传递cookie信息
     contents = Utility.get_json(base_config_path)
     driver.add_cookie({'name': 'userName', 'value': contents['userName']})
     driver.add_cookie({'name': 'userPass', 'value': contents['userPass']})
     driver.add_cookie({'name': 'token', 'value': contents['token']})
     driver.add_cookie({'name': 'workId', 'value': contents['workId']})
     # driver.add_cookie({'name':'rememberMe','value':contents['rememberMe']})
     cls.open_page(driver, base_config_path)
Ejemplo n.º 6
0
 def test_excute_tech(self, question, result, expect):
     contents = {'question': question, 'result': result}
     self.job.excute_tech(contents)
     sql_one = 'select question from skill_record where skillrecord_student_id="858"'
     result_one = Utility.query_one(path, sql_one)
     if contents['question'] == result_one[0]:
         actual = 'add-pass'
     else:
         actual = 'add-fail'
     self.assertEqual(actual, expect)
Ejemplo n.º 7
0
 def test_console_query_six(self):
     self.report.click_console()
     # 上周
     self.report.click_oldweek_console()
     sql_six = 'select count(last_status) from customer where work_id = "23" and last_status="新认领"'
     result_six = Utility.query_one(path, sql_six)
     if self.driver.find_element_by_xpath('//table[@id="成都"]/tbody/tr[2]/td[8]').text == result_six[0]:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 8
0
 def test_console_query_two(self):
     self.report.click_console()
     # 当期
     self.report.click_evedate_console()
     sql_two = 'select count(last_status) from customer where work_id="11" and last_status="已认领"'
     result_two = Utility.query_one(path, sql_two)
     if self.driver.find_element_by_xpath('//table[@id="成都"]/tbody/tr[1]/td[9]').text == result_two[0]:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 9
0
 def test_market_data_eight(self):
     self.report.click_market()
     # 本年
     self.report.click_market_eveyear_console()
     sql_eight = 'select count(department_id) from customer where "2020-01-01"<=create_time<="2020-04-13"'
     result_eight = Utility.query_one(path, sql_eight)
     if result_eight[0] == 2:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 10
0
 def test_market_data_seven(self):
     self.report.click_market()
     # 上月
     self.report.click_market_oldmonth_console()
     sql_seven = 'select count(department_id) from customer where "2020-03-01"<=create_time<="2020-03-31"'
     result_seven = Utility.query_one(path, sql_seven)
     if result_seven[0] == 0:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 11
0
 def test_market_data_six(self):
     self.report.click_market()
     # 上周
     self.report.click_market_oldweek_console()
     sql_six = 'select count(department_id) from customer where "2020-04-06"<=create_time<="2020-04-12"'
     result_six = Utility.query_one(path, sql_six)
     if result_six[0] == 0:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 12
0
 def test_market_data_three(self):
     self.report.click_market()
     # 今日
     self.report.click_market_eveday_console()
     sql_three = 'select count(department_id) from customer where create_time="2020-04-13"'
     result_three = Utility.query_one(path, sql_three)
     if result_three[0] == 2:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 13
0
 def test_market_data_two(self):
     self.report.click_market()
     # 当期
     self.report.click_market_evedate_console()
     sql_two = 'select count(department_id) from customer where "2020-01-31"<=create_time<="2020-03-31'
     result_two = Utility.query_one(path, sql_two)
     if result_two[0] == 0:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 14
0
 def get_session(cls, sum):
     base_info = Utility.get_json('..\\config\\base.conf')
     login_url = "%s://%s:%s/%s/" % (
         base_info['PROTOCOL'],
         base_info['HOSTNAME'],
         base_info['PORT'],
         base_info['AURL'],
     )
     print(login_url)
     base_data = Utility.get_json('..\\config\\Account.conf')
     login_data = {
         'userName': base_data[sum]['userName'],
         'userPass': base_data[sum]['userPass'],
         'checkcode': base_data[sum]['checkcode']
     }
     print(login_data)
     session = requests.session()
     resp = session.post(login_url, login_data)
     print(resp.text)
     return session
Ejemplo n.º 15
0
 def test_sale_data_eight(self):
     self.report.click_sale()
     # 本年
     self.report.click_sale_eveyear_console()
     sql_eight = 'select count(last_status) from customer where work_id = "66" and last_status="已认领"'
     result_eight = Utility.query_one(path, sql_eight)
     if self.driver.find_element_by_xpath('//table[@id="成都"]/tbody/tr[2]/td[9]').text == result_eight[0]:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, 'query-pass')
Ejemplo n.º 16
0
 def test_public(self, password, name, status, source, ucus, num, expect):
     claim_data = {
         'passwd': password,
         'name': name,
         'status': status,
         'source': source,
         'ucus': ucus,
         'num': num
     }
     sql = f'select count(customer_id) from customer'
     result = Utility.query_one(path, sql)
     self.train.do_claim(path, claim_data)
     resp = self.driver.find_element_by_id('public-pool-table')
     self.train.affirm_claim()
     new_result = Utility.query_one(path, sql)
     if ucus not in resp.text and new_result[0] - result[0] != 1:
         actual = 'success'
     else:
         actual = 'fail'
     self.assertEqual(actual, expect)
Ejemplo n.º 17
0
 def test_console_query_one(self, starttime, endtime, expect):
     self.report.click_console()
     # 搜索
     self.report.input_console_date(starttime, endtime)
     self.report.click_cnsole_query()
     sql_one = 'select count(last_status) from customer where work_id = "23" and last_status="新认领"'
     result_one = Utility.query_one(path, sql_one)
     if self.driver.find_element_by_xpath('//table[@id="成都"]/tbody/tr[2]/td[8]').text == result_one[0]:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, expect)
Ejemplo n.º 18
0
 def test_market_data_one(self, starttime, endtime, expect):
     self.report.click_market()
     # 搜索
     self.report.input_market_date(starttime, endtime)
     self.report.click_market()
     sql_one = 'select count(department_id) from customer where create_time="2020-04-13"  '
     result_one = Utility.query_one('../config/base.conf', sql_one)
     if result_one[0] == 2:
         actual = 'query-pass'
     else:
         actual = 'query-fail'
     self.assertEqual(actual, expect)
Ejemplo n.º 19
0
 def test_resource(self, password, source, ucus, num, name, expect):
     try:
         res_data = {
             'passwd': password,
             'source': source,
             'ucus': ucus,
             'num': num,
             'name': name
         }
         sql = f'select count(customer_id) from customer'
         result = Utility.query_one(path, sql)
         self.train.resource_submit(path, res_data)
         resp = self.driver.find_element_by_id('allot-table')
         new_result = Utility.query_one(path, sql)
         if ucus not in resp.text and new_result[0] - result[0] != 1:
             actual = 'success'
         else:
             actual = 'fail'
         self.assertEqual(actual, expect)
     except Exception as e:
         actual = 'fail'
         self.assertEqual(actual, expect)
Ejemplo n.º 20
0
 def test_edit(self, password, name, phone, intention, workage, expect):
     try:
         edit_data = {
             'passwd': password,
             'name': name,
             'phone': phone,
             'intention': intention,
             'workage': workage
         }
         sql = f'select count(customer_id) from customer'
         result = Utility.query_one(path, sql)
         self.train.edit_customer(path, edit_data)
         new_result = Utility.query_one(path, sql)
         resp = self.driver.find_element_by_css_selector(
             '#personal-table > tbody:nth-child(2)')
         if new_result[0] - result[0] != 1 and name in resp.text:
             actual = 'success'
         else:
             actual = 'fail'
         self.assertEqual(actual, expect)
     except Exception as e:
         actual = 'fail'
         self.assertEqual(actual, expect)
Ejemplo n.º 21
0
from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.report import Report
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

date_datas = Utility.get_json('../config/testdata_dengyu.conf')
console_data = Utility.get_excel_GUI_tuple(date_datas[7])
sale_data = Utility.get_excel_GUI_tuple(date_datas[8])
market_data = Utility.get_excel_GUI_tuple(date_datas[9])
job_data = Utility.get_excel_GUI_tuple(date_datas[10])

path = Service.choose_path()
class TestReport(unittest.TestCase):

    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.miss_login(self.driver, path)
        self.driver.find_element_by_link_text(u'报表中心').click()
        self.report = Report(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
        self.driver.quit()
Ejemplo n.º 22
0
import unittest
import time
from selenium.webdriver.common.by import By

from parameterized import parameterized

from woniuboss2_ui.lib.training_ui import Train
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

train_data = Utility.get_json('..\\config\\testdata.conf')
query_seek = Utility.get_excel_GUI_tuple(train_data[0])
query_add = Utility.get_excel_GUI_tuple(train_data[1])
query_edit = Utility.get_excel_GUI_tuple(train_data[2])
query_tail = Utility.get_excel_GUI_tuple(train_data[3])
query_delt = Utility.get_excel_GUI_tuple(train_data[4])

query_deliver = Utility.get_excel_GUI_tuple(train_data[5])
query_look = Utility.get_excel_GUI_tuple(train_data[6])

query_public = Utility.get_excel_GUI_tuple(train_data[7])

query_resource = Utility.get_excel_GUI_tuple(train_data[8])
query_prorate = Utility.get_excel_GUI_tuple(train_data[9])
print(query_prorate)

path = Service.choose_path()


class Training(unittest.TestCase):
    def setUp(self):
Ejemplo n.º 23
0
from selenium.webdriver.common.by import By

from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.login import Login
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

login_datas = Utility.get_json("../config/testdata_dengyu.conf")
login_data = Utility.get_excel_GUI_tuple(login_datas[0])

path = Service.choose_path()


class TestLogin(unittest.TestCase):
    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.open_page(self.driver, path)
        self.login = Login(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
        self.driver.quit()

    # 测试登录功能
    @parameterized.expand(login_data)
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.enterprise import Enterprise
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

enterprise_datas = Utility.get_json('../config/testdata_dengyu.conf')
enterprise_add_data = Utility.get_excel_GUI_tuple(enterprise_datas[4])
enterprise_edit_data = Utility.get_excel_GUI_tuple(enterprise_datas[5])
enterprise_query_data = Utility.get_excel_GUI_tuple(enterprise_datas[6])

path = Service.choose_path()


class TestEnterprise(unittest.TestCase):
    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.miss_login(self.driver, path)
        self.driver.find_element_by_link_text(u'企业客户').click()
        self.enterprise = Enterprise(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
#Author:
#CreatDate:
#Version:
#====#====#====#====
from selenium.webdriver.common.by import By

from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.student import Student
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

student_datas = Utility.get_json("../config/testdata.conf")
student_data = Utility.get_excel_GUI_tuple(student_datas[1])

path = Service.choose_path()


class TestStudent(unittest.TestCase):
    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.open_page(self.driver, path)
        self.student = Student(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
Ejemplo n.º 26
0
#Author:
#CreatDate:
#Version: 
#====#====#====#====
from selenium.webdriver.common.by import By

from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.student_leave import StudentLeave
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

student_leave_datas = Utility.get_json("../config/testdatawangqi.conf")
student_leave_data = Utility.get_excel_GUI_tuple(student_leave_datas[2])
path = Service.choose_path()
class TestLeave(unittest.TestCase):

    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.open_page(self.driver, path)
        self.leave = StudentLeave(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
        self.driver.quit()
Ejemplo n.º 27
0
from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.job import Job
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

jpb_datas = Utility.get_json('../config/testdata_dengyu.conf')
tech_data = Utility.get_excel_GUI_tuple(jpb_datas[11])
edit_one_data = Utility.get_excel_GUI_tuple(jpb_datas[12])
edit_two_data = Utility.get_excel_GUI_tuple(jpb_datas[13])
edit_three_data = Utility.get_excel_GUI_tuple(jpb_datas[14])

path = Service.choose_path()


class Testjob(unittest.TestCase):
    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.miss_login(self.driver, path)
        self.driver.find_element_by_link_text(u'就业管理').click()
        self.job = Job(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
        self.driver.quit()
Ejemplo n.º 28
0
 def open_page(cls, driver, path):
     contents = Utility.get_json(path)
     URL = 'http://%s:%s/%s' % (contents['HOSTNAME'], contents['PORT'],
                                contents['AURL'])
     driver.get(URL)
Ejemplo n.º 29
0
import time
import unittest
from parameterized import parameterized
from selenium.webdriver.common.by import By

from woniuboss2_ui.lib.renshi_manage import EmployManage
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

test_config_info = Utility.get_json('..\\config\\testdataduyuexin.conf')
technical_interview_info = Utility.get_excel_GUI_tuple(test_config_info[2])
mock_interview_info = Utility.get_excel_GUI_tuple(test_config_info[3])

path = Service.choose_path()


class EmployTest(unittest.TestCase):
    def setUp(self):
        self.driver = Service.get_driver(path)
        self.employ = EmployManage(self.driver)

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

    @parameterized.expand(technical_interview_info)
    def test_technical_interview(self, q_content, e_content, expect):
        technical_interview_data = {
            'question_content': q_content,
            'evalute_content': e_content
        }
        # 执行技术面试的操作
Ejemplo n.º 30
0
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait

from parameterized import parameterized
import unittest
import time

# 获取测试数据
from woniuboss2_ui.lib.market import Market
from woniuboss2_ui.tools.service import Service
from woniuboss2_ui.tools.utility import Utility

market_datas = Utility.get_json("../config/testdata_dengyu.conf")
market_decode_data = Utility.get_excel_GUI_tuple(market_datas[1])
market_add_data = Utility.get_excel_GUI_tuple(market_datas[2])
market_upload_data = Utility.get_excel_GUI_tuple(market_datas[3])

path = Service.choose_path()
class TestMarket(unittest.TestCase):

    def setUp(self):
        print('test start')
        self.driver = Service.get_driver(path)
        Service.miss_login(self.driver, path)
        self.driver.find_element_by_link_text(u'市场营销').click()
        self.market = Market(self.driver)

    def tearDown(self):
        print('test over')
        time.sleep(2)
        self.driver.quit()