gh-124621: Emscripten: Add smoke test for using pyrepl in Chrome (#137004)

Adds a mechanism to test browser-based initialisation of the Python interpreter,
via a Playwright headless browser instance.
This commit is contained in:
Hood Chatham 2025-07-24 08:44:02 +02:00 committed by GitHub
parent ecb3f23b94
commit ae4d27eba7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 753 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';
test('has title', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle("Emscripten PyRepl Example");
const xterm = await page.locator('css=#terminal');
await expect(xterm).toHaveText(/Python.*on emscripten.*Type.*for more information/);
const xtermInput = await page.getByRole('textbox');
await xtermInput.pressSequentially(`def f():\nprint("hello", "emscripten repl!")\n\n`);
await xtermInput.pressSequentially(`f()\n`);
await expect(xterm).toHaveText(/hello emscripten repl!/);
});