From 05d3ddb3973c710b3d552a492b365b47d099e543 Mon Sep 17 00:00:00 2001 From: comeback01 Date: Sat, 27 Sep 2025 11:35:03 +0200 Subject: [PATCH] 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. --- jules-scratch/verification/verify_translation.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jules-scratch/verification/verify_translation.py b/jules-scratch/verification/verify_translation.py index 4b462731..f654af51 100644 --- a/jules-scratch/verification/verify_translation.py +++ b/jules-scratch/verification/verify_translation.py @@ -1,5 +1,6 @@ from playwright.sync_api import sync_playwright, expect import time +import re def run(playwright): browser = playwright.chromium.launch(headless=True) @@ -10,8 +11,11 @@ def run(playwright): page.goto("http://localhost:5173", wait_until="networkidle") 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 expect(language_button).to_be_visible()