-
Notifications
You must be signed in to change notification settings - Fork 40
feat: automated UI testing with Playwright #906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
5f8b799
test(e2e): add Playwright setup and notebook load spec
vgeorge fbac778
Add Playwright e2e tests with DeckGL canvas interaction support
vgeorge dbfb855
test(e2e): refactor DeckGL helpers and fix optional unproject
vgeorge d4d151d
feat(globe): add GlobeWidget and workspace-based e2e; expose MapLibre…
vgeorge 2ecfc40
test: exclude Playwright e2e tests from vitest
vgeorge d715f73
Merge branch 'main' into feat/playwright-e2e-setup
vgeorge 6cc0130
fix(docs): correct mkdocstrings syntax and auto-generate projection t…
vgeorge cdf80b8
fix(docs): add models page to resolve ViewState cross-reference
vgeorge 837c628
fix(docs): restore map.md to main branch version to fix ViewState cro…
vgeorge 3667c59
revert: restore files to main branch versions
vgeorge 9029ff8
feat: add DeckGL ref exposure for Playwright tests
vgeorge 59f17c8
fix: formatting issues on fixture notebook
vgeorge b4316a4
fix: lint
vgeorge 8c490d2
Merge branch 'main' into feat/playwright-e2e-setup
vgeorge 6a53a1a
fix: add comment, update .gitignore
vgeorge f199458
fix: lint
vgeorge 6057d9c
Merge branch 'main' into feat/playwright-e2e-setup
kylebarron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
test(e2e): add Playwright setup and notebook load spec
- Loading branch information
commit 5f8b799a1953648d2715df3cf7cc2e017ea088e2
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,3 +30,7 @@ node_modules | |
| .env | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| # Playwright test artifacts | ||
| test-results/ | ||
| playwright-report/ | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { defineConfig, devices } from '@playwright/test'; | ||
|
|
||
| export default defineConfig({ | ||
| testDir: './tests/e2e', | ||
| testMatch: '**/*.spec.ts', | ||
| fullyParallel: false, | ||
| forbidOnly: !!process.env.CI, | ||
| retries: process.env.CI ? 2 : 0, | ||
| workers: 1, | ||
| timeout: 60000, | ||
| expect: { | ||
| timeout: 30000, | ||
| }, | ||
| reporter: 'list', | ||
|
|
||
| use: { | ||
| baseURL: 'http://localhost:8889', | ||
| trace: 'on-first-retry', | ||
| screenshot: 'only-on-failure', | ||
| navigationTimeout: 30000, | ||
| browserName: 'chromium', | ||
| }, | ||
|
|
||
| projects: [ | ||
| { | ||
| name: 'chromium', | ||
| use: { ...devices['Desktop Chrome'] }, | ||
| }, | ||
| ], | ||
|
|
||
| webServer: { | ||
| command: 'uv run --group dev jupyter lab --no-browser --port=8889 --notebook-dir=tests/e2e/fixtures --IdentityProvider.token=""', | ||
| url: 'http://localhost:8889', | ||
| reuseExistingServer: false, // Always restart for clean state | ||
| timeout: 30000, | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # End-to-End Tests | ||
|
|
||
| Playwright-based end-to-end tests for Lonboard widgets in JupyterLab. | ||
|
|
||
| ## Running Tests | ||
|
|
||
| ```bash | ||
| # Run all e2e tests | ||
| npm run test:e2e | ||
|
|
||
| # Run with UI mode | ||
| npm run test:e2e:ui | ||
| ``` | ||
|
|
||
| ## Architecture | ||
|
|
||
| - **JupyterLab**: Runs on port 8889 (isolated from dev instances on 8888) | ||
| - **Working Directory**: `tests/e2e/fixtures/` (only test notebooks visible) | ||
| - **Clean State**: JupyterLab server restarts for each test run (`reuseExistingServer: false`) | ||
| - Fresh kernel state on every run | ||
| - No session persistence between test runs | ||
| - No interference with development sessions | ||
|
|
||
| ## Test Fixtures | ||
|
|
||
| Test notebooks are stored in `tests/e2e/fixtures/` and committed to the repository. They provide scaffolding to replicate correct user workflows. | ||
|
|
||
| ### simple-map.ipynb | ||
|
|
||
| Basic test notebook with 4 points in a grid displaying a simple scatterplot map. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .ipynb_checkpoints/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import geopandas as gpd\n", | ||
| "from shapely.geometry import Point\n", | ||
| "from lonboard import Map, ScatterplotLayer" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Simple test data - 4 points in a grid\n", | ||
| "points = [\n", | ||
| " Point(-10, -10),\n", | ||
| " Point(-10, 10),\n", | ||
| " Point(10, -10),\n", | ||
| " Point(10, 10),\n", | ||
| "]\n", | ||
| "gdf = gpd.GeoDataFrame(geometry=points, crs='EPSG:4326')\n", | ||
| "\n", | ||
| "layer = ScatterplotLayer.from_geopandas(\n", | ||
| " gdf,\n", | ||
| " get_fill_color=[255, 0, 0],\n", | ||
| " get_radius=100000,\n", | ||
| ")\n", | ||
| "\n", | ||
| "m = Map(layer, view_state={\"longitude\": 0, \"latitude\": 0, \"zoom\": 2})\n", | ||
| "m" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Check selected bounds (run after bbox selection)\n", | ||
| "print(f\"Selected bounds: {m.selected_bounds}\")" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "name": "python", | ||
| "version": "3.10.0" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 4 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| test.describe('Notebook Load', () => { | ||
| test('JupyterLab starts and loads notebook', async ({ page }) => { | ||
| // Open a simple map notebook | ||
| await page.goto('/lab/tree/simple-map.ipynb'); | ||
|
|
||
| // Verify the correct notebook tab is active | ||
| await expect(page.locator('.jp-mod-current[role="tab"]:has-text("simple-map.ipynb")')).toBeVisible({ timeout: 10000 }); | ||
|
|
||
| // Verify kernel status shows in footer | ||
| await expect(page.locator('text=/Python 3.*Idle/')).toBeVisible({ timeout: 30000 }); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.