# __author__ : KingWolf
# createtime : 2019/4/16 4:50

from appium_learn.kyb_project_test.utils.driver import Driver
from appium_learn.kyb_project_test.utils.common_logs import Common_log
from appium_learn.kyb_project_test.page_object.baseView.common_view import Common_view
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from appium.webdriver.common.mobileby import MobileBy
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
import os
import random

logger = Common_log(logger='regiser_action').get_logger()


class Register_View(Common_view):

    #注册按钮
    register_button = (By.ID, 'com.tal.kaoyan:id/login_register_text')

    #注册页面-添加头像(这里需要判断权限问题)
    add_userheader = (By.ID, 'com.tal.kaoyan:id/activity_register_userheader')

    #系统权限处理
    permission = (By.ID, 'android:id/button1')
    uiautomator_loc1 = (MobileBy.ANDROID_UIAUTOMATOR,
                        'new UiSelector().text("允许")')
    uiautomator_loc2 = (MobileBy.ANDROID_UIAUTOMATOR,
예제 #2
0
# ! /usr/bin/env python
# - * - coding:utf-8 - * -
# __author__ : KingWolf
# createtime : 2019/4/5 5:56

from appium_learn.kyb_project_test.config.read_configparser import Config_paser
from appium import webdriver
from appium_learn.kyb_project_test.utils.common_logs import Common_log
import os

logger = Common_log(logger='driver').get_logger()


class Driver(object):
    def __init__(self):

        self.cf = Config_paser()

    def read_caps(self):

        #读取capability配置
        desired_caps = {}
        desired_caps['platformName'] = self.cf.get_selectoin(
            'capability', 'platformName')
        desired_caps['platformVersion'] = self.cf.get_selectoin(
            'capability', 'platformVersion')
        desired_caps['deviceName'] = self.cf.get_selectoin(
            'capability', 'deviceName')
        # desired_caps['udid'] = self.cf.get_selectoin('capability','udid')  #米8用的
        desired_caps['appPackage'] = self.cf.get_selectoin(
            'capability', 'appPackage')
예제 #3
0
# ! /usr/bin/env python
# - * - coding:utf-8 - * -
# __author__ : KingWolf
# createtime : 2019/4/7 4:16

import time
import os
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from appium_learn.kyb_project_test.utils.common_logs import Common_log
from appium_learn.kyb_project_test.utils.driver import Driver
from appium_learn.kyb_project_test.page_object.baseView.common_view import Common_view

logger = Common_log(logger='login_check').get_logger()

class Common_login(Common_view):

    #账号密码,登录按钮
    username_loc = (By.ID,'com.tal.kaoyan:id/login_email_edittext')
    password_loc = (By.ID,'com.tal.kaoyan:id/login_password_edittext')
    login_botton_loc = (By.ID,'com.tal.kaoyan:id/login_login_btn')

    #下线通知提醒
    comit_tip = (By.ID,'com.tal.kaoyan:id/tip_commit')

    #个人中心和昵称
    myself_button = (By.ID,'com.tal.kaoyan:id/mainactivity_button_mysefl')
    nickname = (By.ID,'com.tal.kaoyan:id/activity_usercenter_username')
예제 #4
0
# ! /usr/bin/env python
# - * - coding:utf-8 - * -
# __author__ : KingWolf
# createtime : 2019/4/7 5:49

from appium_learn.kyb_project_test.utils.driver import Driver
from appium_learn.kyb_project_test.utils.common_logs import Common_log
import time
import unittest

logger = Common_log(logger='common_start_unittest').get_logger()

class Common_start(unittest.TestCase):

    def setUp(self):
        logger.info('===================setup======================')
        self.driver = Driver().read_caps()

    def tearDown(self):
        logger.info('====================teardown==========================')
        time.sleep(5)
        #关闭app
        self.driver.close_app()
예제 #5
0
# ! /usr/bin/env python
# - * - coding:utf-8 - * -
# __author__ : KingWolf
# createtime : 2019/5/3 4:13

from appium_learn.kyb_project_test.config.read_configparser import Config_paser
from appium import webdriver
from appium_learn.kyb_project_test.utils.common_logs import Common_log
from multi_devices.multi_case_test import Multi_case
import os
import time
import multiprocessing

logger = Common_log(logger='multi_devices_sync').get_logger()

class Multi_devices(object):

    def __init__(self):

        self.cf = Config_paser()
        #设置不同模拟器的udid
        self.devices_udids = ['127.0.0.1:62001', '127.0.0.1:62025']


    def read_caps(self,udid,port):

        #读取capability配置
        desired_caps = {}
        desired_caps['platformName'] = self.cf.get_selectoin('capability','platformName')
        desired_caps['platformVersion'] = self.cf.get_selectoin('capability','platformVersion')
        desired_caps['deviceName'] = self.cf.get_selectoin('capability','deviceName')   #设置了udid,这里任意
예제 #6
0
# ! /usr/bin/env python
# - * - coding:utf-8 - * -
# __author__ : KingWolf
# createtime : 2019/4/5 6:39

from appium_learn.kyb_project_test.page_object.baseView.base_view import BaseView
from appium_learn.kyb_project_test.utils.common_logs import Common_log
from appium_learn.kyb_project_test.utils.driver import Driver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
import time
import os
import csv

logger = Common_log(logger='commom_view').get_logger()


class Common_view(BaseView):

    skipbtn = (By.ID, 'com.tal.kaoyan:id/tv_skip')

    def check_skipbtn(self):
        """
        检测是否存在跳过按钮
        :return:
        """
        logger.info('=================check skip_btn========================')
        try:
            # '跳过'按钮的定位
            skip_btn = self.driver.find_element(*self.skipbtn)
        except NoSuchElementException: