mirror of
https://github.com/pyscript/pyscript.git
synced 2025-12-20 02:37:41 -05:00
* [next] WIP: Add basic integrations tests * fix typos in README.md * Update README.md to specify when files are _ files ignored --------- Co-authored-by: Fabio Pliger <fpliger@users.noreply.github.com>
47 lines
1.7 KiB
JavaScript
47 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
exports.shared = {
|
|
bootstrap: ({ expect }, baseURL) => async ({ page }) => {
|
|
await page.goto(`${baseURL}/bootstrap.html`);
|
|
await page.waitForSelector('html.ready');
|
|
await page.getByRole('button').click();
|
|
const result = await page.evaluate(() => document.body.innerText);
|
|
await expect(result.trim()).toBe('OK');
|
|
},
|
|
|
|
worker: ({ expect }, url) => async ({ page }) => {
|
|
const logs = [];
|
|
page.on('console', msg => logs.push(msg.text()));
|
|
await page.goto(url);
|
|
await page.waitForSelector('html.worker.ready');
|
|
await expect(logs.join(',')).toBe('main,thread');
|
|
},
|
|
|
|
workerWindow: ({ expect }, baseURL) => async ({ page }) => {
|
|
await page.goto(`${baseURL}/worker-window.html`);
|
|
await page.waitForSelector('html.worker.ready');
|
|
const result = await page.evaluate(() => document.body.innerText);
|
|
await expect(result.trim()).toBe('OK');
|
|
},
|
|
};
|
|
|
|
exports.python = {
|
|
bootstrap: ({ expect }, baseURL) => async ({ page }) => {
|
|
await page.goto(`${baseURL}/bootstrap.html`);
|
|
await page.waitForSelector('html.ready');
|
|
const result = await page.evaluate(() => document.body.innerText);
|
|
await expect(result.trim()).toBe('OK');
|
|
},
|
|
|
|
fetch: ({ expect }, url) => async ({ page }) => {
|
|
const logs = [];
|
|
page.on('console', msg => logs.push(msg.text()));
|
|
await page.goto(url);
|
|
await page.waitForSelector('html.ready');
|
|
await expect(logs.length).toBe(1);
|
|
await expect(logs[0]).toBe('hello from A');
|
|
const body = await page.evaluate(() => document.body.innerText);
|
|
await expect(body.trim()).toBe('hello from A, hello from B');
|
|
},
|
|
};
|