Scripts in module mode need to be abide by the Same Origin Policy (CORS headers are used to load them) This can cause issues on some setups. This commit adds a new "scriptDisableModuleSupport" that can be used to disable the "modules" mode. Closes #1721
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import {assertLogMessage} from "./utils/log";
|
|
|
|
const fs = require('fs');
|
|
const Docker = require('dockerode');
|
|
import { Selector } from 'testcafe';
|
|
import {login} from "./utils/roles";
|
|
import {
|
|
findContainer,
|
|
rebootBack,
|
|
rebootPusher,
|
|
resetRedis,
|
|
rebootTraefik,
|
|
startContainer,
|
|
stopContainer, stopRedis, startRedis
|
|
} from "./utils/containers";
|
|
import {getBackDump, getPusherDump} from "./utils/debug";
|
|
|
|
fixture `Modules`
|
|
.page `http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Modules/with_modules.json`;
|
|
|
|
test("Test that module loading works out of the box", async (t: TestController) => {
|
|
|
|
await login(t, 'http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/Modules/with_modules.json');
|
|
|
|
|
|
await assertLogMessage(t, 'Successfully loaded module: foo = bar');
|
|
|
|
t.ctx.passed = true;
|
|
}).after(async t => {
|
|
if (!t.ctx.passed) {
|
|
console.log("Test 'Test that module loading works out of the box' failed. Browser logs:")
|
|
try {
|
|
console.log(await t.getBrowserConsoleMessages());
|
|
} catch (e) {
|
|
console.error('Error while fetching browser logs (maybe linked to a closed iframe?)', e);
|
|
try {
|
|
console.log('Logs from main window:');
|
|
console.log(await t.switchToMainWindow().getBrowserConsoleMessages());
|
|
} catch (e) {
|
|
console.error('Unable to retrieve logs', e);
|
|
}
|
|
}
|
|
}
|
|
});
|