mirror of
https://github.com/wekan/wekan.git
synced 2026-11-24 09:59:47 -05:00
Add Dev server nobuild to both build menus with shared URL and port options. Load checkout JavaScript and templates in memory using the installed Meteor toolchain; start its bundled MongoDB on the next port and wait for owned database shutdown. Run server, Node, import, E2E and all supported Chromium, Firefox and WebKit regressions sequentially, stopping on failure. Preserve CommonJS semantics, native fetch, dynamic import namespaces and client source access boundaries. Document verified results and the remaining Windows and intermittent Firefox limits. Thanks to xet7 !
38 lines
1.7 KiB
JavaScript
38 lines
1.7 KiB
JavaScript
'use strict';
|
|
const { test, expect } = require('../fixtures');
|
|
|
|
test.describe('Dev server nobuild', () => {
|
|
test.skip(process.env.WEKAN_TEST_SERVER_MODE !== 'source', 'Requires the source-loader development server');
|
|
|
|
test('source-loaded sign-in preserves native browser fetch', async ({ page }) => {
|
|
const errors = [];
|
|
page.on('pageerror', error => errors.push(error.message));
|
|
await page.goto('/sign-in', { waitUntil: 'domcontentloaded' });
|
|
await expect(page.locator('input[name="at-field-username_and_email"]')).toBeVisible();
|
|
const status = await page.evaluate(async () => {
|
|
const url = Meteor.absoluteUrl('__source/status');
|
|
return (await fetch(url)).json();
|
|
});
|
|
expect(status).toEqual({ mode: 'source', port: 3000, mongoPort: 3001 });
|
|
expect(errors).toEqual([]);
|
|
});
|
|
|
|
test('serves declared client source and rejects private or invented imports', async ({ request }) => {
|
|
const client = await request.get('/__source/module', { params: { id: '/client/main.js', parent: '' } });
|
|
expect(client.status()).toBe(200);
|
|
const source = await client.json();
|
|
expect(source.id).toBe('client/main.js');
|
|
expect(source.code).toContain('/client/styles');
|
|
for (const params of [
|
|
{ id: '/server/main.js', parent: '' },
|
|
{ id: '../../private/settings.json', parent: 'client/main.js' },
|
|
{ id: '/client/main.js', parent: 'invented.js' },
|
|
{ id: '/.tools/dev-source/3000/web.browser/program.json', parent: '' },
|
|
]) {
|
|
const response = await request.get('/__source/module', { params });
|
|
expect(response.status()).toBe(403);
|
|
expect(await response.text()).toBe('Client module unavailable');
|
|
}
|
|
});
|
|
});
|