comments-search.feature 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. # SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. Feature: comments-search
  4. Scenario: Search my own comment on a file belonging to myself
  5. Given user "user0" exists
  6. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  7. And "user0" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
  8. When Logging in using web as "user0"
  9. And searching for "first" in app "files"
  10. Then the list of search results has "1" results
  11. And search result "0" contains
  12. | type | comment |
  13. | comment | My first comment |
  14. | authorId | user0 |
  15. | authorName | user0 |
  16. | path | myFileToComment.txt |
  17. | fileName | myFileToComment.txt |
  18. | name | My first comment |
  19. Scenario: Search my own comment on a file shared by someone with me
  20. Given user "user0" exists
  21. And user "user1" exists
  22. And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
  23. And as "user1" creating a share with
  24. | path | sharedFileToComment.txt |
  25. | shareWith | user0 |
  26. | shareType | 0 |
  27. And user "user0" accepts last share
  28. And "user0" posts a comment with content "My first comment" on the file named "/sharedFileToComment.txt" it should return "201"
  29. When Logging in using web as "user0"
  30. And searching for "first" in app "files"
  31. Then the list of search results has "1" results
  32. And search result "0" contains
  33. | type | comment |
  34. | comment | My first comment |
  35. | authorId | user0 |
  36. | authorName | user0 |
  37. | path | sharedFileToComment.txt |
  38. | fileName | sharedFileToComment.txt |
  39. | name | My first comment |
  40. Scenario: Search other user's comment on a file shared by me
  41. Given user "user0" exists
  42. And user "user1" exists
  43. And User "user0" uploads file "data/textfile.txt" to "/mySharedFileToComment.txt"
  44. And as "user0" creating a share with
  45. | path | mySharedFileToComment.txt |
  46. | shareWith | user1 |
  47. | shareType | 0 |
  48. And user "user1" accepts last share
  49. And "user1" posts a comment with content "Other's first comment" on the file named "/mySharedFileToComment.txt" it should return "201"
  50. When Logging in using web as "user0"
  51. And searching for "first" in app "files"
  52. Then the list of search results has "1" results
  53. And search result "0" contains
  54. | type | comment |
  55. | comment | Other's first comment |
  56. | authorId | user1 |
  57. | authorName | user1 |
  58. | path | mySharedFileToComment.txt |
  59. | fileName | mySharedFileToComment.txt |
  60. | name | Other's first comment |
  61. Scenario: Search other user's comment on a file shared by someone with me
  62. Given user "user0" exists
  63. And user "user1" exists
  64. And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
  65. And as "user1" creating a share with
  66. | path | sharedFileToComment.txt |
  67. | shareWith | user0 |
  68. | shareType | 0 |
  69. And user "user0" accepts last share
  70. And "user1" posts a comment with content "Other's first comment" on the file named "/sharedFileToComment.txt" it should return "201"
  71. When Logging in using web as "user0"
  72. And searching for "first" in app "files"
  73. Then the list of search results has "1" results
  74. And search result "0" contains
  75. | type | comment |
  76. | comment | Other's first comment |
  77. | authorId | user1 |
  78. | authorName | user1 |
  79. | path | sharedFileToComment.txt |
  80. | fileName | sharedFileToComment.txt |
  81. | name | Other's first comment |
  82. Scenario: Search several comments on a file belonging to myself
  83. Given user "user0" exists
  84. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  85. And "user0" posts a comment with content "My first comment to be found" on the file named "/myFileToComment.txt" it should return "201"
  86. And "user0" posts a comment with content "The second comment should not be found" on the file named "/myFileToComment.txt" it should return "201"
  87. And "user0" posts a comment with content "My third comment to be found" on the file named "/myFileToComment.txt" it should return "201"
  88. When Logging in using web as "user0"
  89. And searching for "comment to be found" in app "files"
  90. Then the list of search results has "2" results
  91. And search result "0" contains
  92. | type | comment |
  93. | comment | My third comment to be found |
  94. | authorId | user0 |
  95. | authorName | user0 |
  96. | path | myFileToComment.txt |
  97. | fileName | myFileToComment.txt |
  98. | name | My third comment to be found |
  99. And search result "1" contains
  100. | type | comment |
  101. | comment | My first comment to be found |
  102. | authorId | user0 |
  103. | authorName | user0 |
  104. | path | myFileToComment.txt |
  105. | fileName | myFileToComment.txt |
  106. | name | My first comment to be found |
  107. Scenario: Search comment with a large message ellipsized on the right
  108. Given user "user0" exists
  109. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  110. And "user0" posts a comment with content "A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments" on the file named "/myFileToComment.txt" it should return "201"
  111. When Logging in using web as "user0"
  112. And searching for "verbose" in app "files"
  113. Then the list of search results has "1" results
  114. And search result "0" contains
  115. | type | comment |
  116. | comment | A very verbose message that is meant to… |
  117. | authorId | user0 |
  118. | authorName | user0 |
  119. | path | myFileToComment.txt |
  120. | fileName | myFileToComment.txt |
  121. | name | A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments |
  122. Scenario: Search comment with a large message ellipsized on the left
  123. Given user "user0" exists
  124. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  125. And "user0" posts a comment with content "A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments" on the file named "/myFileToComment.txt" it should return "201"
  126. When Logging in using web as "user0"
  127. And searching for "searching" in app "files"
  128. Then the list of search results has "1" results
  129. And search result "0" contains
  130. | type | comment |
  131. | comment | …ed message returned when searching for long comments |
  132. | authorId | user0 |
  133. | authorName | user0 |
  134. | path | myFileToComment.txt |
  135. | fileName | myFileToComment.txt |
  136. | name | A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments |
  137. Scenario: Search comment with a large message ellipsized on both ends
  138. Given user "user0" exists
  139. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  140. And "user0" posts a comment with content "A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments" on the file named "/myFileToComment.txt" it should return "201"
  141. When Logging in using web as "user0"
  142. And searching for "ellipsized" in app "files"
  143. Then the list of search results has "1" results
  144. And search result "0" contains
  145. | type | comment |
  146. | comment | …t to be used to test the ellipsized message returned when se… |
  147. | authorId | user0 |
  148. | authorName | user0 |
  149. | path | myFileToComment.txt |
  150. | fileName | myFileToComment.txt |
  151. | name | A very verbose message that is meant to be used to test the ellipsized message returned when searching for long comments |
  152. Scenario: Search comment on a file in a subfolder
  153. Given user "user0" exists
  154. And user "user0" created a folder "/subfolder"
  155. And User "user0" uploads file "data/textfile.txt" to "/subfolder/myFileToComment.txt"
  156. And "user0" posts a comment with content "My first comment" on the file named "/subfolder/myFileToComment.txt" it should return "201"
  157. When Logging in using web as "user0"
  158. And searching for "first" in app "files"
  159. Then the list of search results has "1" results
  160. And search result "0" contains
  161. | type | comment |
  162. | comment | My first comment |
  163. | authorId | user0 |
  164. | authorName | user0 |
  165. | path | subfolder/myFileToComment.txt |
  166. | fileName | myFileToComment.txt |
  167. | name | My first comment |
  168. Scenario: Search several comments
  169. Given user "user0" exists
  170. And user "user1" exists
  171. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  172. And User "user0" uploads file "data/textfile.txt" to "/mySharedFileToComment.txt"
  173. And as "user0" creating a share with
  174. | path | mySharedFileToComment.txt |
  175. | shareWith | user1 |
  176. | shareType | 0 |
  177. And user "user1" accepts last share
  178. And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
  179. And as "user1" creating a share with
  180. | path | sharedFileToComment.txt |
  181. | shareWith | user0 |
  182. | shareType | 0 |
  183. And user "user0" accepts last share
  184. And "user0" posts a comment with content "My first comment to be found" on the file named "/myFileToComment.txt" it should return "201"
  185. And "user0" posts a comment with content "The second comment should not be found" on the file named "/myFileToComment.txt" it should return "201"
  186. And "user0" posts a comment with content "My first comment to be found" on the file named "/mySharedFileToComment.txt" it should return "201"
  187. And "user1" posts a comment with content "Other's first comment that should not be found" on the file named "/mySharedFileToComment.txt" it should return "201"
  188. And "user1" posts a comment with content "Other's second comment to be found" on the file named "/mySharedFileToComment.txt" it should return "201"
  189. And "user0" posts a comment with content "My first comment that should not be found" on the file named "/sharedFileToComment.txt" it should return "201"
  190. And "user1" posts a comment with content "Other's first comment to be found" on the file named "/sharedFileToComment.txt" it should return "201"
  191. And "user0" posts a comment with content "My second comment to be found that happens to be more verbose than the others and thus should be ellipsized" on the file named "/sharedFileToComment.txt" it should return "201"
  192. And "user0" posts a comment with content "My third comment to be found" on the file named "/myFileToComment.txt" it should return "201"
  193. When Logging in using web as "user0"
  194. And searching for "comment to be found" in app "files"
  195. Then the list of search results has "6" results
  196. And search result "0" contains
  197. | type | comment |
  198. | comment | My third comment to be found |
  199. | authorId | user0 |
  200. | authorName | user0 |
  201. | path | myFileToComment.txt |
  202. | fileName | myFileToComment.txt |
  203. | name | My third comment to be found |
  204. And search result "1" contains
  205. | type | comment |
  206. | comment | My second comment to be found that happens to be more … |
  207. | authorId | user0 |
  208. | authorName | user0 |
  209. | path | sharedFileToComment.txt |
  210. | fileName | sharedFileToComment.txt |
  211. | name | My second comment to be found that happens to be more verbose than the others and thus should be ellipsized |
  212. And search result "2" contains
  213. | type | comment |
  214. | comment | Other's first comment to be found |
  215. | authorId | user1 |
  216. | authorName | user1 |
  217. | path | sharedFileToComment.txt |
  218. | fileName | sharedFileToComment.txt |
  219. | name | Other's first comment to be found |
  220. And search result "3" contains
  221. | type | comment |
  222. | comment | Other's second comment to be found |
  223. | authorId | user1 |
  224. | authorName | user1 |
  225. | path | mySharedFileToComment.txt |
  226. | fileName | mySharedFileToComment.txt |
  227. | name | Other's second comment to be found |
  228. And search result "4" contains
  229. | type | comment |
  230. | comment | My first comment to be found |
  231. | authorId | user0 |
  232. | authorName | user0 |
  233. | path | mySharedFileToComment.txt |
  234. | fileName | mySharedFileToComment.txt |
  235. | name | My first comment to be found |
  236. And search result "5" contains
  237. | type | comment |
  238. | comment | My first comment to be found |
  239. | authorId | user0 |
  240. | authorName | user0 |
  241. | path | myFileToComment.txt |
  242. | fileName | myFileToComment.txt |
  243. | name | My first comment to be found |
  244. Scenario: Search comment with a query that also matches a file name
  245. Given user "user0" exists
  246. And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
  247. And "user0" posts a comment with content "A comment in myFileToComment.txt" on the file named "/myFileToComment.txt" it should return "201"
  248. When Logging in using web as "user0"
  249. And searching for "myFileToComment" in app "files"
  250. Then the list of search results has "2" results
  251. And search result "0" contains
  252. | type | file |
  253. | path | /myFileToComment.txt |
  254. | name | myFileToComment.txt |
  255. And search result "1" contains
  256. | type | comment |
  257. | comment | A comment in myFileToComment.txt |
  258. | authorId | user0 |
  259. | authorName | user0 |
  260. | path | myFileToComment.txt |
  261. | fileName | myFileToComment.txt |
  262. | name | A comment in myFileToComment.txt |