BigW Consortium Gitlab

paths.rb 12.1 KB
Newer Older
Nihad Abbasov committed
1 2
module SharedPaths
  include Spinach::DSL
3
  include RepoHelpers
4
  include DashboardHelper
5
  include WaitForRequests
Nihad Abbasov committed
6

7
  step 'I visit new project page' do
8 9 10
    visit new_project_path
  end

11 12 13 14
  step 'I visit login page' do
    visit new_user_session_path
  end

15 16 17 18 19 20 21 22
  # ----------------------------------------
  # User
  # ----------------------------------------

  step 'I visit user "John Doe" page' do
    visit user_path("john_doe")
  end

randx committed
23 24 25 26
  # ----------------------------------------
  # Group
  # ----------------------------------------

27
  step 'I visit group "Owned" page' do
28
    visit group_path(Group.find_by(name: "Owned"))
randx committed
29 30
  end

31 32 33 34
  step 'I visit group "Owned" activity page' do
    visit activity_group_path(Group.find_by(name: "Owned"))
  end

35
  step 'I visit group "Owned" issues page' do
36
    visit issues_group_path(Group.find_by(name: "Owned"))
randx committed
37 38
  end

39
  step 'I visit group "Owned" merge requests page' do
40
    visit merge_requests_group_path(Group.find_by(name: "Owned"))
randx committed
41 42
  end

43 44 45 46
  step 'I visit group "Owned" milestones page' do
    visit group_milestones_path(Group.find_by(name: "Owned"))
  end

47
  step 'I visit group "Owned" members page' do
48
    visit group_group_members_path(Group.find_by(name: "Owned"))
49 50
  end

51
  step 'I visit group "Owned" settings page' do
52
    visit edit_group_path(Group.find_by(name: "Owned"))
53 54
  end

Artem Sidorenko committed
55 56 57 58
  step 'I visit group "Owned" projects page' do
    visit projects_group_path(Group.find_by(name: "Owned"))
  end

59
  step 'I visit group "Guest" page' do
60
    visit group_path(Group.find_by(name: "Guest"))
61 62 63
  end

  step 'I visit group "Guest" issues page' do
64
    visit issues_group_path(Group.find_by(name: "Guest"))
65 66 67
  end

  step 'I visit group "Guest" merge requests page' do
68
    visit merge_requests_group_path(Group.find_by(name: "Guest"))
69 70 71
  end

  step 'I visit group "Guest" members page' do
72
    visit group_group_members_path(Group.find_by(name: "Guest"))
73 74 75
  end

  step 'I visit group "Guest" settings page' do
76
    visit edit_group_path(Group.find_by(name: "Guest"))
77 78
  end

79 80 81 82
  # ----------------------------------------
  # Dashboard
  # ----------------------------------------

83
  step 'I visit dashboard page' do
Douwe Maan committed
84
    visit dashboard_projects_path
85 86
  end

87 88 89 90
  step 'I visit dashboard activity page' do
    visit activity_dashboard_path
  end

91
  step 'I visit dashboard projects page' do
Dmitriy Zaporozhets committed
92 93 94
    visit projects_dashboard_path
  end

95
  step 'I visit dashboard issues page' do
96
    visit assigned_issues_dashboard_path
Nihad Abbasov committed
97 98
  end

99
  step 'I visit dashboard merge requests page' do
100
    visit assigned_mrs_dashboard_path
Nihad Abbasov committed
101 102
  end

103
  step 'I visit dashboard search page' do
104
    visit search_path
Nihad Abbasov committed
105 106
  end

107 108 109 110
  step 'I visit dashboard help page' do
    visit help_path
  end

111 112 113 114 115
  step 'I visit dashboard groups page' do
    visit dashboard_groups_path
  end

  step 'I should be redirected to the dashboard groups page' do
116
    expect(current_path).to eq dashboard_groups_path
117 118 119 120
  end

  step 'I visit dashboard starred projects page' do
    visit starred_dashboard_projects_path
121 122
  end

123 124 125 126
  # ----------------------------------------
  # Profile
  # ----------------------------------------

127
  step 'I visit profile page' do
Nihad Abbasov committed
128 129 130
    visit profile_path
  end

131 132 133 134
  step 'I visit profile applications page' do
    visit applications_profile_path
  end

135 136 137 138
  step 'I visit profile password page' do
    visit edit_profile_password_path
  end

139
  step 'I visit profile account page' do
140
    visit profile_account_path
Nihad Abbasov committed
141 142
  end

143
  step 'I visit profile SSH keys page' do
144
    visit profile_keys_path
145 146
  end

147 148
  step 'I visit profile preferences page' do
    visit profile_preferences_path
149 150
  end

151
  step 'I visit Authentication log page' do
152
    visit audit_log_profile_path
Nihad Abbasov committed
153 154
  end

155 156 157 158
  # ----------------------------------------
  # Admin
  # ----------------------------------------

159
  step 'I visit admin page' do
160 161 162
    visit admin_root_path
  end

163 164 165 166
  step 'I visit abuse reports page' do
    visit admin_abuse_reports_path
  end

167
  step 'I visit admin projects page' do
168
    visit admin_projects_path
169 170
  end

171
  step 'I visit admin users page' do
172 173 174
    visit admin_users_path
  end

175
  step 'I visit admin logs page' do
176 177 178
    visit admin_logs_path
  end

179 180 181 182
  step 'I visit admin messages page' do
    visit admin_broadcast_messages_path
  end

183
  step 'I visit admin hooks page' do
184 185 186
    visit admin_hooks_path
  end

187
  step 'I visit admin Resque page' do
188
    visit admin_background_jobs_path
189 190
  end

191
  step 'I visit admin teams page' do
192 193 194
    visit admin_teams_path
  end

195 196 197 198
  step 'I visit spam logs page' do
    visit admin_spam_logs_path
  end

199 200 201 202
  # ----------------------------------------
  # Generic Project
  # ----------------------------------------

203
  step "I visit my project's home page" do
204
    visit project_path(@project)
205 206
  end

207
  step "I visit my project's settings page" do
208
    visit edit_project_path(@project)
209 210
  end

211
  step "I visit my project's files page" do
212
    visit project_tree_path(@project, root_ref)
Nihad Abbasov committed
213 214
  end

215
  step 'I visit a binary file in the repo' do
216
    visit project_blob_path(@project,
217
      File.join(root_ref, 'files/images/logo-black.png'))
218 219
  end

220
  step "I visit my project's commits page" do
221
    visit project_commits_path(@project, root_ref, { limit: 5 })
222 223
  end

224
  step "I visit my project's commits page for a specific path" do
225
    visit project_commits_path(@project, root_ref + "/files/ruby/regex.rb", { limit: 5 })
226 227
  end

228
  step 'I visit my project\'s commits stats page' do
229
    visit stats_project_repository_path(@project)
randx committed
230 231
  end

232
  step "I visit my project's graph page" do
233 234
    # Stub Graph max_size to speed up test (10 commits vs. 650)
    Network::Graph.stub(max_count: 10)
235

236
    visit project_network_path(@project, root_ref)
237 238
  end

239
  step "I visit my project's issues page" do
240
    visit project_issues_path(@project)
241 242
  end

243
  step "I visit my project's merge requests page" do
244
    visit project_merge_requests_path(@project)
245 246
  end

247
  step "I visit my project's members page" do
248
    visit project_project_members_path(@project)
249 250
  end

251
  step "I visit my project's wiki page" do
252
    visit project_wiki_path(@project, :home)
253 254
  end

255
  step 'I visit project hooks page' do
256
    visit project_settings_integrations_path(@project)
257 258
  end

259
  step 'I visit project deploy keys page' do
260
    visit project_deploy_keys_path(@project)
261 262
  end

263
  step 'I visit project find file page' do
264
    visit project_find_file_path(@project, root_ref)
265 266
  end

267 268 269 270
  # ----------------------------------------
  # "Shop" Project
  # ----------------------------------------

271
  step 'I visit project "Shop" page' do
272
    visit project_path(project)
Nihad Abbasov committed
273 274
  end

275
  step 'I visit project "Shop" activity page' do
276
    visit activity_project_path(project)
277 278
  end

279
  step 'I visit project "Forked Shop" merge requests page' do
280
    visit project_merge_requests_path(@forked_project)
281 282
  end

283
  step 'I visit edit project "Shop" page' do
284
    visit edit_project_path(project)
285 286
  end

287
  step 'I visit project branches page' do
288
    visit project_branches_path(@project)
Nihad Abbasov committed
289 290
  end

Dmitriy Zaporozhets committed
291
  step 'I visit project protected branches page' do
292
    visit project_protected_branches_path(@project)
Dmitriy Zaporozhets committed
293 294
  end

295
  step 'I visit compare refs page' do
296
    visit project_compare_index_path(@project)
Nihad Abbasov committed
297 298
  end

299
  step 'I visit project commits page' do
300
    visit project_commits_path(@project, root_ref, { limit: 5 })
301 302
  end

303
  step 'I visit project commits page for stable branch' do
304
    visit project_commits_path(@project, 'stable', { limit: 5 })
Nihad Abbasov committed
305 306
  end

307
  step 'I visit blob file from repo' do
308
    visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
Nihad Abbasov committed
309 310
  end

311
  step 'I visit ".gitignore" file in repo' do
312
    visit project_blob_path(@project, File.join(root_ref, '.gitignore'))
313 314
  end

315
  step 'I am on the new file page' do
316
    expect(current_path).to eq(project_create_blob_path(@project, root_ref))
317 318 319
  end

  step 'I am on the ".gitignore" edit file page' do
320
    expect(current_path).to eq(
321
      project_edit_blob_path(@project, File.join(root_ref, '.gitignore')))
322 323
  end

324
  step 'I visit project source page for "6d39438"' do
325
    visit project_tree_path(@project, "6d39438")
Nihad Abbasov committed
326 327
  end

328 329
  step 'I visit project source page for' \
       ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
330
    visit project_tree_path(@project,
331 332 333
                            '6d394385cf567f80a8fd85055db1ab4c5295806f')
  end

334
  step 'I visit project tags page' do
335
    visit project_tags_path(@project)
Nihad Abbasov committed
336 337
  end

338
  step 'I visit project commit page' do
339
    visit project_commit_path(@project, sample_commit.id)
Nihad Abbasov committed
340 341
  end

342
  step 'I visit project "Shop" issues page' do
343
    visit project_issues_path(project)
Nihad Abbasov committed
344 345
  end

346
  step 'I visit issue page "Release 0.4"' do
skv committed
347
    issue = Issue.find_by(title: "Release 0.4")
348
    visit project_issue_path(issue.project, issue)
Nihad Abbasov committed
349 350
  end

351
  step 'I visit project "Shop" labels page' do
352
    project = Project.find_by(name: 'Shop')
353
    visit project_labels_path(project)
Nihad Abbasov committed
354 355
  end

356 357
  step 'I visit project "Forum" labels page' do
    project = Project.find_by(name: 'Forum')
358
    visit project_labels_path(project)
359 360 361 362
  end

  step 'I visit project "Shop" new label page' do
    project = Project.find_by(name: 'Shop')
363
    visit new_project_label_path(project)
364 365 366 367
  end

  step 'I visit project "Forum" new label page' do
    project = Project.find_by(name: 'Forum')
368
    visit new_project_label_path(project)
369 370
  end

371
  step 'I visit merge request page "Bug NS-04"' do
372
    visit merge_request_path("Bug NS-04")
373
    wait_for_requests
Nihad Abbasov committed
374 375
  end

376
  step 'I visit merge request page "Bug NS-05"' do
377
    visit merge_request_path("Bug NS-05")
378
    wait_for_requests
379 380
  end

381 382
  step 'I visit merge request page "Bug NS-07"' do
    visit merge_request_path("Bug NS-07")
383
    wait_for_requests
384 385 386 387
  end

  step 'I visit merge request page "Bug NS-08"' do
    visit merge_request_path("Bug NS-08")
388
    wait_for_requests
389 390
  end

391 392
  step 'I visit merge request page "Bug CO-01"' do
    mr = MergeRequest.find_by(title: "Bug CO-01")
393
    visit project_merge_request_path(mr.target_project, mr)
394
    wait_for_requests
395 396
  end

397
  step 'I visit project "Shop" merge requests page' do
398
    visit project_merge_requests_path(project)
Nihad Abbasov committed
399 400
  end

401
  step 'I visit forked project "Shop" merge requests page' do
402
    visit project_merge_requests_path(project)
403 404
  end

405
  step 'I visit project "Shop" milestones page' do
406
    visit project_milestones_path(project)
Nihad Abbasov committed
407 408
  end

409
  step 'I visit project "Shop" team page' do
410
    visit project_project_members_path(project)
Nihad Abbasov committed
411 412
  end

413
  step 'I visit project wiki page' do
414
    visit project_wiki_path(@project, :home)
Nihad Abbasov committed
415
  end
416

Ciro Santilli committed
417 418 419 420 421 422
  # ----------------------------------------
  # Visibility Projects
  # ----------------------------------------

  step 'I visit project "Community" page' do
    project = Project.find_by(name: "Community")
423
    visit project_path(project)
Ciro Santilli committed
424 425
  end

426 427
  step 'I visit project "Community" source page' do
    project = Project.find_by(name: 'Community')
428
    visit project_tree_path(project, root_ref)
429 430
  end

Ciro Santilli committed
431 432
  step 'I visit project "Internal" page' do
    project = Project.find_by(name: "Internal")
433
    visit project_path(project)
Ciro Santilli committed
434 435 436 437
  end

  step 'I visit project "Enterprise" page' do
    project = Project.find_by(name: "Enterprise")
438
    visit project_path(project)
Ciro Santilli committed
439 440 441 442 443 444 445 446
  end

  # ----------------------------------------
  # Empty Projects
  # ----------------------------------------

  step "I visit empty project page" do
    project = Project.find_by(name: "Empty Public Project")
447
    visit project_path(project)
Ciro Santilli committed
448 449
  end

450 451 452 453
  step "I should not see command line instructions" do
    expect(page).not_to have_css('.empty_wrapper')
  end

454 455 456
  # ----------------------------------------
  # Public Projects
  # ----------------------------------------
457
  step 'I visit the public groups area' do
458
    visit explore_groups_path
459 460
  end

461 462 463 464
  # ----------------------------------------
  # Snippets
  # ----------------------------------------

465
  step 'I visit project "Shop" snippets page' do
466
    visit project_snippets_path(project)
467 468
  end

469
  step 'I visit snippets page' do
470
    visit explore_snippets_path
471 472
  end

473 474 475
  def root_ref
    @project.repository.root_ref
  end
476 477

  def project
478
    Project.find_by!(name: 'Shop')
479
  end
480

481 482
  def merge_request_path(title)
    mr = MergeRequest.find_by(title: title)
483
    project_merge_request_path(mr.target_project, mr)
484 485
  end

486 487 488 489
  # ----------------------------------------
  # Errors
  # ----------------------------------------

490
  step 'page status code should be 404' do
491
    expect(status_code).to eq 404
492
  end
Nihad Abbasov committed
493
end