summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJIAO <JIAO@DESKTOP-Q4S6VOM>2022-12-22 14:38:21 +0800
committerJIAO <JIAO@DESKTOP-Q4S6VOM>2022-12-22 14:38:21 +0800
commit247c0a37005c95258ddf25f1732763ad182d6197 (patch)
tree60f561e3b79a3b1b136a4184616765d6756d95d0
parent8e09523cff5294e64a923ecad3bbbddef788b37b (diff)
Instagram_ios脚本提交
-rw-r--r--App_automation/air_test_auto/app/Instagram/Instagram.py8
-rw-r--r--App_automation/air_test_auto/app/Instagram/Instagram_ios.py371
-rw-r--r--App_automation/air_test_auto/app/Instagram/tpl1665468348186.pngbin0 -> 19642 bytes
-rw-r--r--App_automation/air_test_auto/app/Instagram/tpl1665468418365.pngbin0 -> 22697 bytes
-rw-r--r--App_automation/air_test_auto/app/Instagram/tpl1671436367920.pngbin0 -> 15238 bytes
-rw-r--r--App_automation/air_test_auto/app/Instagram/tpl1671439074166.pngbin0 -> 13980 bytes
-rw-r--r--App_automation/air_test_auto/app/Instagram/tpl1671504839560.pngbin0 -> 24874 bytes
7 files changed, 371 insertions, 8 deletions
diff --git a/App_automation/air_test_auto/app/Instagram/Instagram.py b/App_automation/air_test_auto/app/Instagram/Instagram.py
index acd297c..b42a565 100644
--- a/App_automation/air_test_auto/app/Instagram/Instagram.py
+++ b/App_automation/air_test_auto/app/Instagram/Instagram.py
@@ -53,7 +53,6 @@ def open():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def quit():
try:
set_current(deviceid1) # 切换手机1
@@ -89,7 +88,6 @@ def quit():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def login():
try:
set_current(deviceid1) # 切换手机1
@@ -123,7 +121,6 @@ def login():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def sendDynamic():
try:
set_current(deviceid1) # 切换手机1
@@ -179,7 +176,6 @@ def sendDynamic():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def sendMessage():
try:
set_current(deviceid1) # 切换手机1
@@ -250,7 +246,6 @@ def search():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def voicecalls():
try:
sleep(60)
@@ -307,7 +302,6 @@ def voicecalls():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def videoCall():
try:
sleep(60)
@@ -365,7 +359,6 @@ def videoCall():
rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
rp.report(output_file=report_name + "_" + r"_test.html")
-
def stopapp():
sleep(10)
if poco(text="Instagram已停止运行").exists():
@@ -378,7 +371,6 @@ def stopapp():
if poco(text="关闭应用").exists():
poco(text="关闭应用").click()
-
def report_deny():
a1 = r'{}{}'.format(report_dataDir, "\log_deny")
name = str(time.strftime("%Y%m%d%H%M", time.localtime()))
diff --git a/App_automation/air_test_auto/app/Instagram/Instagram_ios.py b/App_automation/air_test_auto/app/Instagram/Instagram_ios.py
new file mode 100644
index 0000000..3ad9c05
--- /dev/null
+++ b/App_automation/air_test_auto/app/Instagram/Instagram_ios.py
@@ -0,0 +1,371 @@
+# -*- encoding=utf8 -*-
+__author__ = "JIAO"
+
+import os
+import sys
+rootDirectory = os.path.abspath(os.path.join(os.getcwd(), "../.."))
+App_automation = r'{}{}'.format(rootDirectory, "App_automation")
+sys.path.append(App_automation)
+from airtest.core.api import *
+import logging
+logger = logging.getLogger("airtest")
+logger.setLevel(logging.ERROR)
+from air_test_auto.control import *
+auto_setup(__file__, devices=["android://127.0.0.1:5037/" + deviceid3])
+auto_setup(__file__,logdir=True)
+init_device(platform="IOS",uuid=deviceid1)
+from poco.drivers.ios import iosPoco
+poco = iosPoco()
+from airtest.report.report import *
+
+
+def open():
+ clearApp()
+ start_app("com.apple.Preferences") # 打开设置
+ sleep(5)
+ swipe([570, 494], [578, 1098])
+ sleep(5)
+ poco(name="搜索").click()
+ text("Instagram")
+ sleep(10)
+ if exists(Template(r"tpl1671436367920.png", record_pos=(-0.421, -0.549), resolution=(1170, 2532))):
+ print("app已安装,不需要重新安装")
+ stop_app("com.burbn.instagram") # 关闭app
+ start_app("com.burbn.instagram") # 打开app
+ sleep(5)
+ else:
+ start_app("com.apple.AppStore") # 打开app store
+ sleep(10)
+ poco(name="Search").click()
+ poco(name="SearchField").click()
+ text("Instagram")
+ sleep(5)
+ touch(Template(r"tpl1671436367920.png", record_pos=(-0.421, -0.549), resolution=(1170, 2532)))
+ sleep(10)
+ if poco(name="get").exists():
+ poco(name="get").click()
+ sleep(20)
+ poco(name="安装").click()
+ sleep(2)
+ poco(name="SecureTextField").click()
+ sleep(2)
+ text("Test12345678")
+ sleep(2)
+ poco(name="登录").click()
+ sleep(180)
+ if poco(name="open").exists():
+ print("app安装完成")
+ else:
+ print("app安装失败")
+ else:
+ poco(name="re-download").click()
+ sleep(180)
+ if poco(name="open").exists():
+ print("app安装完成")
+ start_app("com.burbn.instagram")
+ sleep(10)
+ else:
+ print("app安装失败")
+ try:
+ snapshot(msg="Instagram_open")
+ assert_equal(poco(name="profile-tab").exists(), True, "Instagram_open succeeded")
+ print('Instagram_open succeeded')
+ print('The test case succeeded', flush=True)
+ return print('The test case succeeded')
+ except AssertionError:
+ print("Instagram_open failed")
+ print("The test case faileded", flush=True)
+ return print('The test case faileded')
+
+def login():
+ try:
+ set_current(deviceid1) # 切换手机1
+ stop_app("com.burbn.instagram")
+ start_app("com.burbn.instagram") # 打开app
+ sleep(10)
+ if poco(name="登录其他帐户").exists():
+ poco(name="登录其他帐户").click()
+ poco(type="TextField").click()
+ if poco(name="清除帐号、邮箱或手机号文字").exists():
+ poco(name="清除帐号、邮箱或手机号文字").click()
+ sleep(2)
+ text("chenguanbao7")
+ poco(type="SecureTextField").click()
+ text("tsg12345678")
+ poco(name="登录").click()
+ sleep(10)
+ if exists(Template(r"tpl1671439074166.png", record_pos=(-0.001, 0.921), resolution=(1170, 2532))):
+ touch(Template(r"tpl1671439074166.png", record_pos=(-0.001, 0.921), resolution=(1170, 2532)))
+ try:
+ snapshot(msg="Instagram_login")
+ assert_equal(poco(name="profile-tab").exists(), True, "Instagram_login succeeded")
+ print('Instagram_login succeeded')
+ print('The test case succeeded', flush=True)
+ return 'The test case succeeded'
+ except AssertionError:
+ print("Instagram_login failed")
+ print("The test case failed", flush=True)
+ return 'The test case failed'
+ finally:
+ a1 = r'{}{}'.format(report_dataDir, "/" + report_name)
+ rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
+ rp.report(output_file=report_name + "_" + r"_test.html")
+
+def sendMessage():
+ try:
+ set_current(deviceid1)
+ stop_app("com.burbn.instagram") # 关闭app
+ start_app("com.burbn.instagram") # 打开app
+ sleep(10)
+ poco(name="direct-inbox").click()
+ sleep(5)
+ poco(label="cmtest84").click()
+ sleep(5)
+ if poco(name="发消息...").exists():
+ poco(name="发消息...").click()
+ if poco(name="direct-keyboard-text-view").exists():
+ poco(name="direct-keyboard-text-view").click()
+ sleep(5)
+ text("hello")
+ sleep(5)
+ if poco(name="发送").exists():
+ poco(name="发送").click()
+ sleep(5)
+ print("发送语音")
+ poco(name="按住发送语音消息").long_click()
+ sleep(5)
+ poco(name="返回").click()
+ sleep(60)
+ try:
+ snapshot(msg="Instagram_send voice")
+ assert_not_equal(poco(name="正在发送…").exists(), True, "Instagram_sendMessage succeeded")
+ print('Instagram_sendMessage succeeded')
+ print('The test case succeeded', flush=True)
+ stop_app("com.burbn.instagram") # 关闭app
+ return print('The test case succeeded')
+ except AssertionError:
+ print("Instagram_sendMessage failed")
+ print("The test case faileded", flush=True)
+ stop_app("com.burbn.instagram") # 关闭app
+ return print('The test case faileded')
+ finally:
+ a1 = r'{}{}'.format(report_dataDir, "/" + report_name)
+ rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
+ rp.report(output_file=report_name + "_" + r"_test.html")
+
+def search():
+ try:
+ set_current(deviceid1) # 切换手机1
+ stop_app("com.burbn.instagram")
+ start_app("com.burbn.instagram")
+ sleep(10)
+ poco(name="explore-tab").click()
+ sleep(2)
+ poco(name="搜索").click()
+ text("hello")
+ sleep(30)
+ try:
+ snapshot(msg="Instagram search succeeded")
+ assert_equal(poco(name="media-discovery-cell").exists(), True, "Instagram search succeeded")
+ print('Instagram search succeeded')
+ print("The test case succeeded", flush=True)
+ stop_app("com.burbn.instagram")
+ return 'The test case succeeded'
+ except AssertionError:
+ print("Instagram search failed")
+ print('The test case failed', flush=True)
+ stop_app("com.burbn.instagram")
+ return 'The test case failed'
+ finally:
+ a1 = r'{}{}'.format(report_dataDir, "/" + report_name)
+ rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
+ rp.report(output_file=report_name + "_" + r"_test.html")
+
+def sendDynamic():
+ try:
+ set_current(deviceid1) # 切换手机1
+ stop_app("com.burbn.instagram")
+ start_app("com.burbn.instagram") # 打开app
+ sleep(20)
+ if poco(name="create").exists():
+ poco(name="create").click()
+ sleep(5)
+ if poco(name="ig-photo-library-priming-continue-button").exists():
+ poco(name="ig-photo-library-priming-continue-button").click()
+ poco(name="允许访问所有照片").click()
+ sleep(5)
+ poco(name="next-button").click()
+ sleep(2)
+ poco(name="next-button").click()
+ sleep(5)
+ poco(name="share-button").click()
+ sleep(5)
+ if poco(name="分享到 Facebook?").exists():
+ poco(name="Link").click()
+ sleep(60)
+ try:
+ snapshot(msg="Instagram_send_dynamic")
+ assert_not_equal(poco(name="发布中...").exists(), True,"Instagram_send_dynamic succeeded")
+ print('Instagram_send_dynamic succeeded')
+ print("The test case succeeded", flush=True)
+ stop_app("com.burbn.instagram")
+ return 'The test case succeeded'
+ except AssertionError:
+ print("Instagram_send_dynamic failed")
+ print('The test case failed', flush=True)
+ stop_app("com.burbn.instagram")
+ return 'The test case failed'
+ finally:
+ a1 = r'{}{}'.format(report_dataDir, "/" + report_name)
+ rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
+ rp.report(output_file=report_name + "_" + r"_test.html")
+
+def voicecalls():
+ try:
+ set_current(deviceid3) # 切换手机2
+ stop_app("com.instagram.android")
+ start_app("com.instagram.android")
+ sleep(20)
+ set_current(deviceid1) # 切换手机1
+ stop_app("com.burbn.instagram") # 关闭app
+ start_app("com.burbn.instagram") # 打开app
+ sleep(10)
+ poco(name="direct-inbox").click()
+ sleep(5)
+ poco(label="cmtest84").click()
+ sleep(5)
+ poco(name="audio-call").click()
+ set_current(deviceid3) # 切换手机2
+ sleep(10)
+ if poco(text="Instagram已停止运行").exists():
+ poco(text="重新打开应用").click()
+ sleep(5)
+ if exists(Template(r"tpl1671504839560.png", record_pos=(0.15, -0.716), resolution=(1080, 2400))):
+ touch(Template(r"tpl1671504839560.png", record_pos=(0.15, -0.716), resolution=(1080, 2400)))
+ if exists(Template(r"tpl1660205423774.png", record_pos=(0.229, -0.564), resolution=(1080, 1920))):
+ touch(Template(r"tpl1660205423774.png", record_pos=(0.229, -0.564), resolution=(1080, 1920)))
+ if exists(Template(r"tpl1662442474580.png", record_pos=(0.252, -0.553), resolution=(1080, 1920))):
+ touch(Template(r"tpl1662442474580.png", record_pos=(0.252, -0.553), resolution=(1080, 1920)))
+ if exists(Template(r"tpl1664354447074.png", record_pos=(-0.068, -0.676), resolution=(1080, 2400))):
+ touch(Template(r"tpl1664354447074.png", record_pos=(-0.068, -0.676), resolution=(1080, 2400)))
+ sleep(20)
+ set_current(deviceid1)
+ try:
+ snapshot(msg="instagram_voicecalls")
+ assert_equal(poco(name="end-call").exists(), True, "instagram_Voice calls succeeded")
+ print("instagram_Voice calls succeeded")
+ print("The test case succeeded", flush=True)
+ set_current(deviceid1)
+ stop_app("com.burbn.instagram")
+ sleep(20)
+ return print('The test case succeeded')
+ except AssertionError:
+ print("instagram_Voice calls failed")
+ print('The test case failed', flush=True)
+ set_current(deviceid1)
+ stop_app("com.burbn.instagram")
+ sleep(20)
+ return print('The test case failed')
+ finally:
+ a1 = r'{}{}'.format(report_dataDir, "/" + report_name)
+ rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
+ rp.report(output_file=report_name + "_" + r"_test.html")
+
+def videoCall():
+ try:
+ set_current(deviceid3) # 切换手机2
+ stop_app("com.instagram.android")
+ start_app("com.instagram.android")
+ sleep(20)
+ set_current(deviceid1) # 切换手机1
+ stop_app("com.burbn.instagram") # 关闭app
+ start_app("com.burbn.instagram") # 打开app
+ sleep(10)
+ poco(name="direct-inbox").click()
+ sleep(5)
+ poco(label="cmtest84").click()
+ sleep(5)
+ poco(name="video-chat").click()
+ set_current(deviceid3) # 切换手机2
+ sleep(10)
+ if poco(text="Instagram已停止运行").exists():
+ poco(text="重新打开应用").click()
+ sleep(5)
+ if exists(Template(r"tpl1671504839560.png", record_pos=(0.15, -0.716), resolution=(1080, 2400))):
+ touch(Template(r"tpl1671504839560.png", record_pos=(0.15, -0.716), resolution=(1080, 2400)))
+ if exists(Template(r"tpl1660205423774.png", record_pos=(0.229, -0.564), resolution=(1080, 1920))):
+ touch(Template(r"tpl1660205423774.png", record_pos=(0.229, -0.564), resolution=(1080, 1920)))
+ if exists(Template(r"tpl1662442474580.png", record_pos=(0.252, -0.553), resolution=(1080, 1920))):
+ touch(Template(r"tpl1662442474580.png", record_pos=(0.252, -0.553), resolution=(1080, 1920)))
+ if exists(Template(r"tpl1664354447074.png", record_pos=(-0.068, -0.676), resolution=(1080, 2400))):
+ touch(Template(r"tpl1664354447074.png", record_pos=(-0.068, -0.676), resolution=(1080, 2400)))
+ sleep(20)
+ set_current(deviceid1)
+ try:
+ snapshot(msg="instagram_videoCall")
+ assert_equal(poco(name="end-call").exists(), True, "instagram_Voice calls succeeded")
+ print("instagram_Voice calls succeeded")
+ print('The test case succeeded', flush=True)
+ set_current(deviceid1)
+ stop_app("com.burbn.instagram")
+ sleep(20)
+ return print('The test case succeeded')
+ except AssertionError:
+ print("instagram_Voice calls failed")
+ print("The test case failed", flush=True)
+ set_current(deviceid1)
+ sleep(20)
+ stop_app("com.burbn.instagram")
+ return print('The test case failed')
+ finally:
+ a1 = r'{}{}'.format(report_dataDir, "/" + report_name)
+ rp = LogToHtml(__file__, export_dir=a1, lang='zh', plugins=["poco.utils.airtest.report"])
+ rp.report(output_file=report_name + "_" + r"_test.html")
+
+def close():
+ stop_app("com.burbn.instagram")
+
+def clearApp():
+ keyevent("HOME")
+ keyevent("HOME")
+ touch(Template(r"tpl1665468348186.png", record_pos=(-0.396, 0.657), resolution=(1170, 2532)))
+ touch(Template(r"tpl1665468418365.png", record_pos=(-0.001, 0.756), resolution=(1170, 2532)))
+ for i in range(10):
+ swipe([855, 1683], [852, 796])
+
+
+if __name__ == '__main__':
+ Instagram = sys.argv
+ for i in Instagram:
+ if i == 'open':
+ open()
+ elif i == 'login':
+ login()
+ elif i == 'sendDynamic':
+ sendDynamic()
+ elif i == 'sendMessage':
+ sendMessage()
+ elif i == 'search':
+ search()
+ elif i == 'voiceCalls':
+ voicecalls()
+ elif i == 'videoCall':
+ videoCall()
+ elif i == 'all':
+ open()
+ login()
+ sendDynamic()
+ sendMessage()
+ search()
+ voicecalls()
+ videoCall()
+
+
+
+
+
+
+
+
+
+
diff --git a/App_automation/air_test_auto/app/Instagram/tpl1665468348186.png b/App_automation/air_test_auto/app/Instagram/tpl1665468348186.png
new file mode 100644
index 0000000..db2dbb4
--- /dev/null
+++ b/App_automation/air_test_auto/app/Instagram/tpl1665468348186.png
Binary files differ
diff --git a/App_automation/air_test_auto/app/Instagram/tpl1665468418365.png b/App_automation/air_test_auto/app/Instagram/tpl1665468418365.png
new file mode 100644
index 0000000..47144db
--- /dev/null
+++ b/App_automation/air_test_auto/app/Instagram/tpl1665468418365.png
Binary files differ
diff --git a/App_automation/air_test_auto/app/Instagram/tpl1671436367920.png b/App_automation/air_test_auto/app/Instagram/tpl1671436367920.png
new file mode 100644
index 0000000..a03303a
--- /dev/null
+++ b/App_automation/air_test_auto/app/Instagram/tpl1671436367920.png
Binary files differ
diff --git a/App_automation/air_test_auto/app/Instagram/tpl1671439074166.png b/App_automation/air_test_auto/app/Instagram/tpl1671439074166.png
new file mode 100644
index 0000000..9419e8f
--- /dev/null
+++ b/App_automation/air_test_auto/app/Instagram/tpl1671439074166.png
Binary files differ
diff --git a/App_automation/air_test_auto/app/Instagram/tpl1671504839560.png b/App_automation/air_test_auto/app/Instagram/tpl1671504839560.png
new file mode 100644
index 0000000..61357ed
--- /dev/null
+++ b/App_automation/air_test_auto/app/Instagram/tpl1671504839560.png
Binary files differ