Skip to content
New issue

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

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

Already on GitHub? # to your account

Doing integration (front and backend) tests using the notebook #1285

Open
maartenbreddels opened this issue Apr 15, 2017 · 3 comments
Open
Milestone

Comments

@maartenbreddels
Copy link
Member

I was thinking how to do proper testing for ipyvolume, but the same holds for ipywidgets, so I thought of bringing the discussion here.
I think unittests in javascript/typescript are not an issue, Python the same. But at some moment, you want to check if things really work as expected from the notebook, hence an integration test.
I asked @blink1073 how they've done it for jupyterlab, and they use karma+mocha, which uses a real browser. This is perfect for me, since for ipyvolume I need to have a WebGL context, which I believe is not supported in something like PhantomJS.

I had the following idea in mind. You write your tests in a notebook, once you save it, karma (or webpack) will detect a file change, and will do the webpack/karma dance, including the json from the notebook (possibly minus the outputs) and include it in a test. Then karma will execute the tests and our custom code (mostly coming from the jupyterlab project) will attempt to executing all the code coming from the notebook. You could possibly get code coverage from JS and Python in the same run as well.

This will require 'stealing' some code from the jupyterlab project (actually, on the long run it will probably need to go in a seperate package). For instance run-test.py seems useful.

I don't have the time or knowledge to set this all up myself (I don't have any experience with the Jupyterlab TS code). However, @jasongrout, do you think this is something you have time for before (and for) the release of ipywidgets 7.0? I'm happy to contribute where I can, and after 7.0 we can see how we can polish it, and put it maybe in a separate package.

@jasongrout jasongrout added this to the Future milestone Apr 19, 2017
@jasongrout
Copy link
Member

Let's look at doing something with the testing infrastructure after we do a beta (hopefully this week or next). I'm putting this in the Future milestone for right now since it seems quite ambitious.

@StefanBrand
Copy link
Contributor

I have a simple use-case at hand. In an integration test with papermill, how can I figure out from the backend whether an IntSlider will be displayed as widget? E.g. I'd like to verify whether my environment can display the slider like this:

IntSlider

The plain text representation would cause the test to fail:

IntSlider plain text representation

(There is an Exception opening new comm in Javascript:)

Exception opening new comm

@jtpio
Copy link
Member

jtpio commented Mar 29, 2021

FYI this PR adds visual regression testing to ipywidgets using galata: #3172

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants