This is to reduce maintenance burden. A GIF representation of a web
page can be produced by converting its PNG capture. There are numerous
third-party tools which can do the job better (optimized palette,
minimized loss, etc).
https://github.com/ariya/phantomjs/issues/12480
To prevent unintended macro expansion, don't use the name
stdout/stdin/stderr in the native System object. Those properties are
achieved by shadowing it in the module interface (JavaScript side).
https://github.com/ariya/phantomjs/issues/12496
Regression from #12431: the loop to clear all surviving pages
neglects to check for entries in `m_pages` which have already
been closed, fully destructed, and therefore replaced by NULL
pointers.
The newer ConsoleReporter is very quiet by default, which is nice, but
this provides a way to get something more like the older one-line-per-test
output.
#12230 (Test suite improvements).
* Anything on the command line after "run-tests.sh" will be understood
as a regular expression (if there is more than one argument, they are
concatenated, with spaces in between) and only the tests whose "full
names" match that regexp will be run. The full name of a test is the
"describe" string plus a space plus the "it" string. Note well that,
unlike the test-runner output, there is no colon in there.
* run-tests.sh and run-tests.js now correctly handle being invoked from
an arbitrary directory; the cwd does not have to be the project root.
* Shell portability fixes for run-tests.sh.
#12230 (Test suite improvements).
The new Jasmine includes a version of this formerly external add-on, but it
is buggy and doesn't print details of failing tests.
#12230 (Test suite improvements).
The newer jasmine-console behavior requires minor adjustments to the
ConsoleReporter we create in run-tests.js. Also, en passant fix for
a bug in the final callback: exiting with status equal to the number
of failed tests does not work, because the _exit() system call takes
only the low eight bits of the value passed. If a test run happened
to have 256 failing tests, the old code would have spuriously exited
successfully. Instead, just exit(1) if any tests fail.
#12230 (Test suite improvements).
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).
Two tests were spuriously failing because they tried to load pages on
`github.com` that were no longer structured as expected. Use a local
webserver instead.
#12230 (Test suite improvements).
The last reference test.pdf in the tests was using a complete different region
of the input "image.jpg" because the used phantomjs version used to generate it
had a bug. This bug was fixed in 833eb824f5bae07f1b157d6757e7e3c98343f812
("Don't scale the unit px to 1/2.54 points for PDFs") and
1daa2eb4dd49efb848ff96e37f298a774520cc9b ("Disable page shrinking for pdf
printing to create accurate output").
The new version should now use the same region of the input image as the other
generated files for the gif, jpg and png tests. The only difference is the
extra height is still displayed on a second page but this is currently expected
by phantomjs.
https://github.com/ariya/phantomjs/issues/11590 ("page.paperSize is not
accurate for .pdf")
Related to #11952.
Those tests use "http://phantomjs.org" as fixture.
The website "/images" directory has been renamed "/img",
breaking the tests.
Maybe not the greatest way to go about it, but
for now it will do. We probably need to have fixtures
served by a local server.
Previously, there was a single global cookie jar shared between all web pages.
Now, one can have separate cookie jars for different web pages.
Makes CookieJar a normal class, not a singleton.
Moves many public CookieJar methods to public slots.
Adds default cookie jar to Phantom.
Adds the CookieJar module that provides access to cookie jars in javascript.
Adds cookie jar module tests.
Usage:
var jar = require('cookiejar').create();
var webpage = require('webpage').create();
webpage.cookieJar = jar;
...
webpage.close();
jar.close();
JS API changes:
Webpage:
var jar = page.cookieJar; -- assigns 'jar' the given webpage's cookie jar.
page.cookiejar = jar; -- sets 'jar' as the given webpage's cookie jar.
CookieJar:
var jar = require('cookiejar').create(path)
creates a cookie jar with persistent storage at the given file path
(path not mandatory).
var cookies = jar.cookies; -- assign's 'jar' the list of cookies in the
cookie jar.
jar.cookies = [c1, c2]; -- sets the cookie jar's cookies as the ones in the
list.
jar.addCookie(cookie) -- adds cookie 'cookie' to the cookie jar.
https://github.com/ariya/phantomjs/issues/11417
Previously the test suite 'WebPage render image' made a series of
webpage.open without waiting them to complete. This effected next
runned tests because on load handlers for pages were fired after
'WebPage render image' test finish.
https://github.com/ariya/phantomjs/issues/11780
Enables subscription to RepaintRequested events.
When the callback is invoked the time that the repaint was requested as well as the x,y and width,height of the repainted rectangle are provided as parameters.
Usage: page.onRepaint = function(time, x, y, width, height) { }
https://github.com/ariya/phantomjs/issues/11793
This tests mousedown, mouseup, click, and doubleclick for clicks with
modifier events. The mousedown/mouseup tests pass in 1.9.2, the
click/doubleclick do not. All pass with a build from this branch.
Location information of parse time error is given to javaScriptError not
with stack by with separate lineNumber and sourceID arguments. Put this info
to stack if it is empty so that it will be visible to user.
https://github.com/ariya/phantomjs/issues/11640
To achieve this, Request Headers are stored in both "original" and "lowercase".
In this way we don't mangle with the request object we have received, while
still be able to handle headers when NOT in the classic "Camel-Case" format.
Fixes#11421.
For whatever reason, swapping the order with the render() tests solve the
intermittent random failures. Also, split the tests between loading
start and finish checks (to better recognize which one is failing, if
there is a failure), also make the tests more asynchoronous.
https://github.com/ariya/phantomjs/issues/11091