mirror of https://github.com/vector-im/riot-web
show browser logs on error
parent
976f041bba
commit
5cd52e2ebd
|
@ -58,9 +58,9 @@ function logXHRRequests(page) {
|
||||||
const type = req.resourceType();
|
const type = req.resourceType();
|
||||||
if (type === 'xhr' || type === 'fetch') {
|
if (type === 'xhr' || type === 'fetch') {
|
||||||
buffer += `${req.method()} ${req.url()} \n`;
|
buffer += `${req.method()} ${req.url()} \n`;
|
||||||
if (req.method() === "POST") {
|
// if (req.method() === "POST") {
|
||||||
buffer += " Post data: " + req.postData();
|
// buffer += " Post data: " + req.postData();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
|
|
14
start.js
14
start.js
|
@ -28,6 +28,9 @@ const homeserver = 'http://localhost:8008';
|
||||||
global.riotserver = 'http://localhost:5000';
|
global.riotserver = 'http://localhost:5000';
|
||||||
global.browser = null;
|
global.browser = null;
|
||||||
|
|
||||||
|
let consoleLogs = null;
|
||||||
|
let xhrLogs = null;
|
||||||
|
|
||||||
async function runTests() {
|
async function runTests() {
|
||||||
console.log("running tests ...");
|
console.log("running tests ...");
|
||||||
const options = {};
|
const options = {};
|
||||||
|
@ -37,6 +40,9 @@ async function runTests() {
|
||||||
global.browser = await puppeteer.launch(options);
|
global.browser = await puppeteer.launch(options);
|
||||||
const page = await helpers.newPage();
|
const page = await helpers.newPage();
|
||||||
|
|
||||||
|
consoleLogs = helpers.logConsole(page);
|
||||||
|
xhrLogs = helpers.logXHRRequests(page);
|
||||||
|
|
||||||
const username = 'user-' + helpers.randomInt(10000);
|
const username = 'user-' + helpers.randomInt(10000);
|
||||||
const password = 'testtest';
|
const password = 'testtest';
|
||||||
process.stdout.write(`* signing up as ${username} ... `);
|
process.stdout.write(`* signing up as ${username} ... `);
|
||||||
|
@ -44,10 +50,12 @@ async function runTests() {
|
||||||
process.stdout.write('done\n');
|
process.stdout.write('done\n');
|
||||||
|
|
||||||
const noticesName = "Server Notices";
|
const noticesName = "Server Notices";
|
||||||
process.stdout.write(`* accepting "${noticesName}" and accepting terms & conditions ...`);
|
process.stdout.write(`* accepting "${noticesName}" and accepting terms & conditions ... `);
|
||||||
await acceptServerNoticesInviteAndConsent(page, noticesName);
|
await acceptServerNoticesInviteAndConsent(page, noticesName);
|
||||||
process.stdout.write('done\n');
|
process.stdout.write('done\n');
|
||||||
|
|
||||||
|
throw new Error('blubby');
|
||||||
|
|
||||||
const room = 'test';
|
const room = 'test';
|
||||||
process.stdout.write(`* creating room ${room} ... `);
|
process.stdout.write(`* creating room ${room} ... `);
|
||||||
await createRoom(page, room);
|
await createRoom(page, room);
|
||||||
|
@ -62,6 +70,10 @@ function onSuccess() {
|
||||||
|
|
||||||
function onFailure(err) {
|
function onFailure(err) {
|
||||||
console.log('failure: ', err);
|
console.log('failure: ', err);
|
||||||
|
console.log('console.log output:');
|
||||||
|
console.log(consoleLogs.logs());
|
||||||
|
console.log('XHR requests:');
|
||||||
|
console.log(xhrLogs.logs());
|
||||||
process.exit(-1);
|
process.exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue