Splitting integration tests (#2296)

This commit is contained in:
Andrea Giammarchi
2025-02-20 15:16:36 +01:00
committed by GitHub
parent 46239caa19
commit edbac13713
4 changed files with 28 additions and 25 deletions

View File

@@ -47,7 +47,7 @@
"build:3rd-party": "node rollup/3rd-party.cjs",
"build:tests-index": "node rollup/build_test_index.cjs",
"clean:3rd-party": "rm src/3rd-party/*.js && rm src/3rd-party/*.css",
"test:integration": "npm run test:ws; static-handler --coi . 2>/dev/null & SH_PID=$!; EXIT_CODE=0; playwright test tests/js_tests.spec.js tests/py_tests.spec.js || EXIT_CODE=$?; kill $SH_PID 2>/dev/null; exit $EXIT_CODE",
"test:integration": "npm run test:ws; static-handler --coi . 2>/dev/null & SH_PID=$!; EXIT_CODE=0; (playwright test tests/js_tests.spec.js && playwright test tests/py_tests.main.spec.js && playwright test tests/py_tests.worker.spec.js) || EXIT_CODE=$?; kill $SH_PID 2>/dev/null; exit $EXIT_CODE",
"test:ws": "bun tests/javascript/ws/index.js & playwright test tests/javascript/ws/index.spec.js",
"dev": "node dev.cjs",
"release": "npm run build && npm run zip",

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
import { test, expect } from '@playwright/test';
test.setTimeout(30 * 1000);
test('Python unit tests - MicroPython on MAIN thread', async ({ page }) => {
await page.goto('http://localhost:8080/tests/python/index.html');
const result = page.locator("#result"); // Payload for results will be here.
await result.waitFor(); // wait for the result.
const data = JSON.parse(await result.textContent()); // get the result data.
await expect(data.fails).toMatchObject([]); // ensure no test failed.
});
test('Python unit tests - Pyodide on MAIN thread', async ({ page }) => {
await page.goto('http://localhost:8080/tests/python/index.html?type=py');
const result = page.locator("#result"); // Payload for results will be here.
await result.waitFor(); // wait for the result.
const data = JSON.parse(await result.textContent()); // get the result data.
await expect(data.fails).toMatchObject([]); // ensure no test failed.
});

View File

@@ -2,22 +2,6 @@ import { test, expect } from '@playwright/test';
test.setTimeout(120 * 1000);
test('Python unit tests - MicroPython on MAIN thread', async ({ page }) => {
await page.goto('http://localhost:8080/tests/python/index.html');
const result = page.locator("#result"); // Payload for results will be here.
await result.waitFor(); // wait for the result.
const data = JSON.parse(await result.textContent()); // get the result data.
await expect(data.fails).toMatchObject([]); // ensure no test failed.
});
test('Python unit tests - Pyodide on MAIN thread', async ({ page }) => {
await page.goto('http://localhost:8080/tests/python/index.html?type=py');
const result = page.locator("#result"); // Payload for results will be here.
await result.waitFor(); // wait for the result.
const data = JSON.parse(await result.textContent()); // get the result data.
await expect(data.fails).toMatchObject([]); // ensure no test failed.
});
test('Python unit tests - MicroPython on WORKER', async ({ page }) => {
await page.goto('http://localhost:8080/tests/python/index.html?worker');
const result = page.locator("#result"); // Payload for results will be here.