Commit Graph

6350 Commits

Author SHA1 Message Date
Florian Bruhin f396c6fe67 tests: Make sure we close history database connections
With pytest main, pytest now reuses temporary directories...
2022-12-06 17:06:56 +01:00
Florian Bruhin 100e654fd7 tests: Replace class-level pytestmark by decorators 2022-11-29 08:56:53 +01:00
Florian Bruhin ce64e5d899 Add a quirk for Array.at
Trivial to polyfill, needed by various pages in the wild,
and only natively available with Qt 6.2.

Closes #7501
Also see #7237 and 726d5e614b
2022-11-29 08:31:05 +01:00
Kian-Meng Ang d77b0fb8a3 Fix typos
Found via `codespell -S *.js -L
technik,gir,nam,ans,wih,wil,ro,nowe,te,datas,qutie,ned,fo,clude,alph,crashers,nd,wasn,cros,ue,possition`

Co-authored-by: Marcel Schilling <marcel.schilling@uni-luebeck.de>
2022-11-19 13:03:39 +08:00
Florian Bruhin 4e39f9a8ce tests: Use snake-case wait_until 2022-11-08 18:27:39 +01:00
Florian Bruhin 6e54962fe4 pylint: Remove now-unneeded suppressions
The recent pytest 7.2 upgrade leads pylint to complain:

    ************* Module unit.browser.test_qutescheme
    tests/unit/browser/test_qutescheme.py:26:0: I0021: Useless suppression of 'no-name-in-module' (useless-suppression)
    tests/unit/browser/test_qutescheme.py:226:0: I0021: Useless suppression of 'no-member' (useless-suppression)

    ************* Module helpers.fixtures
    tests/helpers/fixtures.py:39:0: I0021: Useless suppression of 'no-name-in-module' (useless-suppression)
    tests/helpers/fixtures.py:639:0: I0021: Useless suppression of 'no-member' (useless-suppression)

possibly due to it not being able to infer 'py' anymore with the weird
shenanigans pytest does now?

Also, what weird glitch in the matrix is it that those just happen to be
on lines [2]26 and [6]39 for *both* files? 🤯
2022-11-08 18:27:21 +01:00
Florian Bruhin 2b86f66e48 tests: Try to fix Windows flakiness in userscript runner test 2022-11-08 18:02:57 +01:00
Florian Bruhin 1387c999fa Skip problematic QtWebKit tests with OpenSSL 3
See https://github.com/cherrypy/cheroot/issues/517 and #7467
2022-11-08 16:17:31 +01:00
Florian Bruhin fa62360357 Remove unneeded str
Only needed in Python 3.5 times
2022-09-30 20:23:38 +02:00
Florian Bruhin 31878b4b7b Speculatively stabilize :history-clear tests
See #7415, #5390. Similar to ad429d9552a9f169a1122cb5784424848d4805e2.
2022-09-26 16:06:30 +02:00
toofar 79bb6670d8 bar: Test enabled attribute on progress and backforward
There is now some code in statusbar relying on the enabled attribute
stopping events from being processed (or at least stopping them from
showing the widget again). So add tests to make sure that behaviour
keeps working.

Also split the big test in test_backforward into a couple of smaller
ones and pull some common lines out to a (still clunky) fixture.
2022-09-16 16:51:41 +12:00
Florian Bruhin 038361d8aa Improve error message on unresolved executables
No more confusing 'No program defined'
2022-08-29 09:37:49 +02:00
Florian Bruhin 40125ca73b Fix half-finished test 2022-08-23 22:21:40 +02:00
Florian Bruhin 73e30e4738 js: Handle stylesheets in cross-origin frames gracefully
Otherwise the exception gets shown since the recent message change.
2022-08-23 20:07:53 +02:00
Florian Bruhin 3dd969e731 Merge remote-tracking branch 'origin/pr/7293' 2022-08-23 17:58:09 +02:00
Florian Bruhin a90d2ba580 Remove unused imports 2022-08-22 14:29:14 +02:00
Florian Bruhin 6379553774 Revert "Ignore flask development warnings."
This reverts commit d6b7d51307.

We switched to CherryPy for the SSL server in the previous commit, so
this won't be needed anymore.
2022-08-22 14:21:20 +02:00
Florian Bruhin 41c4ee3e2f tests: Use CherryPy for HTTPS server
Not sure why we didn't do this initially, maybe it wasn't possible: https://webpy.org/cookbook/ssl

This means we don't need to (ab)use the Flask development server anymore.
2022-08-22 14:21:08 +02:00
Florian Bruhin 3f875e3b27 Add --quiet for :back and :forward 2022-08-22 11:44:31 +02:00
Florian Bruhin 9f4e26186e Fix notification unit tests after GetServerInformation was added 2022-08-18 11:42:44 +02:00
Florian Bruhin 55b2fb6c9c
Merge pull request #7344 from qutebrowser/update-dependencies
Update dependencies
2022-08-18 02:24:38 -07:00
Florian Bruhin 62d3a80026 tests: Support GetServerInformation for test notification server
Huge thanks to u/SomethingOfAGirl on Reddit for finding out how to make this work!

See https://www.riverbankcomputing.com/pipermail/pyqt/2021-March/043724.html
2022-08-18 11:09:33 +02:00
toofar d6b7d51307 Ignore flask development warnings.
We used to dodge these by listening on 0.0.0.0. Now they are on to us
and always show the warnings. Running flask in development mode here is
intended, so lets not have the warnings fail the tests.

Ref: https://github.com/pallets/werkzeug/issues/2480
2022-08-18 19:18:09 +12:00
Florian Bruhin 65aa61f33f Fixup content.javascript.log_messages.excludes issues 2022-08-15 18:53:35 +02:00
Florian Bruhin d9e20f6b30 config: Handle config.py errors while updating mutables
Fixes #3580
2022-08-15 18:24:30 +02:00
Florian Bruhin 28f171d1bb config: Properly convert values for list/dict commands
Those commands use the config interface expecting Python objects (via
update_mutables), but we always used the raw user-supplied string as
input.

Thus far, it was very hard to trigger this bug: It would only
trigger with a List or Dict config option, with a value type which does
*not* accept a string type in to_py(). That means:

- List / FlagList / ConfirmQuit / ShellCommand
- Bool / BoolAsk
- Int
- Float
- Dict / Padding

(Notably, Perc, PercOrInt and Regex all *do* accept a string.)

That leaves only a couple of candidates:

- hints.selectors, but that's "no_autoconfig: true"
- bindings.default, ditto
- bindings.commands, but no reason to use :config-dict-* on it,
  especially with fixed keys

Therefore, this got only uncovered now, after adding
content.javascript.log_message.levels, which is a Dict with FlagList
values.

Note that we still don't have any config definition with an affected
List type, thus currently making it impossible to test the changes for
:config-list-{add,remove}.

Also note the adjusted test_{dict,list}_add_invalid_value tests - they
were just plain wrong. The command functions are never going to be
called by a Python object from the user (only with a str).

Finally, test_list_remove_no_value also needed an adjustment because
the value validation now happens *before* the other validation done
by the command.
2022-08-15 18:23:29 +02:00
Florian Bruhin 8eecf3af83 config: Discard prior mutables before applying
If we only clear existing mutables *after* applying, we get into an
inconsistent state if there was an error in one of the config values:

The improper value lingers around in self._mutables, and then gets
returned when get_mutable_obj() (or update_mutables()) gets called the
next time.

Reproducer:

    qutebrowser --debug --temp-basedir \
        ':config-dict-add content.javascript.log_message.levels example.org bla' \
        ':later 1000 config-dict-add content.javascript.log_message.levels example.org bla'

Results in:

    ERROR: Invalid value 'bla' - expected a value of type list but got str.
    ERROR: example.org already exists in content.javascript.log_message - use --replace to overwrite!

Fixes the second part of #7343.

nb: As before, the mutable updating actually gets interrupted by a
failing update, instead of it e.g. collecting all errors but carrying
on. With this change, the remaining updates will thus also be discarded,
but that does not seem to be a problem with how mutables are currently
used. Ideally, we should get rid of the mutable handling entirely
anyways, at least for qutebrowser internal code - see #4344.
2022-08-15 16:15:15 +02:00
Florian Bruhin ec2dcfce9e Add content.javascript.log_messages.excludes
Fixes #7342
2022-08-15 15:07:24 +02:00
Florian Bruhin b9920503db Add utils.match_globs
Needed for the next commit.
2022-08-15 13:55:37 +02:00
Florian Bruhin 418f91dfcd tests: Remove trailing periods in feature files
Breaks after https://github.com/pytest-dev/pytest-bdd/pull/539
2022-07-17 11:51:21 +02:00
Florian Bruhin a16aa959bb tests: Fix broken BDD definition
This happened to work before this commit:
7cd7b40df3

Because the "command" argument was still defined from the previous
"And I run ..." step.
2022-07-05 12:27:06 +02:00
kt programs 389eac1bb3 macOS: fix hide_decoration making window nonresizable
Use PyObjC to call `setWindowMask:` with resizable flag on the
underlying NSWindow.

Fixes #4067
2022-07-05 17:14:05 +08:00
Florian Bruhin dd68a84bc9 Correctly set initial content.{javascript.clipboard,default_encoding}
Those are handled separately from the other settings, but were never initialized
properly in init_settings().

For content.javascript.clipboard, this is a recent regression introduced in
4a6df3a8e8. For content.default_encoding, this has
been around since 2018: 3956f81e73.

Fixes #7281
2022-06-22 11:52:41 +02:00
Florian Bruhin aec6014242 Revert "Add LinkedIn array.at quirk"
This reverts commit 5e0d6dc148.

This seems to have been fixed on LinkedIn's side in the meantime.
Also removes the associated changelog entry.
2022-06-22 09:37:26 +02:00
Florian Bruhin cf58c694e3 notification: Skip on QtWebKit, try 2 2022-06-21 14:57:24 +02:00
Florian Bruhin ce7443219c notification: Skip on QtWebKit 2022-06-21 14:14:03 +02:00
Florian Bruhin 8067c0979f notification: Fix marks in tests 2022-06-21 13:02:05 +02:00
Florian Bruhin 4dc3380cdc notification: Improve error case tests 2022-06-21 12:32:21 +02:00
Florian Bruhin 5f0e3e9877 notification: Add unit tests for error cases
Those require a lot of patching (and other efforts), but it does not
seem possible to write this kind of thing as an integration test:

https://www.riverbankcomputing.com/pipermail/pyqt/2022-June/044733.html
https://www.riverbankcomputing.com/pipermail/pyqt/2022-June/044734.html
2022-06-21 12:29:28 +02:00
Florian Bruhin a7625bf924 notification: Fix wrong return type annotation 2022-06-21 12:29:10 +02:00
Florian Bruhin 124fc717d1 notification: Add PID to DBus test notification service
Fixes #7160
2022-06-21 12:29:06 +02:00
Florian Bruhin 5e0d6dc148 Add LinkedIn array.at quirk
Closes #7237
2022-06-20 17:25:52 +02:00
Florian Bruhin 4df7aedf2b tests: Improve greasemonkey tests 2022-06-20 16:44:24 +02:00
Florian Bruhin 3f4a3efdf1 pylint: remove now unneeded suppressions 2022-06-20 09:07:40 +02:00
Florian Bruhin e5d091bbab greasemonkey: Add some more tests 2022-06-18 15:27:59 +02:00
Florian Bruhin 21419c9ef5 greasemonkey: Don't implicitly load scripts
Needed for #7245 and also seems like cleaner code.
2022-06-17 17:05:17 +02:00
Florian Bruhin 676e016771 Only replace the exact same message
If we have a error message followed by an info message with the same text, they
should both be shown, not replaced automatically.
2022-06-14 17:05:46 +02:00
Florian Bruhin d576a8d88f Don't render messages at Qt rich text by default
Closes #7246
2022-06-14 17:05:40 +02:00
Florian Bruhin 5616a99eff Add a MessageInfo data class
Preparation for #7246
2022-06-14 17:05:23 +02:00
Florian Bruhin db7bc2c6ff Add tests for :session-save --no-history 2022-06-14 13:31:26 +02:00