From bf3d9cb7cd6d9990ad1e24adeb047343ef215e0d Mon Sep 17 00:00:00 2001
From: yj <2077506045@qq.com>
Date: 星期三, 24 七月 2024 09:12:42 +0800
Subject: [PATCH] 测评系统自动测试

---
 testcase/conftest.py |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/testcase/conftest.py b/testcase/conftest.py
index d82f962..8ba0f3b 100644
--- a/testcase/conftest.py
+++ b/testcase/conftest.py
@@ -14,7 +14,12 @@
 @pytest.fixture(scope="session")
 def driver(request):
     options = Options()
-    options.debugger_address = "127.0.0.1:9222"
+    # options.debugger_address = "127.0.0.1:9222"
+    options.add_argument('--headless')
+    options.add_argument('--no-sandbox')
+    options.add_argument('--disable-gpu')
+    options.add_argument('--disable-dev-shm-usage')
+    # options.add_argument('window-size=1200x600')
     # 鍒濆鍖杦ebdriver
     driver = webdriver.Chrome(options=options)
     request.addfinalizer(driver.quit)
@@ -30,11 +35,14 @@
     """
     # 鑾峰彇褰撳墠椤圭洰鏍硅矾寰�
     root_path = os.getcwd()
-    if "\\testcase" in root_path:
-        root_path = root_path[0:root_path.rfind("\\testcase")]
+    print(root_path)
+    if "testcase" in root_path:
+        root_path = root_path.replace('testcase', '')
     # 鑾峰彇鍒拌鑾峰彇鏁版嵁鐨勯敭
     key = request.param
+    file_path = os.path.join(root_path, "data", "test_data.json")
+    print("file_path:", file_path)
     # 璇诲彇鏁版嵁
-    with open(root_path + r"\data\test_data.json", "r", encoding="utf-8") as f:
+    with open(file_path, "r", encoding="utf-8") as f:
         values = json.load(f)
         return values[key]

--
Gitblit v1.9.1