Commit Graph

907 Commits

Author SHA1 Message Date
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
951c2e8eb6 Fix qflags_key comparison. 2015-11-25 18:54:03 +01:00
Florian Bruhin
c755a78518 bdd: Add tests for :tab-close/:tab-only. 2015-11-25 18:48:10 +01:00
Florian Bruhin
67f726c9d4 tests: Add another BOM test for javascript_escape. 2015-11-25 18:47:16 +01:00
Florian Bruhin
73e9fd1118 Handle BOM (\ufeff) for webelem.javascript_escape. 2015-11-25 18:14:52 +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
24a71e5c2e Fix webelem.javascript_escape with U+2028/U+2029. 2015-11-25 10:32:22 +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
542d13b70d tests: Add a not_xvfb marker. 2015-11-24 16:17:07 +01:00
Florian Bruhin
14f4689998 tests: Fix TestInitLog.
This worked before b0d4ebe because --debug was given and the
"args.loglevel.upper()" part was never executed.

However, loglevel is expected as a string, not as an int.
2015-11-23 21:50:48 +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
196d1e95be tests: Skip test_normal_connection IPC test on OS X.
Seems like it hangs there sometimes.
2015-11-23 20:33:11 +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
ea06c64ed4 Fix typos. 2015-11-23 11:17:26 +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
Florian Bruhin
eb232734b4 bdd: Increase timeouts for :stop test.
The old ones weren't enough for Travis it seems.
2015-11-21 15:14:32 +01:00
Florian Bruhin
4f165a7669 bdd: Add a test for :stop. 2015-11-21 14:23:44 +01:00
Daniel Schadt
7d6327873a Pass test only when mhtml file is written
Otherwise we might spill data to tests that come after the mhtml ones.
2015-11-21 12:45:57 +01:00
Daniel Schadt
59c9c6ccb0 Actually test :download --mhtml, not :download 2015-11-21 12:37:26 +01:00
Daniel Schadt
c7294781f5 Don't make ExpectedRequest orderable
Instead, make it hashable and use collections.Counter instead of sorted
lists. This actually produces a nicer output for differences between
the counters.
2015-11-21 00:20:09 +01:00
Daniel Schadt
c12011c84d Style fixes 2015-11-21 00:10:49 +01:00
Daniel Schadt
b776aeac84 Use same representation in webview and quteprocess
Otherwise the "page loaded" message will not be recognized.

Also use percent-encoding to avoid unicode-related bugs on different
systems.
2015-11-20 19:11:20 +01:00
Florian Bruhin
af875f4b8f Add a :fake-key command.
Closes #556.
See #551.
2015-11-20 19:06:06 +01:00
Daniel Schadt
0a9a75c337 Add more tests for the :download command 2015-11-20 18:31:39 +01:00
Daniel Schadt
0c2a285fef Convert to QUrl before waiting for the logline
webview uses QUrl to output the url and thus might convert some escape
sequences to their unicode characters. If we don't do the same
conversions here, we will "miss" the log message and fail the test.
2015-11-20 18:30:08 +01:00
Daniel Schadt
7f8c118991 Fix pylint 2015-11-20 16:57:27 +01:00
Daniel Schadt
cd78086d10 Fix pep257 2015-11-20 16:23:46 +01:00
Daniel Schadt
729d29b8a7 webserver: listen on 127.0.0.1 instead of 0.0.0.0 2015-11-20 16:17:34 +01:00
Daniel Schadt
09e310277d Remove server global, use lambda instead 2015-11-20 16:13:30 +01:00
Daniel Schadt
fb8f200291 Remove polling in webserver, use property instead 2015-11-20 16:11:13 +01:00
Daniel Schadt
613faf84ef Move pylint comment 2015-11-20 15:30:27 +01:00
Daniel Schadt
097a14d5f3 Disable pylint no-member for cherrypy.wsgiserver 2015-11-20 14:03:51 +01:00
Daniel Schadt
a991a8c43c Don't compare requests triggered by loading a page 2015-11-20 13:42:32 +01:00
Daniel Schadt
3466ee03f6 Change development server to cherrypy.wsgiserver
The Flask/Werkzeug development servers had some issues which lead to
failing tests (together with some Qt bugs).
2015-11-20 13:35:24 +01:00
Daniel Schadt
452c6f5310 Add __str__ method to ExpectedRequest
Better for reading test logs.
2015-11-20 13:35:24 +01:00
Florian Bruhin
1ec03462c8 Add a utils.parse_keystring. 2015-11-20 07:06:16 +01:00
Florian Bruhin
9a310dd1fb bdd: Add step to check for JS console.log. 2015-11-20 07:06:16 +01:00
Florian Bruhin
4d1f37f296 bdd: Add tests for :inspector. 2015-11-18 20:08:25 +01:00
Florian Bruhin
55992337b8 bdd: Add a --qute-delay argument. 2015-11-18 20:01:40 +01:00
Daniel Schadt
4060fd5e90 Fix mhtml tests 2015-11-18 19:56:49 +01:00
Daniel Schadt
3438a45b19 Merge branch 'master' into download-page 2015-11-18 19:27:26 +01:00
Daniel Schadt
0d6d276592 mhtml: remove non-existing ftp asset
This could be the cause of failing tests, depending on the OS.
2015-11-18 19:15:18 +01:00
Florian Bruhin
90c1240ad4 tests: Remove unnecessary override. 2015-11-18 18:29:27 +01:00
Florian Bruhin
dd2ec30b97 Revert "Use parametrization for TestKeyToString:test_all."
This reverts commit aa1ea9b063.

I changed my mind on this, generating >400 tests for this is stupid.
2015-11-18 18:15:21 +01:00
Florian Bruhin
516a81c3cc tests: Don't parse httpbin date.
We don't need the parsed date, and the parsing is locale dependent, which can
cause trouble.
2015-11-17 07:36:21 +01:00
Florian Bruhin
726525b26a bdd: Add some more tests for scrolling with floats. 2015-11-17 06:57:33 +01:00
Florian Bruhin
40e2258ef3 Don't accept floats for :scroll-px. 2015-11-17 06:57:13 +01:00
Florian Bruhin
71134f97e3 bdd: Wait for request with "... should be loaded".
Hopefully makes things less prone to race conditions.
2015-11-17 06:42:13 +01:00
Florian Bruhin
779df4c08e bdd: Use separate files for scroll navigate tests.
hello.txt was already cached from some other tests, so let's make sure a fresh
file gets loaded.
2015-11-17 06:40:23 +01:00
Florian Bruhin
7fe9be432a tests: Make httpbin.Request a proper class. 2015-11-16 23:24:11 +01:00
Florian Bruhin
bc96da47ef bdd: Tests for scrolling with non-scrollable page. 2015-11-16 20:35:44 +01:00
Florian Bruhin
a4d15b550e Abort :back/:forward at beginning/end of history. 2015-11-16 19:03:07 +01:00
Florian Bruhin
eef760359c Add missing 3.txt. 2015-11-16 07:17:53 +01:00
Florian Bruhin
6a4ea944cf bdd: Add tests with very big counts. 2015-11-16 07:17:43 +01:00
Florian Bruhin
fe08cb24f8 bdd: Test some commands with count. 2015-11-15 20:48:07 +01:00
Florian Bruhin
eeab4d41ba Make it possible to pass a count via command name.
This is only used for tests so far and not intended for general usage (and thus
undocumented).
2015-11-15 19:55:01 +01:00
Florian Bruhin
29a1620e81 bdd: Add tests for :scroll-page with --*-navigate. 2015-11-15 17:50:26 +01:00
Florian Bruhin
3d44d619fc bdd: Add some tests for :scroll-{perc,page}. 2015-11-15 16:38:56 +01:00
Florian Bruhin
1af30772b1 bdd: Add some comments to scroll.feature. 2015-11-15 16:38:56 +01:00
Florian Bruhin
4c75422c05 bdd: Add some :debug-webaction tests. 2015-11-15 16:38:56 +01:00
Florian Bruhin
145772476b bdd: Add some tests for :jseval. 2015-11-15 16:38:56 +01:00
Florian Bruhin
9f1c6e0139 bdd: Add some comments to misc.feature. 2015-11-15 16:38:56 +01:00
Florian Bruhin
384c753094 tests: Add ensure_not_logged to TestProcess. 2015-11-15 16:38:56 +01:00
Florian Bruhin
e9ece3d114 tests: Validate **kwargs for TestProcess.wait_for. 2015-11-13 23:26:14 +01:00
Florian Bruhin
9607fae935 Skip check_coverage.py with --lf. 2015-11-13 22:43:12 +01:00
Florian Bruhin
b61462ccb8 Fix the style fixes. 2015-11-13 22:41:37 +01:00
Florian Bruhin
1da7996c3b Style fixes. 2015-11-13 22:27:41 +01:00
Florian Bruhin
04c2e45bee bdd: Add a first test for :jseval. 2015-11-13 07:56:59 +01:00
Florian Bruhin
3290048458 tests: Do custom fnmatch-like matching.
fnmatch treats [, ] and ? as shell metacharacters too, and has no way to escape
them. We need a literal [] and really only need * for filtering.
2015-11-13 07:56:59 +01:00
Florian Bruhin
205af3737f bdd: Skip yankpaste tests if clipboard is broken.
This seems to be the case on OS X Yosemite (on my Mac Mini).
2015-11-13 06:54:45 +01:00
Florian Bruhin
0085421ec6 tests: Use __tracebackhide__ in wait_for methods. 2015-11-13 06:45:55 +01:00
Florian Bruhin
ce66d731f2 tests: Add missing file. 2015-11-13 06:24:53 +01:00
Florian Bruhin
40c7990d3a tests: Skip ipc TestSendToRunningInstance on OS X.
This did hang often on OS X, and I don't have the time to properly debug this.

See #1045.
2015-11-12 22:17:37 +01:00
Florian Bruhin
85c82b32fb tests: Only print ignored lines with invalid ones. 2015-11-12 22:13:56 +01:00
Florian Bruhin
1dd5bb1596 bdd: Add more tests for :zoom 2015-11-12 22:10:13 +01:00
Daniel Schadt
4210d7e15d mhtml: use png instead of ico for test
Seems like httpbin sends a different MIME-type on travis than on my
laptop, something 'clear' like image/png should fix this.
2015-11-12 21:58:33 +01:00
Florian Bruhin
00ccc236bb bdd: Add more :paste tests. 2015-11-12 21:52:39 +01:00
Florian Bruhin
25921792ef tests: Allow to open about:…/qute:… in QuteProc. 2015-11-12 21:52:06 +01:00
Daniel Schadt
354259777a mhtml: don't test with dynamically modified page 2015-11-12 21:07:14 +01:00
Daniel Schadt
69a92af097 mhtml: add "complex" test case
The html page is very ugly, but tests the downloader pretty throughout
2015-11-12 20:57:38 +01:00
Florian Bruhin
ba902f1d92 tests: Fix test_testprocess flakyness.
When we don't include the start time in the measurement, the subprocess will
already start sleeping before we start measuring, which can lead to times
measured which are around 260-300ms.
2015-11-12 20:29:06 +01:00
Florian Bruhin
9c5ce8a688 tests: Improve partial_compare output. 2015-11-12 19:04:37 +01:00
Daniel Schadt
30e2afb59d mhtml: reduce test flakiness
Waiting for "All assets downloaded" may lead to race conditions when
the output file is read before qute wrote it, so the test fails.
2015-11-12 13:17:10 +01:00
Florian Bruhin
1f3df64fe4 bdd: Add some first tests for :paste. 2015-11-11 22:38:43 +01:00
Florian Bruhin
3680f01576 Switch to pytest 2.8.
Closes #1077.

There were two issues:

- Paths for coverage.py suddenly were absolute instead of relative, so we strip
  the common base part if that happens.

  /home/florian/proj/qutebrowser/git/qutebrowser/browser/cookies.py has 100%
  coverage but is not in perfect_files!
  /home/florian/proj/qutebrowser/git/qutebrowser/browser/http.py has 100%
  coverage but is not in perfect_files!
  [...]

- There was an io.UnsupportedOperationError in test_check_coverage.py because
  of pytest-faulthandler, so we just don't load that in the subprocess.
2015-11-11 20:57:47 +01:00
Florian Bruhin
416cfaf002 tests: Switch from pytest-capturelog to catchlog. 2015-11-11 19:57:03 +01:00
Florian Bruhin
6bd45bbf24 tests: Add some code for MHTML integration tests. 2015-11-11 09:01:05 +01:00
Florian Bruhin
7cddd52b2d Merge branch 'download-page' of https://github.com/Kingdread/qutebrowser into Kingdread-download-page 2015-11-10 22:39:07 +01:00
Florian Bruhin
d99f9a3a20 Improve :set error messages. 2015-11-10 22:09:36 +01:00
Florian Bruhin
54e2cea460 Fix some corner cases with :set. 2015-11-10 21:27:42 +01:00
Florian Bruhin
a26e99f004 bdd: Add some tests for :set. 2015-11-10 21:07:49 +01:00
Florian Bruhin
128465f12b Add some more tests for :set-cmd-text. 2015-11-10 19:22:13 +01:00
Florian Bruhin
250f0e7410 Merge branch 'test-browser-cache-more' of https://github.com/lamarpavel/qutebrowser into lamarpavel-test-browser-cache-more 2015-11-10 18:57:28 +01:00
Florian Bruhin
d71618031d bdd: Decrease timeouts if not on CI. 2015-11-10 09:24:47 +01:00
Florian Bruhin
ada4b669bc tests: Strip [2s ago] markers from log messages. 2015-11-10 09:23:37 +01:00
Florian Bruhin
e1c6cd6c6d tests: Skip test_file for PyQIODevice on OS X.
Those seem to cause a hang on Travis on OS X sometimes.
2015-11-10 08:55:31 +01:00
Florian Bruhin
dc3bfb5eb4 bdd: Print ignored lines in testprocess. 2015-11-10 08:47:29 +01:00
Florian Bruhin
6b4dbad15b bdd: Wait until request is done for hints.feature. 2015-11-10 08:22:06 +01:00