Skip to content

Commit cccf323

Browse files
committed
test: cover the env-backed welcome actions with a seeded Python env
When a Python env is configured the welcome local-server actions become enabled; pin that. The test seeds `app-data.json` with a `pythonPath` (the real config seam the app reads) and asserts the "New notebook" action loses its `disabled` class. Gated on JLAB_TEST_PYTHON_PATH (CI provisions a venv with jupyterlab and sets it; skipped locally when absent) so the suite stays green everywhere. Driving the JupyterLab content itself is left to a separate plain-Playwright suite against the server URL (Phase 3). Note: AI-assisted (Claude Code). Manually verified: passes locally with JLAB_TEST_PYTHON_PATH set to a jupyterlab env; skips cleanly when unset.
1 parent 673a77d commit cccf323

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/e2e/python-env.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { expect, test } from '@playwright/test';
2+
import { cleanup, launchApp, pageByTitle } from './helpers';
3+
4+
// These tests need a real Python env with jupyterlab. CI provisions one and
5+
// points JLAB_TEST_PYTHON_PATH at it; locally, set it to any python that has
6+
// jupyterlab installed. Skipped when absent so the suite stays green everywhere.
7+
const pythonPath = process.env.JLAB_TEST_PYTHON_PATH;
8+
9+
test.describe('with a seeded Python environment', () => {
10+
test.skip(
11+
!pythonPath,
12+
'set JLAB_TEST_PYTHON_PATH to a python with jupyterlab'
13+
);
14+
15+
test('the welcome local-server actions are enabled', async () => {
16+
const { app, userDataDir } = await launchApp({ pythonPath });
17+
try {
18+
const welcome = await pageByTitle(app, /welcome/i);
19+
await welcome.waitForLoadState('domcontentloaded');
20+
const newNotebook = welcome.locator('#new-notebook-link');
21+
await expect(newNotebook).toBeVisible();
22+
// The app validates the seeded env and emits EnableLocalServerActions,
23+
// which removes the `disabled` class from the local-server actions.
24+
await expect(newNotebook).not.toHaveClass(/disabled/, { timeout: 20000 });
25+
} finally {
26+
await app.close();
27+
cleanup(userDataDir);
28+
}
29+
});
30+
});

0 commit comments

Comments
 (0)