summaryrefslogtreecommitdiff
path: root/tests/end2end/features/caret.feature
blob: 1302a1e6d9ec2657e36325b44ea288bf78d02243 (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
Feature: Caret mode
    In caret mode, the user can select and yank text using the keyboard.

    Background:
        Given I open data/caret.html
        And I run :tab-only
        And I also run :mode-enter caret

    # :yank selection

    Scenario: :yank selection without selection
        When I run :yank selection
        Then the message "Nothing to yank" should be shown

    Scenario: :yank selection message
        When I run :selection-toggle
        And I run :move-to-end-of-word
        And I run :yank selection
        Then the message "3 chars yanked to clipboard" should be shown

    Scenario: :yank selection message with one char
        When I run :selection-toggle
        And I run :move-to-next-char
        And I run :yank selection
        Then the message "1 char yanked to clipboard" should be shown

    Scenario: :yank selection with primary selection
        When selection is supported
        And I run :selection-toggle
        And I run :move-to-end-of-word
        And I run :yank selection --sel
        Then the message "3 chars yanked to primary selection" should be shown
        And the primary selection should contain "one"

    Scenario: :yank selection with --keep
        When I run :selection-toggle
        And I run :move-to-end-of-word
        And I run :yank selection --keep
        And I run :move-to-end-of-word
        And I run :yank selection --keep
        Then the message "3 chars yanked to clipboard" should be shown
        And the message "7 chars yanked to clipboard" should be shown
        And the clipboard should contain "one two"

    # :selection-follow

    Scenario: :selection-follow with --tab (with JS)
        When I set content.javascript.enabled to true
        And I run :tab-only
        And I run :mode-enter caret
        And I run :selection-toggle
        And I run :move-to-end-of-word
        And I run :selection-follow --tab
        Then data/hello.txt should be loaded
        And the following tabs should be open:
            - data/caret.html
            - data/hello.txt (active)

    Scenario: :selection-follow with --tab (without JS)
        When I set content.javascript.enabled to false
        And I run :tab-only
        And I run :mode-enter caret
        And I run :selection-toggle
        And I run :move-to-end-of-word
        And I run :selection-follow --tab
        Then data/hello.txt should be loaded
        And the following tabs should be open:
            - data/caret.html
            - data/hello.txt

    @flaky
    Scenario: :selection-follow with link tabbing (without JS)
        When I set content.javascript.enabled to false
        And I run :mode-leave
        And I run :jseval document.activeElement.blur();
        And I run :fake-key <tab>
        And I run :selection-follow
        Then data/hello.txt should be loaded

    @flaky
    Scenario: :selection-follow with link tabbing (with JS)
        When I set content.javascript.enabled to true
        And I run :mode-leave
        And I run :jseval document.activeElement.blur();
        And I run :fake-key <tab>
        And I run :selection-follow
        Then data/hello.txt should be loaded

    @flaky
    Scenario: :selection-follow with link tabbing in a tab (without JS)
        When I set content.javascript.enabled to false
        And I run :mode-leave
        And I run :jseval document.activeElement.blur();
        And I run :fake-key <tab>
        And I run :selection-follow --tab
        Then data/hello.txt should be loaded

    @flaky
    Scenario: :selection-follow with link tabbing in a tab (with JS)
        When I set content.javascript.enabled to true
        And I run :mode-leave
        And I run :jseval document.activeElement.blur();
        And I run :fake-key <tab>
        And I run :selection-follow --tab
        Then data/hello.txt should be loaded