Commit Graph

2168 Commits

Author SHA1 Message Date
Philipp Albrecht d5faeef14c Rename :edit-command to :cmd-edit
Group commands related to commands/commandline by prefixing them with `cmd-`. In this
case we additionally renamed the command slightly to fit better with the `cmd-` prefix.
2023-08-11 09:02:17 +02:00
Philipp Albrecht 86925b58cb Rename :repeat-command to :cmd-repeat-last
Group commands related to commands/commandline by prefixing them with `cmd-`. In this
case we additionally renamed the command slightly to fit better with the `cmd-` prefix.
2023-08-11 09:02:12 +02:00
Philipp Albrecht f354d3ab91 Rename :run-with-count to :cmd-run-with-count
Group commands related to commands/commandline by prefixing them with `cmd-`.
2023-08-11 09:02:08 +02:00
Philipp Albrecht 20de484de5 Rename :set-cmd-text to :cmd-set-text
Group commands related to commands/commandline by prefixing them with `cmd-`. In this
case renaming the command slightly was a better fit.
2023-08-11 09:02:02 +02:00
Philipp Albrecht 80b4d2f243 Rename :later to :cmd-later
Group commands related to commands/commandline by prefixing them with `cmd-`.
2023-08-11 09:02:01 +02:00
Philipp Albrecht 2fe4864b78 Rename :repeat to :cmd-repeat
Grouping commands related to commands/commandline by prefixing them with `cmd-`.
2023-08-11 09:00:27 +02:00
Florian Bruhin fc843f3944 Fix lint/tests 2023-08-10 16:53:52 +02:00
Florian Bruhin 8defe1ae44 Require user interaction for hints on qute:// pages
With Qt 6.3+, user interaction is required to navigate outside of qute:// from a
qute:// page.

Fixes #7815

See #7220 - should be revisited once we have a qute-bookmarks:// instead where
we can adjust permissions when registering the URL handler.
2023-08-10 15:30:34 +02:00
Florian Bruhin 0b200207dd Add --all to :{quick,book}mark-del
Needed mostly for urlmarks BDD tests so they can clear things between tests.
Hopefully with --all, this won't be accidentally triggered by users.

Preparation for #7815
2023-08-10 15:30:26 +02:00
Florian Bruhin 9e21e2e86b tests: Handle PermissionError for waitpid in test_restart
While not documented that way:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/cwait?view=msvc-170

It looks like that Windows sometimes sets errno to EACCES here (causing a
PermissionError):

>           os.waitpid(pid, 0)  # pid, options... positional-only :(
E           PermissionError: [Errno 13] Permission denied

I have no idea why it happens, but it results in flaky tests on CI.
We aren't particularly interested in this (we just want to make sure the process
is cleaned up before the next test runs...), so let's just ignore this.
2023-08-10 13:25:26 +02:00
Florian Bruhin 7bf5abbc69 Add a test for :restart 2023-07-23 16:32:49 +02:00
Florian Bruhin e909f57f4f Fix lint/tests 2023-07-23 14:10:10 +02:00
Florian Bruhin a537ac3e49 reuse: Replace last copyright texts 2023-07-23 12:59:11 +02:00
Florian Bruhin 3eb826f664 reuse: Update remaining copyright texts
git ls-files | \
    xargs sed -Ei 's/Copyright [0-9]{4}(-[0-9]{4}) ([^<]*)<([^>]*)>/SPDX-FileCopyrightText: \2<\3>/'
2023-07-23 12:52:01 +02:00
Florian Bruhin 0718b25796 reuse: Initial copyright text update for myself
git ls-files | \
    xargs sed -Ei 's/Copyright [0-9]{4}(-[0-9]{4}) Florian Bruhin \(The Compiler\) <mail@qutebrowser\.org>/SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org>/'
2023-07-23 12:49:05 +02:00
Florian Bruhin b2aaba6043 reuse: Adjust most license headers
git ls-files | xargs grep -l "is free software"  | xargs reuse annotate --license="GPL-3.0-or-later" --skip-unrecognised
2023-07-23 12:11:07 +02:00
Florian Bruhin 9330e9fd91 Fix funny remaining master branch reference 2023-07-23 12:08:22 +02:00
Florian Bruhin ec34865168 Move master branch references to main
Closes #7097
2023-07-23 11:38:19 +02:00
Philipp Albrecht e3a58e84c6 Don't crash on --logfilter 2023-07-20 15:09:48 +02:00
Philipp Albrecht 45f6cf01c3 Don't show warning when jumping to next/prev without matches 2023-07-05 11:16:55 +02:00
Philipp Albrecht d9e8b638bf Remove vim modelines
We're deprecating vim modelines in favor of `.editorconfig`.

Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:

```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```

Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:

```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
2023-06-30 11:03:06 +02:00
Florian Bruhin 5fa878c7d1 py38: Run modified pyupgrade
Modified to leave f-strings alone for now, and also not do some other
stuff we should do separately:

    diff --git i/pyupgrade/_main.py w/pyupgrade/_main.py
    index 4292174..37547b3 100644
    --- i/pyupgrade/_main.py
    +++ w/pyupgrade/_main.py
    @@ -294,7 +294,8 @@ def _fix_tokens(contents_text: str) -> str:
                    token.utf8_byte_offset == 0 and
                    token.line < 3 and
                    token.name == 'COMMENT' and
    -                tokenize.cookie_re.match(token.src)
    +                tokenize.cookie_re.match(token.src) and
    +                False
            ):
                del tokens[i]
                assert tokens[i].name == 'NL', tokens[i].name
    diff --git i/pyupgrade/_plugins/fstrings.py w/pyupgrade/_plugins/fstrings.py
    index e648075..eb44c0c 100644
    --- i/pyupgrade/_plugins/fstrings.py
    +++ w/pyupgrade/_plugins/fstrings.py
    @@ -88,7 +88,7 @@ def _format_params(call: ast.Call) -> set[str]:
        return params

    -@register(ast.Call)
    +# @register(ast.Call)
    def visit_Call(
            state: State,
            node: ast.Call,
    diff --git i/pyupgrade/_plugins/open_mode.py w/pyupgrade/_plugins/open_mode.py
    index a20b95c..0388781 100644
    --- i/pyupgrade/_plugins/open_mode.py
    +++ w/pyupgrade/_plugins/open_mode.py
    @@ -28,7 +28,7 @@ def _permute(*args: str) -> tuple[str, ...]:
        return tuple(''.join(p) for s in args for p in itertools.permutations(s))

    -MODE_REMOVE = frozenset(_permute('U', 'r', 'rU', 'rt'))
    +MODE_REMOVE = frozenset(_permute('U', 'rU', 'rt'))
    MODE_REPLACE_R = frozenset(_permute('Ub'))
    MODE_REMOVE_T = frozenset(_plus(_permute('at', 'rt', 'wt', 'xt')))
    MODE_REMOVE_U = frozenset(_permute('rUb'))

Then run with:

    git ls-files | grep -E '(\.py|misc/userscripts)' | xargs ~/tmp/pyupgrade/.venv/bin/pyupgrade --py38-plus

And manually reverted some changes (e.g. it picking up bash userscripts)
2023-06-26 14:39:54 +02:00
Florian Bruhin 93c7fdd60c Initial Python 3.7 drop 2023-06-26 14:39:54 +02:00
Florian Bruhin 9e9b57772e tests: Resurrect :print --pdf test 2023-06-26 13:50:19 +02:00
Florian Bruhin e15223211c Fix :print --pdf with subdirectories
Fixes #5160
2023-06-26 13:50:19 +02:00
Florian Bruhin 036af85199 Revert "Work around Python 3.12 test issues"
Fixed with newest PyQt snapshot.
This reverts commit c62e9aba5b.
2023-06-25 21:48:12 +02:00
Florian Bruhin c62e9aba5b Work around Python 3.12 test issues
See #7727
2023-06-09 20:06:40 +02:00
Florian Bruhin e70f5b0318 Merge branch 'process-message-improvements' 2023-05-31 12:23:33 +02:00
Florian Bruhin 68e61a239d ci: Ignore spurious QPainter messages 2023-05-31 12:08:10 +02:00
Florian Bruhin 58436a2955 Fix lint/tests 2023-05-29 13:56:04 +02:00
Florian Bruhin 3e4d021070 tests: Fix relative URL for caret test
Similar issue as with ab7245732e
2023-04-07 15:45:20 +02:00
Florian Bruhin 54026a3217 tests: Ignore another Qt 6.5 debug message
See https://github.com/qutebrowser/qutebrowser/issues/7624
2023-04-06 22:55:53 +02:00
Florian Bruhin fd4217ffd2 tests: Make download error more forgiving
For unknown reasons, on nightly CI we now get TWO errors:

<qutebrowser.browser.webkit.certificateerror.CertificateErrorWrapper errors=['NoPeerCertificate', 'SelfSignedCertificate'] string='The peer did not present any certificate\nThe certificate is self-signed, and untrusted'>
2023-03-29 15:15:11 +02:00
toofar c5803587c1 tests: Add text content to another HTML file
I saw this test fail on windows at some point with what looked like the
same issue. (Couldn't find an element to click.)

ref; #7621
2023-03-25 18:38:27 +13:00
toofar cb0b51c094 tests: wait for flaky iframes to load via JS
TL;DR: I think I stabilized a couple of hinting iframe tests and applied
that change to all the iframe usages in the end2end tests in the hopes
that it would resolve some other flaky tests.

I was facing some tests that hinted elements in iframes failing
intermittently recently. They were most consistently failing on the
windows runner. This is similar to the trend described in the comment
linked from #1525.

The tests failing recently where:

    tests (py39-pyqt515, windows-2019, 3.9)
    test_using_hintfollow_inside_an_iframe
    test_using_hintfollow_inside_an_iframe_button

    tests (py311-pyqt515, ubuntu-20.04, 3.11)
    test_using_hintfollow_inside_an_iframe
    test_using_hintfollow_inside_an_iframe_button

They are failing because hints don't get generated for the elements in
the iframe. I can see hints do get generated for the iframe itself
though.
Examining the logs in 5.15 it seems that there is a
`cur_load_finished(True) (tab *)` log line after we run :hint. I suspect
that this is the load finished signal for the iframe.
I attempted to change the bdd open_path function to wait for the current
message it's looking for and then additionally look for that
cur_load_finished signal, but then it starts failing locally when the
iframe load signal actually comes before the parent frame one. Just
looking for the cur_load_finished signal itself also always found it
immediately ("already found"), probably from the parent frame.

So instead of trying to deal with that indeterminate ordering or
trying to change the signals to say what frame they are coming from, I
added javascript to all the pages used in iframes that run on load, and
changed all the tests to watch for log messages from the JS.

It's not the most maintainable solution, perhaps if we generated our
test files with jinja we could have some "subframe loaded" boilerplate,
get a message to log from a query param, look at metadata from test
files for the open_path checking etc.

I then searched for all the iframe usages in the test data and applied
that change to all of those files and all the tests that used them. A
few of those tests also had `flaky` annotations on them. I removed those
annotations for now in the hopes that there were affected by the same
problem. And that I actually managed to work around it correctly.

ref: #7621
2023-03-25 18:37:58 +13:00
Florian Bruhin fe6687f2ea tests: Stabilize "Hinting an input after undoing a tab close"
Without this wait, the test is flaky, because sometimes the keys are pressed
before qutebrowser has entered insert mode.

When running:

    tox -e py311-pyqt64 -- tests/end2end/features/test_hints_bdd.py -k undoing --count 100

around 30% of the runs, we get:

============================== :click-element id qute-input-existing ==============================

[...]

----> Waiting for 'command called: *' in the log
[...]
17:56:54.042 DEBUG    commands   command:run:549 Calling qutebrowser.components.misccommands.click_element(<qutebrowser.browser.webengine.webenginetab.WebEngineTab tab_id=197 url='http://localhost:50977/data/hints/link_input.html'>, 'id', 'qute-input-existing', target=<ClickTarget.normal: 1>, force_event=False, select_first=False)
17:56:54.043 DEBUG    ipc        ipc:_get_socket:373 In _get_socket with None socket!
----> found it

============================== :fake-key -g something ==============================

[...]

----> Waiting for '[*] contents: existingsomething' in the log
17:56:54.062 DEBUG    modes      modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.111 DEBUG    modes      modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.112 DEBUG    modes      modeman:_handle_keypress:290 got keypress in mode KeyMode.normal - delegating to <qutebrowser.keyinput.modeparsers.NormalKeyParser>
[...]
17:56:54.113 DEBUG    commands   command:run:535 command called: quickmark-save
[...]
17:56:54.143 DEBUG    webview    webenginetab:_js_cb_single:766 Got element from JS: {'attributes': {'id': 'qute-input-existing', 'value': 'existing'}, 'caret_position': 0, 'class_name': '', 'id': 0, 'is_content_editable': False, 'outer_xml': '<input id="qute-input-existing" value="existing">', 'rects': [{'bottom': 143, 'height': 21, 'left': 8, 'right': 166, 'top': 122, 'width': 158}], 'tag_name': 'INPUT', 'text': '', 'value': 'existing'}
17:56:54.143 DEBUG    webelem    webelem:click:422 Clicking <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'> with click_target ClickTarget.normal, force_event False
17:56:54.143 DEBUG    webelem    webelem:is_editable:257 Checking if element is editable: <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'>
17:56:54.143 DEBUG    webelem    webelem:click:434 Clicking via JS focus()
17:56:54.144 DEBUG    webelem    webelem:is_editable:257 Checking if element is editable: <qutebrowser.browser.webengine.webengineelem.WebEngineElement html='<input id="qute-input-existing" value="existing">'>
17:56:54.144 DEBUG    modes      modeman:enter:366 Entering mode KeyMode.insert (reason: clicking input)

With the change, the test passes 100/100 times.
2023-03-23 18:10:22 +01:00
Florian Bruhin 0510ffcfa9 tests: Remove before_first_request for webserver_sub_ssl
This was first introduced in adbdfcbad3,
most likely because we got logging from the built-in Werkzeug webserver.

It doesn't seem to be needed anymore, possibly since
41c4ee3e2f where we started using CherryPy
for the SSL server too.

This should fix nighly bleeding tests, because the before_first_request
decorator got removed in Flask:

https://github.com/pallets/flask/pull/4621
https://github.com/pallets/flask/pull/4995
2023-03-20 17:23:55 +01:00
toofar 294e73660c Re-focus tabs created from :undo
There's some weird issue with Qt6.4 and 6.5 where a webengine view gets
its widget swapped out when it gets history deserialized into it. While
it's swapping widgets it has no so the focus gets passed to some other
widget should never even have focus.

There's probably more comprehensive ways we could handle this, by
overriding the WebEngineView layout, or by overriding focusNextPrevChild
on the parent to put out own logic into the "child is going, pass focus
to parent" logic chain.

But all that seems like a bit too much of a headache for this very
focussed issue. We want the new tab to get focus, so lets re-focus it.
Technically we could just focus the last tab that we open, if we are
undoing multiple, but the existing logic is to open each of them in turn
as foreground tabs and this reinforces that.

Closes: #7623
2023-03-19 13:23:18 +13:00
toofar cb9f3fa141 tests: skip special URL deserializing tests on win
Not sure why its failing on windows, but it only really needs to run in
one environment anyway.
Previously this was using chrome://gpu but that was failing on CI due to
it invoking some vulkan stuff the didn't work without a GPU. I changed
it to chrome://sandbox/ for no good reason, but it seems to be working
fine on ubuntu at least.

Follow up to 151d808940
2023-03-18 19:13:26 +13:00
toofar c55f899c83 tests: add some text to another test HTML file
This one is for 6.5. Interesting that it was fine on 6.4.

I haven't gone and added text to all the test file because I'm hoping
it'll be something that upstream addresses in short order. So I'm only
adding text to files used by failing tests.

See d413b87c3f #7621 and #7624
2023-03-18 17:32:48 +13:00
toofar fa70b4a319 tests: ignore new blink "message rejected" log 2023-03-18 17:29:25 +13:00
toofar 151d808940 change "special url" in tests to avoid vulkan error
On GH actions I'm seeing an "unexpected line" failure around creating a
vulkan context when loading chrome://gpu

    ERROR tests/end2end/features/test_tabs_bdd.py::test_cloning_a_tab_with_a_special_url - end2end.fixtures.testprocess.InvalidLine:
    1829
    Error: vkCreateInstance failed with VK_ERROR_INCOMPATIBLE_DRIVER
    1830
        at CheckVkSuccessImpl (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/VulkanError.cpp:88)
    1831
        at CreateVkInstance (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:360)
    1832
        at Initialize (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:235)
    1833
        at Create (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:165)
    1834
        at operator() (../../../3rdparty/chromium/third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp:420)

I'm not sure its actually failing the test, we are just seeing the error
in the logs and flagging it.
Instead of adding the logs to an ignore list I'm going to switch the
page we use so that if the error comes up for real we'll be sure to see
the logs.
2023-03-18 16:47:12 +13:00
toofar d413b87c3f Add some text to test HTML pages.
With 6.4 and 6.5 it looks like pages without text on them only render
after a delay (on the order of hundreds of milliseconds).

ref: #7621
2023-03-18 16:47:12 +13:00
toofar 856fe781a1 Merge remote-tracking branch 'upstream/qt6-v2' into master-qt6 2023-03-18 16:24:58 +13:00
Florian Bruhin 4793070db3 Merge branch 'qt6-v2' into master-qt6 2023-03-17 20:30:13 +01:00
Florian Bruhin 9b7348a880 Qt 6.5: Always use new dark mode values for newer Qt's
I don't quite understand why the value changed from #00000 to #121212
there with Qt 6.3, but it looks like the change is here to stay.

Instead of keeping #000000 the default and adding an override for every
new Qt release, let's just switch over and add an override for the old
versions (5.15 and 6.2), so this won't break again for every new release.

See #7624
2023-03-17 17:27:37 +01:00
Florian Bruhin 2d45f6f002 tests: Ignore more Qt 6.5 / debug build messages
See #7624
2023-03-17 17:27:29 +01:00
Florian Bruhin 6e48c9f1a9 Revert "lint: add stacklevel kwarg to warnings"
This reverts commit 47be6f3aeb.

This doesn't really make sense in test files, as the warning would point
inside some internal pytest code, which is not helpful.

Instead, let's just disable the corresponding flake8 warning in tests.
2023-03-14 11:57:24 +01:00
toofar 47be6f3aeb lint: add stacklevel kwarg to warnings
flake8-bugbear B028 No explicit stacklevel keyword argument found. The
warn method from the warnings module uses a stacklevel of 1 by default.
This will only show a stack trace for the line on which the warn method
is called. It is therefore recommended to use a stacklevel of 2 or
greater to provide more information to the user.

Semgrep helped:

    semgrep --lang=py -e 'warnings.warn($ARG)' --replacement 'warnings.warn($ARG, stacklevel=2)' $FILES -a
    semgrep --lang=py -e 'warnings.warn($ARG1, $ARG2)' --replacement 'warnings.warn($ARG1, $ARG2, stacklevel=2)' $FILES -a

Although it did lose the f-string on one of them.
2023-02-26 13:39:35 +13:00
toofar ce134c9662 lint: superfluous-parens and useless-suppression
Unnecessary parens after '=' keyword
2023-02-06 19:50:22 +13:00
toofar ff8dbc4580 lint: broad-exception-raised
Mostly pretty lazy fixes. Most of the places in the tests we were
already matching on error message, a couple of places we weren't. The
tick-tock one was the only one that wasn't being used right where it was
raised.

Some of them I just changed to RuntimeError because it was shorter than
adding the pylint directive.
2023-02-06 18:53:56 +13:00
Florian Bruhin 0941c59c3b tests: Ignore another spurious Chromium error 2022-12-13 09:43:08 +01:00
Florian Bruhin b4d32e04f4 Merge branch 'master' into qt6-v2 2022-12-13 09:05:32 +01:00
Florian Bruhin 725ed95d8a tests: Fix downloads.feature flakiness
The "Answering a question for a cancelled download" test was flaky,
due to the preceding PDF.js test sometimes not waiting properly for its
download to finish: "I wait until the download is finished" waited for
the initial PDF download above (which causes PDF.js to open), but not
for the real download after clicking the save button.

See #5390

TODO: Cherry-pick to master?
2022-11-24 14:56:52 +01:00
Florian Bruhin e11f899b41 tests: Ignore new QtWebEngine 6.4 message
See #7314
2022-11-24 14:19:38 +01:00
Florian Bruhin f6e4ba3d6f Make skipping broken PDF.js work properly
Fixup for c7ea2f705f
See #7135
2022-11-24 14:12:38 +01:00
toofar 2d66466194 Merge branch 'master' into qt6-v2
Just a few conflicts around CI and dependencies.
2022-11-20 15:48:00 +13: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 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
Florian Bruhin 87f58a30b7 Fix half-finished test
(cherry picked from commit 40125ca73b)
2022-08-26 22:32:10 +02:00
Florian Bruhin 40125ca73b Fix half-finished test 2022-08-23 22:21:40 +02:00
Florian Bruhin 815374c6b6 js: Handle stylesheets in cross-origin frames gracefully
Otherwise the exception gets shown since the recent message change.

(cherry picked from commit 73e30e4738)
2022-08-23 20:10:57 +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 496c14bc9e quteprocess: Add --qute-delay-start
Allows for some rudimentary debugging of subprocesses.
2022-08-23 18:31:42 +02:00
Florian Bruhin d31b2e2016 Qt 6.4: Adjust dark mode tests
See #7314 and #6097
2022-08-23 18:31:42 +02:00
Florian Bruhin 68f01b9072 Qt 6.4: Ignore new Chromium cert errors in tests
See #7314
2022-08-23 18:31:42 +02:00
Florian Bruhin a7e6a3a178 Avoid deprecated QProcess.pid()
processId() got introduced in Qt 5.3

FIXME: pick to master?
2022-08-23 18:31:42 +02:00
Florian Bruhin 76456e6bd9 tests: Ignore another Chromium line 2022-08-23 18:31:42 +02:00
Florian Bruhin 07434241ef Reintroduce skipped tests 2022-08-23 18:31:42 +02:00
Florian Bruhin 769ef6859f Adjust some fixme comments 2022-08-23 18:31:42 +02:00
Florian Bruhin 344fcb6918 Ignore additional chromium message
See https://github.com/qutebrowser/qutebrowser/runs/6658849317?check_suite_focus=true
2022-08-23 18:31:41 +02:00
Florian Bruhin 80961cee6b lint: Fix flake8 whitespace issues 2022-08-23 18:31:41 +02:00
Florian Bruhin e658ce6acf lint: Remove unused imports
Via autoflake and git add -p
2022-08-23 18:31:41 +02:00
Florian Bruhin c7ea2f705f tests: Skip broken PDF.js installations
See #7135

TODO: cherry-pick to master?
2022-08-23 18:31:41 +02:00
Florian Bruhin ee7b283afb Fix sandboxing tests on Flatpak
See https://github.com/flathub/org.qutebrowser.qutebrowser/issues/193

TODO: Cherry-pick to master?
2022-08-23 18:31:41 +02:00
Florian Bruhin ef486aa263 Remove unneeded old log ignores 2022-08-23 18:31:41 +02:00
Florian Bruhin e4bc609ff4 Update dark mode tests for Qt 6 and ARM
Thanks to tinywrkb for running them on Flatpak infrastructure!
2022-08-23 18:31:41 +02:00
Florian Bruhin 29d1096e8e Adjust test_preferred_colorscheme_with_dark_mode for Qt 6 2022-08-23 18:31:41 +02:00
Florian Bruhin 634cbc2d5f Adjust dark mode tests for Qt 6 2022-08-23 18:31:41 +02:00
Florian Bruhin 81a67a9201 Adjust referrer handling for Qt 6
As suspected in a comment, ReducedReferrerGranularity does not exist anymore
with Chromium 90, and neither does an option for getting the full referrer back:

https://chromium-review.googlesource.com/c/chromium/src/+/2545444
https://bugs.chromium.org/p/chromium/issues/detail?id=1150018
2022-08-23 18:31:41 +02:00
Florian Bruhin 473f048041 downloads: Bump up maximum redirects
TODO: Cherry-pick to master?
TODO: Changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin 59922dfe4e Delete empty files after download errors
It's debatable whether we should keep non-empty files, but surely empty
ones are useless.

TODO: Add changelog entry
TODO: Pick to master?
2022-08-23 18:31:41 +02:00
Florian Bruhin 4812c8e30e Add a test for insecure download redirects
TODO: Pick to master?
TODO: Changelog entry
2022-08-23 18:31:41 +02:00
Florian Bruhin 556d6cbdc2 Let Qt handle QtNetwork redirects
With Qt 6, the default changed to Qt handling network redirects instead of us
doing so manually. This seems like a good thing, so instead of setting the
redirect policy back to QNetworkRequest.RedirectPolicy.ManualRedirectPolicy,
let's just let Qt handle everything.

By default, Qt allows 50 redirects before giving up. That seems a tad much, so
we set it back to our former default.

This change comes with a few changes in behavior:

- Redirects to the same URL now fail (too many redirects) rather than being
  ignored. I'm not sure how the previous behavior was useful. We added it in the
  initial implemetation in 6856c49be9 (later
  refactored a bit in 70e390a2e8) and added a test
  in d13f88f0ac. But it doesn't make sense...

- We use QNetworkRequest.RedirectPolicy.NoLessSafeRedirectPolicy (no HTTPS ->
  HTTP redirects allowed), while the former behavior didn't validate redirects
  at all. Interestingly enough, I can't get Chromium to error out in that case
  for downloads (though I only tried on localhost with a self-signed
  certificate). However, it seems like a reasonable default.
  Test will be added in a follow-up commit.

- Partially downloaded files aren't deleted anymore on a "too many redirect"
  error. This should be solved in a more generic way, will do so in a follow-up
  commit.

TODO: Pick to master?

Fixes #2679.
2022-08-23 18:31:41 +02:00
Florian Bruhin 76514547cf qt6 tests: Update ignored messages
On Qt 6.3: 'ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.'
2022-08-23 18:31:41 +02:00
Florian Bruhin c5a51eb0bc Drop Qt < 5.15
Fixes #7091

TODO: Add changelog
2022-08-23 18:31:41 +02:00
Florian Bruhin deb21acdeb qt6 tests: Fix remaining PyQt5 references 2022-08-23 18:31:40 +02:00
Florian Bruhin d387b1a108 tests: Adjust most imports 2022-08-23 18:31:40 +02:00
Florian Bruhin 236371cb1d Fix up various webkit/webengine imports 2022-08-23 18:31:40 +02:00
Florian Bruhin 0877fb0d78 Run scripts/dev/rewrite_enums.py 2022-08-23 18:31:38 +02:00
Florian Bruhin d47cfd99d7 Run scripts/dev/rewrite_qt_imports.sh 2022-08-23 18:09:11 +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 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 ec2dcfce9e Add content.javascript.log_messages.excludes
Fixes #7342
2022-08-15 15:07:24 +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
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 db7bc2c6ff Add tests for :session-save --no-history 2022-06-14 13:31:26 +02:00
Florian Bruhin 27ca9af77f Add test for :session-save with --no-history 2022-06-14 13:28:43 +02:00
Florian Bruhin 70697b8d97 tests: Make it possible to pass flags when saving session 2022-06-14 13:25:11 +02:00
Florian Bruhin 2cb20dbf5b Skip test broken on QtWebKit
(cherry picked from commit d01dd9be07bd1591b1ecda298a2bf84b41ea280c)
2022-06-13 21:46:49 +02:00
Florian Bruhin bf045f7ec7 Add a helper dataclass for find flags
When e.g. doing:
- '?foo' (search with reverse=True -> FindBackwards)
- 'N' (prev_result -> no FindBackwards)
- 'n' (next_result -> FindBackwards again)

we need to take a copy of the flags so that we can temporarily clear
FindBackwards when pressing 'N'.

Relevant history:

- We originally did int(self._flags) in
  d450257485.
- In f0da508c21, we used
  QWebPage.FindFlags(int(self._flags)) instead.
- With 97bdcb8e674c8ff27ab92448effef263880ab3aa (picked from
  c349fbd180) we instead do:
  flags = QWebEnginePage.FindFlag(self._flags)

Using FindFlag instead of FindFlags seemed to work fine with PyQt6 and
enum.Flag. With PyQt5, however, later clearing a flag bit ends up with us
getting 0 as an integer, thus losing the type information about this being a
FindFlag instance, and resulting in a TypeError when calling into Qt.

We could use FindFlags() with PyQt 6 but FindFlag() with PyQt 5 to copy the
original flags, but that's getting rather cumbersome. Instead, let's have a
helper dataclass of bools, do away with the bit-twiddling, and only convert it
to a Qt flags when we actually need them. This solves the copying issue nicely,
and also makes the code a lot nicer.

Finally, this also adds a test case which fails when the flags are mutated in
place instead of copied.

We could do the same kind of change for QtWebKit as well, but given that it's
somewhat dead - and perhaps more importantly, won't run with Qt 6 - let's not
bother. To not break the end2end tests with QtWebKit, the output still is the
same as before.

(cherry picked from commit 96a0cc39512753445bc7a01b218b2f1290819ddd)
2022-06-13 18:40:08 +02:00
Florian Bruhin e15bda307e search: Split navigation/search callbacks
This way, we can move more logic (checking wrapping, etc.) into the API,
thus making the commands much more simple and stateless.
2022-06-13 18:40:08 +02:00
Florian Bruhin 583354d524 Merge remote-tracking branch 'origin/pr/6670' into dev 2022-06-13 15:47:31 +02:00
Florian Bruhin fc17602f79 Add test for using :prompt-fileselect-external on wrong prompt 2022-06-13 14:37:27 +02:00
Florian Bruhin 435e880477 Fix test 2022-06-13 14:25:03 +02:00
Florian Bruhin fe2a5529e6 Merge remote-tracking branch 'origin/pr/7003' 2022-06-13 14:06:51 +02:00
Florian Bruhin 85b867fe8d Merge remote-tracking branch 'origin/pr/7096' 2022-06-13 12:34:33 +02:00
Florian Bruhin 5e2fe7924e Apply MathML darkmode workaround for display math
See e.g. https://en.wikipedia.org/wiki/Gradient#General_coordinates
2022-05-12 10:10:49 +02:00
Florian Bruhin a84ecfb80a Display close matches for invalid commands 2022-05-09 11:48:41 +02:00
Florian Bruhin 3e9203b829 tests: Update bs4 argument name 2022-04-11 10:29:44 +02:00
Nicholas Schwab d1bc60edb8 Adapte errors on click-element to filter. 2022-04-08 14:28:17 +02:00
Nicholas Schwab 39dbf2266f Remove duplicate value in error message for invalid point. 2022-04-08 14:25:07 +02:00
Nicholas Schwab bf562a74fa Added missing Then in test case for click-element. 2022-04-08 14:05:16 +02:00
Axel Dahlberg 55303587b8 test(download) no folder chosen 2022-04-08 09:27:26 +02:00
Nicholas Schwab 709592b46a Adapted expected errors in end2end test for click-element. 2022-04-06 20:09:03 +02:00
Axel Dahlberg bf34f18f09 style(prompt) fix 2022-04-06 16:06:08 +02:00
Axel Dahlberg 6411db1228 test(downloads) fix fixture replacements 2022-04-06 15:54:30 +02:00
Axel Dahlberg 6462133477
Apply suggestions from code review
Co-authored-by: Florian Bruhin <me@the-compiler.org>
2022-04-06 15:38:35 +02:00
Florian Bruhin 96425c93bf Merge remote-tracking branch 'origin/pr/7103' 2022-04-05 12:14:53 +02:00
Jimmy e9ed6456fd Load icons via importlib.resources
The PyQt resources system is gone in 6.2 and deprecated before that. This
should be the last usage of it.

Switches icons to be read with `utils.resources.read_file_binary()` in
`notification.py` (fallback desktop notification icon) and `app.py` (icon for
the desktop window).

importlib only loads resources under a package, so the icons are moved under
the `qutebrowser/` directory.

Closes: #6062
2022-04-04 18:03:54 +12:00
Jimmy 060e4fbf80 Drop python3.6 support.
Commits for dropping 3.5 support to copy from:

c245b7d855ccd "Initial drop of Python 3.5"
ccdfb44b85 "Drop support for Python 3.6.0"

Anything needed to update regarding OS version support in
doc/install.asciidoc?
TODO: remove 3.6/7 annotations in requirements files and
  rebuild

workflows: not sure I updated it right (run 5.12 with 3.7, same 18.04 OS) but
18.04 seems to have 3.7 on it too so it should work. It'll all change when we
drop <5.15 anyway. Not sure what the minimum ubuntu version will be going
forward.

Regarding mimetype overrides (ebb3046822) the doctring says they can all go
in 3.7 but .h5 is still missing on py39, not sure if we should care.

There are a bunch of old(?) warning messages still ignored in tests/end2end/fixtures/quteprocess.py.
2022-04-04 12:08:19 +12:00
Florian Bruhin bd8c940320 Simplify some syntax
Found via pyupgrade
2022-04-03 12:18:09 +02:00
Nicholas Schwab eb1e49c468 Fixed spaces at line end. 2022-04-01 20:45:16 +02:00
Nicholas Schwab 93e548eccf Added tests for click-element focused. 2022-04-01 20:32:21 +02:00
Nicholas Schwab 061542808b Added some tests for click-element with position filter. 2022-04-01 20:27:07 +02:00
Nicholas Schwab 2c0470d098 Add tests for click-element with CSS filter. 2022-04-01 20:27:07 +02:00
Nicholas Schwab 53b87f024c Adapt tests to new error output. 2022-04-01 20:27:07 +02:00
Axel Dahlberg 3656345076 test(downloads) wip test for external fileselect 2022-03-31 17:30:17 +02:00
Florian Bruhin 735ec65865 pylint: Work around Python 3.10 pathlib issue
See https://github.com/PyCQA/pylint/issues/5783
2022-03-29 18:11:32 +02:00
Jimmy 6341154aeb Skip debucachestats test on python < 3.9
Refactor the magic tag creation thing to add python version checking support.
Makes `_check_version()` support checking plain tuples to so that I don't have
to copy the operator dict.

Now most of the branches of the if/else are the same, meh.
2022-03-26 16:06:42 +13:00
Florian Bruhin b8c2c8d381 Simplify socket usage 2022-03-14 11:27:41 +01:00
Florian Bruhin 1a737b8bc1 tests: Catch async ERR_INVALID_URL 2022-03-07 14:24:43 +01:00
Florian Bruhin 7f1d92b596 Fix sandboxing test on Qt 5.12/QtWebKit/Windows 2022-03-06 23:05:13 +01:00
Florian Bruhin 2e5eab3dcc Fix lint 2022-03-06 22:56:50 +01:00
Florian Bruhin 44e00c5992 Handle missing support in sandbox test 2022-03-04 09:44:29 +01:00
Florian Bruhin 941627d778 Refactor tests to use new sandbox setting 2022-03-04 09:39:06 +01:00
Florian Bruhin 8fe1de2fdc Add qt.chromium.sandboxing setting and sandboxing test 2022-03-03 21:16:04 +01:00
Axel Dahlberg caaa6b6fda feat(tabbedbrowser) add option to select mode based on url pattern 2022-02-19 12:32:28 +01:00
Florian Bruhin 9c4169c7b7 tests: Remove some unused imports 2022-02-11 13:12:43 +01:00
Florian Bruhin 02f331b89c tests: Update webserver started regex
Needed for webserver_sub_ssl.py with bleeding edge CI as it excludes the trailing slash, probably recent Flask/Werkzeug change.
2022-01-29 09:37:53 +01:00
Florian Bruhin 9ce7b48f46 Merge remote-tracking branch 'origin/pr/6626' 2022-01-05 16:33:20 +01:00
Florian Bruhin f4714a9300 Use flake8-pytest-style 2022-01-04 10:30:24 +01:00
Florian Bruhin 26d308d95d pylint: Enable docparams checker 2021-12-03 13:36:20 +01:00
Florian Bruhin b84d68e8ee pylint: Enable for_any_all extension 2021-12-03 12:04:59 +01:00
Florian Bruhin 100e87ff0e pylint: Remove now-useless suppressions 2021-12-02 17:43:45 +01:00
Florian Bruhin ed2342a430 pylint: Handle consider-using-with 2021-12-02 17:30:47 +01:00
Florian Bruhin aef42047b7 Add hint test for tabindex-negative 2021-12-01 21:35:39 +01:00
Florian Bruhin 470fede771 tests: Move invisible.html to hints/html 2021-12-01 17:21:31 +01:00
Florian Bruhin 546caffcba Merge remote-tracking branch 'origin/pr/6798' 2021-12-01 16:44:55 +01:00
Florian Bruhin 568b1e253a Merge remote-tracking branch 'origin/pr/6796' 2021-11-22 18:05:36 +01:00
Tim Gadanidis 73aed03a7f Skip failing tests on Windows 2021-11-22 11:32:43 -05:00
Tim Gadanidis a50f6dc2ea Add tests for closing last tab when giving/taking 2021-11-21 00:00:22 -05:00
Florian Bruhin 4ace7502c5 Update docs/changelog 2021-11-13 19:04:45 +01:00
Florian Bruhin 60f281eb30 Merge remote-tracking branch 'origin/pr/6810' 2021-11-13 19:01:54 +01:00
harish3124 f0757198c0 Fix Tests 2021-11-11 15:50:07 +05:30
harish3124 b2bddd9f39 Added Tests and Docs 📰 2021-11-11 15:27:05 +05:30
Philipp Albrecht 7fcfb9b635 Enable overriding of backend auto-detection
One can override the auto-detection mechanism by passing
the backend via --qute-bdd-backend=<backend> or by setting the
environment variable QUTE_BDD_BACKEND=<backend>.
2021-11-05 15:50:41 +01:00
Tim Gadanidis 087c84c0d5 Fix back-to-forward test search direction test
Test originally expected "Baz" instead of "baz", which is what should
actually be found if starting at the bottom and then searching forward
(wrapping around).
2021-11-04 17:15:17 -04:00
Tim Gadanidis 437141ddea Test resetting direction on duplicate searches 2021-11-04 16:10:53 -04:00
Tim Gadanidis 4899cf269e Update duplicate search test 2021-11-02 12:16:07 -04:00
Charlotte Van Petegem 6121673c1a
Switch to tab when clicking on notification 2021-10-09 14:00:30 +02:00
Nicholas Boyd Isacsson 1892831255 Try to fix :tab-clone --private test 2021-09-10 17:19:11 +02:00
Nicholas Boyd Isacsson 2e0549fe9f Update test cases for :tab-clone --private 2021-09-10 15:53:54 +02:00
phesch 57f0155fa0 Match counter: fix lints, implement suggestions 2021-09-08 21:19:32 +02:00
Florian Bruhin d0ae710f66 tests: Ignore some more Chromium outputs 2021-07-13 18:14:25 +02:00
Florian Bruhin 2047218361 Revert "Fix enum stringification for Python 3.10 a7+"
This reverts commit e2c5fe6262.
See https://mail.python.org/archives/list/python-dev@python.org/thread/ZMC67QA2JVQJSWSFWRS6IM6ZX4EK277G/#LSTMFAPSPD3BGZ4D6HQFODXZVB3PLYKF
2021-07-12 16:03:41 +02:00
Florian Bruhin 631c8d43a3 tests: Ignore another Chromium message 2021-06-24 23:37:51 +02:00
Florian Bruhin 714df8a15f More history test stabilization 2021-06-24 20:41:15 +02:00
Florian Bruhin 1dddbe697e tests: Speculatively stabilize history tests
If we're not waiting for the async INSERT in the SQL database, it can happen
that :debug-dump-history gets called before the history entry was addeded to the
actual database.

See #5390
2021-06-15 16:53:58 +02:00
Florian Bruhin 83fb5fef86 Fix prefers_reduced_motion on Windows
See #6530
2021-06-09 11:08:04 +02:00
Florian Bruhin 96149c7e28 Add content.prefers_reduced_motion
Closes #6530
2021-06-09 10:22:17 +02:00
Florian Bruhin e6261ad92e tests: Fix flakiness in test_invocations.py
We don't need to check the log inside the test, as the quteproc fixture does
that for us anyways.

Also, looks like a new harmless message turned up.
2021-06-07 11:11:45 +02:00
Florian Bruhin b4b65b8cd1 Make dark mode tests work correctly on ARM/aarch64
Fixes #6489
2021-06-01 16:48:04 +02:00
Florian Bruhin 03fa938383 tests: Update import path for pytestqt SignalBlocker 2021-05-29 23:23:08 +02:00
Florian Bruhin 1830f784df Fix tests/lint
We need to set XDG_RUNTIME_DIR properly in the tests so that the log is empty.
2021-05-28 16:50:58 +02:00
Florian Bruhin 40477e826c log: Handle JSONLogger in change_console_formatter
Fixes #6482
2021-05-28 15:46:35 +02:00
Florian Bruhin 7961cf7355 RIP Freenode 2021-05-26 09:34:37 +02:00
Florian Bruhin 468d1f5dc1 tests: Avoid deprecated SSL protocol value
See https://docs.python.org/3.10/whatsnew/3.10.html#ssl
2021-05-05 20:35:43 +02:00
Florian Bruhin 0ee169e497 Fix tests on Windows 2021-04-23 11:10:53 +02:00
Florian Bruhin c7b3559d82 Fix :spawn -u -o
Fixes #6407
2021-04-23 10:42:34 +02:00
Florian Bruhin 908abb6566 notifications: Fix image padding assertion
The underlying Chromium pads images so that scanlines align on 4-byte
boundaries. Thus, with an image size of e.g. 239x239, we'll have 3 bytes
of padding (239 mod 4 = 3; 240 mod 4 = 0).

Fixes #6375
2021-04-09 17:14:26 +02:00
Florian Bruhin e2c5fe6262 Fix enum stringification for Python 3.10 a7+
https://bugs.python.org/issue40066
https://mail.python.org/archives/list/python-dev@python.org/message/CHQW6THTDYNPPFWQ2KDDTUYSAJDCZFNP/
b775106d94
2021-04-08 09:51:16 +02:00
Florian Bruhin c39c66aec4 Simplify pathlib usage in webserver_sub_ssl 2021-04-06 14:00:13 +02:00
Florian Bruhin ac9388fb1b tests: Fix accidental network access
Running :adblock-update also updates ABP lists and thus tries downloading easylist.
2021-03-31 13:10:09 +02:00
Florian Bruhin 545a295cf0 ci: Move test_mkvenv.py to update-dependencies
It requires some time and network access, so no need to run it as part of the automated tests.
2021-03-31 13:10:09 +02:00
Florian Bruhin aea69ff3df tests: Ignore mDNS errors
They happen with data/crashers/webrtc.html in Flatpak and are harmless.
2021-03-31 13:10:09 +02:00
Florian Bruhin 40c72f849d flatpak: Skip download dispatcher tests 2021-03-31 13:10:09 +02:00
Florian Bruhin ca1a204514 notifications: Make test page more human-friendly 2021-03-27 20:54:53 +01:00
Florian Bruhin f1f0dc73df notifications: Add basic tests for message notifications 2021-03-27 15:50:50 +01:00
Florian Bruhin 89ffeeb79d notifications: Include origin 2021-03-27 15:35:25 +01:00