class TestOrderPrecess(unittest.TestCase): # @ddt.data(*test_data) def setUp(self) -> None: self.driver = open_browser() self.login = LoginPage(self.driver) self.login.open_url(url1) def tearDown(self) -> None: self.login.close() @ddt.data(*test_data) def test_case01(self, data): self.login.input_username(data['username']) self.login.input_password(data['password']) self.login.submit_click() # print(self.login.is_successed(data['username'])) self.login.housepage_click() house = HousePage(self.driver) house.phone_type_click() # 点击诺基亚 goodspage = GoodsPage(self.driver) goodspage.nokia_n85_click() time.sleep(1) # 点击立即购买 buynow = BuyNow(self.driver) buynow.buy_now_click() time.sleep(1) # 点击去付款 account = Account(self.driver) account.go_account_click() time.sleep(1) #填写收货信息 # addrpage = AddrPage(self.driver) # addrpage.click_china() # 选择中国 # addrpage.click_province() # 随即选择省份 # time.sleep(1) # addrpage.click_city() # 随即选择市 # time.sleep(1) # addrpage.click_district() # 随即选择区 # time.sleep(1) # addrpage.input_consigneename(data['consigneename']) # 从excel中读取收货人并输入 # time.sleep(1) # addrpage.input_detail_addr(data['detailaddr']) # 从excel中读取详细地址并输入 # time.sleep(1) # addrpage.input_tel(str(data['tel'])) # 从excel中读取手机并输入 # time.sleep(1) # addrpage.input_email(str(data['email'])) # 从excel中读取邮箱并输入 # time.sleep(1) # print("*"*10) # addrpage.input_zipcode(str(data['zipcode'])) # 从excel中读取邮政编码并输入 # time.sleep(1) # addrpage.input_mobile(str(data['mobile'])) # 从excel中读取电话并输入 # time.sleep(1) # addrpage.addr_submit() # 点击点击配送至这个地址按钮 submitorder = SubmitOrder(self.driver) time.sleep(2) submitorder.choose_distribution() submitorder.choose_pay() time.sleep(2) js = 'window.scrollTo(0,1000)' self.driver.execute_script(js) a = submitorder.submit_order_click() # print(a) #断言 successpage = SuccessPage(self.driver) result = successpage.is_success(data['text']) self.assertEqual(data['expect'], result, msg='中奖啦')
self.click(self.nokia_5800_loc) def nokia_E66_click(self): self.click(self.nokia_E66_loc) def feilipu_click(self): self.click(self.feilipu_loc) def KD876_click(self): self.click(self.KD876_loc) if __name__ == '__main__': driver = open_browser() login = LoginPage(driver) login.open_url(url) username = '******' password = '******' login.input_username(username) login.input_password(password) login.submit_click() print(login.is_successed(username)) login.housepage_click() house = HousePage(driver) house.phone_type_click() #点击诺基亚 goodspage = GoodsPage(driver) goodspage.nokia_n85_click()