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.
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.
The port fixture is one that Panel has configured in a conftest.py file.
You can check out the guide Test UI rendering. Let me know what you think - I wrote the guide
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.