def start_prod(): '''生产模式启动''' # 引入启动模块 using("businessdao.air") from businessdao import run # 调用启动方法 run()
# -*- encoding=utf8 -*- __author__ = "v-wutaotao" from airtest.core.api import using using("Gameplay.air") import Gameplay auto_setup(__file__) import time from poco.drivers.unity3d import UnityPoco poco = UnityPoco() def addmoney(): poco("btn_gm").click() for momey in range(2): poco(text="增加1000砖石").click() poco(text="增加1000金币").click() Gameplay.start() addmoney()
# -*- coding=utf-8 -*- __author__ = "jingchuan.wei" from airtest.core.api import using,sleep,stop_app,snapshot,clear_app,wake,home,start_app # from airtest.report.report import simple_report import time from airtest.core.api import text,touch using("D:/test/spider/login.air") using("D:/test/spider/rewardLevel.air") from login import Login from poco.drivers.android.uiautomation import AndroidUiautomationPoco import unittest from poco.drivers.unity3d import UnityPoco class CommentNotEnoughCoins(Login): @classmethod def setUpClass(cls): super(CommentNotEnoughCoins, cls).setUpClass() @classmethod def tearDownClass(cls): super(CommentNotEnoughCoins, cls).tearDownClass() def setUp(self): stop_app("com.gameholic.drawsomethingbyspider") clear_app("com.gameholic.drawsomethingbyspider") wake() home() start_app("com.gameholic.drawsomethingbyspider") sleep(7) self.poco = UnityPoco()
# -*- encoding=utf8 -*- __author__ = "jinghcuan.wei" __title__ = "test make level" __desc__ = """ this is a test script. 用来测试制作关卡 """ # start your script here from airtest.core.api import sleep, clear_app, wake, home, start_app, stop_app, snapshot, Template, exists, shell, assert_exists, using from airtest.report.report import simple_report import sys import time from airtest.core.api import text, touch sys.path.append("D:/test/spider/login.air") using("D:/test/spider/makeLevel.air") from login import Login from poco.drivers.android.uiautomation import AndroidUiautomationPoco import unittest from poco.drivers.unity3d import UnityPoco class MakeLvCase(Login): @classmethod def setUpClass(cls): super(MakeLvCase, cls).setUpClass() @classmethod def teardownclass(cls): super(MakeLvCase, cls).tearDownClass()
# -*- encoding=utf8 -*- __author__ = "hallo" from airtest.core.api import * import threading import time import random #ST.PROJECT_ROOT = "D:\\airtest_script\\" ST.PROJECT_ROOT = "D:\\android_airtest\\" from airtest.core.api import using using("login.air") from login import login using("common_api.air") from common_api import authApp, selectMode, selectOrg_0, selectApp, take_pic from poco.drivers.android.uiautomation import AndroidUiautomationPoco poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False) auto_setup(__file__) #,拍照后,打开图片,定位,并退出 def pic_test(): touch((130, 330)) #点击图片位置查看图片 swipe((1000, 1000), (200, 1000), duration=0.5) #从左到右画横线1秒
# -*- encoding=utf8 -*- __author__ = "Lee.li" from airtest.core.api import using using("auto_test.air") from airtest.core.api import * from poco.drivers.unity3d import UnityPoco import time devices = "127.0.0.1:62001" print("start...") poco = UnityPoco() # 启动游戏 # Startgame.test_Start() def test_SignInReward(devices): """1.每天第一次登陆弹出签到窗口进行签到 2.第一次登陆的时候没有签到,就到福利中去签到 """ dev = connect_device("android:///" + devices) poco = UnityPoco(device=dev) if poco("Check").exists() and poco( "RedPoint").exists(): # 判断签到状态,有红点就是还没签到 poco("Check").click() # 点击签到 print("签到成功!") else: poco("SysGWelfare").click() poco("WelfareDlg(Clone)").offspring("item4").click() if poco("RedPoint").exists(): poco("Check").click()
# -*- encoding=utf8 -*- __author__ = "janson" #上传、搜索、查看、删除发票 from airtest.core.api import * from airtest.core.api import using using(r"E:\黄振旭\费用管理系统自动化测试用例\conf\common.air") from common import common from selenium import webdriver from selenium.webdriver.common.keys import Keys from airtest_selenium.proxy import WebChrome driver = WebChrome() driver.maximize_window() #放大浏览器 driver.get("http://14.21.59.70:1000/#/mrp/base/warehouseList") common.login(driver, "huangzhenxu") driver.find_element_by_xpath( "//*[@id=\"app\"]/div/div/div[2]/div/div/ul/div/li/ul/div/a/li/span" ).click() #进入【上传发票】页面 driver.assert_template( Template(r"tpl1594800342361.png", record_pos=(7.415, 2.15), resolution=(100, 100)), "成功打开发票管理页面") driver.airtest_touch( Template(r"tpl1594800381828.png", record_pos=(7.82, 2.985), resolution=(100, 100))) driver.assert_template( Template(r"tpl1594800422516.png", record_pos=(13.66, 4.545), resolution=(100, 100)), "打开识别发票接界面")
# -*- encoding=utf8 -*- __author__ = "v-wutaotao" from airtest.core.api import * import os from HTMLTestRunner import HTMLTestRunner import unittest from airtest.core.api import using using("test_mathfunc.air") from test_mathfunc import TestMathFunc using("emalitest.air") import emalitest auto_setup(__file__) # if __name__ == "__main__": wake() shell("input swipe 525 1723 525 1087 300") home() """唤醒MI6设备并进入主界面""" test_suite = unittest.TestSuite() tests = [ TestMathFunc("test_add"), TestMathFunc("test_minus"), TestMathFunc("test_multi"), TestMathFunc("test_divide"), TestMathFunc("test_name"), TestMathFunc("test_game"), TestMathFunc("test_btnopt"), TestMathFunc("test_facial"), TestMathFunc("test_head"), TestMathFunc("test_welfare"),
#coding = utf-8 __author__ = "LT" __title__ = "启动入口" __desc__ = """启动入口程序模块""" from airtest.core.api import using using("myconfig.air") from myconfig import start_model #-----------------------生产启动函数--------------------------------- def start_prod(): '''生产模式启动''' # 引入启动模块 using("businessdao.air") from businessdao import run # 调用启动方法 run() print("-----------------------主启动程序---------------------->start_run start") if start_model == "prod": start_prod() else: print("请检查myconfig配置中启动模式是否改为prod模式") print("-----------------------主启动程序---------------------->start_run end")
# -*- encoding=utf8 -*- __author__ = "hallo" from airtest.core.api import * #ST.PROJECT_ROOT = "C:\\airtest_script\\" ST.PROJECT_ROOT = "D:\\android_airtest\\" from airtest.core.api import using using("common_api.air") from common_api import selectTab from poco.drivers.android.uiautomation import AndroidUiautomationPoco poco = AndroidUiautomationPoco(use_airtest_input=True, screenshot_each_action=False) auto_setup(__file__) #完成登录 (首次打开登录页面,用户数据为空,输入账户登录,验证登陆成功后回到工作台) def login(username='******', password='******', enterprise='p1', real_name='kentestgrp10'): #遍历账号输入框,不管有没值,先置空 for edittext in poco(type='android.widget.EditText'): edittext.set_text("") #获取用户名输入框,点击清空内容并输入 username_field = poco(text="请输入用户名") username_field.click() text(username, enter=False) #不自动换行
#coding = utf-8 "启动入口程序模块" __author__ = "LT" from airtest.core.api import using using("businessdao.air") from businessdao import run using("myconfig.air") from myconfig import start_model print("-----------------------主启动程序---------------------->start_run start") if start_model == "prod": run() else: print("请检查myconfig配置中启动模式是否改为prod模式") print("-----------------------主启动程序---------------------->start_run end")
# -*- encoding=utf8 -*- # 明日方舟护肝小能手 __author__ = "Kuma" __title__ = "护肝小能手" from airtest.core.api import * from airtest.core.api import using using("TestCase.air") import TestCase # 优先连接手机,其次连接模拟器(目前仅支持网易mumu) try: dev = connect_device("Android:///") except: dev = connect_device("Android://127.0.0.1:5037/127.0.0.1:7555?cap_method=JAVACAP^&^&ori_method=ADBORI") try: dev.minicap.get_stream() except: dev = connect_device("Android:///?cap_method=JAVACAP") G.add_device(dev) auto_setup(__file__) OPEAR_CONF = { "0": "启动游戏", "00": "启动游戏登录账号", "1": "单关卡循环刷图+自动吃药(需选中关卡)", "2": "剿灭用:单关卡循环刷图(需选中关卡)", "3": "自动领取任务奖励(需保证界面在主页)", "4": "自动获取信用(需保证界面在主页)",
# -*- encoding=utf8 -*- __author__ = "v-wutaotao" from airtest.core.api import * from airtest.core.api import using using("Gameplay.air") import Gameplay using("welfare.air") import welfare using("activity.air") import activity from HTMLTestRunner import HTMLTestRunner auto_setup(__file__) import unittest class TestMathFunc(unittest.TestCase): # TestCase基类方法,所有case执行之前自动执行 @classmethod def setUpClass(cls): print("这里是所有测试用例前的准备工作") # TestCase基类方法,所有case执行之后自动执行 @classmethod def tearDownClass(cls): print("这里是所有测试用例后的清理工作") # TestCase基类方法,每次执行case前自动执行 def setUp(self): print("这里是一个测试用例前的准备工作")