merge_requests.feature 13.2 KB
Newer Older
Douwe Maan's avatar
Douwe Maan committed
1
@project_merge_requests
2
Feature: Project Merge Requests
3
  Background:
4
    Given I sign in as a user
5 6 7
    And I own project "Shop"
    And project "Shop" have "Bug NS-04" open merge request
    And project "Shop" have "Feature NS-03" closed merge request
8
    And I visit project "Shop" merge requests page
9 10 11 12 13

  Scenario: I should see open merge requests
    Then I should see "Bug NS-04" in merge requests
    And I should not see "Feature NS-03" in merge requests

14 15 16 17 18 19
  Scenario: I should see CI status for merge requests
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    Given "Bug NS-05" has CI status
    When I visit project "Shop" merge requests page
    Then I should see merge request "Bug NS-05" with CI status

20 21 22 23 24 25 26 27 28
  Scenario: I should not see target branch name when it is project's default branch
    Then I should see "Bug NS-04" in merge requests
    And I should not see "master" branch

  Scenario: I should see target branch when it is different from default
    Given project "Shop" have "Bug NS-06" open merge request
    When I visit project "Shop" merge requests page
    Then I should see "other_branch" branch

Douwe Maan's avatar
Douwe Maan committed
29
  Scenario: I should see rejected merge requests
30
    Given I click link "Closed"
31 32 33 34 35 36 37 38 39 40 41
    Then I should see "Feature NS-03" in merge requests
    And I should not see "Bug NS-04" in merge requests

  Scenario: I should see all merge requests
    Given I click link "All"
    Then I should see "Feature NS-03" in merge requests
    And I should see "Bug NS-04" in merge requests

  Scenario: I visit merge request page
    Given I click link "Bug NS-04"
    Then I should see merge request "Bug NS-04"
42
    And I should see "1 of 1" in the sidebar
43 44 45 46 47 48

  Scenario: I close merge request page
    Given I click link "Bug NS-04"
    And I click link "Close"
    Then I should see closed merge request "Bug NS-04"

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
49 50 51 52 53 54 55
  Scenario: I reopen merge request page
    Given I click link "Bug NS-04"
    And I click link "Close"
    Then I should see closed merge request "Bug NS-04"
    When I click link "Reopen"
    Then I should see reopened merge request "Bug NS-04"

56 57 58 59 60
  Scenario: I submit new unassigned merge request
    Given I click link "New Merge Request"
    And I submit new merge request "Wiki Feature"
    Then I should see merge request "Wiki Feature"

61 62 63 64 65 66 67 68 69 70 71 72
  Scenario: I download a diff on a public merge request
    Given public project "Community"
    And "John Doe" owns public project "Community"
    And project "Community" has "Bug CO-01" open merge request with diffs inside
    Given I logout directly
    And I visit merge request page "Bug CO-01"
    And I click on "Email Patches"
    Then I should see a patch diff
    And I visit merge request page "Bug CO-01"
    And I click on "Plain Diff"
    Then I should see a patch diff

73 74 75 76 77
  @javascript
  Scenario: I comment on a merge request
    Given I visit merge request page "Bug NS-04"
    And I leave a comment like "XML attached"
    Then I should see comment "XML attached"
78

79 80 81 82 83 84 85 86 87
  @javascript
  Scenario: Visiting Merge Requests after leaving a comment
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-04"
    And I leave a comment like "XML attached"
    And I visit project "Shop" merge requests page
    And I sort the list by "Last updated"
    Then I should see "Bug NS-04" at the top

88 89 90 91 92 93 94 95
  @javascript
  Scenario: Visiting Merge Requests after being sorted the list
    Given I visit project "Shop" merge requests page
    And I sort the list by "Oldest updated"
    And I visit my project's home page
    And I visit project "Shop" merge requests page
    Then The list should be sorted by "Oldest updated"

96 97 98 99 100 101 102
  @javascript
  Scenario: Visiting Issues after being sorted the list
    Given I visit project "Shop" merge requests page
    And I sort the list by "Oldest updated"
    And I visit project "Shop" issues page
    Then The list should be sorted by "Oldest updated"

103 104 105 106 107 108 109
  @javascript
  Scenario: Visiting Merge Requests from a differente Project after sorting
    Given I visit project "Shop" merge requests page
    And I sort the list by "Oldest updated"
    And I visit dashboard merge requests page
    Then The list should be sorted by "Oldest updated"

110 111 112 113 114 115 116 117 118 119
  @javascript
  Scenario: Visiting Merge Requests after commenting on diffs
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
    And I click on the Changes tab
    And I leave a comment like "Line is wrong" on diff
    And I visit project "Shop" merge requests page
    And I sort the list by "Last updated"
    Then I should see "Bug NS-05" at the top

120 121 122 123
  @javascript
  Scenario: I comment on a merge request diff
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
124
    And I click on the Changes tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
125
    And I leave a comment like "Line is wrong" on diff
126
    And I switch to the merge request's comments tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
127
    Then I should see a discussion has started on diff
128 129 130 131 132 133 134 135 136
    And I should see a badge of "1" next to the discussion link

  @javascript
  Scenario: I see a new comment on merge request diff from another user in the discussion tab
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
    And user "John Doe" leaves a comment like "Line is wrong" on diff
    Then I should see a discussion by user "John Doe" has started on diff
    And I should see a badge of "1" next to the discussion link
137

138 139 140 141 142 143 144 145 146 147
  @javascript
  Scenario: I edit a comment on a merge request diff
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
    And I click on the Changes tab
    And I leave a comment like "Line is wrong" on diff
    And I change the comment "Line is wrong" to "Typo, please fix" on diff
    Then I should not see a diff comment saying "Line is wrong"
    And I should see a diff comment saying "Typo, please fix"

148 149 150 151 152 153
  @javascript
  Scenario: I delete a comment on a merge request diff
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
    And I click on the Changes tab
    And I leave a comment like "Line is wrong" on diff
154
    And I should see a badge of "1" next to the discussion link
155 156 157
    And I delete the comment "Line is wrong" on diff
    And I click on the Discussion tab
    Then I should not see any discussion
158
    And I should see a badge of "0" next to the discussion link
159

160 161 162 163
  @javascript
  Scenario: I comment on a line of a commit in merge request
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
164 165
    And I click on the commit in the merge request
    And I leave a comment like "Line is wrong" on diff in commit
166
    And I switch to the merge request's comments tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
167
    Then I should see a discussion has started on commit diff
168 169 170 171 172

  @javascript
  Scenario: I comment on a commit in merge request
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
173
    And I click on the commit in the merge request
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
174
    And I leave a comment on the diff page in commit
175
    And I switch to the merge request's comments tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
176
    Then I should see a discussion has started on commit
177 178 179 180 181 182 183 184 185 186

  @javascript
  Scenario: I accept merge request with custom commit message
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And merge request "Bug NS-05" is mergeable
    And I visit merge request page "Bug NS-05"
    And merge request is mergeable
    Then I modify merge commit message
    And I accept this merge request
    Then I should see merged request
187 188 189 190 191 192 193 194 195 196 197 198

  # Markdown

  Scenario: Headers inside the description should have ids generated for them.
    When I visit merge request page "Bug NS-04"
    Then Header "Description header" should have correct id and link

  @javascript
  Scenario: Headers inside comments should not have ids generated for them.
    Given I visit merge request page "Bug NS-04"
    And I leave a comment with a header containing "Comment with a header"
    Then The comment with the header should not have an ID
199 200 201 202 203 204 205

  # Toggling inline comments

  @javascript
  Scenario: I hide comments on a merge request diff with comments in a single file
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
206
    And I click on the Changes tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
207 208 209
    And I leave a comment like "Line is wrong" on line 39 of the third file
    And I click link "Hide inline discussion" of the third file
    Then I should not see a comment like "Line is wrong here" in the third file
210 211 212 213 214

  @javascript
  Scenario: I show comments on a merge request diff with comments in a single file
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
215
    And I click on the Changes tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
216 217
    And I leave a comment like "Line is wrong" on line 39 of the third file
    Then I should see a comment like "Line is wrong" in the third file
218 219 220 221 222

  @javascript
  Scenario: I hide comments on a merge request diff with comments in multiple files
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
223
    And I click on the Changes tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
224 225 226 227 228
    And I leave a comment like "Line is correct" on line 12 of the second file
    And I leave a comment like "Line is wrong" on line 39 of the third file
    And I click link "Hide inline discussion" of the third file
    Then I should not see a comment like "Line is wrong here" in the third file
    And I should still see a comment like "Line is correct" in the second file
229 230 231 232 233

  @javascript
  Scenario: I show comments on a merge request diff with comments in multiple files
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
234
    And I click on the Changes tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
235 236 237 238 239 240
    And I leave a comment like "Line is correct" on line 12 of the second file
    And I leave a comment like "Line is wrong" on line 39 of the third file
    And I click link "Hide inline discussion" of the third file
    And I click link "Show inline discussion" of the third file
    Then I should see a comment like "Line is wrong" in the third file
    And I should still see a comment like "Line is correct" in the second file
skv's avatar
skv committed
241 242 243 244 245

  @javascript
  Scenario: I unfold diff
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
246
    And I click on the Changes tab
skv's avatar
skv committed
247 248
    And I unfold diff
    Then I should see additional file lines
Marin Jankovski's avatar
Marin Jankovski committed
249 250 251 252 253

  @javascript
  Scenario: I show comments on a merge request side-by-side diff with comments in multiple files
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
254
    And I click on the Changes tab
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
255 256
    And I leave a comment like "Line is correct" on line 12 of the second file
    And I leave a comment like "Line is wrong" on line 39 of the third file
Marin Jankovski's avatar
Marin Jankovski committed
257 258
    And I click Side-by-side Diff tab
    Then I should see comments on the side-by-side diff page
259

260 261 262 263
  @javascript
  Scenario: I view diffs on a merge request
    Given project "Shop" have "Bug NS-05" open merge request with diffs inside
    And I visit merge request page "Bug NS-05"
264
    And I click on the Changes tab
265 266
    Then I should see the proper Inline and Side-by-side links

267 268 269 270 271
  # Description preview

  @javascript
  Scenario: I can't preview without text
    Given I visit merge request page "Bug NS-04"
272
    And I click link "Edit" for the merge request
273
    And I haven't written any description text
274
    Then The Markdown preview tab should say there is nothing to do
275 276 277 278

  @javascript
  Scenario: I can preview with text
    Given I visit merge request page "Bug NS-04"
279
    And I click link "Edit" for the merge request
280 281
    And I write a description like ":+1: Nice"
    Then The Markdown preview tab should display rendered Markdown
282 283 284 285

  @javascript
  Scenario: I preview a merge request description
    Given I visit merge request page "Bug NS-04"
286
    And I click link "Edit" for the merge request
287 288 289 290 291 292 293
    And I preview a description text like "Bug fixed :smile:"
    Then I should see the Markdown preview
    And I should not see the Markdown text field

  @javascript
  Scenario: I can edit after preview
    Given I visit merge request page "Bug NS-04"
294
    And I click link "Edit" for the merge request
295
    And I preview a description text like "Bug fixed :smile:"
296
    Then I should see the Markdown write tab
297 298 299 300 301 302 303

  @javascript
  Scenario: I search merge request
    Given I click link "All"
    When I fill in merge request search with "Fe"
    Then I should see "Feature NS-03" in merge requests
    And I should not see "Bug NS-04" in merge requests
Valery Sizov's avatar
tests  
Valery Sizov committed
304 305 306 307 308 309 310

  @javascript
  Scenario: I can unsubscribe from merge request
    Given I visit merge request page "Bug NS-04"
    Then I should see that I am subscribed
    When I click button "Unsubscribe"
    Then I should see that I am unsubscribed
311 312 313 314 315 316 317 318

  @javascript
  Scenario: I can change the target branch
    Given I visit merge request page "Bug NS-04"
    And I click link "Edit" for the merge request
    When I click the "Target branch" dropdown
    And I select a new target branch
    Then I should see new target branch changes