Commit Graph

95 Commits

Author SHA1 Message Date
Florian Bruhin
a55952375b bdd: Improve output when comparing sessions
See #1440.
2016-04-21 00:15:37 +02:00
Florian Bruhin
4520261884 bdd: Make TestProcess.log_summary public
We want to use it from the BDD conftest.py
2016-04-20 07:55:23 +02:00
Florian Bruhin
a99cb5f6b2 bdd: Improve wait_for_load_finished output 2016-04-20 07:38:32 +02:00
Florian Bruhin
1579f27564 bdd: Add sections to log
See #1418
2016-04-20 07:38:12 +02:00
Florian Bruhin
d02d99e53e bdd: Make quteproc.set_setting work with quotes
This hopefully fixes editor BDD tests on Windows as the editor path is
now correctly quoted.
2016-04-06 08:13:43 +02:00
Daniel Schadt
bd5b1f207d fix lint 2016-03-29 21:02:54 +02:00
Daniel Schadt
f82d0f0c94 quteprocess: properly escape xpath expression
Since XPath doesn't have a way to escape quotes (or any other
character), we have to use a workaround by using concat() and switching
between quoting styles.
2016-03-29 20:34:40 +02:00
Daniel Schadt
b6c5ff25fd tests: add click_element to quteprocess 2016-03-29 13:32:35 +02:00
Daniel Schadt
6a96e1d6d8 quteprocess: remove duplicate code 2016-03-28 23:10:20 +02:00
Daniel Schadt
f6e8815871 tests: add integration tests for dirbrowser 2016-03-28 23:10:20 +02:00
Florian Bruhin
a4687c6745 Fix lint 2016-02-27 02:41:01 +01:00
Florian Bruhin
83e86706ff tests: Make check for ddg being loaded less strict
Before this change, adding a new logging message involving logging e.g. the
default duckduckgo setting value failed.

Now we basically use a black- instead of a whitelist and only fail if we get a
load status message for duckduckgo.
2016-02-27 02:16:42 +01:00
Florian Bruhin
b201b65669 tests: Handle trailing / in wait_for_load_finished.
We actually already added that in 16ec035418, but
in 9a02dc174d we accidentally dropped it again.
2016-02-19 06:42:23 +01:00
Florian Bruhin
02f367a308 Add basic profiling capability for quteproc tests.
When --qute-profile-subprocs is given, we write a profile file for each
qutebrowser invocation and also create prof/combined.pstats afterwards.
2016-02-11 08:02:44 +01:00
Florian Bruhin
eb692ba7f6 Fix lint. 2016-02-04 07:13:27 +01:00
Florian Bruhin
774bcbf6b3 tests: Don't fail on teardown too if test failed.
When a end-to-end test failed which would've marked an error message as
expected later in the test, seeing the teardown message about an unexpected
error being logged is really confusing.
2016-02-04 06:43:14 +01:00
Florian Bruhin
921e8b50b7 Fix lint. 2016-02-03 08:16:59 +01:00
Florian Bruhin
af28996f82 tests: Fail if duckduckgo gets loaded accidentally
In the long run, we should detect any accidental external accesses using
mitmproxy, as per #1282. In the meantime, we try to detect duckduckgo requests
being logged and fail the tests if that happens.

However, a duckduckgo URL is logged in fuzzy_url during startup/config init,
which is why we ignore it there.
2016-02-03 06:50:48 +01:00
Florian Bruhin
cf0034d42c Set __tracebackhide__ in quteproc.after_test 2016-02-02 19:16:45 +01:00
Florian Bruhin
03118bd804 tests: Add a quteproc_new fixture.
This can be used to spawn a dedicated qutebrowser subprocess for a given test,
e.g. to test specific commandline arguments.
2016-01-20 18:19:29 +01:00
Florian Bruhin
ef17c86586 tests: Allow custom args when starting testprocess. 2016-01-20 06:53:25 +01:00
Florian Bruhin
0b116729f7 bdd: Fix skipping tests from JS.
With the previous solution, we'd call pytest.skip on teardown only, which means
the rest of the test (e.g. because of a wait_for) could still fail.
2016-01-14 20:32:17 +01:00
Florian Bruhin
9c87eaf371 bdd: Allow to skip a test from JS.
This is a bit tricky since the test will actually run, but be marked as
skipped. The problem is we can't raise a pytest.skip.Exception during a test,
or it'll show up as an exception in a virtual Qt method.

Still this is better than nothing.
2016-01-14 18:50:36 +01:00
Florian Bruhin
252dc5bf1b bdd: Add ability to fail tests from javascript. 2016-01-14 07:03:55 +01:00
Florian Bruhin
9479b65d25 bdd: Add first SSL test. 2016-01-12 23:35:48 +01:00
Florian Bruhin
8dd7f080f4 tests: Default to 5s timeout if not on CI. 2016-01-12 22:49:54 +01:00
Florian Bruhin
adbdfcbad3 tests: Add an SSL server subprocess. 2016-01-12 22:48:38 +01:00
Florian Bruhin
25dbf3731b tests: Split wait_for_load_finished from open_path. 2016-01-12 22:47:09 +01:00
Florian Bruhin
ab79cd2496 tests: Avoid pytrace=False for now.
Using pytest.fail with pytrace=False hides the quteprocess output, which makes
it a lot harder to debug stuff.

This is because TestReport.longrepr is suddenly a string and we can't add infos
to it - see https://github.com/pytest-dev/pytest/issues/1316
2016-01-08 12:35:12 +01:00
Florian Bruhin
9e9cedf3e0 tests: Shorten (not suppress) quteproc log w/o -v.
The output was almost always useless without -v because the debug log wasn't
shown at all, only error/info.

Now we display a maximum of 50 lines (regardless of what level) without -v.
2016-01-07 19:41:49 +01:00
Florian Bruhin
18b5860584 bdd: Add "When I open ... in a new window" step. 2016-01-07 08:20:48 +01:00
Florian Bruhin
7cc98a1248 Fix lint. 2016-01-06 23:19:44 +01:00
Florian Bruhin
916b294976 bdd: Fix regex escape.
The . chars weren't properly escaped.
2016-01-06 22:59:05 +01:00
Florian Bruhin
a5f2ac5f03 Adjust copyright years. 2016-01-04 07:12:39 +01:00
Florian Bruhin
bba6589e19 Capture qutebrowser/httpbin output separately.
When using print and relying on pytest to capture it as stdout, we ran into
this pytest/pytest-qt issue:

https://github.com/pytest-dev/pytest-qt/issues/113

Now we use our own capturing mechanism instead, which also means we get nicer
output.

Fixes #1122.
2015-12-16 21:25:13 +01:00
Florian Bruhin
fd96685b02 tests: Wait until the qutebrowser window has focus.
This should fix the second case in #1183 and other related flakiness in
keyinput.feature.
2015-12-15 07:43:14 +01:00
Florian Bruhin
b3515f5e82 pylint: Remove import-error disabling from tests. 2015-12-01 22:47:10 +01:00
Florian Bruhin
5817b47f75 Revert "Use fully qualified imports in tests."
Seems like this also breaks frozen tests...
This reverts commit c7fdcc92b8.
2015-12-01 22:45:59 +01:00
Florian Bruhin
c7fdcc92b8 Use fully qualified imports in tests.
This is cleaner even if pylint can't handle it.
2015-12-01 22:03:59 +01:00
Florian Bruhin
150a83d8f4 pylint: Remove unneeded supressions. 2015-12-01 22:03:58 +01:00
Florian Bruhin
f5febc4807 Log basedir and save it in QuteProcess for tests. 2015-11-28 23:35:32 +01:00
Florian Bruhin
b8467b8fef tests: Various cleanups. 2015-11-26 14:25:33 +01:00
Florian Bruhin
7baed5f80f tests: Don't start qutebrowser process if unneeded. 2015-11-26 13:56:42 +01:00
Florian Bruhin
c861cf54e6 tests: Make QuteProcess.path_to_url public. 2015-11-26 01:33:27 +01:00
Florian Bruhin
9fe02d55c9 bdd: Add "I press the keys ..." step. 2015-11-25 17:19:16 +01:00
Florian Bruhin
8f2b29a1f9 tests: Make it possible to load httpbin root. 2015-11-24 21:27:20 +01:00
Florian Bruhin
b7323914b8 tests: Add plain arg to quteprocess.get_contents. 2015-11-24 18:22:20 +01:00
Florian Bruhin
607ca0f478 tests: Wait until page is dumped for header check.
If we don't do this, it's possible for the test process to delete the temporary
directory before qutebrowser actually writes the file.
2015-11-23 20:12:52 +01:00
Florian Bruhin
76143574ef tests: Add quteproc.get_content. 2015-11-23 14:37:29 +01:00
Florian Bruhin
52aca30342 tests: Add quteproc.temp_setting. 2015-11-23 13:31:17 +01:00