Add webpack as part of the smoketest

This commit is contained in:
Alex Dima 2021-11-15 22:16:09 +01:00
parent 423a55b305
commit dfe35b15bb
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
14 changed files with 57 additions and 41 deletions

View file

@ -12,7 +12,9 @@
vs: '../../release/dev/vs'
}
});
require(['vs/editor/editor.main'], () => {});
require(['vs/editor/editor.main'], () => {
window.monacoAPI = monaco;
});
</script>
</body>
</html>

View file

@ -35,14 +35,21 @@ yaserver
});
async function runTests() {
await runTest('chromium');
await runTest('firefox');
// await runTest('webkit');
for (const type of ['amd', 'webpack']) {
await runTest(type, 'chromium');
await runTest(type, 'firefox');
// await runTest(type, 'webkit');
}
}
function runTest(browser) {
/**
* @param {string} type
* @param {'chromium'|'firefox'|'webkit'} browser
* @returns
*/
function runTest(type, browser) {
return new Promise((resolve, reject) => {
const env = { BROWSER: browser, ...process.env };
const env = { BROWSER: browser, TESTS_TYPE: type, ...process.env };
if (DEBUG_TESTS) {
env['DEBUG_TESTS'] = 'true';
}

View file

@ -11,7 +11,12 @@ const { PORT } = require('./common');
const browserType = process.env.BROWSER || 'chromium';
const DEBUG_TESTS = Boolean(process.env.DEBUG_TESTS || false);
const URL = `http://127.0.0.1:${PORT}/test/smoke/amd.html`;
const TESTS_TYPE = process.env.TESTS_TYPE || 'amd';
const URL =
TESTS_TYPE === 'amd'
? `http://127.0.0.1:${PORT}/test/smoke/amd.html`
: `http://127.0.0.1:${PORT}/test/smoke/webpack/webpack.html`;
/** @type {playwright.Browser} */
let browser;
@ -59,8 +64,8 @@ afterEach(async () => {
});
describe('Smoke Test', () => {
it('`monaco` is exposed as global', async () => {
assert.strictEqual(await page.evaluate(`typeof monaco`), 'object');
it('`monacoAPI` is exposed as global', async () => {
assert.strictEqual(await page.evaluate(`typeof monacoAPI`), 'object');
});
/**
@ -70,7 +75,7 @@ describe('Smoke Test', () => {
*/
async function createEditor(text, language) {
return await page.evaluate(
`window.ed = monaco.editor.create(document.getElementById('editor-container'), { value: '${text}', language: '${language}' })`
`window.ed = monacoAPI.editor.create(document.getElementById('editor-container'), { value: '${text}', language: '${language}' })`
);
}

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
</head>
<body>
<div id="editor-container" style="position: absolute; width: 500px; height: 400px"></div>
<script type="text/javascript" src="out/app.js"></script>
</body>
</html>