mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-19 18:27:29 -05:00
* Remove duplicate LICENSE. * Remove un-userd pyscript.sw directory and its content. * Remove ReadTheDocs settings (unused). * Remove un-used pyproject.toml * Remove now unused CHANGELOG. Changes now tracked via release notes on GitHub. * Updated / cleaned release page template and associated GH actions. * Update prettierignore to remove un-needed refs. * Move troubleshooting into correct README. * Add reason for the index.html * Rename the "pyscript.core" directory to "core". * Update PR template because CHANGELOG is no longer used. * Codespell configuration in pyproject.toml. * Update pyscript.core -> core in .githubignore * Remove test-results/.last-run.json. This should be ignored by git. * Pin nodejs version. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
123 lines
4.1 KiB
JavaScript
123 lines
4.1 KiB
JavaScript
import { test, expect } from '@playwright/test';
|
|
|
|
test('MicroPython display', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/mpy.html');
|
|
await page.waitForSelector('html.done.worker');
|
|
const body = await page.evaluate(() => document.body.innerText);
|
|
await expect(body.trim()).toBe([
|
|
'M-PyScript Main 1',
|
|
'M-PyScript Main 2',
|
|
'M-PyScript Worker',
|
|
].join('\n'));
|
|
});
|
|
|
|
test('MicroPython hooks', async ({ page }) => {
|
|
const logs = [];
|
|
page.on('console', msg => {
|
|
const text = msg.text();
|
|
if (!text.startsWith('['))
|
|
logs.push(text);
|
|
});
|
|
await page.goto('http://localhost:8080/tests/javascript/hooks.html');
|
|
await page.waitForSelector('html.done.worker');
|
|
await expect(logs.join('\n')).toBe([
|
|
'main onReady',
|
|
'main onBeforeRun',
|
|
'main codeBeforeRun',
|
|
'actual code in main',
|
|
'main codeAfterRun',
|
|
'main onAfterRun',
|
|
'worker onReady',
|
|
'worker onBeforeRun',
|
|
'worker codeBeforeRun',
|
|
'actual code in worker',
|
|
'worker codeAfterRun',
|
|
'worker onAfterRun',
|
|
].join('\n'));
|
|
});
|
|
|
|
test('MicroPython + Pyodide js_modules', async ({ page }) => {
|
|
const logs = [];
|
|
page.on('console', msg => {
|
|
const text = msg.text();
|
|
if (!text.startsWith('['))
|
|
logs.push(text);
|
|
});
|
|
await page.goto('http://localhost:8080/tests/javascript/js_modules.html');
|
|
await page.waitForSelector('html.done');
|
|
await expect(logs.length).toBe(6);
|
|
await expect(logs[0]).toBe(logs[1]);
|
|
await expect(logs[1]).toBe(logs[2]);
|
|
await expect(logs[3]).toBe(logs[4]);
|
|
await expect(logs[4]).toBe(logs[5]);
|
|
});
|
|
|
|
test('MicroPython + configURL', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/config-url.html');
|
|
await page.waitForSelector('html.main.worker');
|
|
});
|
|
|
|
test('Pyodide + terminal on Main', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/py-terminal-main.html');
|
|
await page.waitForSelector('html.ok');
|
|
});
|
|
|
|
|
|
test('Pyodide + terminal on Worker', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/py-terminal-worker.html');
|
|
await page.waitForSelector('html.ok');
|
|
});
|
|
|
|
test('Pyodide + multiple terminals via Worker', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/py-terminals.html');
|
|
await page.waitForSelector('html.first.second');
|
|
});
|
|
|
|
test('MicroPython + Pyodide fetch', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/fetch/index.html');
|
|
await page.waitForSelector('html.mpy.py');
|
|
});
|
|
|
|
test('MicroPython + Pyodide ffi', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/ffi.html');
|
|
await page.waitForSelector('html.mpy.py');
|
|
});
|
|
|
|
test('MicroPython + Storage', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/storage.html');
|
|
await page.waitForSelector('html.ok');
|
|
});
|
|
|
|
test('MicroPython + JS Storage', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/js-storage.html');
|
|
await page.waitForSelector('html.ok');
|
|
});
|
|
|
|
test('MicroPython + workers', async ({ page }) => {
|
|
test.setTimeout(120*1000); // Increase timeout for this test.
|
|
await page.goto('http://localhost:8080/tests/javascript/workers/index.html');
|
|
await page.waitForSelector('html.mpy.py');
|
|
});
|
|
|
|
test('MicroPython Editor setup error', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/issue-2093/index.html');
|
|
await page.waitForSelector('html.errored');
|
|
});
|
|
|
|
test('MicroPython async @when listener', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/async-listener.html');
|
|
await page.waitForSelector('html.ok');
|
|
});
|
|
|
|
test('Pyodide loader', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/loader/index.html');
|
|
await page.waitForSelector('html.ok');
|
|
const body = await page.evaluate(() => document.body.textContent);
|
|
await expect(body.includes('Loaded Pyodide')).toBe(true);
|
|
});
|
|
|
|
test('Py and Mpy config["type"]', async ({ page }) => {
|
|
await page.goto('http://localhost:8080/tests/javascript/config_type.html');
|
|
await page.waitForSelector('html.mpy.py');
|
|
});
|