summaryrefslogtreecommitdiff
path: root/tests/end2end/features/qutescheme.feature
blob: 755c103e7961d38fccc666495302ad74d1bdc7f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:

Feature: Special qute:// pages

    Background:
        Given I open about:blank

    # :help

    Scenario: :help without topic
        When I run :tab-only
        And I run :help
        And I wait until qute://help/index.html is loaded
        Then the following tabs should be open:
            - qute://help/index.html (active)

    Scenario: :help with invalid topic
        When I run :help foo
        Then the error "Invalid help topic foo!" should be shown

    Scenario: :help with command
        When the documentation is up to date
        And I run :tab-only
        And I run :help :back
        And I wait until qute://help/commands.html#back is loaded
        Then the following tabs should be open:
            - qute://help/commands.html#back (active)

    Scenario: :help with invalid command
        When I run :help :foo
        Then the error "Invalid command foo!" should be shown

    Scenario: :help with setting
        When the documentation is up to date
        And I run :tab-only
        And I run :help editor.command
        And I wait until qute://help/settings.html#editor.command is loaded
        Then the following tabs should be open:
            - qute://help/settings.html#editor.command (active)

    Scenario: :help with -t
        When I run :tab-only
        And I run :help -t
        And I wait until qute://help/index.html is loaded
        Then the following tabs should be open:
            - about:blank
            - qute://help/index.html (active)

    # https://github.com/qutebrowser/qutebrowser/issues/2513
    Scenario: Opening link with qute:help
        When the documentation is up to date
        And I run :tab-only
        And I open qute:help without waiting
        And I wait for "Changing title for idx 0 to 'qutebrowser help'" in the log
        And I hint with args "links normal" and follow a
        Then qute://help/quickstart.html should be loaded

    Scenario: Opening a link with qute://help
        When the documentation is up to date
        And I run :tab-only
        And I open qute://help without waiting
        And I wait until qute://help/ is loaded
        And I hint with args "links normal" and follow a
        Then qute://help/quickstart.html should be loaded

    Scenario: Opening a link with qute://help/index.html/..
        When the documentation is up to date
        And I open qute://help/index.html/.. without waiting
        Then qute://help/ should be loaded

    Scenario: Opening a link with qute://help/index.html/../
        When the documentation is up to date
        And I open qute://help/index.html/../ without waiting
        Then qute://help/ should be loaded

    Scenario: Opening a link with qute://help/img/
        When the documentation is up to date
        And I open qute://help/img/ without waiting
        Then "*Error while * qute://*" should be logged
        And "* url='qute://help/img'* LoadStatus.error" should be logged

    # :history

    Scenario: :history without arguments
        When I run :tab-only
        And I run :history
        And I wait until qute://history/ is loaded
        Then the following tabs should be open:
            - qute://history/ (active)

    Scenario: :history with -t
        When I run :tab-only
        And I run :history -t
        And I wait until qute://history/ is loaded
        Then the following tabs should be open:
            - about:blank
            - qute://history/ (active)

    # qute://settings

    Scenario: Focusing input fields in qute://settings and entering valid value
        When I set search.ignore_case to never
        And I open qute://settings
        # scroll to the right - the table does not fit in the default screen
        And I run :scroll-to-perc -x 100
        And I run :jseval document.getElementById('input-search.ignore_case').value = ''
        And I run :click-element id input-search.ignore_case
        And I wait for "Entering mode KeyMode.insert *" in the log
        And I press the keys "always"
        And I press the key "<Escape>"
        # an explicit Tab to unfocus the input field seems to stabilize the tests
        And I press the key "<Tab>"
        And I wait for "Config option changed: search.ignore_case *" in the log
        Then the option search.ignore_case should be set to always

    # Sometimes, an unrelated value gets set
    @flaky
    Scenario: Focusing input fields in qute://settings and entering invalid value
        When I open qute://settings
        # scroll to the right - the table does not fit in the default screen
        And I run :scroll-to-perc -x 100
        And I run :jseval document.getElementById('input-search.ignore_case').value = ''
        And I run :click-element id input-search.ignore_case
        And I wait for "Entering mode KeyMode.insert *" in the log
        And I press the keys "foo"
        And I press the key "<Escape>"
        # an explicit Tab to unfocus the input field seems to stabilize the tests
        And I press the key "<Tab>"
        Then "Invalid value 'foo' *" should be logged

    # pdfjs support

    @qtwebengine_skip: pdfjs is not implemented yet
    Scenario: pdfjs is used for pdf files
        Given pdfjs is available
        When I set content.pdfjs to true
        And I open data/misc/test.pdf
        Then the javascript message "PDF * [*] (PDF.js: *)" should be logged

    @qtwebengine_todo: pdfjs is not implemented yet
    Scenario: pdfjs is not used when disabled
        When I set content.pdfjs to false
        And I set downloads.location.prompt to false
        And I open data/misc/test.pdf
        Then "Download test.pdf finished" should be logged

    @qtwebengine_skip: pdfjs is not implemented yet
    Scenario: Downloading a pdf via pdf.js button (issue 1214)
        Given pdfjs is available
        # WORKAROUND to prevent the "Painter ended with 2 saved states" warning
        # Might be related to https://bugreports.qt.io/browse/QTBUG-13524 and
        # a weird interaction with the previous test.
        And I have a fresh instance
        When I set content.pdfjs to true
        And I set downloads.location.suggestion to filename
        And I set downloads.location.prompt to true
        And I open data/misc/test.pdf
        And I wait for "[qute://pdfjs/*] PDF * (PDF.js: *)" in the log
        And I run :jseval document.getElementById("download").click()
        And I wait for "Asking question <qutebrowser.utils.usertypes.Question default='test.pdf' mode=<PromptMode.download: 5> text=* title='Save file to:'>, *" in the log
        And I run :leave-mode
        Then no crash should happen

    # :pyeval

    Scenario: Running :pyeval
        When I run :debug-pyeval 1+1
        And I wait until qute://pyeval/ is loaded
        Then the page should contain the plaintext "2"

    Scenario: Causing exception in :pyeval
        When I run :debug-pyeval 1/0
        And I wait until qute://pyeval/ is loaded
        Then the page should contain the plaintext "ZeroDivisionError"

    Scenario: Running :pyveal with --file using a file that exists as python code
        When I run :debug-pyeval --file (testdata)/misc/pyeval_file.py
        Then the message "Hello World" should be shown
        And "pyeval output: No error" should be logged

    Scenario: Running :pyeval --file using a non existing file
        When I run :debug-pyeval --file nonexistentfile
        Then the error "[Errno 2] No such file or directory: 'nonexistentfile'" should be shown

    Scenario: Running :pyeval with --quiet
        When I run :debug-pyeval --quiet 1+1
        Then "pyeval output: 2" should be logged

    ## :messages

    Scenario: :messages without level
        When I run :message-error the-error-message
        And I run :message-warning the-warning-message
        And I run :message-info the-info-message
        And I run :messages
        Then qute://log/?level=info should be loaded
        And the error "the-error-message" should be shown
        And the warning "the-warning-message" should be shown
        And the page should contain the plaintext "the-error-message"
        And the page should contain the plaintext "the-warning-message"
        And the page should contain the plaintext "the-info-message"

    Scenario: Showing messages of type 'warning' or greater
        When I run :message-error the-error-message
        And I run :message-warning the-warning-message
        And I run :message-info the-info-message
        And I run :messages warning
        Then qute://log/?level=warning should be loaded
        And the error "the-error-message" should be shown
        And the warning "the-warning-message" should be shown
        And the page should contain the plaintext "the-error-message"
        And the page should contain the plaintext "the-warning-message"
        And the page should not contain the plaintext "the-info-message"

    Scenario: Showing messages of type 'info' or greater
        When I run :message-error the-error-message
        And I run :message-warning the-warning-message
        And I run :message-info the-info-message
        And I run :messages info
        Then qute://log/?level=info should be loaded
        And the error "the-error-message" should be shown
        And the warning "the-warning-message" should be shown
        And the page should contain the plaintext "the-error-message"
        And the page should contain the plaintext "the-warning-message"
        And the page should contain the plaintext "the-info-message"

    @qtwebengine_flaky
    Scenario: Showing messages of an invalid level
        When I run :messages cataclysmic
        Then the error "Invalid log level cataclysmic!" should be shown

    Scenario: Using qute://log directly
        When I open qute://log without waiting
        # With Qt 5.9, we don't get a loaded message?
        And I wait for "Changing title for idx * to 'log'" in the log
        Then no crash should happen

    Scenario: Using qute://plainlog directly
        When I open qute://plainlog
        Then no crash should happen

    # :version

    Scenario: Open qute://version
        When I open qute://version
        Then the page should contain the plaintext "Version info"

    # qute://gpl

    Scenario: Open qute://gpl
        When I open qute://gpl
        Then the page should contain the plaintext "GNU GENERAL PUBLIC LICENSE"