Metadata-Version: 2.3
Name: pytest-ipywidgets
Version: 1.50.0
Dynamic: Summary
Project-URL: Home, https://github.com/widgetti/solara/tree/master/packages/pytest-ipywidgets
Project-URL: Documentation, https://solara.dev
Author-email: "Maarten A. Breddels" <maartenbreddels@gmail.com>
License: The MIT License (MIT)
        
        Copyright (c) 2022 Maarten A. Breddels
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in
        all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
        THE SOFTWARE.
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.7
Requires-Dist: pillow
Requires-Dist: pixelmatch
Requires-Dist: playwright
Requires-Dist: pytest
Requires-Dist: pytest-playwright
Requires-Dist: solara-server[starlette]==1.50.0
Requires-Dist: solara-ui==1.50.0
Provides-Extra: all
Requires-Dist: jupyterlab<4; extra == 'all'
Requires-Dist: notebook<7; extra == 'all'
Requires-Dist: voila; extra == 'all'
Provides-Extra: ipywidgets7
Requires-Dist: lxml<5.2; extra == 'ipywidgets7'
Requires-Dist: voila~=0.3.0; extra == 'ipywidgets7'
Provides-Extra: ipywidgets8
Requires-Dist: voila>=0.4; extra == 'ipywidgets8'
Provides-Extra: jupyterlab
Requires-Dist: jupyterlab<4; extra == 'jupyterlab'
Provides-Extra: notebook
Requires-Dist: notebook<7; extra == 'notebook'
Provides-Extra: solara
Provides-Extra: voila
Requires-Dist: voila; extra == 'voila'
Description-Content-Type: text/markdown

Test ipywidgets with playwright and pytest.


# Installation

```bash
pip install "pytest-ipywidgets[all]"
```

*(Note that the optional `[all]` installs all dependencies, including compatible versions of notebook, jupyterlab and voila.)*

# Usage

## Using solara-server (in-process)

If you want to test your ipywidgets with playwright in-process, you can use the `solara_test` fixture, use `display` to
show your widget in the browser.

```python
import ipywidgets as widgets
import playwright.sync_api
from IPython.display import display

def test_widget_button_solara(solara_test, page_session: playwright.sync_api.Page):
    # this all runs in-process
    button = widgets.Button(description="Click Me!")

    def change_description(obj):
        button.description = "Tested event"

    button.on_click(change_description)
    display(button)
    button_sel = page_session.locator("text=Click Me!")
    button_sel.wait_for()
    button_sel.click()
    page_session.locator("text=Tested event").wait_for()
```

# Testing in the main Jupyter Environments (Notebook, Lab, Voila & Solara)

See https://solara.dev/documentation/advanced/howto/testing for more information.
