Ejemplo n.º 1
0
class Login_page(BaseAction):
    """
    登录页面
    """
    conf = eleaction.EleAction("控件.ini")
    data = eleaction.EleAction("数据.ini")
    user_loc = conf.get_value("登陆", "用户名")
    user_value = data.get_value("个人帐号", "用户名")
    pwd_loc = conf.get_value("登陆", "密码")
    pwd_value = data.get_value("个人帐号", "密码")
    login_loc = conf.get_value("登陆", "立即登录")
    launch_loc = conf.get_value("启动", "立即体验")

    def Launch(self):
        self.click(*self.launch_loc)

    def Input_User(self):
        self.send_keys(*self.user_loc, value=self.username_value)

    def Input_Pwd(self):
        self.sendkeys(*self.pwd_loc, value=self.pwd_value)

    def click_login(self):
        self.click(*self.login_loc)

    def login(self):
        """
        定义统一登录入口
        :return:
        """
        self.Launch()
        self.Input_User()
        self.Input_Pwd()
        self.click()
Ejemplo n.º 2
0
class MainHome_page(BaseAction):
    """
        我的店铺首页页面
    """
    conf = eleaction.EleAction("控件.ini")
    data = eleaction.EleAction("数据.ini")
    mainHome_loc = data.get_value("Tab", "本地之窗")
    goods_loc = data.get_value("商户首页", "商品")
    shopping_loc = data.get_value("商户首页", "加入购物车")
    pickup_loc = data.get_value("商户首页", "自提")
    goPay_loc = data.get_value("商户首页", "去结算")
    shopCar_loc = data.get_value("商户首页", "购物车")
    shopCount_loc =data.get_value("商户首页", "加购数量")

    def __init__(self, driver):
        super().__init__(driver)
        self.click(*self.mainHome_loc)

    def click_goods(self):
        # 点击商品,进入商品详情页
        self.click(*self.goods_loc)

    def click_shopping(self):
        # 点击加入购物车按钮
        self.click(*self.shopping_loc)

    def click_pickup(self):
        # 选择自提
        self.click(*self.pickup_loc)

    def click_goPay(self):
        # 点击去结算
        self.click(*self.goPay_loc)


    def shopping(self):
        """
        定义加入购物车
        :return:
        """
        self.click_mainhome()
        try:
            if self.shopCount == 0:
                self.click_shopping()
                self.click_goPay()
            else:
                self.click_goPay()
        except Exception as e:
            print(e)
Ejemplo n.º 3
0
class MainHome_page(BaseAction):
    """
        确认订单页面
    """
    conf = eleaction.EleAction("控件.ini")
    data = eleaction.EleAction("数据.ini")
    evaluate_loc = data.get_value("确认订单", "提交订单")

    def click_evaluate(self):
        # 点击提交订单
        self.click(*self.evaluate_loc)

    def evaluateOrder(self):
        # 提交订单
        self.click_evaluate()
Ejemplo n.º 4
0
def Driver():
    cfgRead = eleaction.EleAction("cfginfo.ini")
    base_url = cfgRead.get_value("appium", "base_url")
    desired_caps = dict(cfgRead.get_items("desired_caps_01"))
    print(desired_caps)
    dr = webdriver.Remote(base_url, desired_caps)
    return dr
Ejemplo n.º 5
0
class MainHome_page(BaseAction):
    """
        支付中心页面
    """
    conf = eleaction.EleAction("cfginfo.ini")
    data = eleaction.EleAction("控件.ini")
    balance = data.get_value("支付中心", "余额支付")
    payment = data.get_value("支付中心", "立即支付")
    paypwd1 = data.get_value("支付中心", "输入支付密码1")
    paypwd2 = data.get_value("支付中心", "输入支付密码2")
    paypwd3 = data.get_value("支付中心", "输入支付密码3")
    paypwd4 = data.get_value("支付中心", "输入支付密码4")
    paypwd5 = data.get_value("支付中心", "输入支付密码5")
    paypwd6 = data.get_value("支付中心", "输入支付密码6")

    def __init__(self, driver):
        super().__init__(driver)

    def click_balance(self):
        # 选择余额支付
        self.click(*self.balance)

    def click_payment(self):
        # 点击立即支付
        self.click(*self.payment)

    def Input_paypwd1(self):
        self.sendkeys(*self.paypwd1, "1")

    def Input_paypwd2(self):
        self.sendkeys(*self.paypwd2, "2")

    def Input_paypwd3(self):
        self.sendkeys(*self.paypwd1, "3")

    def Input_paypwd4(self):
        self.sendkeys(*self.paypwd1, "4")

    def Input_paypwd5(self):
        self.sendkeys(*self.paypwd1, "5")

    def Input_paypwd6(self):
        self.sendkeys(*self.paypwd1, "6")

    def payment(self):
        c = BaseAction.findelement(*self.balance)
        print(c.is_selected())
Ejemplo n.º 6
0
def URL():
    cfg = eleaction.EleAction("控件.ini")
    url = cfg.get_value("url", "baseurl")
    return url
Ejemplo n.º 7
0
from time import sleep

from appium import webdriver

from src.common import eleaction
from src.functions import baseaction

Ele = eleaction.EleAction("控件.ini")
BaseAction = baseaction.BaseAction(webdriver)

desired_caps = {}
desired_caps['platformName'] = "Android"  # Android
desired_caps['platformVersion'] = "5.0"  # android 版本
desired_caps['deviceName'] = "6c024ac3"  # 设备名称
desired_caps['appPackage'] = "com.hsmja.royal_home"  # 包名
desired_caps['appActivity'] = "com.hsmja.royal.home.HomePanDuan"  # activity名称
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
sleep(5)
ele = Ele.get_value("Lauch", "立即体验")
lau = BaseAction.findelement("id", ele)
lau.click()
sleep(5)
driver.find_element_by_id("com.hsmja.royal_home:id/btn_mine").click()
sleep(5)
driver.find_element_by_id("com.hsmja.royal_home:id/nameTv").click()
sleep(5)
driver.send_keys("13554815604")
sleep(10)
ele = driver
ele.click()
ele.send_keys("xuyuan123456")
Ejemplo n.º 8
0
class Owner_page(BaseAction):
    """
    我的页面
    """
    conf = eleaction.EleAction("控件.ini")
    data = eleaction.EleAction("数据.ini")
    headpic_loc = conf.get_value("个人中心", "头像")
    nickname_loc = conf.get_value("个人中心", "昵称")
    QR_loc = conf.get_value("个人中心", "二维码")
    setting_loc = conf.get_value("个人中心", "设置")
    IM_loc = conf.get_value("个人中心", "我信")
    allOrder_loc = conf.get_value("个人中心", "我的订单")
    orderUnpai_loc = conf.get_value("个人中心", "待付款")
    orderUnsent_loc = conf.get_value("个人中心", "待发货")
    orderUnreceived_loc = conf.get_value("个人中心", "待收货")
    orderService_loc = conf.get_value("个人中心", "退款/售后")
    mineWallet_loc = conf.get_value("个人中心", "我的钱包")
    shopCar_loc = conf.get_value("个人中心", "购物车")
    collectGood_loc = conf.get_value("个人中心", "收藏商品")
    careStore_loc = conf.get_value("个人中心", "店铺关注")
    mineAddress_loc = conf.get_value("个人中心", "我的地址")
    openStore_loc = conf.get_value("个人中心", "我要开店")
    wodetuiguang_loc = conf.get_value("个人中心", "我的推广")
    courier_loc = conf.get_value("个人中心", "同城快递")
    prize_loc = conf.get_value("个人中心", "推荐我连")
    choujiang_loc = conf.get_value("个人中心", "抽奖")
    prizeReCord_loc = conf.get_value("个人中心", "中奖记录")
    help_loc = conf.get_value("个人中心", "帮助与客服")
    redpacket_loc = conf.get_value("个人中心", "红包")

    def click_headpic(self):
        self.click(*self.headpic_loc)

    def click_nickname(self):
        self.click(*self.nickname)

    def click_QR(self):
        self.click(*self.QR)

    def click_setting(self):
        self.click(*self.setting_loc)

    def click_IM(self):
        self.click(*self.IM_loc)

    def click_allOrder(self):
        self.click(*self.allOrder_loc)

    def click_orderUnpai(self):
        self.click(*self.orderUnpai_loc)

    def click_orderUnsent(self):
        self.click(*self.orderUnsent_loc)

    def click_orderUnreceived(self):
        self.click(*self.orderUnreceived_loc)

    def click_orderService(self):
        self.click(*self.orderService_loc)

    def click_mineWallet(self):
        self.click(*self.mineWallet_loc)

    def click_shopCar(self):
        self.click(*self.shopCar_loc)

    def click_collectGood(self):
        self.click(*self.collectGood_loc)

    def click_careStore(self):
        self.click(*self.careStore_loc)

    def click_mineAddress(self):
        self.click(*self.mineAddress_loc)

    def click_openStore(self):
        self.click(*self.openStore_loc)

    def click_wodetuiguang(self):
        self.click(*self.wodetuiguang_loc)

    def click_courier(self):
        self.click(*self.courier_loc)

    def click_prize(self):
        self.click(*self.prize_loc)

    def click_choujiang(self):
        self.click(*self.choujiang_loc)

    def click_prizeReCord(self):
        self.click(*self.prizeReCord_loc)

    def click_help(self):
        self.click(*self.help_loc)

    def click_redpacket(self):
        self.click(*self.redpacket_loc)
Ejemplo n.º 9
0
from src.common import eleaction
from src.common.baseaction import BaseAction

conf = eleaction.EleAction("控件.ini")
data = eleaction.EleAction("数据.ini")


class ProductmanagePageEntity(BaseAction):
    """产品管理页面"""
    url = "/roomstyle/index"
    productmanage_loc = conf.get_eleinfo("列表", "产品管理")
    productlist_loc = conf.get_eleinfo("产品管理", "产品列表")
    room_loc = conf.get_eleinfo("产品管理", "客房列表")
    ticket_loc = conf.get_eleinfo("产品管理", "门票列表")
    creatproduct_loc = conf.get_eleinfo("产品管理", "创建产品")
    select_hotel_loc = conf.get_eleinfo("产品管理", "选择商家")
    hotel_loc = conf.get_eleinfo("选择商家", "商家")
    room_type_loc = conf.get_eleinfo("选择商家", "客房")
    menticket_type_loc = conf.get_eleinfo("选择商家", "门票")
    ticket_type_loc = conf.get_eleinfo("选择商家", "票券")
    direct_selling_doc = conf.get_eleinfo("选择商家", "直销")
    direct_purchase_doc = conf.get_eleinfo("选择商家", "直采")
    submit_click_doc = conf.get_eleinfo("选择商家", "确认")

    # 点击创建产品
    def click_create_product(self):
        self.findelement(*self.creatproduct_loc).click()

    # 选择归属商家
    def owner_hotel(self):
        self.select(*self.select_hotel_loc, *self.hotel_loc)
Ejemplo n.º 10
0
class Owner_page(BaseAction):
    """
    全部订单页面
    """
    conf = eleaction.EleAction("控件.ini")
    data = eleaction.EleAction("数据.ini")
Ejemplo n.º 11
0
import unittest

from appium.webdriver import webdriver

from src.common import eleaction
from src.functions import baseaction

DesireCaps = eleaction.EleAction("cfginfo.ini")
Ele = eleaction.EleAction("控件.ini")
BaseAction = baseaction.BaseAction(webdriver)


class LauchApp(unittest.TestCase):
    def setup(self):
        """初始化app driver"""
        desired_caps = {}
        desired_caps['platformName'] = DesireCaps.get_value(
            "desired_caps_01", "platformName")  # Android
        desired_caps['platformVersion'] = DesireCaps.get_value(
            "desired_caps_01", "platformVersion")  # android 版本
        desired_caps['deviceName'] = DesireCaps.get_value(
            "desired_caps_01", "deviceName")  # 设备名称
        desired_caps['appPackage'] = DesireCaps.get_value(
            "desired_caps_01", "appPackage")  # 包名
        desired_caps['appActivity'] = DesireCaps.get_value(
            "desired_caps_01", "appActivity")  # activity名称
        base_url = DesireCaps.get_value("appium", "base_url")
        self.desired_caps = desired_caps
        self.base_url = base_url
        self.base_url = DesireCaps.get_value("appium", "base_url")
        self.driver = webdriver.Remote('self.base_url', 'self.desired_caps')
Ejemplo n.º 12
0
import os
import time

from src.common import eleaction

ReadConfig = eleaction.EleAction("cfginfo.ini")


class AppiumServer(object):
    """启动、关闭AppiumServer"""
    def __init__(self):
        global cmd_start_appium, base_url, cmd_stop_appium
        cmd_start_appium = ReadConfig.get_value("appium", "star_appium")
        print(cmd_start_appium)
        base_url = ReadConfig.get_value("appium", "base_url")
        cmd_stop_appium = 'StopAppium.bat %s'
        print(cmd_stop_appium)
        if not os.path.exists("F:\AutoTestProject\WoLianTest\log"):
            os.makedirs("F:\AutoTestProject\WoLianTest\log")

    def start_sever(self):
        """启动AppiumServer"""
        # TODO:目前只是单一手机测试,如果是多个手机,要增加多个端口
        # cmd = 'star / b appium -a 127.0.0.1 -p 4723'
        appium_log_path = "F:\AutoTestProject\WoLianTest\log" + "appium.log"
        os.subprocess.call(cmd_start_appium,
                           shell=True,
                           status=open(appium_log_path, 'w'),
                           stderr=os.subprocess.STDOUT)
        time.sleep(4)
        if self.is_running():