Skip to content

Commit

Permalink
refactor: replace galata with ipywidgets-text
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Oct 11, 2024
1 parent 7308612 commit e896ba8
Show file tree
Hide file tree
Showing 17 changed files with 21 additions and 318 deletions.
34 changes: 2 additions & 32 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ jobs:
name: bqplot-image-gl-dist-${{ github.run_number }}
path: ./dist

- name: Install node
uses: actions/setup-node@v2
with:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Install Python
uses: actions/setup-python@v2
with:
Expand All @@ -66,7 +60,7 @@ jobs:
echo $PWD
ls -al .
ls -al dist/
pip install dist/bqplot_image_gl*.whl "jupyterlab<4" "pytest-ipywidgets[solara]"
pip install dist/bqplot_image_gl*.whl "pytest-ipywidgets[all]"
- name: Install playwright
run: |
Expand All @@ -76,36 +70,12 @@ jobs:
run: |
pytest tests/ui
- name: Install Galata
run: |
yarn install
yarn playwright install chromium
working-directory: ui-tests

- name: Launch JupyterLab
run: yarn run start:detached
working-directory: ui-tests

- name: Wait for JupyterLab
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8988/api
timeout: 20000

- name: Run UI Tests
env:
TARGET_URL: http://127.0.0.1:8988
run: yarn run test
working-directory: ui-tests

- name: Upload UI Test artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: ui-test-output
name: bqplot-image-gl-ui-test-output
path: |
ui-tests/playwright-report
ui-tests/test-results
test-results
tests:
Expand Down
35 changes: 19 additions & 16 deletions tests/ui/image_test.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,35 @@
import ipywidgets as widgets
import playwright.sync_api
from IPython.display import display
import numpy as np
from bqplot import Figure, LinearScale, Axis, ColorScale
from bqplot_image_gl import ImageGL


def test_widget_image(solara_test, page_session: playwright.sync_api.Page, assert_solara_snapshot):

scale_x = LinearScale(min=0, max=1)
scale_y = LinearScale(min=0, max=1)
scales = {"x": scale_x, "y": scale_y}
axis_x = Axis(scale=scale_x, label="x")
axis_y = Axis(scale=scale_y, label="y", orientation="vertical")
def test_widget_image(ipywidgets_runner, page_session: playwright.sync_api.Page, assert_solara_snapshot):

figure = Figure(scales=scales, axes=[axis_x, axis_y])
def kernel_code():
import numpy as np
from bqplot import Figure, LinearScale, Axis, ColorScale
from bqplot_image_gl import ImageGL
scale_x = LinearScale(min=0, max=1)
scale_y = LinearScale(min=0, max=1)
scales = {"x": scale_x, "y": scale_y}
axis_x = Axis(scale=scale_x, label="x")
axis_y = Axis(scale=scale_y, label="y", orientation="vertical")

scales_image = {"x": scale_x, "y": scale_y, "image": ColorScale(min=0, max=2)}
figure = Figure(scales=scales, axes=[axis_x, axis_y])

data = np.array([[0., 1.], [2., 3.]])
image = ImageGL(image=data, scales=scales_image)
scales_image = {"x": scale_x, "y": scale_y, "image": ColorScale(min=0, max=2)}

figure.marks = (image,)
data = np.array([[0., 1.], [2., 3.]])
image = ImageGL(image=data, scales=scales_image)

display(figure)
figure.marks = (image,)

display(figure)

ipywidgets_runner(kernel_code)
svg = page_session.locator(".bqplot")
svg.wait_for()
# page_session.wait_for_timeout(1000)
# make sure the image is rendered
page_session.wait_for_timeout(100)
assert_solara_snapshot(svg.screenshot())
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 0 additions & 41 deletions ui-tests/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions ui-tests/jupyter_server_config.py

This file was deleted.

21 changes: 0 additions & 21 deletions ui-tests/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions ui-tests/playwright.config.js

This file was deleted.

134 changes: 0 additions & 134 deletions ui-tests/tests/bqplot-image-gl.test.ts

This file was deleted.

Binary file not shown.
56 changes: 0 additions & 56 deletions ui-tests/tests/notebooks/image.ipynb

This file was deleted.

0 comments on commit e896ba8

Please sign in to comment.