fix: Playwright API camelCase → snake_case (Python 版)

- getByPlaceholder → get_by_placeholder
- getByRole → get_by_role
- getByText → get_by_text
- getByTestId → get_by_test_id
This commit is contained in:
xst
2026-07-15 10:52:16 +08:00
parent 7b4a54f1ce
commit 7c5a4c5de7
6 changed files with 18 additions and 18 deletions
+4 -4
View File
@@ -64,15 +64,15 @@ class TestLoginPageDirect:
"""验证登录页可直接访问并正常渲染。"""
page.goto(f"{web_config['base_url']}/login")
# 登录页应存在用户名输入框
assert page.getByPlaceholder("请输入用户名").is_visible()
assert page.get_by_placeholder("请输入用户名").is_visible()
@pytest.mark.p1
def test_login_page_elements(self, page: Page, web_config):
"""验证登录页所有关键元素存在。"""
page.goto(f"{web_config['base_url']}/login")
assert page.getByPlaceholder("请输入用户名").is_visible()
assert page.getByPlaceholder("请输入密码").is_visible()
assert page.getByRole("button", name="登录").is_visible()
assert page.get_by_placeholder("请输入用户名").is_visible()
assert page.get_by_placeholder("请输入密码").is_visible()
assert page.get_by_role("button", name="登录").is_visible()
@pytest.mark.p1
def test_double_login_session_redirect(self, page: Page, web_config, ensure_login):