Files
python-tdd/src/functional_tests/test_jasmine.py

19 lines
752 B
Python
Raw Normal View History

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")
if "0 failures" not in result.text:
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}")
self.wait_for(check_results)