summaryrefslogtreecommitdiff
path: root/tests/end2end/features/hints.feature
blob: ddf42132f77865e222446e620937fa75794724ce (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
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
Feature: Using hints

    # https://bugreports.qt.io/browse/QTBUG-58381
    Background:
        Given I clean up open tabs

    Scenario: Using :hint-follow outside of hint mode (issue 1105)
        When I run :hint-follow
        Then the error "hint-follow: This command is only allowed in hint mode, not normal." should be shown

    Scenario: Using :hint-follow with an invalid index.
        When I open data/hints/html/simple.html
        And I hint with args "links normal" and follow xyz
        Then the error "No hint xyz!" should be shown

    Scenario: Using :hint with invalid mode.
        When I run :hint --mode=foobar
        Then the error "Invalid mode: Invalid value 'foobar' - valid values: number, letter, word" should be shown

    Scenario: Switching tab between :hint and start_cb (issue 3892)
        When I open data/hints/html/simple.html
        And I open data/hints/html/simple.html in a new tab
        And I run :hint ;; tab-prev
        And I wait for regex "hints: .*|Current tab changed \(\d* -> \d*\) before _start_cb is run\." in the log
        # 'hints: .*' is logged when _start_cb is called before tab-prev (on
        # qtwebkit, _start_cb is called synchronously)
        And I run :hint-follow a
        Then the error "hint-follow: This command is only allowed in hint mode, not normal." should be shown

    ### Opening in current or new tab

    Scenario: Following a hint and force to open in current tab.
        When I open data/hints/link_blank.html
        And I hint with args "links current" and follow a
        And I wait until data/hello.txt is loaded
        Then the following tabs should be open:
            - data/hello.txt (active)

    Scenario: Following a hint and allow to open in new tab.
        When I open data/hints/link_blank.html
        And I hint with args "links normal" and follow a
        And I wait until data/hello.txt is loaded
        Then the following tabs should be open:
            - data/hints/link_blank.html
            - data/hello.txt

    # https://github.com/qutebrowser/qutebrowser/issues/7842
    @qtwebkit_skip
    Scenario: Following a hint from a local file to a remote origin
        When I open file://(testdata)/hints/link_inject.html?port=(port)
        And I hint with args "links" and follow a
        Then data/hello.txt should be loaded

    Scenario: Following a hint to link with sub-element and force to open in current tab.
        When I open data/hints/link_span.html
        And I hint with args "links current" and follow a
        And I wait until data/hello.txt is loaded
        Then the following tabs should be open:
            - data/hello.txt (active)

    Scenario: Entering and leaving hinting mode (issue 1464)
        When I open data/hints/html/simple.html
        And I hint with args "all"
        And I run :fake-key -g <Esc>
        Then no crash should happen

    Scenario: Using :hint spawn with flags and -- (issue 797)
        When I open data/hints/html/simple.html
        And I hint with args "-- all spawn -v (python-executable) -c ''" and follow a
        Then the message "Command exited successfully. See :process * for details." should be shown

    Scenario: Using :hint spawn with flags (issue 797)
        When I open data/hints/html/simple.html
        And I hint with args "all spawn -v (python-executable) -c ''" and follow a
        Then the message "Command exited successfully. See :process * for details." should be shown

    Scenario: Using :hint spawn with flags and --rapid (issue 797)
        When I open data/hints/html/simple.html
        And I hint with args "--rapid all spawn -v (python-executable) -c ''" and follow a
        Then the message "Command exited successfully. See :process * for details." should be shown

    @posix
    Scenario: Using :hint spawn with flags passed to the command (issue 797)
        When I open data/hints/html/simple.html
        And I hint with args "--rapid all spawn -v echo -e foo" and follow a
        Then the message "Command exited successfully. See :process * for details." should be shown

    Scenario: Using :hint run
        When I open data/hints/html/simple.html
        And I hint with args "all run message-info {hint-url}" and follow a
        Then the message "http://localhost:(port)/data/hello.txt" should be shown

    Scenario: Using :hint fill
        When I open data/hints/html/simple.html
        And I hint with args "all fill :message-info {hint-url}" and follow a
        And I press the key "<Enter>"
        Then the message "http://localhost:(port)/data/hello.txt" should be shown

    @posix
    Scenario: Using :hint userscript
        When I open data/hints/html/simple.html
        And I hint with args "all userscript (testdata)/userscripts/echo_hint_text" and follow a
        Then the message "Follow me!" should be shown

    Scenario: Using :hint userscript with a script which doesn't exist
        When I open data/hints/html/simple.html
        And I hint with args "all userscript (testdata)/does_not_exist" and follow a
        Then the error "Userscript '*' not found" should be shown

    Scenario: Yanking to clipboard
        When I run :debug-set-fake-clipboard
        And I open data/hints/html/simple.html
        And I hint with args "links yank" and follow a
        Then the clipboard should contain "http://localhost:(port)/data/hello.txt"

    Scenario: Yanking to primary selection
        When selection is supported
        And I run :debug-set-fake-clipboard
        And I open data/hints/html/simple.html
        And I hint with args "links yank-primary" and follow a
        Then the primary selection should contain "http://localhost:(port)/data/hello.txt"

    Scenario: Yanking to primary selection without it being supported (#1336)
        When selection is not supported
        And I run :debug-set-fake-clipboard
        And I open data/hints/html/simple.html
        And I hint with args "links yank-primary" and follow a
        Then the clipboard should contain "http://localhost:(port)/data/hello.txt"

    Scenario: Yanking email address to clipboard
        When I run :debug-set-fake-clipboard
        And I open data/email_address.html
        And I hint with args "links yank" and follow a
        Then the clipboard should contain "nobody"

    Scenario: Yanking javascript link to clipboard
        When I run :debug-set-fake-clipboard
        And I open data/hints/html/javascript.html
        And I hint with args "links yank" and follow a
        Then the clipboard should contain "javascript:window.location.href='/data/hello.txt'"

    Scenario: Rapid yanking
        When I run :debug-set-fake-clipboard
        And I open data/hints/rapid.html
        And I hint with args "links yank --rapid"
        And I run :hint-follow a
        And I run :hint-follow s
        And I run :mode-leave
        Then the clipboard should contain "http://localhost:(port)/data/hello.txt(linesep)http://localhost:(port)/data/hello2.txt"

    Scenario: Rapid hinting
        When I open data/hints/rapid.html in a new tab
        And I run :tab-only
        And I hint with args "all tab-bg --rapid"
        And I run :hint-follow a
        And I run :hint-follow s
        And I run :mode-leave
        And I wait until data/hello.txt is loaded
        And I wait until data/hello2.txt is loaded
        # We should check what the active tab is, but for some reason that makes
        # the test flaky
        Then the session should look like:
          windows:
          - tabs:
            - history:
              - url: http://localhost:*/data/hints/rapid.html
            - history:
              - url: http://localhost:*/data/hello.txt
            - history:
              - url: http://localhost:*/data/hello2.txt

    Scenario: Using hint --rapid to hit multiple buttons
        When I open data/hints/buttons.html
        And I hint with args "--rapid"
        And I run :hint-follow s
        And I run :hint-follow d
        And I run :hint-follow f
        Then the javascript message "beep!" should be logged
        And the javascript message "bop!" should be logged
        And the javascript message "boop!" should be logged

    Scenario: Using :hint run with a URL containing spaces
        When I open data/hints/html/with_spaces.html
        And I hint with args "all run message-info {hint-url}" and follow a
        Then the message "http://localhost:(port)/data/hello.txt" should be shown

    Scenario: Hinting inputs without type
        When I open data/hints/input.html
        And I hint with args "inputs" and follow a
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        And I run :mode-leave
        # The actual check is already done above
        Then no crash should happen

    Scenario: Error with invalid hint group
        When I open data/hints/buttons.html
        And I run :hint INVALID_GROUP
        Then the error "Undefined hinting group 'INVALID_GROUP'" should be shown

    Scenario: Custom hint group
        When I open data/hints/custom_group.html
        And I set hints.selectors to {"custom":[".clickable"]}
        And I hint with args "custom" and follow a
        Then the javascript message "beep!" should be logged

    Scenario: Custom hint group with URL pattern
        When I open data/hints/custom_group.html
        And I run :set -tu *://*/data/hints/custom_group.html hints.selectors '{"custom": [".clickable"]}'
        And I hint with args "custom" and follow a
        Then the javascript message "beep!" should be logged

    Scenario: Fallback to global value with URL pattern set
        When I open data/hints/custom_group.html
        And I set hints.selectors to {"custom":[".clickable"]}
        And I run :set -tu *://*/data/hints/custom_group.html hints.selectors '{"other": [".other"]}'
        And I hint with args "custom" and follow a
        Then the javascript message "beep!" should be logged

    @qtwebkit_skip
    Scenario: Invalid custom selector
        When I open data/hints/custom_group.html
        And I set hints.selectors to {"custom":["@"]}
        And I run :hint custom
        Then the error "SyntaxError: Failed to execute 'querySelectorAll' on 'Document': '@' is not a valid selector." should be shown

    # https://github.com/qutebrowser/qutebrowser/issues/1613
    Scenario: Hinting inputs with padding
        When I open data/hints/input.html
        And I hint with args "inputs" and follow s
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        And I run :mode-leave
        # The actual check is already done above
        Then no crash should happen

    Scenario: Hinting with ACE editor
        When I open data/hints/ace/ace.html
        And I hint with args "inputs" and follow a
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        And I run :mode-leave
        # The actual check is already done above
        Then no crash should happen

    Scenario: Hinting Twitter bootstrap checkbox
        When I open data/hints/bootstrap/checkbox.html
        And I hint with args "all" and follow a
        # The actual check is already done above
        Then "No elements found." should not be logged

    Scenario: Clicking input with existing text
        When I open data/hints/input.html
        And I run :click-element id qute-input-existing
        And I wait for "Entering mode KeyMode.insert *" in the log
        And I run :fake-key new
        Then the javascript message "contents: existingnew" should be logged

    ### iframes
    Scenario: Using :hint-follow inside an iframe
        When I open data/hints/iframe.html
        And I wait for "* wrapped loaded" in the log
        And I hint with args "links normal" and follow a
        Then "navigation request: url http://localhost:*/data/hello.txt (current http://localhost:*/data/hints/iframe.html), type link_clicked, *" should be logged

    Scenario: Using :hint-follow inside an iframe button
        When I open data/hints/iframe_button.html
        And I wait for "* wrapped_button loaded" in the log
        And I hint with args "all normal" and follow s
        Then "navigation request: url http://localhost:*/data/hello.txt (current http://localhost:*/data/hints/iframe_button.html), *" should be logged

    Scenario: Hinting inputs in an iframe without type
        When I open data/hints/iframe_input.html
        And I wait for "* input loaded" in the log
        And I hint with args "inputs" and follow a
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        And I run :mode-leave
        # The actual check is already done above
        Then no crash should happen

    Scenario: Using :hint-follow inside a scrolled iframe
        When I open data/hints/iframe_scroll.html
        And I wait for "* simple loaded" in the log
        And I hint with args "all normal" and follow a
        And I run :scroll bottom
        And I hint with args "links normal" and follow a
        Then "navigation request: url http://localhost:*/data/hello2.txt (current http://localhost:*/data/hints/iframe_scroll.html), type link_clicked, *" should be logged

    Scenario: Opening a link inside a specific iframe
        When I open data/hints/iframe_target.html
        And I hint with args "links normal" and follow a
        Then "navigation request: url http://localhost:*/data/hello.txt (current *), type link_clicked, *" should be logged

    Scenario: Opening a link with specific target frame in a new tab
        When I open data/hints/iframe_target.html
        And I run :tab-only
        And I hint with args "links tab" and follow s
        And I wait until data/hello2.txt is loaded
        Then the following tabs should be open:
            - data/hints/iframe_target.html (active)
            - data/hello2.txt

    Scenario: Clicking on iframe with :hint all current
        When I open data/hints/iframe.html
        And I wait for "* wrapped loaded" in the log
        And I hint with args "all current" and follow a
        Then no crash should happen

    Scenario: No error when hinting ranged input in frames
        When I open data/hints/issue3711_frame.html
        And I wait for "* issue3711 loaded" in the log
        And I hint with args "all current" and follow a
        Then no crash should happen

    ### hints.auto_follow.timeout

    @not_mac @flaky
    Scenario: Ignoring key presses after auto-following hints
        When I set hints.auto_follow_timeout to 1000
        And I set hints.mode to number
        And I run :bind , message-error "This error message was triggered via a keybinding which should have been inhibited"
        And I open data/hints/html/simple.html
        And I hint with args "all"
        And I press the key "f"
        And I wait until data/hello.txt is loaded
        And I press the key ","
        # Waiting here so we don't affect the next test
        And I wait for "NormalKeyParser for mode normal: Releasing inhibition state of normal mode." in the log
        Then "NormalKeyParser for mode normal: Ignoring key ',', because the normal mode is currently inhibited." should be logged

    Scenario: Turning off auto_follow_timeout
        When I set hints.auto_follow_timeout to 0
        And I set hints.mode to number
        And I run :bind , message-info "Keypress worked!"
        And I open data/hints/html/simple.html
        And I hint with args "all"
        And I press the key "f"
        And I wait until data/hello.txt is loaded
        And I press the key ","
        Then the message "Keypress worked!" should be shown

    ### Word hints

    Scenario: Hinting with a too short dictionary
        When I open data/hints/short_dict.html
        And I set hints.mode to word
        # Test letter fallback
        And I hint with args "all" and follow d
        Then the error "Not enough words in the dictionary." should be shown
        And data/numbers/5.txt should be loaded

    Scenario: Dictionary file does not exist
        When I open data/hints/html/simple.html
        And I set hints.dictionary to no_words
        And I set hints.mode to word
        And I run :hint
        And I wait for "hints: *" in the log
        And I press the key "a"
        Then the error "Word hints requires reading the file at *" should be shown
        And data/hello.txt should be loaded

    ### Number hint mode

    # https://github.com/qutebrowser/qutebrowser/issues/308
    Scenario: Renumbering hints when filtering
        When I open data/hints/number.html
        And I set hints.mode to number
        And I hint with args "all"
        And I press the key "s"
        And I wait for "Filtering hints on 's'" in the log
        And I run :hint-follow 1
        Then data/numbers/7.txt should be loaded

    # https://github.com/qutebrowser/qutebrowser/issues/576
    @qtwebengine_flaky
    Scenario: Keeping hint filter in rapid mode
        When I open data/hints/number.html
        And I set hints.mode to number
        And I hint with args "all tab-bg --rapid"
        And I press the key "t"
        And I run :hint-follow 0
        And I run :hint-follow 1
        Then data/numbers/2.txt should be loaded
        And data/numbers/3.txt should be loaded

    # https://github.com/qutebrowser/qutebrowser/issues/1186
    Scenario: Keeping hints filter when using backspace
        When I open data/hints/issue1186.html
        And I set hints.mode to number
        And I hint with args "all"
        And I press the key "x"
        And I press the key "0"
        And I press the key "<Backspace>"
        And I run :hint-follow 11
        Then the error "No hint 11!" should be shown

    # https://github.com/qutebrowser/qutebrowser/issues/674#issuecomment-165096744
    Scenario: Multi-word matching
        When I open data/hints/number.html
        And I set hints.mode to number
        And I set hints.auto_follow to unique-match
        And I set hints.auto_follow_timeout to 0
        And I hint with args "all"
        And I press the keys "ten p"
        Then data/numbers/11.txt should be loaded

    Scenario: Scattering is ignored with number hints
        When I open data/hints/number.html
        And I set hints.mode to number
        And I set hints.scatter to true
        And I hint with args "all" and follow 00
        Then data/numbers/1.txt should be loaded

    # https://github.com/qutebrowser/qutebrowser/issues/1559
    Scenario: Filtering all hints in number mode
        When I open data/hints/number.html
        And I set hints.mode to number
        And I hint with args "all"
        And I press the key "2"
        And I wait for "Leaving mode KeyMode.hint (reason: all filtered)" in the log
        Then no crash should happen

    # https://github.com/qutebrowser/qutebrowser/issues/1657
    Scenario: Using rapid number hinting twice
        When I open data/hints/number.html
        And I set hints.mode to number
        And I hint with args "--rapid"
        And I run :mode-leave
        And I hint with args "--rapid" and follow 00
        Then data/numbers/1.txt should be loaded

    Scenario: Changing rapid hint filter after selecting hint
        When I open data/hints/number.html
        And I set hints.mode to number
        And I hint with args "all tab-bg --rapid "
        And I press the key "e"
        And I press the key "2"
        And I press the key "<Backspace>"
        And I press the key "o"
        And I press the key "0"
        Then data/numbers/1.txt should be loaded

    Scenario: Using a specific hints mode
        When I open data/hints/number.html
        And I set hints.mode to letter
        And I hint with args "--mode number all"
        And I press the key "s"
        And I wait for "Filtering hints on 's'" in the log
        And I run :hint-follow 1
        Then data/numbers/7.txt should be loaded

    ### hints.leave_on_load
    Scenario: Leaving hint mode on reload
        When I set hints.leave_on_load to true
        And I open data/hints/html/wrapped.html
        And I hint with args "all"
        And I run :reload
        Then "Leaving mode KeyMode.hint (reason: load started)" should be logged

    Scenario: Leaving hint mode on reload without leave_on_load
        When I set hints.leave_on_load to false
        And I open data/hints/html/simple.html
        And I hint with args "all"
        And I run :reload
        Then "Leaving mode KeyMode.hint (reason: load started)" should not be logged


    ### hints.auto_follow option

    Scenario: Using hints.auto_follow = 'always' in letter mode
        When I open data/hints/html/simple.html
        And I set hints.mode to letter
        And I set hints.auto_follow to always
        And I hint with args "all"
        Then data/hello.txt should be loaded

    # unique-match is actually the same as full-match in letter mode
    Scenario: Using hints.auto_follow = 'unique-match' in letter mode
        When I open data/hints/html/simple.html
        And I set hints.mode to letter
        And I set hints.auto_follow to unique-match
        And I hint with args "all"
        And I press the key "a"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'full-match' in letter mode
        When I open data/hints/html/simple.html
        And I set hints.mode to letter
        And I set hints.auto_follow to full-match
        And I hint with args "all"
        And I press the key "a"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'never' without Enter in letter mode
        When I open data/hints/html/simple.html
        And I set hints.mode to letter
        And I set hints.auto_follow to never
        And I hint with args "all"
        And I press the key "a"
        Then "Leaving mode KeyMode.hint (reason: followed)" should not be logged

    Scenario: Using hints.auto_follow = 'never' in letter mode
        When I open data/hints/html/simple.html
        And I set hints.mode to letter
        And I set hints.auto_follow to never
        And I hint with args "all"
        And I press the key "a"
        And I press the key "<Enter>"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'always' in number mode
        When I open data/hints/html/simple.html
        And I set hints.mode to number
        And I set hints.auto_follow to always
        And I hint with args "all"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'unique-match' in number mode
        When I open data/hints/html/simple.html
        And I set hints.mode to number
        And I set hints.auto_follow to unique-match
        And I hint with args "all"
        And I press the key "f"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'full-match' in number mode
        When I open data/hints/html/simple.html
        And I set hints.mode to number
        And I set hints.auto_follow to full-match
        And I hint with args "all"
        # this actually presses the keys one by one
        And I press the key "follow me!"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'never' without Enter in number mode
        When I open data/hints/html/simple.html
        And I set hints.mode to number
        And I set hints.auto_follow to never
        And I hint with args "all"
        # this actually presses the keys one by one
        And I press the key "follow me!"
        Then "Leaving mode KeyMode.hint (reason: followed)" should not be logged

    Scenario: Using hints.auto_follow = 'never' in number mode
        When I open data/hints/html/simple.html
        And I set hints.mode to number
        And I set hints.auto_follow to never
        And I hint with args "all"
        # this actually presses the keys one by one
        And I press the key "follow me!"
        And I press the key "<Enter>"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'always' in word mode
        When I open data/hints/html/simple.html
        And I set hints.mode to word
        And I set hints.auto_follow to always
        And I hint with args "all"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'unique-match' in word mode
        When I open data/hints/html/simple.html
        And I set hints.mode to word
        And I set hints.auto_follow to unique-match
        And I hint with args "all"
        # the link gets "hello" as the hint
        And I press the key "h"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'full-match' in word mode
        When I open data/hints/html/simple.html
        And I set hints.mode to word
        And I set hints.auto_follow to full-match
        And I hint with args "all"
        # this actually presses the keys one by one
        And I press the key "hello"
        Then data/hello.txt should be loaded

    Scenario: Using hints.auto_follow = 'never' without Enter in word mode
        When I open data/hints/html/simple.html
        And I set hints.mode to word
        And I set hints.auto_follow to never
        And I hint with args "all"
        # this actually presses the keys one by one
        And I press the key "hello"
        Then "Leaving mode KeyMode.hint (reason: followed)" should not be logged

    Scenario: Using hints.auto_follow = 'never' in word mode
        When I open data/hints/html/simple.html
        And I set hints.mode to word
        And I set hints.auto_follow to never
        And I hint with args "all"
        # this actually presses the keys one by one
        And I press the key "hello"
        And I press the key "<Enter>"
        Then data/hello.txt should be loaded

    ## Other

    Scenario: Using --first with normal links
        When I open data/hints/html/simple.html
        And I hint with args "all --first"
        Then data/hello.txt should be loaded

    Scenario: Using --first with inputs
        When I open data/hints/input.html
        And I hint with args "inputs --first"
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        # ensure we clicked the first element
        And I run :jseval console.log(document.activeElement.id == "qute-input");
        And I run :mode-leave
        Then the javascript message "true" should be logged

    Scenario: Hinting contenteditable inputs
        When I open data/hints/input.html
        And I hint with args "inputs" and follow f
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        And I run :mode-leave
        # The actual check is already done above
        Then no crash should happen

    Scenario: Deleting a simple target
        When I open data/hints/html/simple.html
        And I hint with args "all delete" and follow a
        And I run :hint
        Then the error "No elements found." should be shown

    Scenario: Statusbar text when entering hint mode from other mode
        When I open data/hints/html/simple.html
        And I run :mode-enter insert
        And I hint with args "all"
        And I run :debug-pyeval objreg.get('main-window', window='current', scope='window').status.txt.text()
        # Changing tabs will leave hint mode
        And I wait until qute://pyeval/ is loaded
        Then the page should contain the plaintext "'Follow hint...'"

    Scenario: Hinting an input after undoing a tab close
        When I open about:blank
        And I open data/hints/link_input.html in a new tab
        And I run :tab-close
        And I run :undo
        And I wait until data/hints/link_input.html is loaded
        And I run :click-element id qute-input-existing
        And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log
        And I run :fake-key -g something
        Then the javascript message "contents: existingsomething" should be logged