mirror of https://github.com/vitalif/phantomjs
Eliminate console spam during normal test execution.
Three tests were (potentially) dumping text to console.log during the run, which they should never do. Fixing that revealed that one of them, the test for interrupting a long-running JS script, was not actually testing what it was supposed to test. Fixing *that* revealed that the long-running-script hook is broken and does not actually interrupt JS infinite loops; that test has been temporarily disabled. #12230 (Test suite improvements).2.0
parent
406f736e14
commit
7102e87bf4
|
@ -1395,15 +1395,25 @@ describe("WebPage object", function() {
|
|||
});
|
||||
});
|
||||
|
||||
it("should interrupt a long-running JavaScript code", function() {
|
||||
xit("should interrupt a long-running JavaScript code", function() {
|
||||
var page = new WebPage();
|
||||
var longRunningScriptCalled = false;
|
||||
var loadStatus;
|
||||
|
||||
page.onLongRunningScript = function() {
|
||||
page.stopJavaScript();
|
||||
longRunningScriptCalled = true;
|
||||
};
|
||||
page.onError = function () {};
|
||||
|
||||
page.open('../test/webpage-spec-frames/forever.html', function(status) {
|
||||
expect(status).toEqual('success');
|
||||
runs(function() {
|
||||
page.open('../test/webpage-spec-frames/forever.html',
|
||||
function(status) { loadStatus = status; });
|
||||
});
|
||||
waits(5000);
|
||||
runs(function() {
|
||||
expect(loadStatus).toEqual('success');
|
||||
expect(longRunningScriptCalled).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -2168,7 +2178,7 @@ xdescribe("WebPage render image", function(){
|
|||
content = fs.read(TEST_FILE, "b");
|
||||
|
||||
fs.remove(TEST_FILE);
|
||||
} catch (e) { console.log(e) }
|
||||
} catch (e) { jasmine.fail(e) }
|
||||
|
||||
// for PDF test
|
||||
if (format === "pdf") {
|
||||
|
|
|
@ -31,9 +31,9 @@ function checkRequest(request, response) {
|
|||
if (expectedPostData !== false) {
|
||||
expect(request.method).toEqual("POST");
|
||||
expect(request.hasOwnProperty('post')).toBeTruthy();
|
||||
console.log("request.post => " + JSON.stringify(request.post, null, 4));
|
||||
console.log("expectedPostData => " + JSON.stringify(expectedPostData, null, 4));
|
||||
console.log("request.headers => " + JSON.stringify(request.headers, null, 4));
|
||||
jasmine.log("request.post => " + JSON.stringify(request.post, null, 4));
|
||||
jasmine.log("expectedPostData => " + JSON.stringify(expectedPostData, null, 4));
|
||||
jasmine.log("request.headers => " + JSON.stringify(request.headers, null, 4));
|
||||
if (request.headers["Content-Type"] && request.headers["Content-Type"] === "application/x-www-form-urlencoded") {
|
||||
expect(typeof request.post).toEqual('object');
|
||||
expect(request.post).toEqual(expectedPostData);
|
||||
|
|
Loading…
Reference in New Issue