|
| 1 | +Feature: Manage WordPress notes |
| 2 | + |
| 3 | + Background: |
| 4 | + Given a WP install |
| 5 | + |
| 6 | + @require-wp-6.9 |
| 7 | + Scenario: Create and list notes |
| 8 | + 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` |
| 9 | + Then STDOUT should be a number |
| 10 | + And save STDOUT as {NOTE_ID} |
| 11 | + |
| 12 | + When I run `wp comment get {NOTE_ID} --field=comment_type` |
| 13 | + Then STDOUT should be: |
| 14 | + """ |
| 15 | + note |
| 16 | + """ |
| 17 | + |
| 18 | + When I run `wp comment list --type=note --post_id=1 --format=ids` |
| 19 | + Then STDOUT should be: |
| 20 | + """ |
| 21 | + {NOTE_ID} |
| 22 | + """ |
| 23 | + |
| 24 | + When I run `wp comment list --type=note --post_id=1 --fields=comment_ID,comment_type,comment_content` |
| 25 | + Then STDOUT should be a table containing rows: |
| 26 | + | comment_ID | comment_type | comment_content | |
| 27 | + | {NOTE_ID} | note | This is a note about the block | |
| 28 | + |
| 29 | + @require-wp-6.9 |
| 30 | + Scenario: Notes are not shown by default in comment list |
| 31 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Regular comment' --comment_author='User' --porcelain` |
| 32 | + Then save STDOUT as {COMMENT_ID} |
| 33 | + |
| 34 | + When I run `wp comment create --comment_post_ID=1 --comment_content='This is a note' --comment_author='Editor' --comment_type='note' --porcelain` |
| 35 | + Then save STDOUT as {NOTE_ID} |
| 36 | + |
| 37 | + When I run `wp comment list --post_id=1 --format=ids` |
| 38 | + Then STDOUT should contain: |
| 39 | + """ |
| 40 | + {COMMENT_ID} |
| 41 | + """ |
| 42 | + And STDOUT should not contain: |
| 43 | + """ |
| 44 | + {NOTE_ID} |
| 45 | + """ |
| 46 | + |
| 47 | + When I run `wp comment list --type=note --post_id=1 --format=ids` |
| 48 | + Then STDOUT should be: |
| 49 | + """ |
| 50 | + {NOTE_ID} |
| 51 | + """ |
| 52 | + |
| 53 | + @require-wp-6.9 |
| 54 | + Scenario: Reply to a note |
| 55 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Initial note' --comment_author='Editor1' --comment_type='note' --porcelain` |
| 56 | + Then save STDOUT as {PARENT_NOTE_ID} |
| 57 | + |
| 58 | + 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` |
| 59 | + Then save STDOUT as {REPLY_NOTE_ID} |
| 60 | + |
| 61 | + When I run `wp comment get {REPLY_NOTE_ID} --field=comment_parent` |
| 62 | + Then STDOUT should be: |
| 63 | + """ |
| 64 | + {PARENT_NOTE_ID} |
| 65 | + """ |
| 66 | + |
| 67 | + When I run `wp comment list --type=note --post_id=1 --format=count` |
| 68 | + Then STDOUT should be: |
| 69 | + """ |
| 70 | + 2 |
| 71 | + """ |
| 72 | + |
| 73 | + @require-wp-6.9 |
| 74 | + Scenario: Resolve a note |
| 75 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Note to be resolved' --comment_author='Editor' --comment_type='note' --porcelain` |
| 76 | + Then save STDOUT as {NOTE_ID} |
| 77 | + |
| 78 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Resolving' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE_ID} --porcelain` |
| 79 | + Then save STDOUT as {RESOLVE_NOTE_ID} |
| 80 | + |
| 81 | + When I run `wp comment meta add {RESOLVE_NOTE_ID} _wp_note_status resolved` |
| 82 | + Then STDOUT should contain: |
| 83 | + """ |
| 84 | + Success: Added custom field. |
| 85 | + """ |
| 86 | + |
| 87 | + When I run `wp comment meta get {RESOLVE_NOTE_ID} _wp_note_status` |
| 88 | + Then STDOUT should be: |
| 89 | + """ |
| 90 | + resolved |
| 91 | + """ |
| 92 | + |
| 93 | + @require-wp-6.9 |
| 94 | + Scenario: Reopen a resolved note |
| 95 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Note to resolve and reopen' --comment_author='Editor' --comment_type='note' --porcelain` |
| 96 | + Then save STDOUT as {NOTE_ID} |
| 97 | + |
| 98 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Resolving' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE_ID} --porcelain` |
| 99 | + Then save STDOUT as {RESOLVE_NOTE_ID} |
| 100 | + |
| 101 | + When I run `wp comment meta add {RESOLVE_NOTE_ID} _wp_note_status resolved` |
| 102 | + Then STDOUT should contain: |
| 103 | + """ |
| 104 | + Success: Added custom field. |
| 105 | + """ |
| 106 | + |
| 107 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Reopening' --comment_author='Editor' --comment_type='note' --comment_parent={NOTE_ID} --porcelain` |
| 108 | + Then save STDOUT as {REOPEN_NOTE_ID} |
| 109 | + |
| 110 | + When I run `wp comment meta add {REOPEN_NOTE_ID} _wp_note_status reopen` |
| 111 | + Then STDOUT should contain: |
| 112 | + """ |
| 113 | + Success: Added custom field. |
| 114 | + """ |
| 115 | + |
| 116 | + When I run `wp comment meta get {REOPEN_NOTE_ID} _wp_note_status` |
| 117 | + Then STDOUT should be: |
| 118 | + """ |
| 119 | + reopen |
| 120 | + """ |
| 121 | + |
| 122 | + @require-wp-6.9 |
| 123 | + Scenario: List notes with comment meta |
| 124 | + When I run `wp comment create --comment_post_ID=1 --comment_content='First note' --comment_author='Editor' --comment_type='note' --porcelain` |
| 125 | + Then save STDOUT as {NOTE1_ID} |
| 126 | + |
| 127 | + 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` |
| 128 | + Then save STDOUT as {NOTE2_ID} |
| 129 | + |
| 130 | + When I run `wp comment meta add {NOTE2_ID} _wp_note_status resolved` |
| 131 | + Then STDOUT should contain: |
| 132 | + """ |
| 133 | + Success: Added custom field. |
| 134 | + """ |
| 135 | + |
| 136 | + When I run `wp comment meta list {NOTE2_ID} --keys=_wp_note_status` |
| 137 | + Then STDOUT should be a table containing rows: |
| 138 | + | comment_id | meta_key | meta_value | |
| 139 | + | {NOTE2_ID} | _wp_note_status | resolved | |
| 140 | + |
| 141 | + @require-wp-6.9 |
| 142 | + Scenario: Get notes for multiple posts |
| 143 | + When I run `wp post create --post_title='Post 2' --porcelain` |
| 144 | + Then save STDOUT as {POST2_ID} |
| 145 | + |
| 146 | + When I run `wp comment create --comment_post_ID=1 --comment_content='Note on post 1' --comment_author='Editor' --comment_type='note' --porcelain` |
| 147 | + Then save STDOUT as {NOTE1_ID} |
| 148 | + |
| 149 | + When I run `wp comment create --comment_post_ID={POST2_ID} --comment_content='Note on post 2' --comment_author='Editor' --comment_type='note' --porcelain` |
| 150 | + Then save STDOUT as {NOTE2_ID} |
| 151 | + |
| 152 | + When I run `wp comment list --type=note --post_id=1 --format=ids` |
| 153 | + Then STDOUT should be: |
| 154 | + """ |
| 155 | + {NOTE1_ID} |
| 156 | + """ |
| 157 | + |
| 158 | + When I run `wp comment list --type=note --post_id={POST2_ID} --format=ids` |
| 159 | + Then STDOUT should be: |
| 160 | + """ |
| 161 | + {NOTE2_ID} |
| 162 | + """ |
0 commit comments