I have created a couple of custom widgets and it would be great to test them. I have seen that some of the tests are ui tests, and they have a page variable that allows them to simulate clicks and test the outcome.
I dag through the
conftest.py file but I am still quite new to pytest and was unable to find how this
page variable is set up.
One file that uses this for example: panel/test_select.py at main · holoviz/panel · GitHub.
So the question is, how are the tests set up to use this?
Welcome to the community. That is a great question.
Panel is using Playwright for its unit tests. Its a really great framework. The
page argument is a so called fixture that it provides you to help with your testing.
port fixture is one that Panel has configured in a
You can check out the guide Test UI rendering. Let me know what you think - I wrote the guide
We have actually released a series of (great ?!) how-to guides on testing
Check out How-to — Panel v1.1.0
I can only accept one as a solution, so I accepted the one pointing specifically to the UI testing page.
Nice and clean descriptions. This, in combination of looking at your GitHub to learn how you yourselves are testing proved to be the best combination.
Thank you Marc!