You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
import pytest
|
|
|
|
from config import *
|
|
|
|
|
|
|
|
|
|
|
|
class Test_Admin():
|
|
|
|
def setup_class(self):
|
|
|
|
# setup 步骤
|
|
|
|
print('setup')
|
|
|
|
driver = sync_playwright().start()
|
|
|
|
browser = driver.chromium.launch(headless=False)
|
|
|
|
self.context = browser.new_context()
|
|
|
|
self.page = self.context.new_page()
|
|
|
|
|
|
|
|
def teardown_class(self):
|
|
|
|
print('teardown')
|
|
|
|
# teardown 步骤
|
|
|
|
self.context.close()
|
|
|
|
self.page.close()
|
|
|
|
|
|
|
|
# 登录管理员账号
|
|
|
|
def test_admin_login(self):
|
|
|
|
# 访问医馆首页
|
|
|
|
self.page.goto(BASE_URL)
|
|
|
|
|
|
|
|
# 输入手机号后失焦触发获取医馆列表事件
|
|
|
|
mobile_input = self.page.get_by_placeholder('请输入手机号')
|
|
|
|
mobile_input.fill(ADMIN_ACCOUNT)
|
|
|
|
mobile_input.blur()
|
|
|
|
|
|
|
|
# 选择厚生堂诊所
|
|
|
|
self.page.get_by_placeholder('请选择诊所名称').click()
|
|
|
|
self.page.get_by_text(CLINIC_NAME).click()
|
|
|
|
|
|
|
|
# 输入密码
|
|
|
|
self.page.get_by_placeholder('请输入密码').fill(ADMIN_PWD)
|
|
|
|
|
|
|
|
#点击登录
|
|
|
|
self.page.get_by_role('button', name='登录').click()
|
|
|
|
|
|
|
|
print(self.page.locator('.max-logo').inner_text())
|
|
|
|
# 验证测试结果
|
|
|
|
assert self.page.locator('.max-logo').inner_text() == CLINIC_NAME
|
|
|
|
|
|
|
|
# 临时代码
|
|
|
|
self.page.wait_for_timeout(2000)
|
|
|
|
|
|
|
|
# 为上下午医生排班
|
|
|
|
def test_doctor_schedule_setup(self):
|
|
|
|
all_menu = self.page.locator('.ivu-menu .ivu-menu-submenu-title').all()
|
|
|
|
for menu in all_menu:
|
|
|
|
if menu.inner_text() == '诊所管理':
|
|
|
|
menu.click()
|
|
|
|
assert True
|
|
|
|
self.page.wait_for_timeout(10000)
|