-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
field.feature
165 lines (151 loc) · 5.58 KB
/
field.feature
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
Feature: Check that FieldTrait works
@api
Scenario: Assert field exists
Given I go to "form/test-form"
Then I see field "field1"
Then I see field "Field 1"
@api
Scenario: Assert field does not exist
Given I go to "test-form"
Then I don't see field "some_random_field"
@api
Scenario Outline: Assert field existence
Given I go to "form/test-form"
Then field "<field>" "<existence>" on the page
Examples:
| field | existence |
| field1 | exists |
| Field 1 | exists |
| field2 | exists |
| Field 2 | exists |
| random_field | not exists |
@api
Scenario Outline: Assert if field is disabled
Given I go to "form/test-form"
Then field "<field>" is "<state>" on the page
Examples:
| field | state |
| field1 | active |
| Field 1 | active |
| field2 | active |
| Field 2 | active |
| field3disabled | disabled |
| Field 3 | disabled |
@api
Scenario Outline: Assert field presence and state
Given I go to "form/test-form"
Then field "<field>" should be "<presence>" on the page and have state "<state>"
Examples:
| field | presence | state |
| field1 | present | active |
| Field 1 | present | active |
| field2 | present | active |
| Field 2 | present | active |
| field3disabled | present | disabled |
| Field 3 | present | disabled |
| field_random | not present | disabled |
| field_random | not present | active |
| field_random | not present | |
@api @javascript
Scenario: Assert fills in form color field with specified id|name|label|value.
Given I visit "/sites/default/files/relative.html"
Then color field "#edit-color-input" value is "#000000"
And I fill color in "#edit-color-input" with "#ffffff"
Then color field "#edit-color-input" value is "#ffffff"
@api @javascript
Scenario: Assert fills in form color field with specified id|name|label|value using an alternate step definition.
Given I visit "/sites/default/files/relative.html"
Then color field "#edit-color-input" value is "#000000"
And I fill color in "#ffffff" for "#edit-color-input"
Then color field "#edit-color-input" value is "#ffffff"
@trait:FieldTrait
Scenario: Assert that negative assertion for "I see field :field" fails with an error
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then I see field "No existing field"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
Form field with id|name|label|value "No existing field" not found.
"""
@trait:FieldTrait
Scenario: Assert that negative assertion for "I don't see field :field" fails with an error
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then I don't see field "Field 1"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
A field "Field 1" appears on this page, but it should not.
"""
@trait:FieldTrait
Scenario: Assert that field does not exist on the page using id, name, label or value.
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then field "Field 1" "does not exist" on the page
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
A field "Field 1" appears on this page, but it should not.
"""
@trait:FieldTrait
Scenario: Assert whether the field has a state.
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then field "field3disabled" is "enabled" on the page
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
A field "field3disabled" should not be disabled, but it is.
"""
@trait:FieldTrait
Scenario: Assert that negative assertion for "field :field1 is :state on the page" fails with an error
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then field "field1" is "disabled" on the page
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
A field "field1" should be disabled, but it is not.
"""
@trait:FieldTrait
Scenario: Assert that negative assertion for "field :field should be :presence on the page and have state :state" fails with an error for existing field
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then field "field1" should be "present" on the page and have state "disabled"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
A field "field1" should be disabled, but it is not.
"""
@trait:FieldTrait
Scenario: Assert that negative assertion for "field :field should be :presence on the page and have state :state" fails with an error for non-existing field
Given some behat configuration
And scenario steps:
"""
Given I go to "form/test-form"
Then field "No existing field" should be "present" on the page and have state "disabled"
"""
When I run "behat --no-colors"
Then it should fail with an error:
"""
Form field with id|name|label|value "No existing field" not found.
"""