Esempio n. 1
0
# coding:utf-8
from PageObject.AddCompanyPageObject import Add_company
from Base.DriverBase import DriverBase
import unittest
from config import readconfig
from public.GetExcelData import get_excel_data
from PageObject.LoginPageObject import Login
from public.GetToastText import ToastText

driverbase = DriverBase()
companyName = get_excel_data('add_company')
logindata = get_excel_data(('register'))


class AddCompany(unittest.TestCase):
    def setUp(self):
        self.driver = driverbase.open_broswer()
        driverbase.max_window()
        self.driver.implicitly_wait(10)
        self.add = Add_company(self.driver)
        self.login = Login(self.driver)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverbase.quit_broswer()

    # 公司名为空
    def test_add_nullname(self):
        self.add.save_login_cookie(readconfig.inputPhone_cookie,
                                   readconfig.inputPsw_cookie,
                                   readconfig.url_login)  # 登录一次,后面的不用再次登录
# coding:utf-8
import unittest
from PageObject.UploadContractPageObject import Upload_contract
from public.GetExcelData import get_excel_data
from config import readconfig
from Base.DriverBase import DriverBase
from public.SQLconnect import MySQLUtil
from public.GetToastText import ToastText
driverbase = DriverBase()
uploaddata = get_excel_data(('upload_contract'))
sql_data = get_excel_data('sql_data')
mysql = MySQLUtil(db=readconfig.sql_db_qiyuebao)


class UploadContract(unittest.TestCase):
    def setUp(self):
        self.driver = driverbase.open_broswer()
        driverbase.max_window()
        self.driver.implicitly_wait(10)
        self.upload = Upload_contract(self.driver)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverbase.quit_broswer()

    # 上传pdf文件
    def upload_pdf(self):
        mysql.update(sql_data[0]['table'], sql_data[0]['set or search'],
                     sql_data[0]['where'])  # 修改当前公司字段为0
        mysql.update(sql_data[1]['table'], sql_data[1]['set or search'],
                     sql_data[1]['where'])  # 更新 成都知道创宇信息计数有限公司为当前公司
Esempio n. 3
0
# coding:utf-8
from time import sleep
from selenium.webdriver.common.by import By
from config import readconfig
from public.GetExcelData import get_excel_data
from Base.BasePage import BasePage
from public.SQLconnect import MySQLUtil

# from Base.DriverBase import start_driver
mysql = MySQLUtil(db=readconfig.sql_db_qiyuebao)
sqldata = get_excel_data('sql_data')

login_page_btn = (By.XPATH, '/html/body/nav/div/div[2]/ul/li[2]/a')  # 0跳转登录页面
psw_login_btn = (By.XPATH, '//*[@id="login_span_type_pwd"]')  # 1切换密码登录
phone_word = (By.XPATH, '// *[@id = "login_id_input_phone"]')  # 2输入手机号
psw_word = (By.XPATH, '//*[@id ="login_id_input_password"]')  # 3输入密码/验证码
login_btn = (By.XPATH, '//*[@id="login_id_login"]')  # 4确定登录
user_name_text = (By.XPATH, '//*[@class = "dropdown-toggle"]')  # 5登录成功header显示的用户名
get_code_btn = (By.XPATH, '//*[@id = "login_button_get_sms_code"]')  # 6点击获取验证码
forgot_psw_btn = (By.XPATH, '/html/body/div[1]/div/div/form/div[1]/div[5]/a')  # 7点击忘记密码
new_psw_word = (By.XPATH, '//*[@id = "login_id_input_password_new"]')  # 8输入新密码
register_page_btn = (By.XPATH, '/html/body/div[1]/div/div/form/div[2]/a')  # 9点击立即注册
register_phone_word = (By.XPATH, '//*[@id = "user-phone-input"]')  # 10输入注册手机号
register_psw_word = (By.XPATH, '//*[@id = "password-input"]')  # 11输入注册密码
register_name_word = (By.XPATH, '//*[@id = "user-name-input"]')  # 12输入注册用户名
register_code_btn = (By.XPATH, '//*[@id = "v-code-btn"]')  # 13点击注册获取验证码
register_code_word = (By.XPATH, '//*[@id = "v-code-input"]')  # 14输入注册验证码
agree_deal_btn = (By.XPATH, '//*[@class = "ui-checkbox wyydfwxy"]')  # 15勾选同意服务协议框
confirm_register_btn = (By.XPATH, '//*[@id = "register-button"]')  # 16确定注册按钮
back_to_homepage = (By.XPATH, '/html/body/nav/div/div[1]/a/span/span[1]')  # 17返回首页
logout_btn = (By.XPATH, '/html/body/nav/div/div[2]/ul/li[2]/ul/li[4]/a')  # 18点击退出按钮
Esempio n. 4
0
# coding:utf-8
import unittest
from PageObject.LoginPageObject import Login
from public.GetExcelData import get_excel_data
from config import readconfig
from Base.DriverBase import DriverBase
from public.GetToastText import ToastText
url = readconfig.url_login
logindata = get_excel_data('code_login')
sqldata = get_excel_data('sql_data')
driverBase = DriverBase()


class Test_code_login(unittest.TestCase):
    def setUp(self):
        self.driver = driverBase.open_broswer()
        driverBase.max_window()
        self.login = Login(self.driver)
        self.driver.implicitly_wait(10)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverBase.quit_broswer()

    def test_code_login_success(self):
        '''账号验证码正确登录'''
        self.login.send_code_login(url, logindata[0]['phone'])
        codes = self.login.get_code(sqldata[4]['set or search'],
                                    sqldata[4]['table'], sqldata[4]['where'])
        self.login.code_login(codes[0])
        self.assertEqual(self.login.login_success_username(),
Esempio n. 5
0
# coding:utf-8
import unittest
from public.GetExcelData import get_excel_data
from config import readconfig
from Base.DriverBase import DriverBase
from PageObject.LoginPageObject import Login
from PageObject.AddCompanyPageObject import Add_company
from public.GetToastText import ToastText

url = readconfig.url_login
register_data = get_excel_data('register')
sqldata = get_excel_data('sql_data')
driverBase = DriverBase()
companydata = get_excel_data('add_company')


class Test_register(unittest.TestCase):
    def setUp(self):
        self.driver = driverBase.open_broswer()
        driverBase.max_window()
        self.login = Login(self.driver)
        self.addcompany = Add_company(self.driver)
        self.driver.implicitly_wait(10)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverBase.quit_broswer()

    # 注册成功
    def test_register_success(self):
        '''注册成功,进入添加公司页面'''
# conding:utf-8
from Base.DriverBase import DriverBase
from PageObject.AddContractPageObject import Add_Contract
from public.GetExcelData import get_excel_data
from config import readconfig
from public.SQLconnect import MySQLUtil
import unittest
from public.GetToastText import ToastText
driverbase = DriverBase()
contract_data = get_excel_data('add_contract')
sql_data = get_excel_data('sql_data')
mysql = MySQLUtil(db=readconfig.sql_db_qiyuebao)
mysql_yx = MySQLUtil(db=readconfig.sql_db_yx)


class AddContract(unittest.TestCase):
    def setUp(self):
        self.driver = driverbase.open_broswer()
        self.driver.maximize_window()
        self.driver.implicitly_wait(30)
        self.add = Add_Contract(self.driver)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverbase.quit_broswer()

    # 添加已完成契约,添加成功
    def test_add_finish_contract(self):
        try:
            mysql.update(sql_data[0]['table'], sql_data[0]['set or search'],
                         sql_data[0]['where'])  # 修改当前公司字段为0
Esempio n. 7
0
# coding:utf-8
import unittest
from PageObject.LoginPageObject import Login
from public.GetExcelData import get_excel_data
from config import readconfig
from Base.DriverBase import DriverBase
from public.GetToastText import ToastText
url = readconfig.url_login
resetdata = get_excel_data('reset_psw')
sqldata = get_excel_data('sql_data')
driverBase = DriverBase()
logindata = get_excel_data('psw_login')

class Reset_password(unittest.TestCase):
    def setUp(self):
        self.driver = driverBase.open_broswer()
        driverBase.max_window()
        self.login = Login(self.driver)
        self.driver.implicitly_wait(30)
        self.toast = ToastText(self.driver)
    def tearDown(self):
        driverBase.quit_broswer()
    # 修改密码成功
    def reset_success(self):
        '''密码修改成功'''
        self.login.send_code_reset(url,resetdata[0]['phone'])
        codes = self.login.get_code(sqldata[3]['set or search'],sqldata[3]['table'],sqldata[3]['where'])
        self.login.psw_reset(codes[0],resetdata[0]['psw'])
        self.assertEqual(self.toast.sever_toast(),resetdata[0]['except_result'])
    # 手机号为空
    def reset_empty_phone(self):
# coding:utf-8
import unittest
from PageObject.LoginPageObject import Login
from public.GetExcelData import get_excel_data
from config import readconfig
from Base.DriverBase import DriverBase
from public.GetToastText import ToastText
url = readconfig.url_login
logindata = get_excel_data('psw_login')
driverBase = DriverBase()


class Test_psw_login(unittest.TestCase):
    def setUp(self):
        self.driver = driverBase.open_broswer()
        driverBase.max_window()
        self.login = Login(self.driver)
        self.driver.implicitly_wait(10)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverBase.quit_broswer()

    def test_login(self):
        '''账号密码正确登录'''
        # login = Login(self.driver)
        self.login.psw_login(logindata[0]['phone'], logindata[0]['psw'], url)
        self.assertEqual(self.login.login_success_username(),
                         logindata[0]['except_result'])

    def test_login_nullpsw(self):
Esempio n. 9
0
# coding:utf-8
from Base.DriverBase import DriverBase
from PageObject.AddContractPageObject import Add_Contract
from public.GetExcelData import get_excel_data
from config import readconfig
from public.SQLconnect import MySQLUtil
import unittest
from public.GetToastText import ToastText
driverbase = DriverBase()
contract_list_data = get_excel_data('contract_list')
sql_data = get_excel_data('sql_data')
mysql = MySQLUtil(db=readconfig.sql_db_qiyuebao)


class ContractList(unittest.TestCase):
    def setUp(self):
        self.driver = driverbase.open_broswer()
        self.driver.maximize_window()
        self.driver.implicitly_wait(30)
        self.add = Add_Contract(self.driver)
        self.toast = ToastText(self.driver)

    def tearDown(self):
        driverbase.quit_broswer()

    # 待我确认列表取消确认契约
    def test_cancel_confirm_contract(self):
        mysql.update(sql_data[0]['table'], sql_data[0]['set or search'],
                     sql_data[0]['where'])  # 修改当前公司字段为0
        mysql.update(sql_data[1]['table'], sql_data[1]['set or search'],
                     sql_data[1]['where'])  # 更新 成都知道创宇信息计数有限公司为当前公司