Commit Graph

311 Commits

Author SHA1 Message Date
Florian Bruhin
1e43b882ae tests: Use urllib to load redirect-later-continue.
This might avoid the EPROTOTYPE bug on OS X. See #1183.
2015-12-18 19:57:15 +01:00
Florian Bruhin
b3e4ac8043 tests: Fix AttributeError in _wait_for_clipboard. 2015-12-18 07:18:27 +01:00
Florian Bruhin
45d6dc6aa3 tests: Hopefully fix keyinput.feature flakiness.
While the original "no focused webview" bug (with the first test after spawning
qutebrowser) from #1183 was fixed, we still had a case where the next test
after ":fake-key sending key to the website with other window focused" failed,
presumably because the inspector was still focused, e.g. here:

http://qutebrowser.org:8010/builders/osx/builds/1175/steps/tests/logs/stdio

This hopefully fixes this by properly waiting until the inspector is gone.
2015-12-18 07:13:16 +01:00
Florian Bruhin
172157ed0d Remove unused import, take two. 2015-12-17 23:09:11 +01:00
Florian Bruhin
a7dee6c053 Remove unused import. 2015-12-17 22:57:16 +01:00
Florian Bruhin
fc84e58043 tests: Ignore "SelectionRequest too old" globally.
If we use pytestmark, it won't be ignored inside subprocess output, so our fix
from https://github.com/The-Compiler/qutebrowser/issues/1124#issuecomment-158073581
never actually worked.

See #1124 and #1183.
2015-12-17 22:33:07 +01:00
Florian Bruhin
8786e979a6 tests: Wait for data in the clipboard.
This should hopefully stabilize the flaky clipboard tests.
See #1183.
2015-12-17 22:17:38 +01:00
Florian Bruhin
982e78249a tests: Clear captured output between tests. 2015-12-16 23:07:42 +01:00
Florian Bruhin
a157f822d6 tests: Handle report.longrepr being a tuple.
For some unknown reason, report.longrepr.addsection might not exist, which
caused failures on OS X and Windows. If that happens, we just don't add a
section at all.
2015-12-16 22:47:33 +01:00
Florian Bruhin
e6284ed5d4 tests: Improve some ugly test IDs. 2015-12-16 22:21:29 +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
e68965fea2 bdd: Wait for help pages to be loaded in tests.
This hopefully fixes #1150.
2015-12-02 22:22:31 +01:00
Florian Bruhin
4170e3c9af bdd: Simplify qute:settings test. 2015-12-02 22:19:43 +01:00
Florian Bruhin
d418f7f9fa Merge branch 'caret_mode_windows_osx' of https://github.com/artur-shaik/qutebrowser into artur-shaik-caret_mode_windows_osx 2015-12-02 06:22:27 +01:00
Panagiotis Ktistakis
6e8ac374dd Add tests for :tab-move wrapping. 2015-12-02 03:35:25 +02:00
Panagiotis Ktistakis
de3460da3e Wrap tabs on :tab-move +/- if tabs->wrap is true. 2015-12-02 03:17:54 +02: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
788a096150 pylint: Ignore import-error globally for tests. 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
d53c4f2702 tests: Increase test_late_message timeout.
This was failing on Travis on OS X, and waiting 1s for process start and 0.5s
sleep seems a bit tight.
2015-12-01 08:10:44 +01:00
Florian Bruhin
6f9b02741a Switch from map() to list comprehensions. 2015-12-01 07:16:32 +01:00
Patric Schmitz
98a454a428 log-javascript-console -> [none, debug, info] 2015-11-29 18:37:11 +01:00
Florian Bruhin
f7a3a9e015 Split testprocess.wait_for into two methods. 2015-11-29 01:23:19 +01:00
Florian Bruhin
a67644589e bdd: Add first test for :bookmark-add. 2015-11-28 23:37:27 +01:00
Florian Bruhin
f9d7f20aac tests: Raise if wait_for is used without kwargs.
Otherwise wait_for would return immediately because matches is empty so
any(matches) is True.
2015-11-28 23:36:26 +01:00
Florian Bruhin
f5febc4807 Log basedir and save it in QuteProcess for tests. 2015-11-28 23:35:32 +01:00
Florian Bruhin
8d5b6b2dad bdd: Add tests for :home. 2015-11-28 22:44:05 +01:00
Florian Bruhin
052e758f38 bdd: Add tests for :help. 2015-11-28 22:34:19 +01:00
Artur Shaik
73f999da31 Revert a43c206 and b344f92. 2015-11-28 21:29:54 +06:00
Florian Bruhin
f847ddf3cb bdd: Remove :rl-backward-delete-char test.
It's flaky and tested enough via unittests.
2015-11-27 20:29:49 +01:00
Florian Bruhin
bf3bd3bb9d Wait for favicon to be loaded for mhtml tests.
This hopefully helps with the flaky MHTML tests on Windows where the favicon
was loaded *after* clearing the requests:

http://qutebrowser.org:8010/builders/win8/builds/1370/steps/unittests-frozen/logs/stdio
2015-11-27 19:30:06 +01:00
Florian Bruhin
d6acb3c3f4 bdd: Hopefully make caret tests more stable.
We now wait until the clipboard actually changed, which should make things run
better.

This should fix the cases where the expected value is empty in #1142.
2015-11-27 18:44:59 +01:00
Florian Bruhin
d5b634301f Make :rl-backward-delete-char test more stable.
The text could be inserted *after* :rl-backward-delete-char was run.
2015-11-27 18:15:17 +01:00
Florian Bruhin
e9ca1ba5c1 bdd: Add a test for :rl-backward-delete-char. 2015-11-27 16:28:06 +01:00
Florian Bruhin
84d6359990 bdd: Wait until page is loaded for tab-detach test
This should make this test more stable hopefully.
2015-11-27 15:18:53 +01:00
Florian Bruhin
b344f92a90 Add two missing xfail markers. 2015-11-27 15:10:08 +01:00
Florian Bruhin
a43c206893 Mark some caret tests as xfail on Windows/OS X.
See #1142.
2015-11-27 14:39:33 +01:00
Florian Bruhin
e4947b03be Fix lint. 2015-11-27 11:50:23 +01:00
Florian Bruhin
b4a630563f bdd: Add tests for caret mode. 2015-11-26 23:42:43 +01:00
Florian Bruhin
dbdedf74c0 bdd: Handle \n when checking clipboard contents. 2015-11-26 22:32:01 +01:00
Florian Bruhin
3d291482a3 bdd: Move clipboard functions to conftest.py.
Those are needed for caret.feature and yankpaste.feature.
2015-11-26 21:22:50 +01:00
Florian Bruhin
bf8a82db12 bdd: Add a test for :tab-detach. 2015-11-26 20:56:36 +01:00
Florian Bruhin
8d1a60528d bdd: Add some tests for :tab-clone. 2015-11-26 20:44:32 +01:00
Florian Bruhin
7f5e07d7cc bdd: Add some tests for :tab-move. 2015-11-26 18:37:47 +01:00
Florian Bruhin
3bcc80048d bdd: Move yankpaste.html to title.html. 2015-11-26 18:37:33 +01:00
Florian Bruhin
6f1474be71 bdd: Remove trailing dots. 2015-11-26 17:50:39 +01:00
Florian Bruhin
bc28a168cc bdd: Add tests for :tab-prev/:tab-next/tabs->wrap. 2015-11-26 16:19:03 +01:00
Florian Bruhin
102db181c5 Remove unused imports. 2015-11-26 15:55:40 +01:00
Florian Bruhin
7eb6f658eb tests: Use JSON for webserver_sub logging.
This simplifies logging output and parsing.
2015-11-26 14:40:20 +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
fac76576d7 bdd: Add "the following tabs should be open" step.
This simplifies a lot of .feature files because we don't actually need to check
the full session.
2015-11-26 01:33:56 +01:00
Florian Bruhin
c861cf54e6 tests: Make QuteProcess.path_to_url public. 2015-11-26 01:33:27 +01:00
Florian Bruhin
fc328b275a bdd: Add some tests for :tab-focus. 2015-11-26 00:48:39 +01:00
Florian Bruhin
c755a78518 bdd: Add tests for :tab-close/:tab-only. 2015-11-25 18:48:10 +01:00
Florian Bruhin
816d62bca5 bdd: Reorganize numbered test files. 2015-11-25 18:02:14 +01:00
Florian Bruhin
eed2584e3f Fixup for last commit. 2015-11-25 17:55:33 +01:00
Florian Bruhin
0a7b552111 bdd: Use 'q' key for forward-unbound-keys test.
It seems ' gives us a 222 keycode with newer Qt versions, but 0 with older
ones. 'q' which is a much lower code should hopefully work better.
2015-11-25 17:52:00 +01:00
Florian Bruhin
21a1f9ca65 bdd: Add various key input tests. 2015-11-25 17:20:53 +01:00
Florian Bruhin
9670ffb78e bdd: Add "the JS message ... should not be logged". 2015-11-25 17:20:05 +01:00
Florian Bruhin
388cc7ae29 bdd: Add "Then ... should be logged" step. 2015-11-25 17:19:49 +01:00
Florian Bruhin
9fe02d55c9 bdd: Add "I press the keys ..." step. 2015-11-25 17:19:16 +01:00
Florian Bruhin
7cfea665ff tests: Strip trailing slash for webserver paths. 2015-11-25 10:40:24 +01:00
Florian Bruhin
027a10c04b bdd: Add some tests for :navigate. 2015-11-24 21:32:45 +01:00
Florian Bruhin
8f2b29a1f9 tests: Make it possible to load httpbin root. 2015-11-24 21:27:20 +01:00
Florian Bruhin
93ef85ff16 tests: Serve index.html files in webserver_sub.py. 2015-11-24 20:43:20 +01:00
Florian Bruhin
f8668ff710 bdd: Add a test for :open with -t and -b. 2015-11-24 20:31:08 +01:00
Florian Bruhin
c22e1df400 Add whitespace. 2015-11-24 19:24:39 +01:00
Florian Bruhin
28b739b9b5 bdd: Add tests for :open. 2015-11-24 19:19:23 +01:00
Florian Bruhin
287b2ba258 bdd: Replace (port) when setting a setting. 2015-11-24 19:19:03 +01:00
Florian Bruhin
925a5ba809 bdd: Add test for :debug-console. 2015-11-24 18:37:34 +01:00
Florian Bruhin
2ef2e3088f bdd: Add tests for :view-source. 2015-11-24 18:24:33 +01:00
Florian Bruhin
d58a5d4d15 bdd: Add "the page source should look like" step. 2015-11-24 18:22:43 +01:00
Florian Bruhin
b7323914b8 tests: Add plain arg to quteprocess.get_contents. 2015-11-24 18:22:20 +01:00
Florian Bruhin
7b1e2ab471 Skip some inspector tests on windows.
Those cause trouble because it can't clean up the local storage directory...
2015-11-24 17:48:09 +01:00
Florian Bruhin
d13ae4c666 tests: Make checks for focus window more forgiving.
It seems on OS X we get this instead of focusing the webview:
"Focus object changed: <qutebrowser.browser.inspector.WebInspector object at ...>"
2015-11-24 16:54:35 +01:00
Florian Bruhin
922fdc0526 Fix :fake-key with no focused webview. 2015-11-24 16:28:56 +01:00
Florian Bruhin
4c1eff625f tests: Make inspector smoke test more reliable.
Before we didn't wait until the inspector window was hidden, which caused the
following tests to fail on our OS X buildbot:

    ==================================== ERRORS ====================================
    _________ ERROR at teardown of test_fakekey_sending_key_to_the_website _________

    [...]

    tests/integration/testprocess.py:186: InvalidLine
    ----------------------------- Captured stdout call -----------------------------
    [...]
    INVALID: Traceback (most recent call last):
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/app.py", line 109, in <lambda>
    IGNORED:     target_arg=target_arg))
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/app.py", line 263, in process_pos_args
    IGNORED:     commandrunner.run_safely_init(cmd[1:])
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/commands/runners.py", line 266, in run_safely_init
    IGNORED:     self.run(text, count)
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/commands/runners.py", line 249, in run
    IGNORED:     result.cmd.run(self._win_id, args)
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/commands/command.py", line 505, in run
    IGNORED:     self.handler(*posargs, **kwargs)
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/browser/commands.py", line 1781, in fake_key
    IGNORED:     tab='current')
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/utils/objreg.py", line 215, in get
    IGNORED:     reg = _get_registry(scope, window, tab)
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/utils/objreg.py", line 202, in _get_registry
    IGNORED:     return _get_tab_registry(window, tab)
    IGNORED:   File "/Users/buildbot/buildbot/slave/osx/build/qutebrowser/utils/objreg.py", line 152, in _get_tab_registry
    IGNORED:     raise RegistryUnavailableError('tab')
    INVALID: qutebrowser.utils.objreg.RegistryUnavailableError: tab
    [...]

While this is a real issue, this test shouldn't affect the next one.

Since we have to wait for windows getting focused but Xvfb doesn't do that, we
skip this tests when running via Xvfb.
2015-11-24 16:17:26 +01:00
Florian Bruhin
9479a50784 bdd: Add a timeout to redirect-later with -1 delay. 2015-11-23 21:37:22 +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
d4c24c935c bdd: Compare unordered req's for :reload --force. 2015-11-23 20:00:25 +01:00
Florian Bruhin
79680f505e Fix docstring. 2015-11-23 19:46:50 +01:00
Florian Bruhin
f3b89dba9b tests: Make test_reload/..._with_force more stable.
This waits until the pages have actually been reloaded.
2015-11-23 19:44:53 +01:00
Florian Bruhin
e2da9aa3f8 tests: Make test_stop more stable.
It's now based by the browser opening a second page after :stop is run rather
than timing-based, which hopefully should make it run more stable on Travis.
2015-11-23 19:43:11 +01:00
Florian Bruhin
d324dd5f70 bdd: Add "I open ... in a new tab" step. 2015-11-23 19:42:01 +01:00
Florian Bruhin
39f29e2531 tests: Wait until clipboard actually changed.
Hopefully fixes #1124.
2015-11-23 16:29:37 +01:00
Florian Bruhin
17b5ccde0e tests: Ignore "SelectionRequest too old" message.
See #1124.
2015-11-23 16:25:03 +01:00
Florian Bruhin
162c8b30e6 Remove unused import. 2015-11-23 14:49:37 +01:00
Florian Bruhin
7a82bb55e4 bdd: Add tests for :reload. 2015-11-23 14:37:54 +01:00
Florian Bruhin
1e79aae231 bdd: Add check_header step. 2015-11-23 14:37:40 +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
Florian Bruhin
e6eaa5f140 tests: Add quteproc.get_setting. 2015-11-23 13:30:49 +01:00
Florian Bruhin
16e1a65448 Merge branch 'download-page' of https://github.com/Kingdread/qutebrowser into Kingdread-download-page 2015-11-23 13:16:16 +01:00
Florian Bruhin
4fa32bd0cd bdd: Use a fresh instance for :stop test.
This hopefully makes it more stable on Travis on OS X.
2015-11-22 17:07:54 +01:00
Daniel Schadt
86eda2843d Normalize application/x-javascript
Should be just application/javascript
2015-11-21 16:19:01 +01:00
Florian Bruhin
39def173ca bdd: Fix request list for :stop test.
We changed the URL in the last commit but forgot to adjust that.
2015-11-21 15:31:19 +01:00