Skip to content
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

Can I use voila with a headless browser for testing widget implementations? #226

Closed
AaronWatters opened this issue Jun 12, 2019 · 2 comments

Comments

@AaronWatters
Copy link

This is really a question. I want to have real automated end to end testing for widget implementations and I don't know how to do it yet properly, so..

Can you use voila to build automatic end-to-end tests for interactive Jupyter widgets?

A test might work like this:

  • test initializes and starts a notebook using voila in a subprocess using a headless browser and waits until the notebook is "done". (X)
  • the notebook Python kernel creates one or more widgets and makes them do something.
  • the widgets (asynchronously) call back to the Python kernel to make testable artifacts (like output images or other evidence that the widget works) saved to files.
  • when the widgets are done they send a signal indicate that they are done asynchronously to the Python kernel.
  • the Python kernel observes that the widgets are done and terminates the voila subprocess and all descendent processes. (XX)
  • the test notices that voila has terminated and validates the file artifacts to confirm that the widgets work as expected.

The parts I'm unsure of are marked (X) and (XX). Please comment.

  • Can you start voila using a headless browser now?
  • What is the appropriate mechanism for stopping the voila process and all descendent processes?

Note that widget communication is asynchronous, so the cells of a notebook may "finish" before widgets have even initialized -- stopping after the cells have executed will not work for testing widgets. Also, you can't use nbconvert for this purpose because nbconvert doesn't interact with widgets "normally".

@maartenbreddels
Copy link
Member

I'm not sure voila is the right way to do this, jupyter/nbconvert#901 goes a bit into this direction. But I think many people want this, to at least see if the widgets render, and possibly have a bot post screenshots when something went wrong.
cc @martinRenou

@maartenbreddels
Copy link
Member

Short answer is yes, you can, a headless browser is not different from a real one. Implementing this is a bit of work, see #574

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants