-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8c0920e
commit 47b3367
Showing
3 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const puppeteer = require('puppeteer'); | ||
|
||
var fs = require('fs'); | ||
var util = require('util'); | ||
|
||
var logFile = fs.createWriteStream('log.txt', { flags: 'w' }); | ||
// Or 'w' to truncate the file every time the process starts. | ||
var logStdout = process.stdout; | ||
|
||
console.log = function () { | ||
logFile.write(util.format.apply(null, arguments) + '\n'); | ||
logStdout.write(util.format.apply(null, arguments) + '\n'); | ||
} | ||
console.error = console.log; | ||
|
||
puppeteer.launch({ | ||
args: [ | ||
'--no-proxy-server', | ||
] | ||
}).then(function (browser) { | ||
browser.newPage().then(function (page) { | ||
page.on('console', function (msg) { | ||
var text = msg.text(); | ||
var type = msg.type(); | ||
if (text.startsWith('[test-result]')) { | ||
console.log('==[TESTING-ENDS]==') | ||
|
||
const details = JSON.parse(text.replace('[test-result]', '')) | ||
console.log(details) | ||
|
||
browser.close() | ||
} else { | ||
console.log(msg) | ||
} | ||
|
||
}); | ||
page.goto(`http://127.0.0.1:3000/test`); | ||
}) | ||
}); |