1
1
mirror of https://github.com/ariya/phantomjs.git synced 2024-08-16 08:10:57 +03:00
Commit Graph

272 Commits

Author SHA1 Message Date
Ariya Hidayat
1141321170 Initialize progress right away with QtWebKit 5.212 (#15342)
Apparently loading progress used to move beyond 0 right after the
frame start loading an URI, even before there is network traffic.

This behavior compatibility prevents the regression on the test
module/webpage/loading.js.
2020-01-09 16:55:21 -08:00
Ariya Hidayat
2b666c91f5 Add some tests for ES2015 features (#15402) 2019-12-31 01:17:35 -08:00
Ariya Hidayat
5da14481bc Remove GhostDriver, thereby also built-in WebDriver support (#15399)
We don't carry an embedded copy of GhostDriver anymore.
2019-12-26 01:23:59 -08:00
Ariya Hidayat
bdaa9c8f83 Temporarily skip failing tests (#15342)
Due to some behavior differences in the latest QtWebKit, some tests do
not behave very well. Let's skip them while the issues are being
investigated.
2019-12-25 14:44:58 -08:00
Ariya Hidayat
1c53215f8e Mark as version 3.0.0-development 2019-12-25 04:43:19 -08:00
jesg
09a4839091 update ghostdriver for phantomjs 2.5 (#14849)
* fix page load for phantomjs 2.5.0
* add unhandledPromptBehavior w3c capability
* add blacklist/whitelist filters
* fix sending keys to content editable elements
* fix file upload for phantomjs 2.5.0
* fix action chains with elements in iframes
* replace calls to execute_script with atoms
* add --remoteHost (@madhavajay)
* add w3c defaults for add cookie
* fix multiple file upload
* add w3c timeout defaults
* fix custom phantomjs headers
* add support for switch to parent frame (Chui Tey)
* add support for right click (Artur Signell)
* add zoomFactor capability
* fix reset log buffer after each post request
* fix registration with selenium grid
* fix memory leak in har log
* add limited support for loggingPrefs capability
* fix browser and har logs default to OFF
* various bug fixes

Issue #14553
2019-11-29 10:29:15 -08:00
Ariya Hidayat
c0944903c3 Use CircleCI to run build and tests (#13828)
Note that we have to disable the test of web server listening on port 1
since CircleCI executes everything with root privilige.
2018-03-09 00:10:16 -08:00
Andrew Murray
d77b8dde0a Fixed typo
Closes gh-14282
2018-03-06 13:14:10 -08:00
Marc Epard
4ef5f27600 Test load-images=yes and load-images=no. 2016-05-07 00:50:20 +03:00
Connor Dunn
7d7e5f345b Add support to render pdf to base64.
https://github.com/ariya/phantomjs/issues/11192
https://github.com/ariya/phantomjs/issues/12392
2016-05-07 00:35:26 +03:00
vitallium
d0388371cf Add/Remove CookieJar methods must return value
Consider CookierJar return a boolean value on
addCookie or removeCookie methods.

Issue: #14047
2016-04-11 21:31:05 +03:00
Zack Weinberg
3d9a327df3 Tests for child process stdin
To avoid cross-platform issues, these tests spawn platform- and 2/3-agnostic
Python scripts; Python is already required to run the test suite.
2016-02-03 10:18:17 -05:00
Zack Weinberg
ed4c4526db Make paths to PhantomJS and Python interpreters available to tests.
Incidental refactoring of the environment variable setup code in
run-tests.py and testharness.js.
2016-02-03 10:18:17 -05:00
Zack Weinberg
8f7d29b875 Minor fix to testharness.js: renumber an enum to remove a gap. 2016-02-03 10:16:29 -05:00
Zack Weinberg
c9b9cae415 Enable test server request logging at -vvv. 2016-02-03 10:16:29 -05:00
Zack Weinberg
c5db190f39 Test directory reorganization.
The `certs`, `fixtures`, `node_modules`, and `www` directories, and
`testharness.js`, are moved into a new `lib` directory to reduce
clutter; the long-term plan is that all other subdirectories will
contain tests.  (Right now, we still have `ghostdriver-tests` as an
exception.)  Adjust `writing-tests.md`, `run-tests.py`, `testharness.js`,
and a couple of tests accordingly.

Also fix a bug in `run-tests.py` where ERROR conditions that happened
before the first test were not being reported accurately.
2016-02-03 10:16:03 -05:00
Ariya Hidayat
482b91d124 Master branch becomes the development version (issue #13937) 2016-01-24 21:59:08 -08:00
Zack Weinberg
62730aa23e Fix spurious testsuite failures.
* test/basics/version: must be updated for version number bumps.
 * test/basics/require: stack trace is now accurate
   (issue #12864, commit 0e32928ae1)
 * test/module/webpage/capture_content: this feature had to be backed out
   (issue #13908, commit cab28ccbd4)
2016-01-24 12:48:25 -05:00
Erik Dubbelboer
db07581956 Add page.setFrameContent, fixes #13837 2016-01-24 12:09:42 +03:00
Marc Epard
f4fa25a9b0 Fix a typo in test/www/url-encoding.py.
Pull request #13918
  Part of issue #13882
2016-01-23 22:36:53 -05:00
Vitaly Slobodin
3e8e04e3d6 [Windows] Disable color output detection 2016-01-23 12:36:58 +03:00
Artur Signell
20d673bf20 Support contextmenu events using webpage.sendEvent('contextmenu')
Phantomjs issue
https://github.com/ariya/phantomjs/issues/11429

Fixes #11429 by allowing to send a "contextmenu" event. Intentionally
does not map a "click" event using "right" button into contextmenu event
because this would be inconsistent with how browsers work.

Related issue in Ghostdriver:
https://github.com/detro/ghostdriver/issues/125
2016-01-23 11:45:41 +03:00
Zack Weinberg
bced581501 Fix whitespace errors introduced in recent commits 2016-01-19 10:38:21 -05:00
Luke Street
e4191335a4 Crash fix: Switch to top frame when current frame is destroyed.
Originally pull request #12109.
Fixes issues #10947 #11103 #11984 #13551 and probably more.

The test case is a composite of test cases provided by
Luke Street (#12109) and kramsee (#13551).
2015-12-22 19:04:24 -05:00
Zack Weinberg
476b7b9401 Small test suite improvements:
* handle failures reported by done() correctly
 * support valgrind as a debugger
2015-12-22 17:17:57 -05:00
YunJu Lee
668d8a42f7 Issue #13234: page.includeJs() callbacks should fire only once.
Thanks to the awkward semantics of JS 'this', callbacks registered for
page.includeJs() completion were not getting deregistered.  This was
invisible under most conditions, but: if you loaded a page, included JS
into it, loaded another page using the same webpage object, and then
included the *same* JS file into the second page, the callback you
provided for the *first* call to includeJs would get called a second
time.
2015-12-21 10:52:13 -05:00
Zack Weinberg
b38fd78eb1 Merge error in previous commit 2015-12-21 10:45:32 -05:00
tmallery
cbe3e2afbf Issue #13638: optional cookie properties should not leak. 2015-12-21 09:36:55 -05:00
Zack Weinberg
1e9b6aaae8 Align columns of data for readability. 2015-12-21 09:35:45 -05:00
Zack Weinberg
7134789d34 Fix stack trace inspection again. 2015-12-21 09:35:21 -05:00
Zack Weinberg
e9c530a842 Make test suite timezone-independent.
And to enforce this, run all the tests in a fixed, unusual time zone from
now on.
2015-12-11 11:48:07 -05:00
Zack Weinberg
0531412a71 Update stack-crawl parsing for changes in newer QtWebkit. 2015-12-11 11:47:11 -05:00
Zack Weinberg
33fc97a77f Fix oversight in testharness.js causing XPASS to be reported as ERROR. 2015-12-11 11:46:05 -05:00
Zack Weinberg
305cc4467a Add phantom.resolveRelativeUrl and phantom.fullyDecodeUrl.
These utility functions make it easier to work with encoded URLs.
See issues #12216 and #11035.
2015-12-03 14:53:10 -05:00
Zack Weinberg
1c203a3927 Encode URLs when passing to JS: issues #12216 and #11035.
* Use QUrl::toEncoded() instead of QUrl::toString() to compute
   WebPage.url, WebPage.frameUrl, the first argument to an
   onNavigationRequested hook, the sole argument to an onUrlChanged hook,
   and the 'url' property of the object passed to an onResourceError
   hook.  This makes them consistent with the data passed to the
   onResourceRequested, onResourceReceived, and onResourceTimeout hooks,
   and with the semantics of WebPage.open(), WebPage.openUrl(), and the
   cookie jar.  (Issue #12216.)

 * Use m_currentFrame->baseUrl() instead of m_currentFrame->url() for
   WebPage.frameUrl; this is a partial workaround for a bug in QtWebKit
   which is the root cause of issue #11035.  Noticed while attempting to
   test the above changes.

 * Take care not to mangle the encoding of the url passed to the
   WebServer.listen callback function.  Necessary in order to test the
   above changes: not only should JS receive %-encoded URLs, the server's
   encoding of non-ASCII characters in URLs should be preserved; to test
   this thoroughly, a heinously non-Unicode-compatible encoding (Shift_JIS)
   is deliberately used for the URLs in all the new tests.
2015-12-03 14:53:10 -05:00
Zack Weinberg
f69d44b829 Don't hardwire listening ports for the test HTTP(S) servers.
Instead, run-tests.py asks the kernel to assign a random unused port
number for each, and then sets environment variables TEST_HTTP_BASE
and TEST_HTTPS_BASE to the base URLs of each server.  In tests that
use testharness.js, these are exposed as global variables with the
same name; tests that don't use the harness will need to pick them out
of require('system').env if they need them.  (Currently there are no
such tests.)

Part of issue #13478 (test suite overhaul).
2015-10-20 17:11:36 -04:00
Zack Weinberg
75944c8d47 Add ability to test exit status and stdin/out/err directly.
This works with more //! directives at the top of a test, which
will normally be a no-harness test.  It is now possible, for
instance, to test for an _unsuccessful_ exit, or for output
appearing on stderr rather than stdout.  The tests for
phantom.exit and sys.stdin/out/err have been augmented
accordingly.

It is also now possible to adjust the backstop timeout on a
per-test basis, and therefore the existing timeouts have been
lowered to 5s (harness), 7s (backstop).

Part of issue #13478 (test suite overhaul).
2015-10-20 17:11:36 -04:00
Zack Weinberg
9eb781f82d Reformat all individual tests' output as TAP.
This enables run-tests.py to parse it and produce structured,
pretty output.  A couple of latent failures were exposed and
marked expected (having to do with control passing beyond
phantom.exit()).

TAP: http://testanything.org/tap-specification.html

Part of issue #13478 (test suite overhaul).
2015-10-20 17:11:36 -04:00
Zack Weinberg
233b22ff2c Remove the old test runner.
Part of issue #13478 (test suite overhaul).
2015-10-20 17:11:18 -04:00
Zack Weinberg
6106d391e9 Convert webpage-spec.js tests to the new format.
Part of issue #13478 (test suite overhaul).
2015-10-20 17:10:47 -04:00
Zack Weinberg
5a266e48dc Convert non-webpage tests to the new format.
This covers fs-spec-*.js, require/require_spec.js, module_spec.js,
webkit-spec.js, and webserver-spec.js.  Also, incorporate
set/690-ttf-crash/ as a regression test (it wasn't being run
automatically).

Part of issue #13478 (test suite overhaul).
2015-10-20 17:10:47 -04:00
Zack Weinberg
2121b56d5b Replace assert.js with a new test harness based on W3C testharness.js.
The principal value of this test harness is its support for asynchronous
tests -- that is, tests where you have to wait for a callback to happen
before you can continue testing.  This applies to every test in our
testsuite that uses WebPage.open(), and some others as well.  With this
harness, the test suite is significantly faster and can be made race-free.

The API is not exactly the same as W3C testharness.js -- important
differences include: test execution is serialized within a file; "file is
test" mode has been removed, as we do not need it and it adds significant
complexity; several additional assertions have been added; the ability to
mark tests as expected to fail, or as to be skipped entirely, has been added.

New-style tests can opt out of testharness.js with a "no-harness"
directive at the top of the file; this is necessary for a small number
of tests (e.g. basics/exit.js) that test functionality the harness
reserves for its own use.

All existing new-style tests have been converted to testharness.js; some
groups of tests have been consolidated into fewer files.  The naming
convention for tests in regression/ is clarified.

Part of issue #13478 (test suite overhaul).
2015-10-20 17:10:46 -04:00
Zack Weinberg
0cc40ddefe Overhaul run-tests.py.
* Eliminate the global variables.
 * More thorough error detection in the HTTP(S) server.
 * Test directive comments must start with //! and the parser is more robust.
 * Handle child process stderr separately from stdout
   (this will make it possible to test more things).
 * Execute tests within each directory in alphabetical order. (#12439)
 * Support and use multi-level wildcards in TESTS.  This means we don't
   have to touch run-tests.py every time we add a subdirectory to
   module/ or standards/.
 * Handle HTTP server errors during a test more gracefully.  Errors caused by
   the client disconnecting in the middle of a query-response transaction are
   ignored.  Other errors are reported and the test suite exits cleanly.
 * Add HTTPS and POST support to test server.
 * Add ability to run PhantomJS under a debugger on a test case.
 * Use argparse for command line parsing.
 * Accept -v as short for --verbose.
 * Repeating -v means more verbosity; at -vvv, phantomjs command lines are
   printed.  (-vv is reserved for printing individual subtests, which will
   happen later.)
 * Fix bug where, with one or more -v, the pjs version number was printed
   twice.

Part of issue #13478 (test suite overhaul).
2015-10-20 17:10:46 -04:00
Zack Weinberg
b2646bf698 Additional test cases, using iframes, for issue #12752. 2015-08-19 15:17:00 -04:00
Dmitry Parshin
327f91d60c response body is only available in onResourceReceived event,
if url matches one of the patterns in 'page.captureContent' property

https://github.com/ariya/phantomjs/issues/10158
2015-05-31 13:43:43 +03:00
Dmitry Parshin
977b2803ce setting bodySize attribute of resource object on 'end' stage
https://github.com/ariya/phantomjs/issues/10158
2015-05-31 13:43:41 +03:00
Dmitry Parshin
434d4e0101 added response body to response object in onResourceReceived event
https://github.com/ariya/phantomjs/issues/10158
2015-05-31 13:43:38 +03:00
Jacek Migdal
32d20b4aa7 Port more tests from webpage-spec.
https://github.com/ariya/phantomjs/issues/12439
2014-12-11 20:38:35 -08:00
Jacek Migdal
0bf14a3d0c Don't rely on JSON.parse() for page.evaluate().
https://github.com/ariya/phantomjs/issues/12615
2014-12-10 22:53:53 -08:00
Jacek Migdal
3b8282cb2e Port the tests from webpage-spec.js
Callback, clip-rect, confirm, object, prompt, scroll-position,
viewport-size and window.

https://github.com/ariya/phantomjs/issues/12439
2014-12-07 16:59:11 -08:00