next integration tests (#1712)

* move integration tests pyscriptjs/tests/integration ->pyscript.core/tests/integration

* add information in regards to how to run integration tests to README

* fix fake server build paths

* fix paths to build and run tests. The change of path before integration tests is a glitch maybe due to pytest cache?

* remove test files created by mistake

* update readme with latest changes

---------

Co-authored-by: Fabio Pliger <fpliger@anaconda.com>
This commit is contained in:
Fabio Pliger
2023-09-15 14:09:07 -07:00
committed by GitHub
parent ed6de66c08
commit f77241e977
28 changed files with 24 additions and 5 deletions

View File

@@ -0,0 +1,64 @@
import pytest
from .support import PyScriptTest
class TestPyScriptRuntimeAttributes(PyScriptTest):
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_injected_html_with_py_event(self):
self.pyscript_run(
r"""
<div id="py-button-container"></div>
<py-script>
import js
py_button = Element("py-button-container")
py_button.element.innerHTML = '<button py-click="print_hello()"></button>'
def print_hello():
js.console.log("hello pyscript")
</py-script>
"""
)
self.page.locator("button").click()
assert self.console.log.lines == ["hello pyscript"]
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_added_py_event(self):
self.pyscript_run(
r"""
<button id="py-button"></button>
<py-script>
import js
py_button = Element("py-button")
py_button.element.setAttribute("py-click", "print_hello()")
def print_hello():
js.console.log("hello pyscript")
</py-script>
"""
)
self.page.locator("button").click()
assert self.console.log.lines == ["hello pyscript"]
@pytest.mark.skip("FIXME: Element interface is gone. Replace with PyDom")
def test_added_then_removed_py_event(self):
self.pyscript_run(
r"""
<button id="py-button">live content</button>
<py-script>
import js
py_button = Element("py-button")
py_button.element.setAttribute("py-click", "print_hello()")
def print_hello():
js.console.log("hello pyscript")
py_button.element.removeAttribute("py-click")
</py-script>
"""
)
self.page.locator("button").click()
self.page.locator("button").click()
assert self.console.log.lines == ["hello pyscript"]