Replies: 3 comments
-
Is there something you don't like about the (admittedly insufficient) existing test suite? That is executed by a github action on PRs, but can also be run locally as described in the contribution guide |
Beta Was this translation helpful? Give feedback.
-
It would be very nice to 'eat our own dog food' and add some UI testing using anvil-test |
Beta Was this translation helpful? Give feedback.
-
it's specifically things for client side low level component functionality which would be easier done having access to both the dom and the anvil components. I don't think that's as easy with anvil-test alone since it focuses on higher level user experience. e.g. def __init__(self):
self.base = anvil_extras.Tabs
self.component = anvil_extras.Tabs(tab_titles=["Tab 1", "Tab 2", "Tab 3"])
self.dom_node = anvil.js.get_dom_node(self.component)
def test_constructor(self):
tabs = self.base(tab_titles=["foo"])
self.assertEqual(tabs.tab_titles, ["foo"])
def test_tabs_clicked(self):
with self.assertRaisesEvent('tabs_clicked'):
self.component.trigger('click')
def test_dynamic_color_prop(self):
self.component.foreground = "#eee"
self.assertEqual(self.dom_node.style.getProperty("--fg"), "#eee")
self.assertEqual(#computed style of tabs is actually #eee)
def test_dynamic_tabs(self):
with self.assertRaises(TypeError):
self.component.tabs = 'foo'
... But happy to be convinced otherwise. |
Beta Was this translation helpful? Give feedback.
-
We should have a separate test suite that depends on anvil-extras
Especially if the user who depend on it grow.
And after #73 we're committing to backward compatibility/being very loud about breaking changes - until anvil supports versioning.
Happy to get this one started since I have a template written for testing anvil components internally.
I'm not sure what the best integration is here.
It shouldn't be part of the anvil-extras client_code since that'll massively bulk up what gets sent to the client for those depending on the app.
We also would want prs to include tests.
It might be least hassle to create a test suite app as a separate repo and make a note of how to add tests with a pr in the contributing docs.
Beta Was this translation helpful? Give feedback.
All reactions