Description
Description
Currently, we only test things that can be statically-generated by Python, using pytest
.
However, a lot of the functionality in this theme comes from JavaScript, which we cannot test simply by looking at the statically-generated HTML files. We currently do not test for interactive things like the dropdown switcher, which makes us more likely to miss regressions and bugs.
Proposed solution
We should investigate using the playwright pytest plugin to do basic "live behavior" testing of important aspects of the theme. playwright
can install its own bundled version of chromium
and is very well supported.
Here's an example of their pytest plugin in-action from their docs:
# test_my_application.py
def test_example_is_working(page):
page.goto("https://example.com")
assert page.inner_text('h1') == 'Example Domain'
page.click("text=More information")
I think we'd have access to anything in the page
object. So for example we could check the inner HTML of a page after it was loaded in chromium
. This could let us test for things in a more reliable fashion.