-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathcomment-notes.feature
More file actions
162 lines (130 loc) · 5.82 KB
/
comment-notes.feature
File metadata and controls
162 lines (130 loc) · 5.82 KB
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
Feature: Manage WordPress notes
Background:
Given a WP install
@require-wp-6.9
Scenario: Create and list notes
When I run `wp comment create --comment_post_ID=1 --comment_content='This is a note about the block' --comment_author='Editor' --comment_type='note' --porcelain`
Then STDOUT should be a number
And save STDOUT as {NOTE_ID}
When I run `wp comment get {NOTE_ID} --field=comment_type`
Then STDOUT should be:
"""
note
"""
When I run `wp comment list --type=note --post_id=1 --format=ids`
Then STDOUT should be:
"""
{NOTE_ID}
"""
When I run `wp comment list --type=note --post_id=1 --fields=comment_ID,comment_type,comment_content`
Then STDOUT should be a table containing rows:
| comment_ID | comment_type | comment_content |
| {NOTE_ID} | note | This is a note about the block |
@require-wp-6.9
Scenario: Notes are not shown by default in comment list
When I run `wp comment create --comment_post_ID=1 --comment_content='Regular comment' --comment_author='User' --porcelain`
Then save STDOUT as {COMMENT_ID}
When I run `wp comment create --comment_post_ID=1 --comment_content='This is a note' --comment_author='Editor' --comment_type='note' --porcelain`
Then save STDOUT as {NOTE_ID}
When I run `wp comment list --post_id=1 --format=ids`
Then STDOUT should contain:
"""
{COMMENT_ID}
"""
And STDOUT should not contain:
"""
{NOTE_ID}
"""
When I run `wp comment list --type=note --post_id=1 --format=ids`
Then STDOUT should be:
"""
{NOTE_ID}
"""
@require-wp-6.9
Scenario: Reply to a note
When I run `wp comment create --comment_post_ID=1 --comment_content='Initial note' --comment_author='Editor1' --comment_type='note' --porcelain`
Then save STDOUT as {PARENT_NOTE_ID}
When I run `wp comment create --comment_post_ID=1 --comment_content='Reply to note' --comment_author='Editor2' --comment_type='note' --comment_parent={PARENT_NOTE_ID} --porcelain`
Then save STDOUT as {REPLY_NOTE_ID}
When I run `wp comment get {REPLY_NOTE_ID} --field=comment_parent`
Then STDOUT should be:
"""
{PARENT_NOTE_ID}
"""
When I run `wp comment list --type=note --post_id=1 --format=count`
Then STDOUT should be:
"""
2
"""
@require-wp-6.9
Scenario: Resolve a note
When I run `wp comment create --comment_post_ID=1 --comment_content='Note to be resolved' --comment_author='Editor' --comment_type='note' --porcelain`
Then save STDOUT as {NOTE_ID}
When I run `wp comment create --comment_post_ID=1 --comment_content='Resolving' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE_ID} --porcelain`
Then save STDOUT as {RESOLVE_NOTE_ID}
When I run `wp comment meta add {RESOLVE_NOTE_ID} _wp_note_status resolved`
Then STDOUT should contain:
"""
Success: Added custom field.
"""
When I run `wp comment meta get {RESOLVE_NOTE_ID} _wp_note_status`
Then STDOUT should be:
"""
resolved
"""
@require-wp-6.9
Scenario: Reopen a resolved note
When I run `wp comment create --comment_post_ID=1 --comment_content='Note to resolve and reopen' --comment_author='Editor' --comment_type='note' --porcelain`
Then save STDOUT as {NOTE_ID}
When I run `wp comment create --comment_post_ID=1 --comment_content='Resolving' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE_ID} --porcelain`
Then save STDOUT as {RESOLVE_NOTE_ID}
When I run `wp comment meta add {RESOLVE_NOTE_ID} _wp_note_status resolved`
Then STDOUT should contain:
"""
Success: Added custom field.
"""
When I run `wp comment create --comment_post_ID=1 --comment_content='Reopening' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE_ID} --porcelain`
Then save STDOUT as {REOPEN_NOTE_ID}
When I run `wp comment meta add {REOPEN_NOTE_ID} _wp_note_status reopen`
Then STDOUT should contain:
"""
Success: Added custom field.
"""
When I run `wp comment meta get {REOPEN_NOTE_ID} _wp_note_status`
Then STDOUT should be:
"""
reopen
"""
@require-wp-6.9
Scenario: List notes with comment meta
When I run `wp comment create --comment_post_ID=1 --comment_content='First note' --comment_author='Editor' --comment_type='note' --porcelain`
Then save STDOUT as {NOTE1_ID}
When I run `wp comment create --comment_post_ID=1 --comment_content='Resolved note' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE1_ID} --porcelain`
Then save STDOUT as {NOTE2_ID}
When I run `wp comment meta add {NOTE2_ID} _wp_note_status resolved`
Then STDOUT should contain:
"""
Success: Added custom field.
"""
When I run `wp comment meta list {NOTE2_ID} --keys=_wp_note_status`
Then STDOUT should be a table containing rows:
| comment_id | meta_key | meta_value |
| {NOTE2_ID} | _wp_note_status | resolved |
@require-wp-6.9
Scenario: Get notes for multiple posts
When I run `wp post create --post_title='Post 2' --porcelain`
Then save STDOUT as {POST2_ID}
When I run `wp comment create --comment_post_ID=1 --comment_content='Note on post 1' --comment_author='Editor' --comment_type='note' --porcelain`
Then save STDOUT as {NOTE1_ID}
When I run `wp comment create --comment_post_ID={POST2_ID} --comment_content='Note on post 2' --comment_author='Editor' --comment_type='note' --porcelain`
Then save STDOUT as {NOTE2_ID}
When I run `wp comment list --type=note --post_id=1 --format=ids`
Then STDOUT should be:
"""
{NOTE1_ID}
"""
When I run `wp comment list --type=note --post_id={POST2_ID} --format=ids`
Then STDOUT should be:
"""
{NOTE2_ID}
"""