Exemplo n.º 1
0
 def test_login(self, phone, password):
     # 点击密码登录
     self.Page_driver.click_btn(by="id",
                                value="com.stoneenglish:id/quick_to_login")
     LogUtil.my_log("登陆日志:").info("点击选择密码登录")
     # 输入手机号
     time.sleep(3)
     self.Page_driver.click_btn(by="id",
                                value="com.stoneenglish:id/login_tel")
     time.sleep(3)
     self.Page_driver.send_keys(by="id",
                                value="com.stoneenglish:id/login_tel",
                                send=phone)
     LogUtil.my_log("登陆日志:").info("输入手机号")
     time.sleep(2)
     self.Page_driver.click_btn(by="id",
                                value="com.stoneenglish:id/login_password")
     self.Page_driver.send_keys(by="id",
                                value="com.stoneenglish:id/login_password",
                                send=password)
     LogUtil.my_log("登陆日志:").info("输入密码")
     time.sleep(3)
     self.Page_driver.click_btn(by="id",
                                value="com.stoneenglish:id/login_ok")
     self.Page_driver.is_toast_exist(expect="登录成功")
     self.Page_driver.assert_toast_result(expect="登录成功")
Exemplo n.º 2
0
 def login_test(self):
     # 点击密码登录
     self.click_btn(by="id", value="com.stoneenglish:id/quick_to_login")
     LogUtil.my_log("登陆日志:").info("点击选择密码登录")
     # 输入手机号
     time.sleep(3)
     self.click_btn(by="id", value="com.stoneenglish:id/login_tel")
     time.sleep(3)
     self.send_keys(by="id",
                    value="com.stoneenglish:id/login_tel",
                    send="13582905701")
     LogUtil.my_log("登陆日志:").info("输入手机号")
     time.sleep(2)
     self.click_btn(by="id", value="com.stoneenglish:id/login_password")
     self.send_keys(by="id",
                    value="com.stoneenglish:id/login_password",
                    send="905701")
     LogUtil.my_log("登陆日志:").info("输入密码")
     time.sleep(2)
     self.click_btn(by="id", value="com.stoneenglish:id/login_ok")
     self.is_toast_exist(expect="登录成功")
Exemplo n.º 3
0
 def test_login(self, phone, password):
     Desire_driver = DesireCaps.appium_desired_caps()
     driver = Action(Desire_driver)
     # 点击密码登录
     driver.click_btn(by="id", value="com.stoneenglish:id/quick_to_login")
     LogUtil.my_log("登陆日志:").info("点击选择密码登录")
     # 输入手机号
     time.sleep(3)
     driver.click_btn(by="id", value="com.stoneenglish:id/login_tel")
     time.sleep(3)
     driver.send_keys(by="id",
                      value="com.stoneenglish:id/login_tel",
                      send=phone)
     LogUtil.my_log("登陆日志:").info("输入手机号")
     time.sleep(2)
     driver.click_btn(by="id", value="com.stoneenglish:id/login_password")
     driver.send_keys(by="id",
                      value="com.stoneenglish:id/login_password",
                      send=password)
     LogUtil.my_log("登陆日志:").info("输入密码")
     time.sleep(3)
     driver.click_btn(by="id", value="com.stoneenglish:id/login_ok")
     driver.is_toast_exist(expect="登录成功")
     driver.assert_toast_result(expect="登录成功")
Exemplo n.º 4
0
from appium import webdriver
import time
from base import DesireCaps
from utils import LogUtil
driver = DesireCaps.appium_desired_caps(host="127.0.0.1", port="4723")
LogUtil.my_log("这是日志啊1").info(
    "11111111111111111111111111111111111111111111111111")
#点击密码登录
driver.find_element_by_id("com.stoneenglish:id/quick_to_login").click()
#输入手机号
time.sleep(3)
driver.find_element_by_id("com.stoneenglish:id/login_tel").click()
time.sleep(3)
driver.find_element_by_id("com.stoneenglish:id/login_tel").send_keys(
    "13582905701")
time.sleep(2)
driver.find_element_by_id("com.stoneenglish:id/login_password").click()
driver.find_element_by_id("com.stoneenglish:id/login_password").send_keys(
    "905701")
time.sleep(2)
driver.find_element_by_id("com.stoneenglish:id/login_ok").click()

time.sleep(5)
driver.quit()
Exemplo n.º 5
0
import time
from base import DesireCaps
from base.BaseAction import Action
import unittest
from utils import LogUtil
import datetime
import ddt
nowtime = str(datetime.datetime.now())
LogUtil.my_log("记录日志unittest:" + nowtime).info("测试开始执行unittest...")
test_data = [{"phone": "13582905701", "password": "******"}]


@ddt.ddt
class Login(unittest.TestCase):
    @ddt.data(*test_data)
    @ddt.unpack
    def test_login(self, phone, password):
        Desire_driver = DesireCaps.appium_desired_caps()
        driver = Action(Desire_driver)
        # 点击密码登录
        driver.click_btn(by="id", value="com.stoneenglish:id/quick_to_login")
        LogUtil.my_log("登陆日志:").info("点击选择密码登录")
        # 输入手机号
        time.sleep(3)
        driver.click_btn(by="id", value="com.stoneenglish:id/login_tel")
        time.sleep(3)
        driver.send_keys(by="id",
                         value="com.stoneenglish:id/login_tel",
                         send=phone)
        LogUtil.my_log("登陆日志:").info("输入手机号")
        time.sleep(2)
Exemplo n.º 6
0
 def tearDownClass(cls):
     # 初始化Appium
     LogUtil.my_log("tearDownClassguanbi:" +
                    nowtime).info("tearDownClass...关闭driver")
     cls.driver.quit()
Exemplo n.º 7
0
 def tearDown(self):
     LogUtil.my_log("tearDown关闭:" +
                    nowtime).info("tearDown关闭...driver.close_app()")
     self.driver.close_app()
Exemplo n.º 8
0
 def setUp(self):
     LogUtil.my_log("setUpC开启:" +
                    nowtime).info("setUp开启...初始化driver.launch_app()")
     self.driver.launch_app()
     self.Page_driver = Action(self.driver)
Exemplo n.º 9
0
 def setUpClass(cls):
     #初始化Appium
     LogUtil.my_log("setUpClass开启:" +
                    nowtime).info("setUpClass开启...初始化Appium")
     cls.driver = DesireCaps.appium_desired_caps()
Exemplo n.º 10
0
import time
from base import DesireCaps
from base.BaseAction import Action
from utils import LogUtil
import datetime
nowtime = str(datetime.datetime.now())
LogUtil.my_log("APP开始登录:" + nowtime).info("APP登录开始执行...")


class CapsTest(Action):
    def __init__(self):
        driver = DesireCaps.appium_desired_caps()
        super().__init__(driver)

    def login_test(self):
        # 点击密码登录
        self.click_btn(by="id", value="com.stoneenglish:id/quick_to_login")
        LogUtil.my_log("登陆日志:").info("点击选择密码登录")
        # 输入手机号
        time.sleep(3)
        self.click_btn(by="id", value="com.stoneenglish:id/login_tel")
        time.sleep(3)
        self.send_keys(by="id",
                       value="com.stoneenglish:id/login_tel",
                       send="13582905701")
        LogUtil.my_log("登陆日志:").info("输入手机号")
        time.sleep(2)
        self.click_btn(by="id", value="com.stoneenglish:id/login_password")
        self.send_keys(by="id",
                       value="com.stoneenglish:id/login_password",
                       send="905701")