Commit a3601612 authored by 17322369953's avatar 17322369953
Browse files

air更新

parent 6c225100
"dingding_msg":
- 59d455293168352cecfaa4fb67f2568f3fa54453a2fdb87ce9817c316dc41b57
"select_user_token":
- user
- select token from user.uc_user_token where enc_user_id=%s;
"exp_expert":
- medical
- SELECT id,expert_name,base_service_count,service_count from exp_expert where deleted=%s and status=%s;
"select_memberPrivilegeId":
- user
- SELECT id ,enc_user_id,privilege_type FROM uc_member_privilege WHERE left_times>0 and status=1 AND privilege_type IN (5,12,9,2,10,11) AND start_time <NOW() AND end_time >NOW() AND enc_user_id IN (SELECT enc_user_id FROM uc_user_member WHERE final_end_time >NOW() AND level_type_code=001) order by id desc limit 1
\ No newline at end of file
......@@ -31,7 +31,7 @@ def print_hi(name):
if __name__ == '__main__':
print_hi('PyCharm')
# pytest.main(
# ['-vs', 'D:/pythonProject/atuobase/test_login/test_login_success.py', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# ['-vs', 'D:/pythonProject/atuobase/operator_login/test_login_success.py', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# os.path.join(os.sep, 'autotest_sc_report'),
# '--clean-alluredir'])
......@@ -39,20 +39,20 @@ if __name__ == '__main__':
report_dir = create_report_dir()
# pytest.main(
# ['-vs', 'D:/pythonProject/atuobase/test_login/test_login_success.py', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# ['-vs', 'D:/pythonProject/atuobase/operator_login/test_login_success.py', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# report_dir, '--clean-alluredir'])
# 开始执行用例
# pytest.main(
# ['-vs', 'D:/pythonProject/atuobase/test_login', 'D:/pythonProject/atuobase/test_buy/test_buy_one_nonseq_commodity.py::TestBuyOneNonseqCommodity::test_buy_one_nonseq_commodity', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# ['-vs', 'D:/pythonProject/atuobase/operator_login', 'D:/pythonProject/atuobase/buy/test_buy_one_nonseq_commodity.py::TestBuyOneNonseqCommodity::test_buy_one_nonseq_commodity', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# report_dir, '--clean-alluredir'])
# Mail().send()
#pytest.main(
# ['-vs', '../autotest-airtest-web-sc/test_buy','../autotest-airtest-web-sc/test_login', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# ['-vs', '../autotest-airtest-web-sc/buy','../autotest-airtest-web-sc/operator_login', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
# report_dir, '--clean-alluredir'])
pytest.main(
['-vs', '../autotest-airtest-web-sc/test_login', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
['-vs', '../autotest-airtest-web-sc/operator_login', '--reruns', '3', '--reruns-delay', '2', '--alluredir',
report_dir, '--clean-alluredir'])
os.system('allure generate -c results/ -o report/')
#os.system('allure serve %s' % report_dir)
# 可以在终端执行命令 pytest D:\pythonProject\atuobase\test_login\test_login_success.py
# 可以在终端执行命令 pytest D:\pythonProject\atuobase\operator_login\test_login_success.py
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.remote.webdriver import WebElement
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains
from time import sleep
from datetime import datetime
from common.logger import log
from common.logger import logger
import os
......@@ -31,10 +30,10 @@ class BasePage(object):
def single_click(self, page_element):
self.wait_seconds(1)
page_element.click()
#action_chains = ActionChains(self.driver)
#action_chains.move_to_element(page_element)
#action_chains.click()
#action_chains.perform()
# action_chains = ActionChains(self.driver)
# action_chains.move_to_element(page_element)
# action_chains.click()
# action_chains.perform()
# self.driver.execute_script("arguments[0].click();", page_element)
def single_click_then_wait(self, page_element, seconds):
......@@ -127,10 +126,10 @@ class BasePage(object):
'''展示窗口句柄信息,测试用,只下日志'''
def display_window_handle(self):
log.info('当前窗口的title:%s' % self.driver.title)
log.info('当前窗口的url:%s' % self.driver.current_url)
log.info('当前窗口的句柄:%s' % self.driver.current_window_handle)
log.info('所有句柄:%s' % self.driver.window_handles)
logger.info('当前窗口的title:%s' % self.driver.title)
logger.info('当前窗口的url:%s' % self.driver.current_url)
logger.info('当前窗口的句柄:%s' % self.driver.current_window_handle)
logger.info('所有句柄:%s' % self.driver.window_handles)
'''获取当前页面title'''
......
......@@ -492,7 +492,7 @@ def simple_report(filepath, logpath=True, logfile=LOGFILE, output=HTML_FILE):
path, name = script_dir_name(filepath)
if logpath is True:
logpath = os.path.join(path, LOGDIR)
rpt = LogToHtml(path, logpath, logfile=logfile, script_name=name)
rpt = LogToHtml(path, logpath, logfile=logfile, script_name=name, plugins=['airtest_selenium.report'])
rpt.report(HTML_TPL, output_file=output)
......
......@@ -54,10 +54,10 @@
</tr>
<tr width="600">
<td class='details-col-elapsed'>6</td>
<td class='details-col-elapsed'>6</td>
<td class='details-col-elapsed'>1分5</td>
<td class="details-col-elapsed">100.0%</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0</td>
<td class='details-col-elapsed'>0分34</td>
<td class="details-col-elapsed">0.0%</td>
</tr>
</table>
......@@ -72,45 +72,10 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/case_login_no_input_userid/log.html' target='_blank'>case_login_no_input_userid</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">10.549</td>
<td class="details-col-elapsed">Unknown</td>
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/case_login_no_input_verifycode/log.html' target='_blank'>case_login_no_input_verifycode</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">9.908</td>
<td class="details-col-elapsed">Unknown</td>
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/case_login_password_error/log.html' target='_blank'>case_login_password_error</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">9.955</td>
<td class="details-col-elapsed">Unknown</td>
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/case_login_success/log.html' target='_blank'>case_login_success</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">9.955</td>
<td class="details-col-elapsed">Unknown</td>
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/case_login_userid_error/log.html' target='_blank'>case_login_userid_error</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">10.563</td>
<td class="details-col-elapsed">Unknown</td>
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/case_login_verify_code_error/log.html' target='_blank'>case_login_verify_code_error</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">9.981</td>
<td class="details-col-elapsed">Unknown</td>
<td class="details-col-elapsed"><a href='../log/case_buy_one_nonseq_commodity/log.html' target='_blank'>case_buy_one_nonseq_commodity</a></td>
<td class="fail">失败</td>
<td class="details-col-elapsed">34.545</td>
<td class="details-col-elapsed">qinguanglei</td>
</tr>
</table>
......
......@@ -9,7 +9,7 @@ curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
# python runner.py tag case_login_success debug sit
if __name__ == '__main__':
# 第一个参数 case 执行类型,'all', 'sc', 'tag'
caseType = sys.argv[1]
......
from test_login.page_login import PageLogin
from selenium.webdriver.remote.webdriver import By
from actions.actions_login.page_login import PageLogin
class PageBuy(PageLogin):
"""基础元素"""
......@@ -35,7 +36,7 @@ class PageBuy(PageLogin):
_main_info_locator = (By.ID, 'tab-7667cf55-c391-4f2c-a5ba-c0f6d27b6d3a')
'''仓库信息'''
# 仓库输入内容
_warehouse_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-122")]')
_warehouse_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-121")]')
# 请求查询仓库元素
_ware_request_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-122")]/../span/span/i')
# _ware_request_locator = (By.XPATH, '//div[text() = "仓库名称"]/../div[@class="el-form-item__content"]/descendant::i[@class="awsui-iconfont" and @style="cursor: pointer;"]')
......@@ -75,7 +76,7 @@ class PageBuy(PageLogin):
'''协议信息'''
# 协议输入内容元素
_protocol_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-124")]')
_protocol_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-123")]')
# 协议请求元素
_protocol_request_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-109")]/../span/span/i')
......@@ -91,7 +92,7 @@ class PageBuy(PageLogin):
'''业务员信息'''
# 业务员输入内容元素
_businessman_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-127")]')
_businessman_content_locator = (By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-126")]')
# 业务员请求元素
_businessman_request_locator = (
By.XPATH, '//input[starts-with(@id,"el-id-") and contains(@id,"-110")]/../span/span/i')
......@@ -112,7 +113,7 @@ class PageBuy(PageLogin):
_merchandise_locator = (By.XPATH, '//span[text()="添加商品"]')
# 商品dialog
_merchandise_dialog_locator = (
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-136") and @class="el-dialog__body"]')
By.XPATH, '//div[starts-with(@id,"el-id-") and contains(@id,"-135") and @class="el-dialog__body"]')
# 商品输入元素
_merchandise_input_locator = (By.XPATH, '//input[@placeholder="模糊检索:商品编码,商品名称,规格型号,厂家物料编码"]')
# 商品搜索元素
......@@ -387,8 +388,10 @@ class PageBuy(PageLogin):
def get_businessman_dialog(self):
return self.get_element_wait_presence(self._businessman_dialog_locator)
'''商品信息hold'''
'''获取商品全选复选框'''
def get_merchandise_all_select(self):
return self.get_element_wait_presence(self._merchandise_all_select_locator)
......@@ -428,5 +431,6 @@ class PageBuy(PageLogin):
return self.get_element_wait_presence(self._detail_table)
'''订单提交'''
def get_submit_element(self):
return self.get_element_wait_presence(self._submit_locator)
......@@ -10,7 +10,7 @@ from common.read_yaml import get_filed_from_yaml
from common.verifycode import VerifyCode
from test_buy.page_buy import PageBuy
module = 'test_buy'
module = 'buy'
class StepsBuy(object):
......
# author:qinguanglei
# ddate:2023/11/16 11:00
# author:qinguanglei
# ddate:2023/11/17 15:54
import allure
import pytest
from test_login.steps_login import StepsLogin
@allure.feature('登录模块')
class TestLoginNoInputUserid(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('不输入用户名登录失败案例-点击登录')
def test_login_no_input_userid(self):
# 载入步骤集合
steps_login = StepsLogin(self.driver)
# 打开浏览器
steps_login.open_browser()
# 输入账号密码,只输入密码
steps_login.enter_account_password(2)
# 输入验证码,输入正确的验证码
steps_login.enter_verify_code(0)
# 点击登录
steps_login.click_login_button()
# 判断结果
steps_login.judge_result_error(2)
# author:qinguanglei
# ddate:2023/11/20 9:56
import allure
import pytest
from test_login.steps_login import StepsLogin
@allure.feature('登录模块')
class TestLoginNoInputVerifycode(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('不输入验证码案例-点击登录')
def test_login_no_input_verifycode(self):
# 载入步骤集合
steps_login = StepsLogin(self.driver)
# 打开浏览器
steps_login.open_browser()
# 输入账号密码,都输入正确的
steps_login.enter_account_password(0)
# 输入验证码,不输入验证码
steps_login.enter_verify_code(2)
# 点击登录
steps_login.click_login_button()
# 判断结果
steps_login.judge_result_error(3)
# author:qinguanglei
# ddate:2023/11/20 9:43
import allure
import pytest
from test_login.page_login import PageLogin
from test_login.steps_login import StepsLogin
@allure.feature('登录模块')
class TestLoginPasswordError(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
# 执行案例前统一获取页面元素操作方法
self.page_login = PageLogin(self.driver)
@allure.story('输入错误密码登录失败案例-点击登录')
def test_login_password_error(self):
# 载入步骤集合
steps_login = StepsLogin(self.driver)
# 打开浏览器
steps_login.open_browser()
# 输入账号密码,密码输入错误
steps_login.enter_account_password(4)
# 输入验证码,输入正确的验证码
steps_login.enter_verify_code(0)
# 点击登录
steps_login.click_login_button()
# 判断结果
steps_login.judge_result_error(1)
# author:qinguanglei
# ddate:2023/11/16 11:18
import pytest
import allure
from test_login.steps_login import StepsLogin
module = 'test_login'
@allure.feature('登录模块')
class TestLoginSuccess(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('登录成功案例-点击登录')
def test_login_success_click(self):
# 载入步骤集合
steps_login = StepsLogin(self.driver)
# 打开浏览器
steps_login.open_browser()
# 输入账号密码,账号与密码都输入
steps_login.enter_account_password(0)
# 输入验证码,正确的验证码
steps_login.enter_verify_code(0)
# 点击登录
steps_login.click_login_button()
# 判断结果
steps_login.judge_result()
# author:qinguanglei
# ddate:2023/11/20 9:23
import allure
import pytest
from test_login.steps_login import StepsLogin
@allure.feature('登录模块')
class TestLoginUseridError(object):
@pytest.fixture(scope='function', autouse=True)
def housework(self, driver_fixture):
# 驱动器从fixture传来
self.driver = driver_fixture
@allure.story('登录用户名错误案例-点击登录')
def test_login_userid_error(self):
# 载入步骤集合
steps_login = StepsLogin(self.driver)
# 打开浏览器
steps_login.open_browser()
# 输入账号密码,用户名输入错误
steps_login.enter_account_password(3)
# 输入验证码,输入正确的验证码
steps_login.enter_verify_code(0)
# 点击登录
steps_login.click_login_button()
# 判断结果
steps_login.judge_result_error(1)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment