From 739094e844d229751091f20ec29146941d0f94fe Mon Sep 17 00:00:00 2001 From: Sunflower613 <2963707761@qq.com> Date: Mon, 22 Apr 2024 04:59:51 +0800 Subject: [PATCH] Fix Test File --- app/test/test_bug528_tangjiao.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/app/test/test_bug528_tangjiao.py b/app/test/test_bug528_tangjiao.py index c732009..802423c 100644 --- a/app/test/test_bug528_tangjiao.py +++ b/app/test/test_bug528_tangjiao.py @@ -6,18 +6,6 @@ from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.common.exceptions import NoSuchElementException, TimeoutException -# 使用 Pytest 的 fixture 初始化 WebDriver 和 URL -@pytest.fixture(scope="module") -def driver(): - # 初始化WebDriver - driver = webdriver.Edge(executable_path=r'D:\codeapp\python-3.8.5\Lib\site-packages\selenium\webdriver\edge\MicrosoftWebDriver.exe') - driver.implicitly_wait(10) - yield driver # yield 语句之后的代码在测试用例执行完毕后运行 - driver.quit() # 测试用例执行完毕后关闭 WebDriver - -@pytest.fixture(scope="module") -def URL(): - return 'http://127.0.0.1:5000' # 测试登录页面输入密码包含空格的情况 def test_login_password_with_space(driver, URL): @@ -44,7 +32,7 @@ def test_login_password_with_space(driver, URL): assert "输入不能包含空格!" in alert.text except (NoSuchElementException, TimeoutException) as e: pytest.fail("页面元素未找到或超时: {}".format(e)) - + # 测试注册页面输入密码包含空格的情况