فهرست منبع

fix(test): Make language verification script more robust

This addresses feedback from CodeRabbitAI by using a regular expression for the language button's aria-label. This ensures the test can run regardless of the browser's default language.
comeback01 5 ماه پیش
والد
کامیت
79a252fc57
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      jules-scratch/verification/verify_translation.py

+ 6 - 2
jules-scratch/verification/verify_translation.py

@@ -1,5 +1,6 @@
 from playwright.sync_api import sync_playwright, expect
 from playwright.sync_api import sync_playwright, expect
 import time
 import time
+import re
 
 
 def run(playwright):
 def run(playwright):
     browser = playwright.chromium.launch(headless=True)
     browser = playwright.chromium.launch(headless=True)
@@ -10,8 +11,11 @@ def run(playwright):
     page.goto("http://localhost:5173", wait_until="networkidle")
     page.goto("http://localhost:5173", wait_until="networkidle")
     print("Page loaded")
     print("Page loaded")
 
 
-    # The aria-label is in Chinese in the source, so we use that.
-    language_button = page.get_by_role("button", name="切换语言")
+    # Use a regex to find the button by its aria-label in either Chinese or English.
+    language_button = page.get_by_role(
+        "button",
+        name=re.compile(r"(切换语言|Change Language)", re.IGNORECASE),
+    )
 
 
     # Wait for the button to be visible
     # Wait for the button to be visible
     expect(language_button).to_be_visible()
     expect(language_button).to_be_visible()