예제 #1
0
#!/usr/bin/env python 
# -*- coding:utf-8 -*-

import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

account = Element('account')
class AccountPage(WebPage):


    def input_account_password(self, content):
        """输入用户密码"""
        self.input_text_no_clear(account.密码输入框, content)

    def click_password_display(self):
        """密码显示或隐藏"""
        self.is_click(account.密码显示)

    def clear_account_password(self):
        self.is_click(account.密码输入框)

    def double_account_password(self):
        self.double_click(account.密码输入框)

    def input_account_nickname(self, content):
        """输入用户昵称"""
        self.input_text(account.昵称输入框, content)

    def input_account_phone(self, content):
예제 #2
0
파일: firm.py 프로젝트: stinazhang/domisaas
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

firm = Element('firm')


class FirmPage(WebPage):
    def click_add(self):
        """点击添加厂商"""
        self.is_click(firm.增加)

    def click_edit(self):
        """点击修改厂商"""
        self.is_click(firm.修改)

    def click_del(self):
        """点击删除厂商"""
        self.is_click(firm.删除)

    def input_firm_name(self, content):
        """输入厂商名称"""
        self.input_text(firm.厂商名称输入框, content)

    def input_firm_code(self, content):
        """输入厂商编码"""
        self.input_text(firm.编码输入框, content)
예제 #3
0
 def __init__(self, driver, project_name):
     super().__init__(driver)
     self.element = Element(project_name)
예제 #4
0
# author:丑牛
# datetime:2021/1/14 15:50
from selenium.common.exceptions import NoSuchElementException

from common.readelement import Element
from page.webpage import WebPage
from utils.logger import log
from utils.times import sleep

home = Element('ml')


class Page(WebPage):
    """主页类"""
    def click_ele(self, group, label_name):
        """点击侧边栏,打开标签页"""
        self.is_click(home.__getitem__(group, label_name))

    def get_ele_text(self, group, label_name):
        """获取标签页element的文本值"""
        label_text = self.element_text(home.__getitem__(group, label_name))
        return label_text

    def input_ele(self, group, label_name, txt):
        """输入文字"""
        self.input_text(home.__getitem__(group, label_name), txt)
        sleep(1)

    def ele_input_file(self, group, label_name, txt):
        """上传文件"""
        self.input_file(home.__getitem__(group, label_name), txt)
예제 #5
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

product = Element('product')


class ProductPage(WebPage):
    def click_add(self):
        """点击添加产品"""
        self.is_click(product.增加)

    def click_edit(self):
        """点击修改产品"""
        self.is_click(product.修改)

    def click_del(self):
        """点击删除产品"""
        self.is_click(product.删除)

    def input_product_name(self, content):
        """输入产品名称"""
        self.input_text(product.名称输入框, content)

    def input_product_code(self, content):
        """输入产品编码"""
        self.input_text(product.编码输入框, content)
예제 #6
0
파일: LoginPage.py 프로젝트: will64185/haha
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from page.webpage import WebPage, sleep
from common.readelement import Element

login = Element('login')


class Loginpage(WebPage):
    """登录页面"""
    def input_username(self, content):
        """输入账号"""
        self.input_text(login['输入账号'], txt=content)

    def input_password(self, content):
        """输入密码"""
        self.input_text(login['输入密码'], txt=content)

    def click_loginButton(self):
        """点击登录"""
        self.is_click(login['登录按钮'])
        sleep()

    def login_name(self):
        """获取当前登录公司"""
        login_name = self.element_text(login['当前登录公司'])
        return login_name

    def mouse_stop1(self):
        """鼠标悬停当前登录人"""
        self.mouse_stop(login['当前登录人'])
예제 #7
0
파일: login.py 프로젝트: KevinWang886/zkaw
from base.base import Base
from common.readelement import Element
import allure
from config.conf import ELEMENT_PATH

login = Element(ELEMENT_PATH, 'login_and_home', 'login')


# 登录页面
class LoginPage(Base):
    """登录类"""
    @allure.step("输入账号")
    def input_account(self, account):
        self.send(login['账号'], account)
        # sleep()

    @allure.step("输入密码")
    def input_password(self, pwd):
        self.send(login['密码'], pwd)

    @allure.step("点击登录按钮")
    def click_login_btn(self):
        self.click(login['登录'])

    @allure.step("获取错误账号空提示")
    def get_account_error(self):
        account_error = self.get_text(login['账号空'])
        return account_error

    @allure.step("获取错误密码空提示")
    def get_pwd_error(self):
예제 #8
0
from base.base import Base
from common.readelement import Element
import allure
import random
from config.conf import ELEMENT_PATH

excavator_base_info = Element(ELEMENT_PATH, 'device_base_info',
                              'excavator_base_info')


# 电铲基本信息管理页面
class ExcavatorBaseInfoPage(Base):
    """电铲基本信息管理类"""
    @allure.step("点击电铲基本信息")
    def click_excavator_base_info(self):
        self.click(excavator_base_info['电铲基本信息'])

    @allure.step("点击电铲物料维护")
    def click_excavator_kind(self):
        self.click(excavator_base_info['电铲物料维护'])

    @allure.step("点击电铲状态维护")
    def click_excavator_status(self):
        self.click(excavator_base_info['电铲状态维护'])

    @allure.step("点击禁止卸点维护")
    def click_excavator_prohibat_uploading(self):
        self.click(excavator_base_info['禁止卸点维护'])

    @allure.step("点击锁定卡车维护")
    def click_excavator_lock_truck(self):
예제 #9
0
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import allure
import base64
from selenium.common.exceptions import TimeoutException

from config.conf import cm
from utils.times import *
from utils.logger import logger
from core.webpage import WebPage
from common.readelement import Element, getElement
from utils.images import area_screenshot, get_image_name

base = Element(cm.tests['tests'], 'base')


class NovaPage(WebPage):
    """WebPage的延伸方法"""

    def assert_text_dom(self, text):
        """验证文字在DOM中"""
        assert self.is_exists(base['模糊匹配文字'] % text), f"文字{text}未在DOM中加载"

    def assert_text_visible(self, text):
        """验证文字是否可见"""
        assert self.is_visible(base['模糊匹配文字'] % text), f"文字{text}不可见"

    @logger(msg="上传文件:{}")
    def upload_file(self, locator, file_path, exists=None, number=None):
        """上传文件
        :param locator: 上传文件的元素 input[type=file]
예제 #10
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

agency = Element('agency')


class AgencyPage(WebPage):
    def click_add(self):
        """点击添加代理商"""
        self.is_click(agency.增加)

    def click_edit(self):
        """点击修改代理商"""
        self.is_click(agency.修改)

    def click_del(self):
        """点击删除代理商"""
        self.is_click(agency.删除)

    def input_agency_name(self, content):
        """输入代理商名称"""
        self.input_text(agency.代理商名称输入框, content)

    def input_agency_remark(self, content):
        """输入代理商备注"""
        self.input_text(agency.备注输入框, content)
예제 #11
0
from base.base import Base
from common.readelement import Element
import allure
from config.conf import ELEMENT_PATH

device_base_info = Element(ELEMENT_PATH, 'device_base_info', 'device_base_info')


# 设备基础信息管理模块
class DeviceBaseInfoPage(Base):
    """设备基础信息管理类"""

    @allure.step("点击电铲信息管理")
    def click_excavator_info(self):
        self.click(device_base_info['电铲信息管理'])

    @allure.step("查看电铲信息管理菜单是否展开")
    def is_excavator_info_menu_open(self):
        if self.find(device_base_info['电铲信息管理菜单']).get_attribute('style') == 'display: none;':
            return True
        else:
            return False

    @allure.step("点击卸点信息管理")
    def click_uploading_info(self):
        self.click(device_base_info['卸点信息管理'])

    @allure.step("点击卡车信息管理")
    def click_truck_info(self):
        self.click(device_base_info['卡车信息管理'])
예제 #12
0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from page.webpage import WebPage, sleep
from common.readelement import Element

search = Element('about')


class AboutPage(WebPage):
    """搜索类"""
    def input_search(self, content):
        """输入搜索"""
        self.input_text(search['搜索框'], txt=content)
        sleep()

    @property
    def imagine(self):
        """搜索联想"""
        return [x.text for x in self.find_elements(search['候选'])]

    def click_search(self):
        """点击搜索"""
        self.is_click(search['搜索按钮'])


if __name__ == '__main__':
    pass
예제 #13
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

permission = Element('permission')


class PermissionPage(WebPage):
    def click_add(self):
        """点击添加权限"""
        self.is_click(permission.增加)

    def click_edit(self):
        """点击修改权限"""
        self.is_click(permission.修改)

    def click_del(self):
        """点击删除权限"""
        self.is_click(permission.删除)

    def input_permission_name(self, content):
        """输入权限名称"""
        self.input_text(permission.名称输入框, content)

    def input_permission_remark(self, content):
        """输入权限备注"""
        self.input_text(permission.备注输入框, content)
예제 #14
0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from page.webpage import WebPage, sleep
from common.readelement import Element

wms = Element('wms')


class wmspage(WebPage):
    """wms-登录界面"""

    def input_username(self, content):
        """输入账号"""
        self.input_text(wms['wms用户名'], txt=content)

    def input_password(self, content):
        """输入密码"""
        self.input_text(wms['wms密码'], txt=content)

    def click_loginButton(self):
        """点击登录"""
        self.is_click(wms['wms登录'])
        sleep(2)

    def click_system(self):
        """wms系统管理"""
        self.is_click(wms['wms系统管理'])

    def click_systemSet(self):
        """wms系统设置"""
        self.is_click(wms['wms系统设置'])
예제 #15
0
from page.webpage import WebPage, sleep
from common.readelement import Element

sell = Element('sell')


class Sellpage(WebPage):
    """销售管理"""
    def click_sellManager(self):
        """销售管理"""
        self.is_click(sell['销售管理'])
        sleep()

    # 销售订单
    def click_sellOrder(self):
        """销售订单"""
        self.is_click(sell['销售订单'])
        sleep(3)

    def click_sellAdd(self):
        """销售新增"""
        self.is_click(sell['销售新增'])

    def input_sellGuest(self, content):
        """销售输入客户"""
        self.input_text(sell['销售输入客户'], txt=content)
        sleep()

    def enter_guest(self):
        """销售输入客户,回车键"""
        self.key_enter(sell['销售输入客户'])
예제 #16
0
파일: PchsPage.py 프로젝트: will64185/haha
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from page.webpage import WebPage, sleep
from common.readelement import Element

search = Element('pchs')


class pchspage(WebPage):
    """采购管理"""

    def click_pchsguanli(self):
        """点击采购管理"""
        self.is_click(search['采购管理'])
        sleep(2)

    # 外采订单
    def click_pchswaicai(self):
        """点击外采订单"""
        self.is_click(search['外采订单'])
        sleep(2)

    def click_wcadd(self):
        """点击新增按钮"""
        self.is_click(search['新增按钮'])

    def click_wcselectsp(self):
        """点击选择供应商按钮"""
        self.is_click(search['选择供应商按钮'])

    def input_supplier(self, content):
예제 #17
0
import time
from common.readelement import Element
from page.home_page import HomePage
import pytest
import allure
from page.login import LoginPage
from config.conf import TEST_DATA_PATH

test_login = Element(TEST_DATA_PATH, '', 'test_login').data


class TestLoin():
    @pytest.fixture(autouse=True)
    def open_page(self, login):
        login.open("/truck-dispatch/?#/login")
        time.sleep(0.5)

    @allure.severity("blocker")
    @allure.story("登录")
    @allure.title("正确账号密码登录")
    def test_login(self, login):
        with allure.step("1、输入账号"):
            # login.input_account(Base.get_data(login, file_name='test_login.yaml')['test_login']['account'])
            login.input_account(test_login["account"])
        with allure.step("2、输入密码"):
            login.input_password(test_login["password"])
        with allure.step("3、点击登录按钮"):
            login.click_login_btn()
        with allure.step("4、断言"):
            assert HomePage.get_username(login) == test_login["username"]
            assert HomePage.get_title(login) == test_login['title']
예제 #18
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

index = Element('index')


class Index(WebPage):
    def switch_index(self):
        """切换到首页"""
        self.is_click(index.首页)
        sleep(1)

    def switch_device(self):
        """切换到设备管理页面"""
        self.is_click(index.设备管理)
        sleep(1)

    def switch_message(self):
        """切换到消息列表页面"""
        self.is_click(index.消息列表)
        sleep(1)

    def switch_feedback(self):
        """切换到反馈信息页面"""
        self.is_click(index.反馈信息)
        sleep(1)
예제 #19
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import sys

sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

feedback = Element('feedback')


class FeedbackPage(WebPage):
    def input_feedback(self, content):
        """输入回复内容"""
        self.input_text(feedback.回复输入框, content)

    def click_feedback(self):
        """点击回复"""
        self.is_click(feedback.回复)

    def click_del(self):
        """点击删除"""
        self.is_click(feedback.删除)

    def click_last_row(self):
        """选择最后一行"""
        self.is_click(feedback.最后一行)

    def click_confirm(self):
        """确定"""
예제 #20
0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""页面对象"""
from page.webpage import WebPage, sleep
from common.readelement import Element

search = Element('search')


class SearchPage(WebPage):
    """搜索类"""
    def input_search(self, content):
        """输入账号"""
        self.input_text(search['账号'], txt=content)
        sleep(2)

    def input_pass(self, content):
        """输入密码"""
        self.input_text(search['密码'], txt=content)
        sleep(2)

    def input_code(self, content):
        """输入验证码"""
        self.input_text(search['验证码'], txt=content)
        sleep(2)

    # @property
    # def imagine(self):
    #     """搜索联想"""
    #     return [x.text for x in self.find_elements(search['候选'])]
예제 #21
0
import time
import pytest
import allure
from common.readelement import Element
from config.conf import TEST_DATA_PATH

test_excavator_kind = Element(TEST_DATA_PATH, 'test_device_base_info',
                              'test_excavator_kind').data


class TestExcavatorKind:
    @pytest.fixture(scope='module', autouse=True)
    def go_to_excavator_kind(self, go_to_excavator_management,
                             excavator_base_info):
        # 判断电铲信息管理菜单是否打开
        if go_to_excavator_management.is_excavator_info_menu_open():
            with allure.step("点击电铲信息管理"):
                go_to_excavator_management.click_excavator_info()
        time.sleep(0.5)
        with allure.step("点击电铲物料维护"):
            excavator_base_info.click_excavator_kind()
            time.sleep(0.5)

    @allure.severity("blocker")
    @allure.story("电铲物料维护")
    @allure.title("查询电铲物料")
    def test_search_excavator(self, excavator_kind):
        with allure.step("1、输入电铲名称"):
            excavator_kind.input_excavator_name(
                test_excavator_kind['excavator_name'])
        with allure.step("2、点击【查询】按钮"):
예제 #22
0
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
from config.conf import cm
from utils.times import sleep
from common.readelement import Element
from tests.test_baidu.page import BasePage

login = Element(cm.element['baidu'], 'login')
search = Element(cm.element['baidu'], 'search')


class SearchPage(BasePage):
    def input_search(self, content):
        """输入搜索"""
        self.input_text(search['搜索框'], text=content)
        sleep()

    @property
    def imagine(self):
        """搜索联想"""
        return [x.text for x in self.find_elements(search['搜索候选'])]

    def click_search(self):
        """点击搜索"""
        self.is_click(search['搜索按钮'])

    def login(self, user, pwd):
        """登录"""
        self.is_click(login['登录'])
        if not self.text_in_element(login['登录方式'], text="用户名密码登录"):
            self.is_click(login['用户名登录'])
예제 #23
0
import time
import pytest
import allure
from common.readelement import Element
from config.conf import TEST_DATA_PATH

test_excavator_status = Element(TEST_DATA_PATH, 'test_device_base_info', 'test_excavator_status').data


class TestExcavatorStatus:

    @pytest.fixture(scope="module", autouse=True)
    def go_to_excavator_status(self, go_to_excavator_management, excavator_base_info):
        if go_to_excavator_management.is_excavator_info_menu_open():
            with allure.step("点击电铲信息管理"):
                go_to_excavator_management.click_excavator_info()
        time.sleep(0.5)
        with allure.step("点击电铲状态维护"):
            excavator_base_info.click_excavator_status()
            time.sleep(0.5)

    @allure.severity("blocker")
    @allure.story("电铲状态维护")
    @allure.title("查询电铲名称")
    def test_query_excavator(self, excavator_status):
        with allure.step("1、输入电铲名称"):
            excavator_status.input_excavator_name(excavator_name=test_excavator_status["excavator_name"])
        with allure.step("2、点击【查询】"):
            excavator_status.click_query_btn()
        time.sleep(0.5)
        with allure.step("3、断言:"):
예제 #24
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-

import sys
sys.path.append('.')
from Page.basepage import WebPage, sleep
from common.readelement import Element

role = Element('role')


class RolePage(WebPage):
    def click_add(self):
        """点击添加角色"""
        self.is_click(role.增加)

    def click_edit(self):
        """点击修改角色"""
        self.is_click(role.修改)

    def click_del(self):
        """点击删除角色"""
        self.is_click(role.删除)

    def input_role_name(self, content):
        """输入角色名称"""
        self.input_text(role.名称输入框, content)

    def input_role_remark(self, content):
        """输入角色备注"""
        self.input_text(role.备注输入框, content)
# -*- coding:utf-8 -*-
from page.basepage import BasePage, sleep
from common.readelement import Element

"""
百度首页页面搜索封装
"""
baidusearch = Element('baidusearch')


class BaiduSearchPage(BasePage):
    """搜索类"""

    def input_search(self, content):
        """搜索框输入"""
        self.input_text(baidusearch['搜索框'], text=content)
        sleep()

    def click_search(self):
        """点击搜索按钮"""
        self.click(baidusearch['搜索按钮'])

    def settings(self):
        """点击设置按钮"""
        self.click(baidusearch['设置下拉框'])
        sleep(2)

    def search_setting(self):
        """点击搜索设置选项"""
        self.click(baidusearch['搜索设置选项'])
        sleep(2)