summaryrefslogtreecommitdiff
path: root/tests/end2end/features/spawn.feature
blob: ba2cc7474758496ff299ef248fba56cc264e9bcc (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
# vim: ft=cucumber fileencoding=utf-8 sts=4 sw=4 et:

Feature: :spawn

    Scenario: Running :spawn
        When I run :spawn -v (echo-exe) "Hello"
        Then the message "Command exited successfully." should be shown

    Scenario: Running :spawn with command that does not exist
        When I run :spawn command_does_not_exist127623
        Then the error "Command 'command_does_not_exist127623' failed to start: *" should be shown

    Scenario: Starting a userscript which doesn't exist
        When I run :spawn -u this_does_not_exist
        Then the error "Userscript 'this_does_not_exist' not found in userscript directories *" should be shown

    Scenario: Starting a userscript with absolute path which doesn't exist
        When I run :spawn -u /this_does_not_exist
        Then the error "Userscript '/this_does_not_exist' not found" should be shown

    Scenario: Running :spawn with invalid quoting
        When I run :spawn ""'""
        Then the error "Error while splitting command: No closing quotation" should be shown

    Scenario: Running :spawn with url variable
        When I run :spawn (echo-exe) {url}
        Then "Executing * with args ['about:blank'], userscript=False" should be logged

    Scenario: Running :spawn with url variable in fully encoded format
        When I open data/title with spaces.html
        And I run :spawn (echo-exe) {url}
        Then "Executing * with args ['http://localhost:(port)/data/title%20with%20spaces.html'], userscript=False" should be logged

    Scenario: Running :spawn with url variable in pretty decoded format
        When I open data/title with spaces.html
        And I run :spawn (echo-exe) {url:pretty}
        Then "Executing * with args ['http://localhost:(port)/data/title with spaces.html'], userscript=False" should be logged

    Scenario: Running :spawn with -m
        When I run :spawn -m (echo-exe) Message 1
        Then the message "Message 1" should be shown

    Scenario: Running :spawn with -u -m
        When I run :spawn -u -m (echo-exe) Message 2
        Then the message "Message 2" should be shown

    Scenario: Running :spawn with -u -o
        When I run :spawn -u -o (echo-exe) Message 3
        And I wait for "load status for * url='qute://process/*'>: LoadStatus.success" in the log
        Then the page should contain the plaintext "Message 3"

    @posix
    Scenario: Running :spawn with userscript
        Given I clean up open tabs
        When I open data/hello.txt
        And I run :spawn -u (testdata)/userscripts/open_current_url
        And I wait until data/hello.txt is loaded
        Then the following tabs should be open:
            - data/hello.txt
            - data/hello.txt (active)

    @posix
    Scenario: Running :spawn with userscript and count
        When I run :spawn -u (testdata)/userscripts/hello_if_count with count 5
        Then the message "Count is five!" should be shown

    @posix
    Scenario: Running :spawn with userscript and no count
        When I run :spawn -u (testdata)/userscripts/hello_if_count
        Then the message "No count!" should be shown


    @windows
    Scenario: Running :spawn with userscript on Windows
        Given I clean up open tabs
        When I open data/hello.txt
        And I run :spawn -u (testdata)/userscripts/open_current_url.bat
        And I wait until data/hello.txt is loaded
        Then the following tabs should be open:
            - data/hello.txt
            - data/hello.txt (active)

    @posix
    Scenario: Running :spawn with userscript that expects the stdin getting closed
        When I run :spawn -u (testdata)/userscripts/stdinclose.py
        Then the message "stdin closed" should be shown