def test_A55(self): u"""测试点击第三个金币堆确认提示弹窗显示的按钮""" page = 'purchase_popup' CostList = GetMeta("shop.xml", "costs") coin3_metacash = int(CostList[5].replace("3000#", "")) CoinList = GetMeta('shop.xml', 'items') coin3_meta = int(CoinList[5].replace("2000#", "")) items = poco("UI Root").child("HeaderPart").offspring("label_count") cash = int(items[0].get_text()) coin = int(items[1].get_text()) if cash >= coin3_metacash: Click('btn_confirm', page) time.sleep(2.0) coin_itemsNew = poco("UI Root").child("HeaderPart").offspring( "label_count") coin_cashnew = int(coin_itemsNew[0].get_text()) coin_coinnew = int(coin_itemsNew[1].get_text()) self.assertEqual(coin_coinnew, coin + coin3_meta, caseList[75]) self.assertEqual(coin_cashnew, cash - coin3_metacash, caseList[76]) else: Click('btn_confirm', page) coin1_cash_less_info = poco("label_info").get_text() cashtext = TextDic['shop_type_title_3'] infotext = TextDic['shop_supplement'] self.assertEqual(coin1_cash_less_info, infotext % cashtext, caseList[77]) coin1_less_botton = poco("label_btn_popup_orange").get_text() goaltext = TextDic['shop_guide'] self.assertEqual(coin1_less_botton, goaltext, caseList[78]) Click('label_btn_popup_orange', page) page = 'shopInterface' self.assertTrue(poco('tex_light').exists(), caseList[79]) # 需要修改!!! Click('label_coin', page)
def test_A57(self): u"""测试点击返回城建按钮是否返回到城建界面""" page = 'shopInterface' Click('btn_back', page) #ui = poco.agent.hierarchy.dump() #frame = json.dumps(ui, indent=4) sleep(3.0) self.assertTrue(poco('c2_left').exists(), caseList[81]) #self.assertIn('c2_left', frame, caseList[81]) time.sleep(1.0)
def test_A10(self): u"""测试点击普通礼盒的提示弹窗的按钮""" page = 'purchase_popup' CostList = GetMeta("shop.xml", "costs") commonBox_metacoin = int(CostList[0].replace("2000#", "")) currency = poco("UI Root").child("HeaderPart").offspring("label_count") coin = int(currency[1].get_text()) if coin >= commonBox_metacoin: Click('label_btn_popup_orange', page) page = 'openbox3_interface' Click('label_cishu', page) page = 'openbox4_interface' poco('label_share').wait_for_appearance() sleep(2.0) Click('label_cishu', page) page = 'openbox5_interface' poco('label_share').wait_for_appearance() sleep(2.0) Click('label_cishu', page) page = 'settleInterface' # 获取开完宝箱后的金币数量 time.sleep(3.0) Click('label_ok', page) sleep(1.0) if poco('sprite_bg_header').exists(): page = 'album_share' Click('btn_close', page) if poco('sprite_bg_header').exists(): page = 'album_share' Click('btn_close', page) currencyNew = poco("UI Root").child("HeaderPart").offspring( "label_count") coinnew = int(currencyNew[1].get_text()) # 检查前端金币数量变化是否正确 self.assertEqual(coinnew, coin - commonBox_metacoin, caseList[11]) else: Click('label_btn_popup_orange', page) page = 'shopInterface' self.assertTrue(poco('sprite_gold_1').exists(), caseList[12]) Click('label_chest', page)
def test_A7(self): u"""测试点击普通礼盒的购买按钮是否弹出提示弹窗""" page = 'shopInterface' Click('btn_cost', page) time.sleep(2.0) self.assertTrue(poco('label_btn_popup_orange').exists(), caseList[6])
def test_A34(self): u"""测试点击金币标签页是否到购买金币模块""" page = 'shopInterface' Click('label_coin', page) self.assertTrue(poco('sprite_gold_1').exists(), caseList[46])
def test_A32(self): u"""测试点击豪华礼盒的提示弹窗的按钮""" page = 'purchase_popup' CostList = GetMeta("shop.xml", "costs") luxuryBox_metacash = int(CostList[2].replace("3000#", "")) if not TsumDrop_dic and not FixedRewards_dic: chestlevel(TsumDrop_dic, FixedRewards_dic) luxuryBox_meta_coin = int( FixedRewards_dic["2003"][userlevel].split("#")[1]) itemsOld = poco("UI Root").child("HeaderPart").offspring("label_count") cashold = int(itemsOld[0].get_text()) coinold = int(itemsOld[1].get_text()) if cashold >= luxuryBox_metacash: Click('label_btn_popup_orange', page) page = 'openbox1_interface' Click('label_cishu', page) page = 'openbox2_interface' poco('label_share').wait_for_appearance() sleep(2.0) Click('label_cishu', page) page = 'openbox3_interface' poco('label_share').wait_for_appearance() sleep(2.0) Click('label_cishu', page) page = 'openbox4_interface' poco('label_share').wait_for_appearance() sleep(2.0) Click('label_cishu', page) page = 'openbox5_interface' poco('label_share').wait_for_appearance() sleep(2.0) Click('label_cishu', page) page = 'settleInterface' # 获取高级礼盒开出的金币数量 luxury_tsumList = poco("UI Root").child( "ChestRewardPanel").offspring("label_count") luxury_getcoin = int(luxury_tsumList[0].get_text().replace( "+", "")) # 检查数量是否正确 self.assertEqual(luxury_getcoin, luxuryBox_meta_coin, caseList[41]) time.sleep(3.0) Click('label_ok', page) sleep(1.0) if poco('sprite_bg_header').exists(): page = 'album_share' Click('btn_close', page) if poco('sprite_bg_header').exists(): page = 'album_share' Click('btn_close', page) luxury_itemsNew = poco("UI Root").child("HeaderPart").offspring( "label_count") luxury_cashnew = int(luxury_itemsNew[0].get_text()) luxury_coinnew = int(luxury_itemsNew[1].get_text()) # 检查前端金币数量变化是否正确 self.assertEqual(luxury_cashnew, cashold - luxuryBox_metacash, caseList[42]) self.assertEqual(luxury_coinnew, coinold + luxuryBox_meta_coin, caseList[43]) else: Click('label_btn_popup_orange', page) page = 'shopInterface' self.assertTrue(poco('tex_light').exists(), caseList[44]) Click('label_chest', page)
def test_A22(self): u"""测试点击向右翻动的按钮有没有翻到豪华礼盒""" page = 'shopInterface' Click('btn_next', page) self.assertFalse(poco('btn_next').exists(), caseList[29])
def test_A2(self): u"""测试点击商店按钮是否进入到商店模块""" page = 'homePage' Click('btn_shop', page) sleep(2.0) self.assertTrue(poco('tex_bg').exists(), caseList[1])
def test_A11(self): u"""测试点击向右翻动的按钮有没有翻到高级礼盒""" page = 'shopInterface' Click('btn_next', page) self.assertTrue(poco('sprite_cash_title').exists(), caseList[13])