Commit Graph

156 Commits

Author SHA1 Message Date
Florian Bruhin
7f013b7808 Fix lint 2016-09-06 17:00:25 +02:00
Florian Bruhin
ce1b2e6f15 quteprocess: Only wait for first about:blank load
We accidentally marked all about:blank lines as waited for...
2016-09-06 17:00:25 +02:00
Florian Bruhin
c07ff15b9b bdd: Display milliseconds in log output 2016-09-06 17:00:25 +02:00
Florian Bruhin
db7de0d619 tests: Set waited_for for initial about:blank load
Otherwise, subsequent lines where we wait for about:blank will fall back
on the older one and not actually wait.
2016-09-06 15:50:36 +02:00
Florian Bruhin
85b3d08c66 bdd: Fix scrolling tests with QtWebEngine
Scrolling happens async with QtWebEngine, so we add a new log output
when the page was scrolled, and wait for that in various places.
2016-09-06 14:58:33 +02:00
Florian Bruhin
19ac488997 tests: Add QUTE_BDD_WEBENGINE environment variable 2016-09-05 15:08:00 +02:00
Florian Bruhin
77aa8b4337 pylint: Use ignored-modules for pytest
See https://github.com/PyCQA/astroid/pull/357
2016-08-23 07:45:31 +02:00
Florian Bruhin
23c4c89a0f tests: Set __tracebackhide__ to a callable
This allows us to only filter the exceptions we actually want to hide.

See #1877
2016-08-23 07:28:08 +02:00
Florian Bruhin
df3733af54 tests: Use pytest.fixture instead of yield_fixture
See #1877
2016-08-22 07:40:24 +02:00
Florian Bruhin
80a3920aad Revert "Revert "tests: Use getfixturevalue""
This reverts commit c8fe21c85f.
2016-08-22 07:24:17 +02:00
Florian Bruhin
c8fe21c85f Revert "tests: Use getfixturevalue"
This reverts commit 961d33b712.
2016-08-21 16:59:54 +02:00
Florian Bruhin
961d33b712 tests: Use getfixturevalue
See #1877
2016-08-21 16:18:33 +02:00
Florian Bruhin
2eae6a0603 bdd: Wait less for xfailing tests
We now divide all timeouts by ten for xfailing tests, with the hope to
still catch newly passing tests, but not spend too much time waiting.

With a quick test, this reduced the testsuite run length from 12 to
7-8 minutes.
2016-08-19 13:11:29 +02:00
Florian Bruhin
362c23692a Change quteproc._request back to quteproc.request
Otherwise our per-test quteproc fixture wouldn't set the 'request'
object properly from the outside, and quteproc always had a module as
request.node.
2016-08-19 13:05:59 +02:00
Florian Bruhin
6cd890aa19 bdd: Set request object on QuteProc 2016-08-19 12:15:50 +02:00
Florian Bruhin
914ce85780 tests: Fix quteproc_new fixture 2016-08-18 23:31:18 +02:00
Florian Bruhin
1c581cf1cf quteproc: Ignore failing messages on xfail
When a test calls pytest.xfail it might stop early, so the message
doesn't get marked as ignored.
2016-08-18 22:23:29 +02:00
Florian Bruhin
788eebc1ad bdd: Ignore "Running without the SUID sandbox!" 2016-08-18 19:29:34 +02:00
Florian Bruhin
0cef4ac2db Add a :click-element command 2016-08-18 15:30:04 +02:00
Florian Bruhin
da73a7123c Add quteproc.click_element_by_id 2016-08-18 13:24:47 +02:00
Niklas Haas
c2cc28a72b
Add new-instance-open-target.window = first-opened
Fixes #1060.

In the process of adding this, I also decided to rewrite
mainwindow.get_window() for clarity (and also because flake8 was warning
about complexity).

Also adds some tests to the new-instance-target mechanism, in particular
a specific test for the issue in question.
2016-08-16 12:24:38 +02:00
Florian Bruhin
9aa6c8cf36 Automatically terminate quteproc_new after a test
This means we don't get a QProcess message because of test_no_loglines
not sending :quit, and we don't need to do so in test_ascii_locale as
there's nothing we need to wait for.
2016-08-10 09:30:24 +02:00
Niklas Haas
6d181e5c6f
Add new-instance-open-target.window setting
This adds the ability to open new tabs in the last-focused window
instead, which fixes #1801.

Right now the only other option is probably not that useful for human
users but it's required to make tests behave deterministically and
consistently. (But with #881 on the roadmap, I would implement this as
another choice)

To this end, also make the test framework set this option to preserve
the invariant against which existing tests are written: that spawning a
new window would effectively also focus it.
2016-08-10 00:06:12 +02:00
Florian Bruhin
2d48a8013f tests: Don't set ssl-strict with QtWebEngine 2016-08-09 15:13:26 +02:00
Florian Bruhin
08b70f0f4c Add qutebrowser.utils.javascript
webelem.javascript_escape got renamed to javascript.string_escape, and a
new javascript.assemble got added to make it easier to call a function
inside a .js file.
2016-08-04 17:53:13 +02:00
Florian Bruhin
a49c524b00 tests: Ensure LogLine gets the right json type 2016-08-03 09:06:58 +02:00
Florian Bruhin
190db8bf5e Also pass -bb to python for end2end tests 2016-07-28 07:19:59 +02:00
Florian Bruhin
e0ab70c8cf end2end tests: Don't fail with "STUB:" warnings
We have some things like pos_px stubbed which will fail any test because
of the stub warning - but some tests don't actually need that, it just
happens when e.g. loading something.

So let's not fail tests based on stub warnings, and see how much works
that way.
2016-07-13 10:55:04 +02:00
Florian Bruhin
e5cab11979 Escape backslashes in end2end test commands
Let's hope this fixes stuff on Windows where \ is used as path
separator...
2016-07-12 17:52:05 +02:00
Florian Bruhin
d91c922b4c Add --qute-bdd-webengine switch for end2end tests 2016-07-11 17:24:03 +02:00
Florian Bruhin
bf286f8c74 Fix some tests 2016-07-07 18:32:52 +02:00
Florian Bruhin
70117265d6 Fix some a/an misspellings
Thanks to https://github.com/jwilk/anorack
2016-07-05 08:34:03 +02:00
Florian Bruhin
f6cd73c784 Merge branch 'expected-error' of https://github.com/Kingdread/qutebrowser into Kingdread-expected-error 2016-07-03 16:58:06 +02:00
Daniel Schadt
ee9d3b6a49 quteprocess: replace Expected with expected 2016-07-02 17:22:40 +02:00
Daniel Schadt
4863df5ac8 quteprocess: also mark expected WARNINGs 2016-07-02 17:19:19 +02:00
Daniel Schadt
bce06d6f43 quteproc: mark expected errors as such
Fixes #1611

This marks errors that are expected by a test with an "(Expected)"
marker and white color (instead of red).

The formatting of the log messages has been deferred to _render_log,
since the .expected attribute is not correctly set right after we read
the message.
2016-07-02 13:59:46 +02:00
Florian Bruhin
4fccc89d7d Split browser into browser/browser.webkit 2016-06-13 11:18:21 +02:00
Florian Bruhin
d40e8e1c2f tests: Set auto-save-interval to 0
Otherwise history tests could fail because waiting for
"Saved to *history" waited for a previous line, not the newest one.

It also doesn't make any sense to save stuff anyways.
2016-06-08 21:54:44 +02:00
Florian Bruhin
a9f27e3247 bdd: Turn off colors with --color=no 2016-06-06 23:19:14 +02:00
Florian Bruhin
d91f4e13d0 Fix long line 2016-06-06 17:13:56 +02:00
Florian Bruhin
2f60073cdf bdd: Allow to run invalid commands via quteproc 2016-06-06 16:10:01 +02:00
Daniel Schadt
a6b47a7c09 fix lint 2016-05-30 16:00:10 +02:00
Daniel Schadt
65e5a3fe09 quteproc: match message with re.DOTALL
Since they may now contain newlines, we need to get the whole message,
which are otherwise not included in .
2016-05-30 16:00:10 +02:00
Daniel Schadt
484320ac19 quteproc: see lines starting with ' ' as error
Now that json logging is used, multiple lines should be correctly
escaped (and parsed), even in tracebacks, so this check should now be
obsolete.
2016-05-30 16:00:10 +02:00
Daniel Schadt
db240e294e quteproc: delegate LogLine to log.ColoredFormatter 2016-05-30 16:00:10 +02:00
Daniel Schadt
6a6f396f85 quteproc: set lineno to None if function is None 2016-05-30 16:00:10 +02:00
Daniel Schadt
cea32ea333 log: embed traceback in json object 2016-05-30 16:00:10 +02:00
Daniel Schadt
96b299a1fc quteproc: Nicer output for unexpected errors
Instead of
    LogLine('{"levelname": "ERROR", ...}')
we get
    21:22:34 ERROR    downloads  mhtml ...
2016-05-30 16:00:10 +02:00
Daniel Schadt
b4022b9795 quteproc: fix log_color in log message
This actually uses the escape code, not just the color name.
2016-05-30 16:00:10 +02:00
Daniel Schadt
ae16240d41 quteproc: fix docstring in formatted_str
Autocomplete was faster and inserted .strip() after line
2016-05-30 16:00:10 +02:00
Daniel Schadt
cf3930f925 quteproc: except ValueError
There is no json.decoder.JSONDecodeError, it was a lie all along...
2016-05-30 16:00:10 +02:00
Daniel Schadt
4a59a1f112 log: implement JSON as logging output
Fixes #1501

Enabled via the --json-logging parameter.
2016-05-30 16:00:10 +02:00
Florian Bruhin
d385206ea0 tests: Set some settings for quteproc
We set ui -> message-timeout to 0 to get better error messages in the
log output and network -> ssl-strict to not hang on unexpected SSL
errors.
2016-05-29 23:40:09 +02:00
Florian Bruhin
2d9cf5ed3a Handle invalid URLs in wait_for_load_finished_url 2016-05-29 22:16:55 +02:00
Florian Bruhin
119d76c502 Fix lint 2016-05-29 18:45:09 +02:00
Florian Bruhin
64d4c9f83e Clean up end2end test file structure
This renames tests/integration to tests/end2end and moves some files to
tests/end2end/fixtures.
2016-05-29 18:20:00 +02:00