2026-05-12 16:40:15 -04:00
|
|
|
import re
|
|
|
|
|
|
2026-02-11 14:42:38 -05:00
|
|
|
from selenium.webdriver.common.by import By
|
|
|
|
|
from .base import FunctionalTest
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class JasmineTest(FunctionalTest):
|
|
|
|
|
def test_jasmine_specs_pass(self):
|
|
|
|
|
self.browser.get(self.live_server_url + "/static/tests/SpecRunner.html")
|
|
|
|
|
|
|
|
|
|
def check_results():
|
|
|
|
|
result = self.browser.find_element(By.CSS_SELECTOR, ".jasmine-overall-result")
|
2026-05-12 16:40:15 -04:00
|
|
|
# Word-boundary anchor — Jasmine 6 reports as "N specs, X failures".
|
|
|
|
|
# Plain `"0 failures" in text` matches "10 failures", "20 failures",
|
|
|
|
|
# etc., letting up to 99 failed specs slip past as green.
|
|
|
|
|
if not re.search(r"(?<!\d)0 failures\b", result.text):
|
2026-03-29 23:39:03 -04:00
|
|
|
failures = self.browser.find_elements(
|
|
|
|
|
By.CSS_SELECTOR, ".jasmine-failed .jasmine-description"
|
|
|
|
|
)
|
|
|
|
|
detail = "\n".join(f.text for f in failures) if failures else "(no detail)"
|
|
|
|
|
self.fail(f"{result.text}\nFailing specs:\n{detail}")
|
|
|
|
|
|
2026-02-11 14:42:38 -05:00
|
|
|
self.wait_for(check_results)
|