class TestProtocol(unittest.TestCase):
    """协议模板模块测试"""
    @classmethod
    def setUpClass(self):
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().passage_manage()
        """准备数据"""
        self.phone = '16612345678'
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['高级设置']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['协议模板']).click()

    def test_A_edit_protocol(self):
        """编辑协议测试"""
        ProtocolPage(self.driver).A_edit_protocol()

    def test_B_restart_protocol(self):
        """重置协议测试"""
        ProtocolPage(self.driver).B_restart_protocol()

    def test_C_print_protocol(self):  # 手机号
        """打印协议测试"""
        ProtocolPage(self.driver).C_print_protocol(self.phone)

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
class TestRoleManage(unittest.TestCase):
    """角色管理模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().role_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['高级设置']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['角色管理']).click()

    def test_A_add_role(self):  # 角色名称,角色描述
        """添加角色测试"""
        RolePage(self.driver).A_add_role(self.txt[0:2], self.txt)

    def test_B_edit_role(self):  # 角色名称,角色描述
        """编辑角色测试"""
        RolePage(self.driver).B_edit_role(self.txt[1:3], self.txt[::-1])

    def test_C_jurisdiction_role(self):
        """权限分配测试"""
        RolePage(self.driver).C_jurisdiction_role()

    def test_D_delete_role(self):
        """删除角色测试"""
        RolePage(self.driver).D_delete_role()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
class TestClubManage(unittest.TestCase):
    """俱乐部信息模块测试"""
    @classmethod
    def setUpClass(self):
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().club_manage()
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.phone = DataGenerate().create_phone()
        self.address = '武汉市光谷软件园'
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['高级设置']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['俱乐部信息']).click()

    def test_A_edit_clubMessage(self):  # 场馆名称,场馆电话,场馆地址
        """编辑俱乐部信息测试"""
        ClubPage(self.driver).A_edit_clubMessage(self.txt[0:5], self.phone,
                                                 self.address)

    def test_B_edit_legalPerson(self):  # 账户名称, 开户行名称
        """编辑法人信息测试"""
        ClubPage(self.driver).B_edit_legalPerson(self.txt[1:5], self.txt[0:4])

    @classmethod
    def tearDownClass(self):
        print('俱乐部信息模块测试结束')
        self.driver.quit()
class TestStaff(unittest.TestCase):
    """员工管理测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().staff_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['店长功能']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['员工管理']).click()

    def test_A_add_staff(self):  # 员工姓名
        """添加员工测试"""
        StaffManage(self.driver).A_add_staff(self.txt[0:2])

    def test_B_edit_staff(self):  # 员工姓名
        """编辑员工测试"""
        StaffManage(self.driver).B_edit_staff(self.txt[1:3])

    def test_C_forbidden_staff(self):
        """禁用员工测试"""
        StaffManage(self.driver).C_forbidden_staff()

    def test_D_restart_staff(self):
        """启用员工测试"""
        StaffManage(self.driver).D_restart_staff()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
Example #5
0
class PersonalClassOrder(unittest.TestCase):
    """私教预约模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.phone = '16612345678'
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().perclassorder_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['教练功能']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['私教预约']).click()

    def test_A_order_perclass(self):  # 会员手机号
        """添加私教课预约测试"""
        PerOrderPage(self.driver).A_order_perclass(self.phone)

    @unittest.skip('无法消课,需配合手机端')
    def test_B_finish_perclass(self):
        """私教消课测试"""
        PerOrderPage(self.driver).B_finish_perclass()

    def test_C_cancel_perclass(self):
        """取消私教课预约测试"""
        PerOrderPage(self.driver).C_cancel_perclass()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
class TestCardManage(unittest.TestCase):
    """卡种管理模块测试"""
    @classmethod
    def setUpClass(self):
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().cardKind_manage()
        """准备数据"""
        self.num = DataGenerate().create_phone()
        self.txt = DataGenerate().create_txt()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['高级设置']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['卡种管理']).click()

    def test_A_add_card(self):  # 卡种名称,天数,底价=价格,备注
        """添加卡种测试"""
        CardKindPage(self.driver).A_add_card(self.txt[0:2], self.num[0:2],
                                             self.num[1:3], self.txt)

    def test_B_edit_card(self):  # 卡种名称
        """编辑卡种测试"""
        CardKindPage(self.driver).B_edit_card(self.txt[1:3])

    def test_C_delete_card(self):
        """删除卡种测试"""
        CardKindPage(self.driver).C_delete_card()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
Example #7
0
class SideReport(unittest.TestCase):
    """体侧报告模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.num = DataGenerate().create_phone()
        self.phone = '16612345678'
        self.time = '2018-10-01 19:31:34'
        self.age = '22'
        self.height = '181'
        self.weight = '100'
        self.other = '11'
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().sidereport_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['教练功能']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['体侧报告']).click()

    def test_A_add_sideReport(self):  # 会员手机号,体测时间,年龄,身高,体重,其他
        """添加体侧报告测试"""
        SideReportPage(self.driver).A_add_sideReport(self.phone, self.time,
                                                     self.age, self.height,
                                                     self.weight, self.other)

    def test_B_edit_sideReport(self):  # 其他
        """编辑体侧报告测试"""
        SideReportPage(self.driver).B_edit_sideReport(self.num[0:2])

    def test_C_look_sideReport(self):
        """查看体测报告测试"""
        SideReportPage(self.driver).C_look_sideReport()

    def test_D_delete_sideReport(self):
        """删除体侧报告测试"""
        SideReportPage(self.driver).D_delete_sideReport()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
Example #8
0
class Cashier(unittest.TestCase):
    """收银台模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.num = DataGenerate().create_phone()
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().cashier_page()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['前台功能']).click()
        time.sleep(0.5)
        self.driver.find_element_by_xpath(self.ele1['收银台']).click()
        time.sleep(0.5)
        EleManage().located_by_xpath(self.driver, self.ele['商品管理tab']).click()

    def test_A_add_goods(self):  # 商品条码,商品名称,商品价格
        """添加商品测试"""
        CashierPage(self.driver).A_add_goods(self.num[1:8], self.txt[0:2],
                                             self.num[0:2])

    def test_B_edit_goods(self):  # 商品价格
        """编辑商品测试"""
        CashierPage(self.driver).B_edit_goods(self.num[1:3])

    def test_C_goods_entry(self):
        """商品入库测试1"""
        CashierPage(self.driver).C_goods_entry()

    def test_D_add_goods_entry(self):  # 商品条码
        """商品入库测试2"""
        CashierPage(self.driver).D_add_goods_entry(self.num[1:8])

    def test_E_buy_goods(self):  # 商品条码
        """商品购买测试"""
        CashierPage(self.driver).E_buy_goods(self.num[1:8])

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
Example #9
0
class OpenClass(unittest.TestCase):
    """公开课模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.num = DataGenerate().create_phone()
        self.mix_num = '2'
        self.max_num = '5'
        self.address = '3栋605'
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().openclass_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['教练功能']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['公开课管理']).click()

    def test_A_add_openclass(self):  # 名字,上课地点,最少人数,最大人数
        """添加公开课"""
        OpenClassPage(self.driver).A_add_openclass(self.txt[0:2], self.address,
                                                   self.mix_num, self.max_num)

    def test_B_edit_openclass(self):  # 名字
        """编辑公开课"""
        OpenClassPage(self.driver).B_edit_openclass(self.txt[1:3])

    def test_C_delete_openclass(self):
        """删除公开课"""
        OpenClassPage(self.driver).C_delete_openclass()

    def test_D_print_openclass(self):
        """打印课表"""
        OpenClassPage(self.driver).D_print_openclass()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
class TestPassage(unittest.TestCase):
    """文章推送模块测试"""

    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().passage_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['高级设置']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['文章推送']).click()

    def test_A_addpassage(self):  # 文章标题,文章摘要,文章内容
        """添加文章测试"""
        PassageManage(self.driver).A_add_passage(self.txt[0:2], self.txt[1:8], self.txt)

    def test_B_editpassage(self):  # 文章标题
        """编辑文章测试"""
        PassageManage(self.driver).B_edit_passage(self.txt[1:3])

    def test_C_searchpassage(self):  # 文章标题
        """搜索文章测试"""
        PassageManage(self.driver).C_search_passage(self.txt[1:3])

    def test_D_delpassage(self):
        """删除文章测试"""
        PassageManage(self.driver).D_del_passage()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
class PersonalClassBuy(unittest.TestCase):
    """私教购买模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.num = DataGenerate().create_phone()
        self.end_data = '2018-12-12'
        self.phone = '16612345678'
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().perclassbuy_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['教练功能']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['私教购买']).click()

    def test_A_buy_perclass(self):  # 失效日期,课程价格,备注,会员手机号
        """添加私教购买测试"""
        PerClassBuyPage(self.driver).A_buy_perclass(self.end_data,
                                                    self.num[0:3], self.txt,
                                                    self.phone)

    def test_B_edit_perclass(self):  # 备注
        """编辑私教购买测试"""
        PerClassBuyPage(self.driver).B_edit_perclass(self.txt[::-1])

    def test_C_delete_perclass(self):
        """删除私教购买测试"""
        PerClassBuyPage(self.driver).C_delete_perclass()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
Example #12
0
class TestLogin(unittest.TestCase):
    """登录测试"""
    def setUp(self):
        print('登录测试开始')
        self.driver = webdriver.Chrome()

    def test_login(self):
        """正常登录测试"""
        self.driver = LoginPage(self.driver).login()
        self.assertEqual(
            self.driver.find_element_by_xpath(
                '//*[@id="app"]/div/ul/div[1]').text, '测试俱乐部02', '登录测试失败')

    def tearDown(self):
        print('登录测试结束')
        self.driver.quit()
Example #13
0
class GroupClass(unittest.TestCase):
    """团课模块测试"""

    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.num = DataGenerate().create_phone()
        self.phone = '16612345678'
        self.start_date = '2018-11-11'
        self.end_date = '2018-12-12'
        self.start_time = '18:00'
        self.end_time = '23:30'
        self.end_new_time = '23:00'
        self.min_num = '2'
        self.max_num = '5'
        self.address = '3栋605'
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().groupclass_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['教练功能']).click()
        time.sleep(1)
        self.driver.find_element_by_xpath(self.ele1['团课管理']).click()
        time.sleep(1)
        EleManage().located_by_xpath(self.driver, self.ele['团课课程tab']).click()

    def test_A_add_groupclass(self):  # 课程名,价格,上课地点,最少人数,最多人数
        """添加团课测试"""
        GroupClassPage(self.driver).A_add_groupclass(self.txt[0:2], self.num[0:2], self.address, self.min_num, self.max_num)

    def test_B_edit_groupclass(self):  # 课程名
        """编辑团课测试"""
        GroupClassPage(self.driver).B_edit_groupclass(self.txt[1:3])

    # @unittest.skip('xxx')
    def test_C_queuing_groupclass(self):  # 开始日期,结束日期,开始时间,结束时间
        """团课排期测试"""
        GroupClassPage(self.driver).C_queuing_groupclass(self.start_date, self.end_date, self.start_time, self.end_time)

    def test_D_delete_groupclass(self):
        """删除团课测试"""
        GroupClassPage(self.driver).D_delete_groupclass()

    def test_E_add_queuing(self):  # 开始日期,结束日期,开始时间,结束时间
        """添加排期测试"""
        GroupClassPage(self.driver).E_add_queuing(self.start_date, self.end_date, self.start_time, self.end_time)

    def test_F_edit_queuing(self):  # 结束时间
        """编辑排期测试"""
        GroupClassPage(self.driver).F_edit_queuing(self.end_new_time)

    def test_G_order_class(self):  # 价格,会员手机号
        """预约团课测试"""
        GroupClassPage(self.driver).G_order_class(self.num[1:4], self.phone)

    @unittest.skip('未知错误,相对位置也无法定位元素')
    def test_H_cancel_class(self):
        """取消预约测试"""
        GroupClassPage(self.driver).H_cancel_class()

    def test_I_delete_queuing(self):
        """删除排期测试"""
        GroupClassPage(self.driver).I_delete_queuing()

    def test_J_print_groupclass(self):
        """打印课表测试"""
        GroupClassPage(self.driver).J_print_groupclass()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()
Example #14
0
class MemberShip(unittest.TestCase):
    """客户管理模块测试"""
    @classmethod
    def setUpClass(self):
        """准备数据"""
        self.txt = DataGenerate().create_txt()
        self.phone = DataGenerate().create_phone()
        self.birth = '2018-10-01'
        """准备元素"""
        self.ele1 = EleManage().meun_manage()
        self.ele = EleManage().membership_manage()
        """启动浏览器"""
        self.driver = webdriver.Chrome()
        self.driver = LoginPage(self.driver).login()
        self.driver.find_element_by_xpath(self.ele1['会籍功能']).click()
        time.sleep(0.5)
        self.driver.find_element_by_xpath(self.ele1['客户管理']).click()
        time.sleep(0.5)
        EleManage().located_by_xpath(self.driver, self.ele['潜在客户tab']).click()
        time.sleep(0.5)

    def test_A_add_potential_customers(self):  # 姓名,手机号,备注
        """添加潜客测试"""
        MemberShipPage(self.driver).A_add_potential_customers(
            self.txt[0:2], self.phone, self.txt)

    def test_B_edit_potential_customers(self):  # 生日
        """编辑潜客测试"""
        MemberShipPage(self.driver).B_edit_potential_customers(self.birth)

    def test_C_distribute_member(self):
        """潜客分配会籍测试"""
        MemberShipPage(self.driver).C_distribute_member()

    def test_D_distribute_coach(self):
        """潜客分配教练测试"""
        MemberShipPage(self.driver).D_distribute_coach()

    def test_E_delete_potential_customers(self):
        """潜客删除测试"""
        MemberShipPage(self.driver).E_delete_potential_customers()

    def test_F_recovery_potential_customers(self):
        """潜客恢复测试"""
        MemberShipPage(self.driver).F_recovery_potential_customers()

    def test_G_edit_vip(self):  # 生日
        """编辑会员测试"""
        MemberShipPage(self.driver).G_edit_vip(self.birth)

    def test_H_distribute_vipmember(self):
        """会员分配会籍测试"""
        MemberShipPage(self.driver).H_distribute_vipmember()

    def test_I_distribute_vipcoach(self):
        """会员分配教练测试"""
        MemberShipPage(self.driver).I_distribute_vipcoach()

    def test_J_delete_vip(self):
        """删除会员测试"""
        MemberShipPage(self.driver).J_delete_vip()

    @classmethod
    def tearDownClass(self):
        self.driver.quit()