mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
Fix antigravity (#1017)
* Fix antigravity * Add test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -98,6 +98,29 @@ class TestExamples(PyScriptTest):
|
||||
assert see_source_link.is_visible()
|
||||
self.assert_no_banners()
|
||||
|
||||
def test_antigravity(self):
|
||||
self.goto("examples/antigravity.html")
|
||||
self.wait_for_pyscript()
|
||||
assert self.page.title() == "Antigravity"
|
||||
|
||||
# confirm that svg added to page
|
||||
wait_for_render(self.page, "*", '<svg.*id="svg8".*>')
|
||||
|
||||
# Get svg layer of flying character
|
||||
char = self.page.wait_for_selector("#python")
|
||||
assert char is not None
|
||||
|
||||
# check that character moves in negative-y direction over time
|
||||
ycoord_pattern = r"translate\(-?\d*\.\d*,\s(?P<ycoord>-?[\d.]+)\)"
|
||||
starting_y_coord = float(
|
||||
re.match(ycoord_pattern, char.get_attribute("transform")).group("ycoord")
|
||||
)
|
||||
time.sleep(2)
|
||||
later_y_coord = float(
|
||||
re.match(ycoord_pattern, char.get_attribute("transform")).group("ycoord")
|
||||
)
|
||||
assert later_y_coord < starting_y_coord
|
||||
|
||||
def test_bokeh(self):
|
||||
# XXX improve this test
|
||||
self.goto("examples/bokeh.html")
|
||||
|
||||
Reference in New Issue
Block a user