Commit Graph

1117 Commits

Author SHA1 Message Date
Florian Bruhin
ed3fd71e6f Force showing of label in test_elided_text
It seems the paintEvent of TextBase never got called since we switched to using
fake_statusbar, breaking the 100% coverage check.
2016-03-15 08:29:33 +01:00
Florian Bruhin
569e7b11fb Make test_elided_text work with non-unicode output
When Qt detects it can't output unicode (via the locale?), it elides using
"..." instead of the unicode char "…". Now the test works in both scenarios.
2016-03-15 07:19:43 +01:00
Florian Bruhin
97ddd674dd Use fake_statusbar for test_elided_text
See #1313
2016-03-15 07:14:39 +01:00
Florian Bruhin
41b6f68fd7 bdd: Add some more tests for downloads 2016-03-14 19:06:42 +01:00
Florian Bruhin
06190a0488 bdd: Do better cleanup/separation for downloads 2016-03-14 19:06:16 +01:00
Florian Bruhin
42a4c1ce4c Also test transform in test_configtypes_hypothesis
If validating works, we might as well also check if transforming does too.
2016-03-11 07:26:16 +01:00
Florian Bruhin
0c6d6367de Force qapp fixture for test_configtypes_hypothesis.
The test needs a QApplication
2016-03-11 07:17:11 +01:00
Florian Bruhin
5d87770513 tests: Allow XPASS for test_installed_package
We need to use strict=False here as test_installed_package can XPASS when
running frozen tests.
2016-03-02 08:09:04 +01:00
Florian Bruhin
d1ec64cab1 Remove skip marker as it's builtin in pytest now 2016-03-02 07:14:06 +01:00
Florian Bruhin
5395e0f6e2 tests: Use a fresh instance as a workaround
Waiting seems like a perfect recipe for another flaky test, so let's better be
safe.
2016-02-28 15:26:18 +01:00
Florian Bruhin
c156f53eba Merge branch 'data-link-fix' of https://github.com/Kingdread/qutebrowser into Kingdread-data-link-fix 2016-02-27 03:01:19 +01:00
Florian Bruhin
48f87d1656 Revert "Use pytest-platform-markers"
This reverts commit 2e12fb3c65.

It seems like it's currently broken...
2016-02-27 02:45:34 +01: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
2e12fb3c65 Use pytest-platform-markers 2016-02-27 00:26:24 +01:00
Daniel Schadt
a382b366bc tests: increase wait time
Otherwise the test might still fail on some systems
2016-02-22 21:46:54 +01:00
Daniel Schadt
a84c8ac247 tests: add workaround for QPainter bug
As suggested in the github discussion.
2016-02-22 17:39:34 +01:00
Florian Bruhin
3ff419f685 Merge branch 'fix/ellipses-on-fullscreen' of https://github.com/NoctuaNivalis/qutebrowser into NoctuaNivalis-fix/ellipses-on-fullscreen 2016-02-22 11:50:26 +01:00
Florian Bruhin
f64916b516 Only run geolocation tests on CI
Trying to get the device location while running the tests can trigger all kind
of funny effects.

Since we can't easily mock the GPS responses, we only run those on the CI where
we at least have some predictable setup.

Fixes #1297.
2016-02-21 17:24:33 +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
6a077f5d5a Fix lint. 2016-02-18 21:38:23 +01:00
Florian Bruhin
36b0e304fc tests: Add first end-to-end test for hints.
This is based on HTML files with a global YAML comment, currently with "target"
as the only allowed key.

The tests then do this:

- Open a HTML file in data/hints/html
- Start hinting
- Make sure only one hint is visible
- Follow it, and make sure the page mentioned in "target:" is reached

Some ideas for the future:

- A "scroll" key, to scroll before hinting
- A "zoom" key, to zoom
- Multiple hints via a list
- Checking position of hints?
- A mode to manually check the pages (to check hint positions)
2016-02-18 20:46:15 +01:00
Florian Bruhin
9a02dc174d bdd: use quteproc.wait_for_load_finished.
Why duplicate that logic?
2016-02-18 20:46:15 +01:00
Daniel Schadt
007425cf16 downloads: fix filename for data: links
Issue #1214

Now uses a sensible filename for data: links instead of the whole base64
content. For PDF.js, it even uses the correct pdf filename.

TODO: Produces "QPainter:🔚 Painter ended with 2 saved states" while
running the tests here (Arch Linux):
CPython: 3.5.1
Qt: 5.5.1, runtime: 5.5.1
PyQt: 5.5.1
2016-02-18 16:17:35 +01:00
Florian Bruhin
5c617b861c Switch to pytest-xvfb. Fixes #1309. 2016-02-16 20:36:23 +01:00
Felix Van der Jeugt
c52e93e296 no ellipsis is inserted in big windows 2016-02-15 22:52:28 +01:00
Florian Bruhin
aa579d76c9 Merge branch 'fix/#1308' of https://github.com/NoctuaNivalis/qutebrowser into NoctuaNivalis-fix/#1308 2016-02-15 22:08:33 +01:00
Felix Van der Jeugt
60c2b9c0b2 fixes #1308 2016-02-15 21:59:09 +01:00
Florian Bruhin
74e168c339 Update Pygments test file. 2016-02-15 07:47:29 +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
5311576c34 Check pep257 via flake8.
We'll still keep the pydocstyle environment though until flake8-pep257 adds
support for that:

https://github.com/Robpol86/flake8-pep257/issues/6
2016-02-10 19:18:47 +01:00
Florian Bruhin
7f791dfcb8 Remove now obsolete test. 2016-02-10 07:06:34 +01:00
Florian Bruhin
b6f1dd963d Handle Shift-Insert correctly in prompt mode.
Fixes #1299.
2016-02-10 06:40:54 +01:00
Florian Bruhin
5ae677376b Rerun TestPyQIODevice.test_qprocess if needed.
This adds a new pytest-rerunfailures dependency. For some reason, that test
sometimes fails with an empty string read, and I can't tell why.
2016-02-08 06:54:47 +01:00
Daniel Schadt
d02ec62e33 tests: fix tests for test_version
Broken since we changed pdfjs.PDFJSNotFound to have a parameter, which
was not given here.
2016-02-05 15:16:23 +01:00
Daniel Schadt
df8f87f8b6 tests: add tests for qutescheme 2016-02-05 15:14:23 +01:00
Florian Bruhin
83dc390808 tests: Move fixtures into a separate file. 2016-02-04 07:27:23 +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
43b6f18864 Whoops, don't use repr(json.dumps(...)) 2016-02-03 21:28:20 +01:00
Florian Bruhin
e5e1a0d95c Reject hints -> chars containing duplicate chars
Fixes #1286.
2016-02-03 21:05:35 +01:00
Florian Bruhin
0b491f6caf Use json.dumps for logged fake clipboard.
For some reason, when comparing the repr in the two processes, we get different
results on OS X and Windows:

- expected: "fünf"
- "f\xfcnf" coming back from the subprocess on OS X
- "fnf" on Windows

Instead we're comparing the json dump now, which should be more predictable.
2016-02-03 20:54:35 +01:00
Florian Bruhin
79f83a033d Add a fake clipboard for tests
There are a lot of problems and flakiness with using a real clipboard.

Instead we now have a :debug-set-fake-clipboard command to set a text, and use
logging when getting the contents.

Fixes #1285.
2016-02-03 20:27:11 +01:00
Florian Bruhin
921e8b50b7 Fix lint. 2016-02-03 08:16:59 +01:00
Florian Bruhin
3292c05340 tests: Display some more qutebrowser logs w/o -v.
50 lines of context is almost useless, e.g. when an exception occurs we don't
even see the traceback.
2016-02-03 07:55:10 +01:00
Florian Bruhin
6008adcb9f bdd: xfail broken yankpaste tests for now.
Using the clipboard seems to be a good recipe for a lot of weird pain.
Until we avoid it altogether (see #1285) we xfail those problematic tests.
2016-02-03 07:49:45 +01:00
Florian Bruhin
302745e0fe tests: Also poll clipboard after setting it. 2016-02-03 07:44:41 +01:00
Florian Bruhin
a90618128d tests: Empty clipboard after testing if it works.
Otherwise, if a test fails to actually put something into the clipboard, we end
up pasting "Does this work?" which could e.g. trigger a search.

When it's cleared, we at least get some "clipboard is empty" error instead.
2016-02-03 06:55:21 +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
Daniel Schadt
1e52f459c9 mhtml: new complex test case
The-Compiler wants a more beautiful test case since the old one was
pretty weird and took lots of explaining at pytest demos, so I made a
new one. This one is a bit nicer on the eye and - to say it with
The-Compiler's words - has no "weird pixelated globe with the
geocities-like background".

To compensate for the globe I've put in some trivia facts so that - if
you are one of the people that like to stare at test pages - you can
always learn something.
2016-02-02 22:23:40 +01:00