comments.feature 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. # SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. Feature: comments
  4. Scenario: Creating a comment on a file belonging to myself
  5. Given user "user0" exists
  6. Given As an "user0"
  7. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  8. When "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  9. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  10. And the response should contain a property "oc:parentId" with value "0"
  11. And the response should contain a property "oc:childrenCount" with value "0"
  12. And the response should contain a property "oc:verb" with value "comment"
  13. And the response should contain a property "oc:actorType" with value "users"
  14. And the response should contain a property "oc:objectType" with value "files"
  15. And the response should contain a property "oc:message" with value "My first comment"
  16. And the response should contain a property "oc:actorDisplayName" with value "user0"
  17. And the response should contain only "1" comments
  18. Scenario: Creating a comment on a shared file belonging to another user
  19. Given user "user0" exists
  20. Given user "12345" exists
  21. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  22. Given as "user0" creating a share with
  23. | path | myFileToComment.txt |
  24. | shareWith | 12345 |
  25. | shareType | 0 |
  26. Given user "12345" accepts last share
  27. When "12345" posts a comment with content "A comment from another user" on the file named "/myFileToComment.txt" it should return "201"
  28. Then As "12345" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  29. And the response should contain a property "oc:parentId" with value "0"
  30. And the response should contain a property "oc:childrenCount" with value "0"
  31. And the response should contain a property "oc:verb" with value "comment"
  32. And the response should contain a property "oc:actorType" with value "users"
  33. And the response should contain a property "oc:objectType" with value "files"
  34. And the response should contain a property "oc:message" with value "A comment from another user"
  35. And the response should contain a property "oc:actorDisplayName" with value "12345"
  36. And the response should contain only "1" comments
  37. Scenario: Creating a comment on a non-shared file belonging to another user
  38. Given user "user0" exists
  39. Given user "user1" exists
  40. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  41. Then "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "404"
  42. Scenario: Reading comments on a non-shared file belonging to another user
  43. Given user "user0" exists
  44. Given user "user1" exists
  45. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  46. Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"
  47. Scenario: Deleting my own comments on a file belonging to myself
  48. Given user "user0" exists
  49. Given As an "user0"
  50. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  51. Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  52. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  53. Then the response should contain a property "oc:parentId" with value "0"
  54. Then the response should contain a property "oc:childrenCount" with value "0"
  55. And the response should contain a property "oc:verb" with value "comment"
  56. And the response should contain a property "oc:actorType" with value "users"
  57. And the response should contain a property "oc:objectType" with value "files"
  58. And the response should contain a property "oc:message" with value "My first comment"
  59. And the response should contain a property "oc:actorDisplayName" with value "user0"
  60. And the response should contain only "1" comments
  61. And As "user0" delete the created comment it should return "204"
  62. And As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  63. And the response should contain only "0" comments
  64. Scenario: Deleting my own comments on a file shared by somebody else
  65. Given user "user0" exists
  66. Given user "user1" exists
  67. Given As an "user0"
  68. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  69. Given as "user0" creating a share with
  70. | path | myFileToComment.txt |
  71. | shareWith | user1 |
  72. | shareType | 0 |
  73. And user "user1" accepts last share
  74. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  75. When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  76. Then the response should contain a property "oc:parentId" with value "0"
  77. And the response should contain a property "oc:childrenCount" with value "0"
  78. And the response should contain a property "oc:verb" with value "comment"
  79. And the response should contain a property "oc:actorType" with value "users"
  80. And the response should contain a property "oc:objectType" with value "files"
  81. And the response should contain a property "oc:message" with value "My first comment"
  82. And the response should contain a property "oc:actorDisplayName" with value "user1"
  83. And the response should contain only "1" comments
  84. And As "user1" delete the created comment it should return "204"
  85. And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  86. And the response should contain only "0" comments
  87. Scenario: Deleting my own comments on a file unshared by someone else
  88. Given user "user0" exists
  89. Given user "user1" exists
  90. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  91. Given as "user0" creating a share with
  92. | path | myFileToComment.txt |
  93. | shareWith | user1 |
  94. | shareType | 0 |
  95. And user "user1" accepts last share
  96. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  97. When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  98. Then the response should contain a property "oc:parentId" with value "0"
  99. And the response should contain a property "oc:childrenCount" with value "0"
  100. And the response should contain a property "oc:verb" with value "comment"
  101. And the response should contain a property "oc:actorType" with value "users"
  102. And the response should contain a property "oc:objectType" with value "files"
  103. And the response should contain a property "oc:message" with value "My first comment"
  104. And the response should contain a property "oc:actorDisplayName" with value "user1"
  105. And the response should contain only "1" comments
  106. And As "user0" remove all shares from the file named "/myFileToComment.txt"
  107. And As "user1" delete the created comment it should return "404"
  108. And As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "404"
  109. Scenario: Edit my own comments on a file belonging to myself
  110. Given user "user0" exists
  111. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  112. Given "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  113. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  114. Then the response should contain a property "oc:parentId" with value "0"
  115. And the response should contain a property "oc:childrenCount" with value "0"
  116. And the response should contain a property "oc:verb" with value "comment"
  117. And the response should contain a property "oc:actorType" with value "users"
  118. And the response should contain a property "oc:objectType" with value "files"
  119. And the response should contain a property "oc:message" with value "My first comment"
  120. And the response should contain a property "oc:actorDisplayName" with value "user0"
  121. And the response should contain only "1" comments
  122. When As "user0" edit the last created comment and set text to "My edited comment" it should return "207"
  123. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  124. And the response should contain a property "oc:parentId" with value "0"
  125. And the response should contain a property "oc:childrenCount" with value "0"
  126. And the response should contain a property "oc:verb" with value "comment"
  127. And the response should contain a property "oc:actorType" with value "users"
  128. And the response should contain a property "oc:objectType" with value "files"
  129. And the response should contain a property "oc:message" with value "My edited comment"
  130. And the response should contain a property "oc:actorDisplayName" with value "user0"
  131. Scenario: Edit my own comments on a file shared by someone with me
  132. Given user "user0" exists
  133. Given user "user1" exists
  134. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  135. Given as "user0" creating a share with
  136. | path | myFileToComment.txt |
  137. | shareWith | user1 |
  138. | shareType | 0 |
  139. And user "user1" accepts last share
  140. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  141. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  142. Then the response should contain a property "oc:parentId" with value "0"
  143. And the response should contain a property "oc:childrenCount" with value "0"
  144. And the response should contain a property "oc:verb" with value "comment"
  145. And the response should contain a property "oc:actorType" with value "users"
  146. And the response should contain a property "oc:objectType" with value "files"
  147. And the response should contain a property "oc:message" with value "My first comment"
  148. And the response should contain a property "oc:actorDisplayName" with value "user1"
  149. And the response should contain only "1" comments
  150. Given As "user1" edit the last created comment and set text to "My edited comment" it should return "207"
  151. Then As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  152. And the response should contain a property "oc:parentId" with value "0"
  153. And the response should contain a property "oc:childrenCount" with value "0"
  154. And the response should contain a property "oc:verb" with value "comment"
  155. And the response should contain a property "oc:actorType" with value "users"
  156. And the response should contain a property "oc:objectType" with value "files"
  157. And the response should contain a property "oc:message" with value "My edited comment"
  158. And the response should contain a property "oc:actorDisplayName" with value "user1"
  159. Scenario: Edit my own comments on a file unshared by someone with me
  160. Given user "user0" exists
  161. Given user "user1" exists
  162. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  163. Given as "user0" creating a share with
  164. | path | myFileToComment.txt |
  165. | shareWith | user1 |
  166. | shareType | 0 |
  167. And user "user1" accepts last share
  168. When "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  169. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  170. And the response should contain a property "oc:parentId" with value "0"
  171. And the response should contain a property "oc:childrenCount" with value "0"
  172. And the response should contain a property "oc:verb" with value "comment"
  173. And the response should contain a property "oc:actorType" with value "users"
  174. And the response should contain a property "oc:objectType" with value "files"
  175. And the response should contain a property "oc:message" with value "My first comment"
  176. And the response should contain a property "oc:actorDisplayName" with value "user1"
  177. And the response should contain only "1" comments
  178. And As "user0" remove all shares from the file named "/myFileToComment.txt"
  179. When As "user1" edit the last created comment and set text to "My edited comment" it should return "404"
  180. Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  181. And the response should contain a property "oc:parentId" with value "0"
  182. And the response should contain a property "oc:childrenCount" with value "0"
  183. And the response should contain a property "oc:verb" with value "comment"
  184. And the response should contain a property "oc:actorType" with value "users"
  185. And the response should contain a property "oc:objectType" with value "files"
  186. And the response should contain a property "oc:message" with value "My first comment"
  187. And the response should contain a property "oc:actorDisplayName" with value "user1"
  188. Scenario: Edit comments of other users should not be possible
  189. Given user "user0" exists
  190. Given user "user1" exists
  191. Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  192. Given as "user0" creating a share with
  193. | path | myFileToComment.txt |
  194. | shareWith | user1 |
  195. | shareType | 0 |
  196. And user "user1" accepts last share
  197. Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  198. When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
  199. Then the response should contain a property "oc:parentId" with value "0"
  200. And the response should contain a property "oc:childrenCount" with value "0"
  201. And the response should contain a property "oc:verb" with value "comment"
  202. And the response should contain a property "oc:actorType" with value "users"
  203. And the response should contain a property "oc:objectType" with value "files"
  204. And the response should contain a property "oc:message" with value "My first comment"
  205. And the response should contain a property "oc:actorDisplayName" with value "user1"
  206. And the response should contain only "1" comments
  207. Then As "user0" edit the last created comment and set text to "My edited comment" it should return "403"