[IMP] tests: group phantomjs the log to have one python log by javascript log
This commit is contained in:
@@ -297,8 +297,12 @@ class HttpCase(TransactionCase):
|
||||
buf.append(s)
|
||||
|
||||
# process lines
|
||||
if '\n' in buf:
|
||||
line, buf = buf.split('\n', 1)
|
||||
if '\n' in buf and (not buf.startswith('<phantomLog>') or '</phantomLog>' in buf):
|
||||
if buf.startswith('<phantomLog>'):
|
||||
line = buf[12:buf.index('</phantomLog>')]
|
||||
buf = bytearray()
|
||||
else:
|
||||
line, buf = buf.split('\n', 1)
|
||||
line = str(line)
|
||||
|
||||
# relay everything from console.log, even 'ok' or 'error...' lines
|
||||
|
||||
@@ -57,7 +57,7 @@ function PhantomTest() {
|
||||
phantom.exit(1);
|
||||
};
|
||||
this.page.onConsoleMessage = function(message) {
|
||||
console.log(message);
|
||||
console.log('<phantomLog>'+message+'</phantomLog>');
|
||||
};
|
||||
this.page.onLoadFinished = function(status) {
|
||||
if (status === "success") {
|
||||
@@ -92,7 +92,7 @@ function PhantomTest() {
|
||||
var message = ("Timeout\nhref: " + window.location.href +
|
||||
"\nreferrer: " + document.referrer +
|
||||
"\n\n" + (document.body && document.body.innerHTML)).replace(/[^a-z0-9\s~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "*");
|
||||
console.log('error', message);
|
||||
console.log('<phantomLog>error ' + message + '</phantomLog>');
|
||||
phantom.exit(1);
|
||||
});
|
||||
}, self.timeout);
|
||||
|
||||
Reference in New Issue
Block a user