def open_app(request): doc = "发布商品-通用条件-" # 准备服务器参数,与appium server进行连接。 driver = AndroidDriver().android_driver(device=request.param) phone = Login_data['phone'] password = Login_data['password'] # 1、 要不要判断欢迎页面是否存在? CommBus(driver).do_welcome(text=doc) IndexPage(driver).location_pop_ups() #处理登录 CommBus(driver).login(phone, password, text=doc) yield driver driver.close_app() driver.quit()
def test_3_publish_services_good(self, open_app, data): doc = "测试发布商企服务商品-" with allure.step("首页点击发布商品"): CommBus(open_app).click_publish_good(text=doc) with allure.step("选择发布商企服务商品"): PublishGoodCommon(open_app).publish_services_good(text=doc) with allure.step("发布商企服务商品"): ServicesGoodPage(open_app).services_good_information( data["product_title"], data["product_description"], data["second_category_name"], data["third_category_name"], data["total_price"], data["subsist"], data["stock"], text=doc) with allure.step("立即上架"): PublishGoodCommon(open_app).submit(text=doc) with allure.step("断言:立即上架后系统提示:商品审核中"): text = BasePage(open_app).get_text(PGOK.title, doc=doc) assert text == "商品审核中" with allure.step("截图保存到项目中"): open_app.save_screenshot( f"{allure_report}/screenshot/发布商品功能-发布商企服务商品.png") allure.attach.file( f"{allure_report}/screenshot/发布商品功能-发布商企服务商品.png", "附件截图", attachment_type=allure.attachment_type.PNG)
def first_start_app(request): doc = "登录重启前置-" # 准备服务器参数,与appium server进行连接。 driver = AndroidDriver().android_driver(device=request.param, noReset=False) phone = request.param['phone'] password = request.param['password'] # 1、 要不要判断欢迎页面是否存在? CommBus(driver).do_welcome(text=doc) # 2、登录 CommBus(driver).click_myindex(text=doc) time.sleep(2) LoginPage(driver).login(phone, password, text=doc) yield driver driver.close_app() driver.quit()
def test_1_Login_success(self, first_start_app, data): doc = "正常用例-登录成功-" # 步骤 输入手机号码:XXX,点击下一步 LP(first_start_app).login(data["phone"], data["password"], text=doc) # 断言 login_status = CommBus(first_start_app).get_loginStatus(doc) assert login_status == True