nbmake icon indicating copy to clipboard operation
nbmake copied to clipboard

Widget calls requiring browser context hang during testing

Open alex-treebeard opened this issue 1 year ago • 4 comments

Describe the bug The ITKWidgets project cannot test a notebooks that calls a widget which is only initialised when a browser is present

To Reproduce See https://github.com/InsightSoftwareConsortium/itkwidgets/pull/587

Expected behavior Can call the initialised widget API successfully

Additional context This issue occurs because nbclient is an alternative to running a full jupyter web app + server (architecture diagram) and doesn't run a browser context.

Problem cell example

image = itk.image_from_array(array)
print('Dimension', image.GetImageDimension())
print('Components', image.GetNumberOfComponentsPerPixel())

from ipynb.

alex-treebeard avatar Feb 16 '23 12:02 alex-treebeard

This repo has a pretty advanced setup using Selenium's python APIs @thewtex you can see that they actually test the widget's functionality (not just load it).

alex-treebeard avatar Mar 10 '23 18:03 alex-treebeard

@alex-treebeard here is a high level architecture that aims to:

  1. Provide the needed JavaScript, WebGL context
  2. Be simple, requiring relatively little code
  3. Work with the existing nbmake code

References:

thewtex avatar Apr 20 '23 13:04 thewtex

weights and biases have come up with an interesting cypress-based solution

https://github.com/wandb/weave/blob/4891c2f5d35bb9077d4add9ab4d92536dbf7b00c/integration_test/cypress/e2e/notebooks/notebooks.ts

alex-treebeard avatar Oct 05 '23 13:10 alex-treebeard

Interesting! It does not look like they are running the notebooks in an actual browser, though, from what I can tell.

thewtex avatar Oct 20 '23 01:10 thewtex