def purchase_private_course(driver):
        purchaseprivatecourse = PurchasePrivateCourse(driver)
        opera_json = OperetionJson()

        # 左侧菜单栏"客户"
        purchaseprivatecourse.go_customer_obj().click()
        time.sleep(2)

        # 搜索会员“测试数据不要删除(18321829313)”
        purchaseprivatecourse.search_bar_obj().click()
        purchaseprivatecourse.search_bar_obj().send_keys("18321829313")
        purchaseprivatecourse.search_customer_obj().click()
        time.sleep(2)

        # 选择搜索结果:“测试数据不要删除(18321829313)”
        purchaseprivatecourse.selected_customer_obj().click()

        # 点击购买私教
        purchaseprivatecourse.purchase_private_course_obj().click()
        time.sleep(2)

        # 选择门店
        Select(purchaseprivatecourse.store_obj()).select_by_visible_text(
            "懒猫馆——测试数据不能删除")

        # 选择销售人员
        Select(purchaseprivatecourse.sales_obj()).select_by_visible_text(
            "测试教练不要删除")

        # 选择上课教练
        Select(purchaseprivatecourse.coach_obj()).select_by_visible_text(
            "测试教练不要删除")

        # 选择课程
        Select(purchaseprivatecourse.course_obj()).select_by_visible_text(
            opera_json.get_data("test01_add_private_course"))

        # 选择价格级别
        Select(purchaseprivatecourse.price_level_obj()).select_by_visible_text(
            "1级(1~10节)")

        # 填写购买数量
        purchaseprivatecourse.count_obj().send_keys(10)

        # 填写合同编号
        purchaseprivatecourse.bianhao_obj().send_keys(
            str(random.randint(100000, 199999)))

        # 下一步
        purchaseprivatecourse.next_obj().click()
        time.sleep(2)

        # 保存
        purchaseprivatecourse.confirm_obj().click()
        time.sleep(2)

        # 确认
        purchaseprivatecourse.queding_obj().click()
        time.sleep(2)
Esempio n. 2
0
class GroupCourse_H5Member:
    def __init__(self, driver):
        self.driver = driver
        self.driver.implicitly_wait(30)
        self.opera_json = OperetionJson()

    # 切换至底部的课程
    def go_course_table_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//li[@class="course"]//span[text()="课程"]')
        return element

    # 定位周二
    def weekdays_tues_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//li[@name="seven_days_select"]//p[@class="weekday" and text()="二"]'
        )
        return element

    # 定位周四
    def weekdays_thur_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//li[@name="seven_days_select"]//p[@class="weekday" and text()="四"]'
        )
        return element

    # 定位场馆
    def store_select_obj(self):
        element = getElement(self.driver, 'xpath', '//div[@class="shop_show"]')
        return element

    def store_select1_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//ul[@class="shop_content"]//li[@data="369627602"]')
        return element

    # 团课列表预约
    def appoint_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//ul[@class="list-2"]/li/descendant::span[contains(text(),"{}")]/ancestor::a'
            .format(self.opera_json.get_data("test01_add_free_group_course")))
        return element

    # 团课详情页面预约
    def appoint_detail_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//a[@class="btn-large order"][text()="预约"]')
        return element

    # 弹框确认
    def confirm_obj(self):
        self.driver.switch_to_alert().accept()
class GroupCourseSetting:
    def __init__(self, driver):
        self.driver = driver
        self.driver.implicitly_wait(30)
        self.opera_json = OperetionJson()

    # 添加团课
    # 进入左侧菜单栏——课程
    def go_course_table_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//*[@id="mCSB_1_container"]/li[4]/a/i')
        return element

    # 进入团课课程设置的table
    def go_group_course_setting_obj(self):
        element = getElement(self.driver, 'xpath', '//a[text()="团课课程设置"]')
        return element

    # 团课课程设置页面的添加
    def add_group_course_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//i[@class="icon_club pointer add"]')
        return element

    # 团课课程添加页面的新增团课名字
    def add_course_name_obj(self):
        element = getElement(self.driver, 'name', 'name')
        return element

    # 团课课程添加页面的新增团课时间
    def add_course_time_obj(self):
        element = getElement(self.driver, 'name', 'course_minutes')
        return element

    # 团课课程添加页面的新增团课支持的门店
    def add_course_store_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//label[contains(text(),"懒猫馆——测试数据不能删除")]')
        return element

    # 团课课程添加页面的新增团课教练
    def add_course_coach_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//label[contains(text(),"懒猫管的团课及私教教练不允许删除")]')
        return element

    # 团课预约另付费:是
    def pay_setting_obj(self):
        element = getElement(self.driver, 'id', 'fee_type_1')
        return element

    # 付费团课储值卡扣费设置
    # 团课储值卡付费设置(付费按钮)
    def pay_card_setting_obj(self, course_name):
        element = getElement(
            self.driver, 'xpath',
            '//td[text()="{}"]/following-sibling::td[4]/i[3]'.format(
                course_name))
        return element

    # 团课付费选择储值卡
    def select_card_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//td[text()="储值卡不要删除数据"]/preceding-sibling::td[1]//input')
        return element

    # 团课付费输入设置的金额
    def money_setting_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//td[text()="储值卡不要删除数据"]/following-sibling::td[1]//input')
        return element

    # 付费设置页面的确定按钮
    def confirm_button_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//button[@class="btn-medium save"]')
        return element

    # 确认
    def add_confirm_obj(self):
        element = getElement(self.driver, 'xpath', '//a[text()="确定"]')
        return element

    # 再次确认
    def queding_obj(self):
        element = getElement(self.driver, 'xpath',
                             '//a[@class="lay-btn-confirm"]')
        return element

    # 管理员代预约付费的团课
    def select_group_course_obj(self):
        course_text = self.opera_json.get_data("test02_add_pay_group_course")
        print(course_text)
        element = getElement(self.driver, 'xpath', '')

    # 删除团课课表
    def delete_course_obj(self, course_name):
        element = getElement(
            self.driver, 'xpath',
            '//td[contains(text(),"{}")]/../td[5]/i[4]'.format(course_name))
        return element

    # 删除的确认按钮
    def confirm_delete_button_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//div[@class="lay-body lay-msg"]//a[text()="确定"]')
        return element

    # 删除成功提示:确定
    def cancel_success_button_obj(self):
        element = getElement(
            self.driver, 'xpath',
            '//div[@class="lay-body lay-msg"]//a[text()="确定"]')
        return element
 def __init__(self, driver):
     self.driver = driver
     self.driver.implicitly_wait(30)
     self.opera_json = OperetionJson()
Esempio n. 5
0
class PrivateCourse_H5Member:
    def __init__(self,driver):
        self.driver = driver
        self.driver.implicitly_wait(30)
        self.opera_json=OperetionJson()

    # 切换至底部的课程
    def go_course_table_obj(self):
        element = getElement(self.driver,'xpath','//li[@class="course"]//span[text()="课程"]')
        return element

    # 定位右上角私教table
    def private_course_table_obj(self):
        element = getElement(self.driver,'xpath','//ul[@class="tab"]/li[2]')
        return element

    # 定位场馆
    def store_select_obj(self):
        element = getElement(self.driver,'xpath','//div[@class="shop_show"]')
        return element

    def store_select1_Obj(self):
        element = getElement(self.driver,'xpath','//ul[@class="shop_content"]//li[@data="369627602"]')
        return element

    # 私教课程列表
    def appoint_obj(self):
        element = getElement(self.driver, 'xpath','//ul[@class="coach_class"]/li[@class="each"]/a[1]/div/h3[text()="{}"]'.format(self.opera_json.get_data("test01_add_private_course")))
        return element

    # 私教课程详情页面预约
    def appoint_detail_obj(self):
        element = getElement(self.driver,'xpath','//a[text()="立即预约"]')
        return element

    # 预约时间
    def appointment_time_obj(self):
        element = getElement(self.driver,'xpath','//div[@class="course_info r"]/ul/li[4]/a')
        return element

    # 选择时间:22:30
    def specific_time_obj(self):
        element = getElement(self.driver,'xpath','//ul[@class="choose_time"]/li[1]')
        return element

    # 确认时间
    def confirm_time_obj(self):
        element = getElement(self.driver,'xpath','//a[text()="确认"]')
        return element

    # 确认预约
    def confirm_appoint_obj(self):
        element = getElement(self.driver,'xpath','//button[text()="确认预约"]')
        return element

    # 浏览器弹框确认
    def confirm_obj(self):
        self.driver.switch_to_alert().accept()
 def setUpClass(cls):
     print("添加私教课程/私教课程的设置")
     cls.driver = Login.test_login()
     cls.paras = parameterize()
     cls.privateCourseName = cls.paras.get_params("私教自动化测试不允许删除")
     cls.opera_json = OperetionJson()
Esempio n. 7
0
 def setUpClass(cls):
     cls.driver = Login.test_login()
     cls.opera_json = OperetionJson()
     print("会员购买储值卡和私教课程合同")
 def setUpClass(cls):
     cls.driver = Login.test_login()
     cls.paras = parameterize()
     cls.paras = parameterize()
     cls.opera_json = OperetionJson()
     print("会籍卡和储值卡添加以及变成禁售")
Esempio n. 9
0
 def setUpClass(cls):
     cls.driver = Login.test_login()
     cls.paras = parameterize()
     cls.opera_json = OperetionJson()
     print("新增会籍销售和教练以及验证是否成功")
     print("删除会籍销售和教练,暂未验证")
 def setUpClass(cls):
     cls.driver = Login.test_login()
     cls.opera_json = OperetionJson()
     print("删除免费/付费团课/私教课程")
Esempio n. 11
0
 def setUpClass(cls):
     cls.driver = Login.test_login()
     cls.opera_json = OperetionJson()
     print("PC端admin代预约付费团课和付费私教课程")
 def setUpClass(cls):
     print("添加团课")
     cls.driver = Login.test_login()
     cls.paras = parameterize()
     cls.opera_json = OperetionJson()