class ChangePassword(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.cpp = ChangePwdPage(self.driver) self.lp = LoginPage(self.driver) def test_change_password(self): u"""修改密码""" # self.driver = webdriver.Firefox() # #登录 # login.Login(self) # #修改密码 # driver = self.driver self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 修改密码 self.cpp.click01() self.cpp.click02() self.cpp.send01("123456") self.cpp.send02("123456") self.cpp.send03("123456") self.cpp.click03() def tearDown(self): time.sleep(2) self.driver.close()
class AddPermissionGroup(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddPermissionGroupPage(self.driver) self.lp = LoginPage(self.driver) def test_more_add_permission_group(self): u"""添加权限组""" # 读取csv文件数据 with open("D:\\mzmy\\add_csv\\add_permission_group.csv") as apg: apg = csv.reader(apg) for a in apg: if a[0] == "权限组名称": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入管理员设置 self.apt.click01() self.apt.click02() self.apt.click03() # 添加权限组 self.apt.click04() self.apt.click05() self.apt.send01(a[0]) self.apt.click06() def tearDown(self): time.sleep(2) self.driver.close()
class AddPackageType(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddPackageTypePage(self.driver) self.lp = LoginPage(self.driver) def test_add_package_type(self): u"""添加套餐类型""" with open("E:\\mzmy\\csv_add\\add_package_type.csv") as apt: apt = csv.reader(apt) for a in apt: if a[0] == "类型名称": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入基础类型设置 self.apt.click01() self.apt.click02() self.apt.click03() # 新增套餐类型 self.apt.click04() self.apt.click05() self.apt.send01(a[0]) self.apt.click06() def tearDown(self): time.sleep(2) self.driver.close()
class LoginOut(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.lop = LoginOutPage(self.driver) self.lp = LoginPage(self.driver) def test_login_out(self): u"""注销""" # self.driver = webdriver.Firefox() # #登录 # login.Login(self) # driver = self.driver self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 注销用户 self.lop.click01() self.lop.click02() def tearDown(self): time.sleep(2) self.driver.close()
class LoginCase(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.lp = LoginPage(self.driver) def test_Login_success(self): self.driver.get(self.url) self.driver.maximize_window() self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button()
class Add_Package(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddPackagePage(self.driver) self.lp = LoginPage(self.driver) def test_add_package(self): u"""添加套餐""" with open("D:\\mzmy\\add_csv\\add_package.csv") as adg: adg = csv.reader(adg) for a in adg: if a[0] == "套餐编号": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入疗程套餐界面 self.apt.click01() self.apt.click02() self.apt.click03() # 新增套餐 self.apt.click04() self.apt.click05() self.apt.send06(a[0]) self.apt.click07() self.apt.send08(a[1]) self.apt.click09() self.apt.click10() self.apt.click11() self.apt.click12() self.apt.click13() self.apt.click14() # 使用JS脚本,将滚动条拖到指定地方 target = self.apt.click15() self.driver.execute_script( "arguments[0].scrollIntoView();", target) self.apt.click16() self.apt.click17() self.apt.click18() self.apt.click19() def tearDown(self): time.sleep(2) self.driver.close()
class AddEmployee(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddEmployeePage(self.driver) self.lp = LoginPage(self.driver) def test_add_employee(self): u"""添加员工""" with open("D:\\mzmy\\add_csv\\add_employee.csv", "r", encoding="gbk") as ae: ae = csv.reader(ae) for a in ae: if a[0] == "姓名": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入员工界面 self.apt.click01() self.apt.click02() self.apt.click03() # 新增员工 self.apt.click04() self.apt.click05() self.apt.send06(a[0]) self.apt.click07() self.apt.click08() self.apt.click09() self.apt.click10() self.apt.click11() self.apt.send12(a[1]) self.apt.click13() self.apt.send14(a[2]) self.apt.click15() self.apt.send16(a[3]) self.apt.click17() self.apt.send18(a[4]) self.apt.click19() self.apt.send20(a[5]) self.apt.click21() def tearDown(self): time.sleep(2) self.driver.close()
class AddManager(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddManagerPage(self.driver) self.lp = LoginPage(self.driver) def test_add_manager(self): u"""添加管理员""" # 读取csv文件数据 with open("D:\\mzmy\\add_csv\\add_manager.csv") as am: am = csv.reader(am) for a in am: if a[0] == "手机号": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入管理员设置 self.apt.click01() self.apt.click02() self.apt.click03() # 添加管理员 self.apt.click04() self.apt.click05() self.apt.send06(a[0]) self.apt.click07() self.apt.send08(a[0]) self.apt.click09() self.apt.send10(a[0]) self.apt.click11() self.apt.click12() self.apt.click13() self.apt.click14() self.apt.click15() def tearDown(self): time.sleep(2) self.driver.close()
class MorePayment(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.mpp = MorePaymentPage(self.driver) self.lp = LoginPage(self.driver) def test_more_payments(self): u"""多个服务项目支付""" for i in range(0, 2): # self.driver = webdriver.Firefox() # #登录 # login.Login(self) # driver = self.driver self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 选择多个服务项目支付 self.mpp.click01() self.mpp.click02() # 选择服务项目 self.mpp.click03() self.mpp.click04() self.mpp.click05() self.mpp.click06() # 添加,选择服务项目 self.mpp.click07() self.mpp.click08() self.mpp.click09() self.mpp.click10() self.mpp.click11() # 结算 self.mpp.click12() self.mpp.click13() self.mpp.click14() self.mpp.click15() def tearDown(self): time.sleep(2) self.driver.close()
class VipSinglePaymentChoseEmployees(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.mpp = VipSinglePaymentChoseEmployeesPage(self.driver) self.lp = LoginPage(self.driver) def test_vip_single_payment_chose_employees(self): u"""会员购买单个项目,选择多个员工""" for i in range(0, 1): self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 会员购买项目 self.mpp.click01() self.mpp.click02() self.mpp.click03() self.mpp.click04() self.mpp.send05("1") self.mpp.click06() # 选择多个员工 self.mpp.click07() self.mpp.click08() self.mpp.click09() self.mpp.click10() self.mpp.click11() self.mpp.click12() self.mpp.click13() self.mpp.click14() self.mpp.click15() self.mpp.click16() self.mpp.click17() # 结算 self.mpp.click18() self.mpp.click19() self.mpp.click20() self.mpp.click21() def tearDown(self): time.sleep(2) self.driver.close()
class SinglePaymentChoseEmployees(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.mpp = SinglePaymentChoseEmployeesPage(self.driver) self.lp = LoginPage(self.driver) def test_single_payment_chose_employees(self): u"""单个服务项目,多个员工,支付""" for i in range(0, 1): self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入收银界面 self.mpp.click01() self.mpp.click02() # 选择购买项目 self.mpp.click03() self.mpp.click04() self.mpp.click05() self.mpp.click06() # 选择多个服务员工 self.mpp.click07() self.mpp.click08() self.mpp.click09() self.mpp.click10() self.mpp.click11() self.mpp.click12() # 结算 self.mpp.click13() self.mpp.click14() self.mpp.click15() self.mpp.click16()
class AddVipMember(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddVipMemberPage(self.driver) self.lp = LoginPage(self.driver) def test_add_vip_member(self): u"""添加会员""" with open("D:\\mzmy\\add_csv\\add_vip_member.csv") as avm: avm = csv.reader(avm) for a in avm: if a[0] == "会员编号": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入收银界面 self.apt.click01() self.apt.click02() # 添加会员 self.apt.click03() self.apt.click04() self.apt.send05(a[0]) self.apt.click06() self.apt.send07(a[0]) self.apt.click08() self.apt.send09(a[0]) self.apt.click10() def tearDown(self): time.sleep(2) self.driver.close()
class AddDepartmentGroup(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddDepartmentGroupPage(self.driver) self.lp = LoginPage(self.driver) def test_add_department_group(self): u"""添加部门分组""" with open("D:\\mzmy\\add_csv\\add_department_group.csv") as adg: adg = csv.reader(adg) for a in adg: if a[0] == "部门名称": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入基础类型设置 self.apt.click01() self.apt.click02() self.apt.click03() # 新增部门分组 self.apt.click04() self.apt.click05() self.apt.click06() self.apt.click07() self.apt.click08() self.apt.send09(a[0]) self.apt.click10() def tearDown(self): time.sleep(2) self.driver.close()
class AddVipCard(unittest.TestCase): def setUp(self): self.driver = webdriver.Firefox() self.url = "https://boss.meizitop.com/#/login" self.apt = AddVipCardPage(self.driver) self.lp = LoginPage(self.driver) def test_add_vip_card(self): u"""添加会员卡""" with open("D:\\mzmy\\add_csv\\add_vipcard.csv") as avc: avc = csv.reader(avc) for a in avc: if a[0] == "会员卡编号": continue else: self.driver.get(self.url) self.driver.maximize_window() # 登陆 self.lp.send_username("18180470015") self.lp.send_password("123456") self.lp.click_button() # 进入会员卡管理 self.apt.click01() self.apt.click02() self.apt.click03() # 添加会员卡 self.apt.click04() self.apt.click05() self.apt.send06(a[0]) self.apt.click07() self.apt.send08(a[1]) self.apt.click09() def tearDown(self): time.sleep(2) self.driver.close()