log all requests with their response code
parent
29d688543d
commit
5129bb57b6
|
@ -54,14 +54,15 @@ function logConsole(page) {
|
||||||
|
|
||||||
function logXHRRequests(page) {
|
function logXHRRequests(page) {
|
||||||
let buffer = "";
|
let buffer = "";
|
||||||
page.on('request', req => {
|
page.on('requestfinished', async (req) => {
|
||||||
const type = req.resourceType();
|
const type = req.resourceType();
|
||||||
if (type === 'xhr' || type === 'fetch') {
|
const response = await req.response();
|
||||||
buffer += `${req.method()} ${req.url()} \n`;
|
//if (type === 'xhr' || type === 'fetch') {
|
||||||
|
buffer += `${type} ${response.status()} ${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 {
|
||||||
logs() {
|
logs() {
|
||||||
|
|
2
start.js
2
start.js
|
@ -54,8 +54,6 @@ async function runTests() {
|
||||||
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);
|
||||||
|
|
Loading…
Reference in New Issue