Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into widget-hydration-py
Browse files Browse the repository at this point in the history
  • Loading branch information
mofojed committed Mar 6, 2024
2 parents 647663c + 5bef1a4 commit 18ed118
Show file tree
Hide file tree
Showing 75 changed files with 2,076 additions and 635 deletions.
8 changes: 7 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,10 @@ playwright/.cache/
**/.gitignore

# Tests are copied to the docker container, as it modifies them
tests/
tests/

# Playwright
test-results/
playwright-report/
blob-report/
playwright/.cache/
43 changes: 43 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: End-to-end Tests

on:
push:
branches:
- main
- 'release/**'
pull_request:
branches:
- main
- 'release/**'

jobs:
e2e-test:
runs-on: ubuntu-22.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run tests
run: "./tools/run_docker.sh e2e-tests"

- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 90

- name: Dump server logs
if: failure()
run: docker logs deephaven-plugins > /tmp/server-log.txt

- name: Upload server logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: server-logs
path: /tmp/server-log.txt
4 changes: 4 additions & 0 deletions .github/workflows/modified-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ on:
- 'matplotlib-v*'
- 'json-v*'
- 'ui-v*'
- 'utilities-v*'
- 'packaging-v*'

jobs:
changes:
Expand All @@ -32,6 +34,8 @@ jobs:
matplotlib: plugins/matplotlib/**
json: plugins/json/**
ui: plugins/ui/**
utilities: plugins/utilities/**
packaging: plugins/packaging/**
# Test all python packages that have been modified individually
test-python:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release-python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ jobs:
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'

- name: Check file existence
id: check_files
uses: andstor/file-existence-action@v3
with:
files: "plugins/${{ inputs.package }}/src/js/package.json"

- name: Install npm dependencies
if: steps.check_files.outputs.files_exists == 'true'
run: npm ci

- name: Build npm packages
if: steps.check_files.outputs.files_exists == 'true'
run: npm run build -- --scope "@deephaven/js-plugin-${{ inputs.package }}"

- name: Set up Python
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tsconfig.tsbuildinfo
.stylelintcache

# Ignore the test reports
coverage/
junit.xml

# Allow for local overrides of docker-compose.yml. https://docs.docker.com/compose/multiple-compose-files/merge/
Expand All @@ -25,6 +26,12 @@ docker-compose.override.yml
# Ignore temporary files created during a release
releases/

# Playwright
test-results/
playwright-report/
blob-report/
playwright/.cache/

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
replay_pid*
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ COPY --link docker/config/deephaven.prop /opt/deephaven/config/deephaven.prop
COPY --link docker/data /data

# Set the environment variable to enable the JS plugins embedded in Python
ENV DEEPHAVEN_ENABLE_PY_JS=true
ENV DEEPHAVEN_ENABLE_PY_JS=true
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ To bypass the pre-commit hook, you can commit with the `--no-verify` flag, for e
git commit --no-verify -m "commit message"`
```

### Running end-to-end tests

We use [Playwright](https://playwright.dev/) for end-to-end tests. We test against Chrome, Firefox, and Webkit (Safari). Snapshots from E2E tests are only run against Linux so they can be validated in CI.

You should be able to pass arguments to these commands as if you were running Playwright via CLI directly. For example, to test only `matplotlib.spec.ts` you could run `npm run e2e:docker -- ./tests/matplotlib.spec.ts`, or to test only `matplotlib.spec.ts` in Firefox, you could run `npm run e2e:docker -- --project firefox ./tests/matplotlib.spec.ts`. See [Playwright CLI](https://playwright.dev/docs/test-cli) for more details.

It is highly recommended to use `npm run e2e:docker` (instead of `npm run e2e`) as CI also uses the same environment. You can also use `npm run e2e:update-snapshots` to regenerate snapshots in said environment.

### Running Python tests

The above steps will also set up `tox` to run tests for the python plugins that support it.
Expand Down
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,33 @@ services:
pull: true
ports:
- '${DEEPHAVEN_PORT:-10000}:10000'
expose:
- 10000
volumes:
- ./docker/data/:/data
- ./tests/app.d:/app.d
environment:
- START_OPTS=-Xmx4g -DAuthHandlers=io.deephaven.auth.AnonymousAuthenticationHandler -Ddeephaven.console.type=python -Ddeephaven.application.dir=./app.d

e2e-tests:
build:
dockerfile: ./tests/Dockerfile
ports:
- '9323:9323'
ipc: host
volumes:
- ./tests:/work/tests
- ./test-results:/work/test-results
- ./playwright-report:/work/playwright-report
entrypoint: "npx playwright test --config=playwright-docker.config.ts"
depends_on:
deephaven-plugins:
condition: service_healthy

update-snapshots:
extends:
service: e2e-tests
entrypoint: 'npx playwright test --config=playwright-docker.config.ts --update-snapshots'
depends_on:
deephaven-plugins:
condition: service_healthy
1 change: 1 addition & 0 deletions docker/config/deephaven.prop
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ includefiles=dh-defaults.prop
deephaven.console.type=python

# Add all plugins that you want installed here
deephaven.jsPlugins.@deephaven/js-plugin-matplotlib=/opt/deephaven/config/plugins/plugins/matplotlib/src/js
deephaven.jsPlugins.@deephaven/js-plugin-ui=/opt/deephaven/config/plugins/plugins/ui/src/js

# Anonymous authentication so we don't need to put in a password
Expand Down
39 changes: 39 additions & 0 deletions docker/data/storage/notebooks/DEMO.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,45 @@ def my_input():
result = my_input()
```

## Picker (string values)

The `ui.picker` component can be used to select from a list of items. Here's a basic example for selecting from a list of string values and displaying the selected key in a text field.

```python
import deephaven.ui as ui
from deephaven.ui import use_state


@ui.component
def picker():
value, set_value = use_state("")

# Picker for selecting values
pick = ui.picker(
"Text 1",
"Text 2",
"Text 3",
label="Text",
on_selection_change=set_value,
selected_key=value,
)

# Show current selection in a ui.text component
text = ui.text("Selection: " + value)

# Display picker and output in a flex column
return ui.flex(
pick,
text,
direction="column",
margin=10,
gap=10,
)


p = picker()
```

## Using Tables

You can open a Deephaven Table and control it using callbacks, as well. Let\'s create a table with some data, and then create a component that allows us to filter the table, and a button group it or ungroup it.
Expand Down
Loading

0 comments on commit 18ed118

Please sign in to comment.