log all requests with their response code

This commit is contained in:
Bruno Windels 2018-07-27 18:58:37 +02:00
parent 29d688543d
commit 5129bb57b6
2 changed files with 5 additions and 6 deletions

View file

@ -54,14 +54,15 @@ function logConsole(page) {
function logXHRRequests(page) {
let buffer = "";
page.on('request', req => {
page.on('requestfinished', async (req) => {
const type = req.resourceType();
if (type === 'xhr' || type === 'fetch') {
buffer += `${req.method()} ${req.url()} \n`;
const response = await req.response();
//if (type === 'xhr' || type === 'fetch') {
buffer += `${type} ${response.status()} ${req.method()} ${req.url()} \n`;
// if (req.method() === "POST") {
// buffer += " Post data: " + req.postData();
// }
}
//}
});
return {
logs() {

View file

@ -54,8 +54,6 @@ async function runTests() {
await acceptServerNoticesInviteAndConsent(page, noticesName);
process.stdout.write('done\n');
throw new Error('blubby');
const room = 'test';
process.stdout.write(`* creating room ${room} ... `);
await createRoom(page, room);