Debian Codegraph @

issue.features/issue0216.feature

raw
1 @issue
2 Feature: Issue #216: ANSI escape sequences are used while using --wip option
3
4 . ENSURE THAT:
5 . * Coloring is disabled when --wip option is used.
6 . * In addition, no colouring is used when using --show-skipped option
7 . * Undefined step snippets are not "colored".
8
9 @setup
10 Scenario: Feature Setup
11 Given a new working directory
12 And a file named "behave.ini" with:
13 """
14 [behave]
15 default_format = pretty
16 show_skipped = false
17 show_timings = false
18 """
19 And a file named "features/steps/use_behave4cmd_steps.py" with:
20 """
21 import behave4cmd0.passing_steps
22 import behave4cmd0.failing_steps
23 import behave4cmd0.note_steps
24 """
25 And a file named "features/steps/ansi_steps.py" with:
26 """
27 from behave import step, then
28 from behave4cmd0.command_steps import step_command_output_should_not_contain_text
29
30 @then(u'the command output should not contain any ANSI escape sequences')
31 def step_command_ouput_should_not_contain_ansi_sequences(context):
32 CSI = u"\x1b[" #< ANSI CONTROL SEQUENCE INTRODUCER (CSI).
33 step_command_output_should_not_contain_text(context, CSI)
34 """
35 And a file named "features/scenario_with_undefined_steps.feature" with:
36 """
37 Feature:
38
39 @wip
40 Scenario: Alice
41 Given a step passes
42 When a step is undefined
43 Then a step passes
44
45 @foo
46 Scenario: Bob
47 When another step is undefined
48 """
49
50
51 Scenario: When using --wip, coloring is disabled
52 When I run "behave --wip features"
53 Then it should fail with:
54 """
55 0 features passed, 1 failed, 0 skipped
56 0 scenarios passed, 1 failed, 0 skipped, 1 untested
57 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested
58 """
59 And the command output should contain:
60 """
61 Scenario: Alice
62 Given a step passes ... passed
63 When a step is undefined ... undefined
64 """
65 But the command output should not contain any ANSI escape sequences
66 And note that "the plain formatter is used as default formatter"
67
68
69 Scenario: When using --wip and --show-skipped, coloring is disabled
70 When I run "behave --wip --show-skipped features"
71 Then it should fail with:
72 """
73 0 features passed, 1 failed, 0 skipped
74 0 scenarios passed, 1 failed, 0 skipped, 1 untested
75 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested
76 """
77 And the command output should contain:
78 """
79 Scenario: Alice
80 Given a step passes ... passed
81 When a step is undefined ... undefined
82 """
83 But the command output should not contain any ANSI escape sequences
84 And note that "the plain formatter is used as default formatter"
85
86
87 Scenario: When using --wip and --format, coloring is disabled
88 When I run "behave --wip -f pretty features"
89 Then it should fail with:
90 """
91 0 features passed, 1 failed, 0 skipped
92 0 scenarios passed, 1 failed, 0 skipped, 1 untested
93 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested
94 """
95 And the command output should contain:
96 """
97 Feature: # features/scenario_with_undefined_steps.feature:1
98
99 @wip
100 Scenario: Alice # features/scenario_with_undefined_steps.feature:4
101 Given a step passes # ../behave4cmd0/passing_steps.py:23
102 When a step is undefined # None
103 Then a step passes # None
104 """
105 But the command output should not contain any ANSI escape sequences
106 And note that "the plain formatter is overridden on command-line"
107 And note that "the coloring mode is disabled"
108
109
110 Scenario: When using --wip and --color, coloring is disabled
111 When I run "behave --wip -f pretty --color features"
112 Then it should fail with:
113 """
114 0 features passed, 1 failed, 0 skipped
115 0 scenarios passed, 1 failed, 0 skipped, 1 untested
116 1 step passed, 0 failed, 1 skipped, 1 undefined, 1 untested
117 """
118 And the command output should contain:
119 """
120 Feature: # features/scenario_with_undefined_steps.feature:1
121
122 @wip
123 Scenario: Alice # features/scenario_with_undefined_steps.feature:4
124 Given a step passes # ../behave4cmd0/passing_steps.py:23
125 When a step is undefined # None
126 Then a step passes # None
127 """
128 But the command output should not contain any ANSI escape sequences
129 And note that "the coloring mode is overridden by the wip mode"