mirror of
https://github.com/encounter/phantomjs.git
synced 2026-03-30 11:35:11 -07:00
3d4f89b41e
* correctly fake a package to hold all the response-hook modules
* use StringIO correctly in the response hooks
* prevent .py(c) files in test/www/ from being accessed directly
* prevent test/www/__init__ from being treated as a response hook
* add a test case that makes sure the existing hooks _can_ return 200 OK
(issue #12439; buggy commit 4d60e94)
29 lines
603 B
JavaScript
29 lines
603 B
JavaScript
/* Test the test server itself. */
|
|
|
|
var assert = require('../assert');
|
|
var webpage = require('webpage');
|
|
var page = webpage.create();
|
|
|
|
var urlsToTest = [
|
|
'http://localhost:9180/hello.html',
|
|
'http://localhost:9180/status?200',
|
|
'http://localhost:9180/echo'
|
|
];
|
|
var i = 0;
|
|
|
|
page.onResourceReceived = function (response) {
|
|
assert.equal(response.status, 200);
|
|
};
|
|
|
|
page.onLoadFinished = function (status) {
|
|
assert.equal(status, 'success');
|
|
i++;
|
|
if (i == urlsToTest.length) {
|
|
phantom.exit(0);
|
|
} else {
|
|
page.open(urlsToTest[i]);
|
|
}
|
|
}
|
|
|
|
page.open(urlsToTest[i]);
|