Files
smart-management-auto-test/zhyy/test_case/TestCase/UI自动化/parent/vispark/home.py

109 lines
5.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
# __author__ = 'xinjiu.qiao'
import allure
from airtest.core.api import *
from ui_auto_lego.common import handle_driver
from ui_library.page.parent.vispark import advance_program, ap_create_class_schedule, home,confirm_subscription_plan
from ui_library.common.read_config import readconfig
from ui_library.operation.parent.vispark.handle_swipe import hd_swipe
from ui_library.logic.parent.vispark.login_logic import logic_login
from ui_auto_lego.common.handle_action import HandleAction
handle_driver_obj = handle_driver.HandleDriver()
home_page = home.prHome()
us_ap = advance_program.adprogram()
subscribe_ap = ap_create_class_schedule.create_class_schedule()
cofirm_subscribe_ap = confirm_subscription_plan.subscribe_confirm()
obj_handle_action = HandleAction()
rf_config = readconfig()
user_info = eval(rf_config.parent_user)
h_swipe = hd_swipe()
handle_login = logic_login()
@allure.feature('ViSpark home')
class TestAP(object):
poco_driver = handle_login.poco_driver
def setup(self):
# 启动被测试应用,并且进行登录到首页
handle_login.login()
def teardown(self):
# 退出被测试应用并清理数据
self.init_mobile_start_app.quit()
sleep(5)
self.init_mobile_start_app.clear_app()
@allure.story("[trial试听课--00*]")
@allure.title("[trial试听课按钮功能检查--00*]")
def test_us_ap_trial(self):
with allure.step("北美未付费用户进入ap,点击获取试听课"):
#首页进入ap
obj_handle_action.click_by_poco(self.poco_driver, home_page.home_us_ap())
#点击试听课按钮
obj_handle_action.click_by_poco(self.poco_driver, us_ap.book_a_free_trial_button_by_poco())
#检查试听课页面
assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver,
ssion="Book a FREE trial with VISPARK") == True
# 点击返回
obj_handle_action.click_by_poco(self.poco_driver, us_ap.get_trial_first_page_back_by_poco())
@allure.story("[Subscribe订阅--00*]")
@allure.title("[Subscribe订阅按钮功能检查--00*]")
def test_us_ap_subscribe(self):
with allure.step("北美未付费用户点击进行订阅"):
# 点击订阅按钮
allure.attach('点击订阅界面')
obj_handle_action.click_by_poco(self.poco_driver, us_ap.subscribe_now_button_by_poco())
# 检查订阅界面
assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver,
ssion="Select a course") == True
@allure.story("[Subscribe订阅--00*]")
@allure.title("[Subscribe订阅后选择档期功能检查--00*]")
def test_us_ap_subscribe_schedule(self):
with allure.step("北美未付费用户点击进行订阅"):
# 点击订阅按钮
obj_handle_action.click_by_poco(self.poco_driver, us_ap.subscribe_now_button_by_poco())
with allure.step("然后选择K2的课程级别"):
# 选择K2
allure.attach('点击K2的课程级别')
handle_driver_obj.touch_pos([subscribe_ap.select_level_by_air("K2")],self.poco_driver)
# 选择课程级别后,档期还未加载完成
# 选择一个档期为wait的档期
allure.attach('选择一个档期')
handle_driver_obj.touch_pos([subscribe_ap.ap_select_schedule_wait_by_air()],self.poco_driver)
# 选择一个档期后,需要页面加载,然后刷新出一个另外的档期选择
# 再次选择一个档期为wait的档期
allure.attach('再次选择一个档期')
handle_driver_obj.touch_pos([subscribe_ap.ap_select_schedule_wait_by_air()], self.poco_driver)
# 点击提交
obj_handle_action.click_by_poco(self.poco_driver, subscribe_ap.ap_create_class_schedule_submit_by_poco())
assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver,
ssion="Confirm subscription plan") == True
@allure.story("[Subscribe订阅--00*]")
@allure.title("[Subscribe选择档期后进行确认然后走支付--00*]")
def test_us_ap_subscribe_confirm(self):
with allure.step("北美未付费用户跳转到支付页面"):
allure.attach('勾选同意协议')
obj_handle_action.click_by_poco(self.poco_driver, cofirm_subscribe_ap.get_course_subscribe_agreement_by_poco())
allure.attach('点击立即支付')
obj_handle_action.click_by_poco(self.poco_driver,
cofirm_subscribe_ap.get_pay_now_button_agreement_by_poco())
assert obj_handle_action.is_exists_by_poco(poco=self.poco_driver,
ssion="Checkout") == True
def a(self):
handle_driver_obj.touch_pos([subscribe_ap.ap_select_schedule_wait_by_air()], self.poco_driver)
if __name__ == '__main__':
# TestLogin().teardown()
# TestLogin().setup()
# TestLogin().test_us_ap_trial()
# TestLogin().test_us_ap_subscribe()
# TestLogin().test_us_ap_subscribe_schedule()
TestAP().test_us_ap_subscribe_confirm()
# TestLogin().a()