Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal Test suite #74

Closed
s-cork opened this issue Jun 8, 2021 · 3 comments
Closed

Internal Test suite #74

s-cork opened this issue Jun 8, 2021 · 3 comments

Comments

@s-cork
Copy link
Collaborator

s-cork commented Jun 8, 2021

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.

@s-cork s-cork added the idea A potential idea label Jun 8, 2021
@meatballs
Copy link
Member

meatballs commented Jun 9, 2021

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

@meatballs
Copy link
Member

It would be very nice to 'eat our own dog food' and add some UI testing using anvil-test

@s-cork
Copy link
Collaborator Author

s-cork commented Jun 9, 2021

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.

@meatballs meatballs removed the idea A potential idea label Nov 25, 2021
@anvilistas anvilistas locked and limited conversation to collaborators Nov 25, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants