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_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)
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)