Ejemplo n.º 1
0
def 切换角色(driver, roomid):
    控件文件 = pubfuc.getymlfileinfo()
    print(driver.desired_capabilities)
    devicedriverinfo = driver.desired_capabilities
    isIOS = 'desired' not in devicedriverinfo
    if isIOS:
        控件信息 = 控件文件['iRoom_{}'.format(devicedriverinfo['platformName'])]
    else:
        控件信息 = 控件文件['iRoom_{}'.format(
            devicedriverinfo['desired']['platformName'])]
    #click 多人群聊
    driver.find_element_by_xpath(控件信息['多人群聊']['xpath']).click()
    sleep(3)
    roomid = f' {roomid}' if isIOS else roomid
    roomxpath = re.sub("xxxx", roomid, 控件信息['房间列表']['xpath'])
    pubfuc.waittimeout(driver.find_element_by_xpath(roomxpath))
    # click 房间
    driver.find_element_by_xpath(roomxpath).click()
    # pubfuc.waittimeout(driver.find_element_by_id(控件信息['JOIN']['id']))
    sleep(5)
    if not driver.find_element_by_id(
            控件信息['JOIN']['id']).get_attribute('enabled'):
        sleep(3)
    driver.find_element_by_id(控件信息['JOIN']['id']).click()
    sleep(10)
    num = 1
    while num < 301:
        print(f"第{num}次{driver}changerole")
        print(
            driver.find_element_by_id(
                控件信息['changerole']['id']).get_attribute('enabled'))
        driver.find_element_by_id(控件信息['changerole']['id']).click()
        sleep(6)
        num += 1
Ejemplo n.º 2
0
    def setUp(self):
        self.控件信息 = pubfuc.getymlfileinfo()['zego_Android']
        #第一个为主播
        devicelist = ['p6']

        self.sd = pubfuc.StartDriver(devicelist)

        self.proc_list = []
        是否mac = 'mac' in pubfuc.getcurretsystem()

        pubfuc.cleannodeproc()
        for i in range(len(self.sd.devicelist)):
            self.proc_list.append(
                multiprocessing.Process(target=self.sd.startappiumserver,
                                        args=(i, )))

        # print(self.proc_list)

        for pro in self.proc_list:
            pro.start()

        for pro in self.proc_list:
            pro.join()

        while len(self.sd.getnodeprocpid()) < len(devicelist):
            sleep(1)

        print(self.sd.getnodeprocpid())

        self.driverlist = []
        for i in range(len(self.sd.devicelist)):
            desire_caps = self.sd.realdevice[i]
            desire_caps['appPackage'] = 'com.zego.videotalk'
            desire_caps['appActivity'] = 'com.zego.videotalk.MainActivity'
            driver = webdriver.Remote(
                f"http://localhost:{self.sd.aport[i]}/wd/hub", desire_caps)
            self.driverlist.append(driver)
            driver.page_source
        print(self.driverlist)
Ejemplo n.º 3
0
def 切后台(driver, roomid):
    控件文件 = pubfuc.getymlfileinfo()
    print(driver.desired_capabilities)
    print(driver.capabilities)
    devicedriverinfo = driver.desired_capabilities
    isIOS = 'desired' not in devicedriverinfo
    if isIOS:
        控件信息 = 控件文件['iRoom_{}'.format(devicedriverinfo['platformName'])]
        return
    else:
        控件信息 = 控件文件['iRoom_{}'.format(
            devicedriverinfo['desired']['platformName'])]
    #click 多人群聊
    driver.find_element_by_xpath(控件信息['多人群聊']['xpath']).click()
    sleep(3)
    roomid = f' {roomid}' if isIOS else roomid
    roomxpath = re.sub("xxxx", roomid, 控件信息['房间列表']['xpath'])
    pubfuc.waittimeout(driver.find_element_by_xpath(roomxpath))
    # click 房间
    driver.find_element_by_xpath(roomxpath).click()
    # pubfuc.waittimeout(driver.find_element_by_id(控件信息['JOIN']['id']))
    sleep(5)
    if not driver.find_element_by_id(
            控件信息['JOIN']['id']).get_attribute('enabled'):
        sleep(3)
    driver.find_element_by_id(控件信息['JOIN']['id']).click()
    sleep(10)
    num = 1
    while num < 301:
        print(f"第{num}次{driver}backapp")
        driver.background_app(5)
        sleep(5)
        #切后台回来后,查看离开房间按钮是否可用,确定正确切回了前台
        print(
            driver.find_element_by_id(
                控件信息['离开房间']['id']).get_attribute('enabled'))
        num += 1
Ejemplo n.º 4
0
def 加入离开房间(driver, roomid):
    控件文件 = pubfuc.getymlfileinfo()
    print(driver.desired_capabilities)
    devicedriverinfo = driver.desired_capabilities
    isIOS = 'desired' not in devicedriverinfo
    num = 1
    while num < 301:
        if num == 1:
            driver.find_element_by_id(
                'com.zego.videotalk:id/sessionid_edittext').send_keys(roomid)
            sleep(2)
        print(f"第{num}次{driver}joinandleaveroom")
        # pubfuc.waittimeout(driver.find_element_by_id(控件信息['JOIN']['id']))
        if not driver.find_element_by_id(
                'com.zego.videotalk:id/start_button').get_attribute('enabled'):
            sleep(3)
        driver.find_element_by_id('com.zego.videotalk:id/start_button').click()
        sleep(10)
        driver.find_element_by_id('com.zego.videotalk:id/vt_btn_close').click()
        sleep(3)
        driver.find_element_by_xpath(
            "//android.widget.Button[@text='离开']").click()
        sleep(2)
        num += 1
Ejemplo n.º 5
0
# -*- coding:utf-8 -*-

import subprocess
import lib.public_functions as pub_func

device_name = 'p9'
device_id = pub_func.getymlfileinfo('devices')[device_name]['deviceName']
# cmd = f'adb -s {device_id} logcat -v threadtime -b all > {device_name}.txt'
# subprocess.check_call(cmd, shell=True)
test_package = 'com.powerinfo.bootstrapA50'

cmd_monkey = f"adb -s {device_id} shell monkey -v -v -v --throttle 300 --pct-touch 30 --pct-motion 20 --pct-nav 20 " \
             f"--pct-majornav 15 --pct-appswitch 5 --pct-anyevent 5 --pct-trackball 0 --pct-syskeys 0 " \
             f"-p {test_package} 30000 > monkey3.txt"

print(cmd_monkey)
# 测试之前执行logcat
subprocess.call(cmd_monkey, shell=True)

Ejemplo n.º 6
0
# -*- coding:utf-8 -*-

import sys
sys.path.append('..')

import subprocess
from time import sleep
import unittest
import lib.public_functions as pubfuc
from appium import webdriver


# desired_caps = pubfuc.get_android_app_info()
# desired_caps = pubfuc.get_ios_app_info()

控件信息 = pubfuc.getymlfileinfo()
设备信息 = pubfuc.getymlfileinfo('devices')

print(设备信息['ip5s_test8'])
desired_caps = 设备信息['ip5s_test5']


# pubfuc.启动appium_server(desired_caps['deviceName'])

driver = webdriver.Remote("http://*****:*****@text='多人群聊']").click()
# sleep(1)

# driver.find_element_by_xpath("//android.widget.TextView[@text='RoomID :3050']").click()
# sleep(1)