BigW Consortium Gitlab

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

78 79 80 81
  # ----------------------------------------
  # Dashboard
  # ----------------------------------------

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

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

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

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

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

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

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

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

114 115
  step 'I visit dashboard todos page' do
    visit dashboard_todos_path
116 117
  end

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

  step 'I visit dashboard starred projects page' do
    visit starred_dashboard_projects_path
124 125
  end

126 127 128 129
  # ----------------------------------------
  # Profile
  # ----------------------------------------

130
  step 'I visit profile page' do
Nihad Abbasov committed
131 132 133
    visit profile_path
  end

134 135 136 137
  step 'I visit profile applications page' do
    visit applications_profile_path
  end

138 139 140 141
  step 'I visit profile password page' do
    visit edit_profile_password_path
  end

142
  step 'I visit profile account page' do
143
    visit profile_account_path
Nihad Abbasov committed
144 145
  end

146
  step 'I visit profile SSH keys page' do
147
    visit profile_keys_path
148 149
  end

150 151
  step 'I visit profile preferences page' do
    visit profile_preferences_path
152 153
  end

154 155
  step 'I visit Audit Log page' do
    visit audit_log_profile_path
Nihad Abbasov committed
156 157
  end

158 159 160 161
  # ----------------------------------------
  # Admin
  # ----------------------------------------

162
  step 'I visit admin page' do
163 164 165
    visit admin_root_path
  end

166 167 168 169
  step 'I visit abuse reports page' do
    visit admin_abuse_reports_path
  end

170
  step 'I visit admin projects page' do
Vinnie Okada committed
171
    visit admin_namespaces_projects_path
172 173
  end

174
  step 'I visit admin users page' do
175 176 177
    visit admin_users_path
  end

178
  step 'I visit admin logs page' do
179 180 181
    visit admin_logs_path
  end

182 183 184 185
  step 'I visit admin messages page' do
    visit admin_broadcast_messages_path
  end

186
  step 'I visit admin hooks page' do
187 188 189
    visit admin_hooks_path
  end

190
  step 'I visit admin Resque page' do
191
    visit admin_background_jobs_path
192 193
  end

194
  step 'I visit admin groups page' do
randx committed
195 196 197
    visit admin_groups_path
  end

198 199 200 201
  step 'I visit admin appearance page' do
    visit admin_appearances_path
  end

202
  step 'I visit admin teams page' do
203 204 205
    visit admin_teams_path
  end

206 207 208 209
  step 'I visit admin settings page' do
    visit admin_application_settings_path
  end

210 211 212 213
  step 'I visit spam logs page' do
    visit admin_spam_logs_path
  end

214 215 216 217
  step 'I visit applications page' do
    visit admin_applications_path
  end

218 219 220 221
  # ----------------------------------------
  # Generic Project
  # ----------------------------------------

222
  step "I visit my project's home page" do
Vinnie Okada committed
223
    visit namespace_project_path(@project.namespace, @project)
224 225
  end

226
  step "I visit my project's settings page" do
Vinnie Okada committed
227
    visit edit_namespace_project_path(@project.namespace, @project)
228 229
  end

230
  step "I visit my project's files page" do
Vinnie Okada committed
231
    visit namespace_project_tree_path(@project.namespace, @project, root_ref)
Nihad Abbasov committed
232 233
  end

234
  step 'I visit a binary file in the repo' do
235 236
    visit namespace_project_blob_path(@project.namespace, @project,
      File.join(root_ref, 'files/images/logo-black.png'))
237 238
  end

239
  step "I visit my project's commits page" do
240
    visit namespace_project_commits_path(@project.namespace, @project, root_ref, { limit: 5 })
241 242
  end

243
  step "I visit my project's commits page for a specific path" do
244
    visit namespace_project_commits_path(@project.namespace, @project, root_ref + "/app/models/project.rb", { limit: 5 })
245 246
  end

247
  step 'I visit my project\'s commits stats page' do
Vinnie Okada committed
248
    visit stats_namespace_project_repository_path(@project.namespace, @project)
randx committed
249 250
  end

251
  step "I visit my project's network page" do
252 253
    # Stub Graph max_size to speed up test (10 commits vs. 650)
    Network::Graph.stub(max_count: 10)
254

Vinnie Okada committed
255
    visit namespace_project_network_path(@project.namespace, @project, root_ref)
256 257
  end

258
  step "I visit my project's issues page" do
Vinnie Okada committed
259
    visit namespace_project_issues_path(@project.namespace, @project)
260 261
  end

262
  step "I visit my project's merge requests page" do
Vinnie Okada committed
263
    visit namespace_project_merge_requests_path(@project.namespace, @project)
264 265
  end

266 267 268 269
  step "I visit my project's members page" do
    visit namespace_project_project_members_path(@project.namespace, @project)
  end

270
  step "I visit my project's wiki page" do
Vinnie Okada committed
271
    visit namespace_project_wiki_path(@project.namespace, @project, :home)
272 273
  end

274
  step 'I visit project hooks page' do
Vinnie Okada committed
275
    visit namespace_project_hooks_path(@project.namespace, @project)
276 277
  end

278
  step 'I visit project deploy keys page' do
Vinnie Okada committed
279
    visit namespace_project_deploy_keys_path(@project.namespace, @project)
280 281
  end

282 283 284 285
  step 'I visit project find file page' do
    visit namespace_project_find_file_path(@project.namespace, @project, root_ref)
  end

286 287 288 289
  # ----------------------------------------
  # "Shop" Project
  # ----------------------------------------

290
  step 'I visit project "Shop" page' do
Vinnie Okada committed
291
    visit namespace_project_path(project.namespace, project)
Nihad Abbasov committed
292 293
  end

294 295 296 297
  step 'I visit project "Shop" activity page' do
    visit activity_namespace_project_path(project.namespace, project)
  end

298
  step 'I visit project "Forked Shop" merge requests page' do
Vinnie Okada committed
299
    visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project)
300 301
  end

302
  step 'I visit edit project "Shop" page' do
Vinnie Okada committed
303
    visit edit_namespace_project_path(project.namespace, project)
304 305
  end

306
  step 'I visit project branches page' do
Vinnie Okada committed
307
    visit namespace_project_branches_path(@project.namespace, @project)
Nihad Abbasov committed
308 309
  end

Dmitriy Zaporozhets committed
310
  step 'I visit project protected branches page' do
Vinnie Okada committed
311
    visit namespace_project_protected_branches_path(@project.namespace, @project)
Dmitriy Zaporozhets committed
312 313
  end

314
  step 'I visit compare refs page' do
Vinnie Okada committed
315
    visit namespace_project_compare_index_path(@project.namespace, @project)
Nihad Abbasov committed
316 317
  end

318
  step 'I visit project commits page' do
319
    visit namespace_project_commits_path(@project.namespace, @project, root_ref, { limit: 5 })
320 321
  end

322
  step 'I visit project commits page for stable branch' do
323
    visit namespace_project_commits_path(@project.namespace, @project, 'stable', { limit: 5 })
Nihad Abbasov committed
324 325
  end

326
  step 'I visit project source page' do
Vinnie Okada committed
327
    visit namespace_project_tree_path(@project.namespace, @project, root_ref)
Nihad Abbasov committed
328 329
  end

330
  step 'I visit blob file from repo' do
Vinnie Okada committed
331
    visit namespace_project_blob_path(@project.namespace, @project, File.join(sample_commit.id, sample_blob.path))
Nihad Abbasov committed
332 333
  end

334
  step 'I visit ".gitignore" file in repo' do
Vinnie Okada committed
335
    visit namespace_project_blob_path(@project.namespace, @project, File.join(root_ref, '.gitignore'))
336 337
  end

338
  step 'I am on the new file page' do
339
    expect(current_path).to eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref))
340 341 342
  end

  step 'I am on the ".gitignore" edit file page' do
343 344
    expect(current_path).to eq(
      namespace_project_edit_blob_path(@project.namespace, @project, File.join(root_ref, '.gitignore')))
345 346
  end

347
  step 'I visit project source page for "6d39438"' do
Vinnie Okada committed
348
    visit namespace_project_tree_path(@project.namespace, @project, "6d39438")
Nihad Abbasov committed
349 350
  end

351 352
  step 'I visit project source page for' \
       ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
Vinnie Okada committed
353
    visit namespace_project_tree_path(@project.namespace, @project,
354 355 356
                            '6d394385cf567f80a8fd85055db1ab4c5295806f')
  end

357
  step 'I visit project tags page' do
Vinnie Okada committed
358
    visit namespace_project_tags_path(@project.namespace, @project)
Nihad Abbasov committed
359 360
  end

361
  step 'I visit project commit page' do
Vinnie Okada committed
362
    visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
Nihad Abbasov committed
363 364
  end

365
  step 'I visit project "Shop" issues page' do
Vinnie Okada committed
366
    visit namespace_project_issues_path(project.namespace, project)
Nihad Abbasov committed
367 368
  end

369
  step 'I visit issue page "Release 0.4"' do
skv committed
370
    issue = Issue.find_by(title: "Release 0.4")
Vinnie Okada committed
371
    visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
Nihad Abbasov committed
372 373
  end

374
  step 'I visit project "Shop" labels page' do
375
    project = Project.find_by(name: 'Shop')
Vinnie Okada committed
376
    visit namespace_project_labels_path(project.namespace, project)
Nihad Abbasov committed
377 378
  end

379 380
  step 'I visit project "Forum" labels page' do
    project = Project.find_by(name: 'Forum')
Vinnie Okada committed
381
    visit namespace_project_labels_path(project.namespace, project)
382 383 384 385
  end

  step 'I visit project "Shop" new label page' do
    project = Project.find_by(name: 'Shop')
Vinnie Okada committed
386
    visit new_namespace_project_label_path(project.namespace, project)
387 388 389 390
  end

  step 'I visit project "Forum" new label page' do
    project = Project.find_by(name: 'Forum')
Vinnie Okada committed
391
    visit new_namespace_project_label_path(project.namespace, project)
392 393
  end

394
  step 'I visit merge request page "Bug NS-04"' do
395
    visit merge_request_path("Bug NS-04")
Nihad Abbasov committed
396 397
  end

398
  step 'I visit merge request page "Bug NS-05"' do
399
    visit merge_request_path("Bug NS-05")
400 401
  end

402 403 404 405 406 407 408 409
  step 'I visit merge request page "Bug NS-07"' do
    visit merge_request_path("Bug NS-07")
  end

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

410 411 412 413 414
  step 'I visit merge request page "Bug CO-01"' do
    mr = MergeRequest.find_by(title: "Bug CO-01")
    visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
  end

415
  step 'I visit project "Shop" merge requests page' do
Vinnie Okada committed
416
    visit namespace_project_merge_requests_path(project.namespace, project)
Nihad Abbasov committed
417 418
  end

419
  step 'I visit forked project "Shop" merge requests page' do
Vinnie Okada committed
420
    visit namespace_project_merge_requests_path(project.namespace, project)
421 422
  end

423
  step 'I visit project "Shop" milestones page' do
Vinnie Okada committed
424
    visit namespace_project_milestones_path(project.namespace, project)
Nihad Abbasov committed
425 426
  end

427
  step 'I visit project "Shop" team page' do
428
    visit namespace_project_project_members_path(project.namespace, project)
Nihad Abbasov committed
429 430
  end

431
  step 'I visit project wiki page' do
Vinnie Okada committed
432
    visit namespace_project_wiki_path(@project.namespace, @project, :home)
Nihad Abbasov committed
433
  end
434

Ciro Santilli committed
435 436 437 438 439 440
  # ----------------------------------------
  # Visibility Projects
  # ----------------------------------------

  step 'I visit project "Community" page' do
    project = Project.find_by(name: "Community")
Vinnie Okada committed
441
    visit namespace_project_path(project.namespace, project)
Ciro Santilli committed
442 443
  end

444 445
  step 'I visit project "Community" source page' do
    project = Project.find_by(name: 'Community')
Vinnie Okada committed
446
    visit namespace_project_tree_path(project.namespace, project, root_ref)
447 448
  end

Ciro Santilli committed
449 450
  step 'I visit project "Internal" page' do
    project = Project.find_by(name: "Internal")
Vinnie Okada committed
451
    visit namespace_project_path(project.namespace, project)
Ciro Santilli committed
452 453 454 455
  end

  step 'I visit project "Enterprise" page' do
    project = Project.find_by(name: "Enterprise")
Vinnie Okada committed
456
    visit namespace_project_path(project.namespace, project)
Ciro Santilli committed
457 458 459 460 461 462 463 464
  end

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

  step "I visit empty project page" do
    project = Project.find_by(name: "Empty Public Project")
Vinnie Okada committed
465
    visit namespace_project_path(project.namespace, project)
Ciro Santilli committed
466 467
  end

468 469 470 471
  step "I should not see command line instructions" do
    expect(page).not_to have_css('.empty_wrapper')
  end

472 473 474 475
  # ----------------------------------------
  # Public Projects
  # ----------------------------------------

476
  step 'I visit the public projects area' do
477
    visit explore_projects_path
478 479
  end

480 481 482
  step 'I visit the explore trending projects' do
    visit trending_explore_projects_path
  end
483

484 485 486
  step 'I visit the explore starred projects' do
    visit starred_explore_projects_path
  end
487 488

  step 'I visit the public groups area' do
489
    visit explore_groups_path
490 491
  end

492 493 494 495
  # ----------------------------------------
  # Snippets
  # ----------------------------------------

496
  step 'I visit project "Shop" snippets page' do
Vinnie Okada committed
497
    visit namespace_project_snippets_path(project.namespace, project)
498 499
  end

500
  step 'I visit snippets page' do
501
    visit explore_snippets_path
502 503
  end

504
  step 'I visit new snippet page' do
505 506 507
    visit new_snippet_path
  end

508 509 510
  def root_ref
    @project.repository.root_ref
  end
511 512

  def project
513
    Project.find_by!(name: 'Shop')
514
  end
515

516 517 518 519 520
  def merge_request_path(title)
    mr = MergeRequest.find_by(title: title)
    namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
  end

521 522 523 524
  # ----------------------------------------
  # Errors
  # ----------------------------------------

525
  step 'page status code should be 404' do
526
    expect(status_code).to eq 404
527
  end
Nihad Abbasov committed
528
end