def test01_creat_redpacket_common(self): u'''创建会员通知''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员红包") if common.findCss( self.driver, "#memberredpacket > div.el-table__body-wrapper > table > tbody > tr > td.el-table_1_column_1 > div" ): creat_time1 = common.findCss( self.driver, "#memberredpacket > div.el-table__body-wrapper > table > tbody > tr > td.el-table_1_column_1 > div" ).text else: creat_time1 = "2018-01-11 16:46:23" m3_redpacket.creat_redpacket_common(self.driver, testdata.dict3) time.sleep(2) creat_time2 = common.findCss( self.driver, "#memberredpacket > div.el-table__body-wrapper > table > tbody > tr > td.el-table_1_column_1 > div" ).text self.assertTrue(creat_time1 < creat_time2) function.logout(self.driver)
def test01_creat_redpoint(self): u'''创建集点活动''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员集点") m2_redpoint.redpoint_status(self.driver, u"进行中") time.sleep(1) if m2_redpoint.get_redpoint_count(self.driver) == 1: self.driver.refresh() m2_redpoint.end_redpoint(self.driver) self.driver.refresh() time.sleep(2) m2_redpoint.creat_redpoint(self.driver, testdata.dict1) time.sleep(2) # 判断创建的集点活动 common.findXpath( self.driver, "/html/body/div[1]/div[2]/div[2]/div/div[2]/div[1]/div/div[1]/div/div[1]/i" ).click() common.findXpath(self.driver, "/html/body/div[5]/div/div[1]/ul/li[3]").click() time.sleep(2) redpoint_check_count = common.findsCss( self.driver, "#memberredcollect > div.el-table__body-wrapper > table > tbody > tr" ) self.assertEqual(len(redpoint_check_count), 1) function.logout(self.driver)
def test04_redstorage_bill(self): u'''储值账单页面''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员储值") m4_redstorage.redstorage_bill(self.driver) time.sleep(2) function.logout(self.driver)
def test01_member_shopname(self): u'''会员管理店铺名称筛选''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员管理") time.sleep(2) # 全部门店会员数判断 m1_member.member_shopname_filter(self.driver, u"全部") time.sleep(2) member_list = common.findXpath( self.driver, "/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/div/div[3]/table/tbody/tr[1]/td[7]/div" ).text self.assertTrue(member_list != "") self.driver.refresh() time.sleep(2) # 分店门店会员数判断 m1_member.member_shopname_filter(self.driver, u"测试员工测试") time.sleep(2) member_list = common.findXpath( self.driver, "/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/div/div[3]/table/tbody/tr[1]/td[7]/div" ).text self.assertTrue(member_list != "") self.driver.refresh() time.sleep(2) m1_member.member_shopname_filter(self.driver, u"业务员:二级业务员测试无默认") time.sleep(2) member_list = common.findXpath( self.driver, "/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/div/div[3]/table/tbody/tr[1]/td[7]/div" ).text self.assertTrue(member_list != "") self.driver.refresh() time.sleep(2) m1_member.member_shopname_filter(self.driver, u"测试分店") time.sleep(2) member_list = common.findXpath( self.driver, "/html/body/div[1]/div[2]/div[2]/div[2]/div[2]/div/div[3]/div/span" ).text self.assertEqual(member_list, u"暂无数据") time.sleep(2) function.logout(self.driver)
def test04_end_redpacket(self): u'''终止红包活动''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员红包") m3_redpacket.end_redpacket(self.driver) end_redpoint_status = common.findCss( self.driver, "#memberredpacket > div.el-table__body-wrapper > table > tbody > tr:nth-child(1) > td.el-table_1_column_4 > div" ).text self.assertEqual(end_redpoint_status, u"已失效") function.logout(self.driver)
def test02_end_redstorage(self): u'''终止会员储值活动''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员储值") m4_redstorage.end_redstorage(self.driver) end_redpoint_status = common.findCss( self.driver, "#memberstorage > div.el-table__body-wrapper > table > tbody > tr:nth-child(1) > td.el-table_1_column_2 > div" ).text self.assertEqual(end_redpoint_status, u"已终止") function.logout(self.driver)
def test04_edit_redpoint(self): u'''修改集点活动''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员集点") m2_redpoint.edit_redpoint(self.driver, testdata.dict2) time.sleep(2) edit_redpoint_text = common.findCss( self.driver, "#memberredcollect > div.el-table__body-wrapper > table > tbody > tr:nth-child(1) > td.el-table_1_column_3 > div > span" ).text self.assertEqual(edit_redpoint_text, u"满5点可兑换泰迪狗一份") function.logout(self.driver)
def test02_redpoint_status(self): u'''会员集点活动状态筛选''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员集点") # 未开始 m2_redpoint.redpoint_status(self.driver, u"未开始") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_count(self.driver), 0) self.driver.refresh() time.sleep(2) # 进行中 m2_redpoint.redpoint_status(self.driver, u"进行中") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_count(self.driver), 1) self.driver.refresh() time.sleep(2) # 已结束 m2_redpoint.redpoint_status(self.driver, u"已结束") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_count(self.driver), 3) self.driver.refresh() time.sleep(2) # 全部活动 m2_redpoint.redpoint_status(self.driver, u"已终止") time.sleep(1) end_redpoint_count = m2_redpoint.get_redpoint_count(self.driver) self.driver.refresh() time.sleep(2) m2_redpoint.redpoint_status(self.driver, u"全部") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_count(self.driver), end_redpoint_count + 4) function.logout(self.driver)
def test03_redpoint_shopname(self): u'''会员集点店铺名称筛选''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员集点") m2_redpoint.redpoint_status(self.driver, u"已结束") m2_redpoint.redpoint_shopname_filter(self.driver, u"测试员工测试") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_shopname_count(self.driver), 3) self.driver.refresh() time.sleep(2) m2_redpoint.redpoint_status(self.driver, u"已结束") m2_redpoint.redpoint_shopname_filter(self.driver, u"测试分店") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_shopname_count(self.driver), 0) self.driver.refresh() time.sleep(2) m2_redpoint.redpoint_status(self.driver, u"已结束") m2_redpoint.redpoint_shopname_filter(self.driver, u"业务员:二级业务员测试无默认") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_shopname_count(self.driver), 0) self.driver.refresh() time.sleep(2) m2_redpoint.redpoint_status(self.driver, u"已结束") m2_redpoint.redpoint_shopname_filter(self.driver, u"全部") time.sleep(1) self.assertEqual(m2_redpoint.get_redpoint_shopname_count(self.driver), 3) self.driver.refresh() time.sleep(2) function.logout(self.driver)
def test01_creat_redstorage(self): u'''创建会员储值''' function.login_shanghu(self.driver, testdata.login_url, testdata.username, testdata.password) time.sleep(2) function.open_menu(self.driver, u"会员功能", u"会员储值") time.sleep(2) common.findCss( self.driver, "body > div.top_content > div.main > div:nth-child(2) > div > div.panel > div.panel-header > div > div.panel-select__wrapper > div > div.el-input.el-input--small > input" ).click() time.sleep(1) common.findXpath(self.driver, "/html/body/div[3]/div/div[1]/ul/li[3]").click() time.sleep(2) get_redstorage_count = common.findsCss( self.driver, "#memberstorage > div.el-table__body-wrapper > table > tbody > tr") if len(get_redstorage_count) == 1: self.driver.refresh() time.sleep(2) m4_redstorage.end_redstorage(self.driver) else: self.driver.refresh() self.driver.refresh() time.sleep(2) m4_redstorage.creat_redstorage(self.driver, testdata.dict6) time.sleep(2) redstorage_status = common.findCss( self.driver, "#memberstorage > div.el-table__body-wrapper > table > tbody > tr:nth-child(1) > td.el-table_1_column_2 > div" ).text self.assertEqual(redstorage_status, u"进行中") function.logout(self.driver)