BigW Consortium Gitlab

paths.rb 14.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
  step 'I visit dashboard groups page' do
    visit dashboard_groups_path
  end

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

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

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

127 128 129 130
  # ----------------------------------------
  # Profile
  # ----------------------------------------

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

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

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

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

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

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

155
  step 'I visit Authentication log page' do
156
    visit audit_log_profile_path
Nihad Abbasov committed
157 158
  end

159 160 161 162
  # ----------------------------------------
  # Admin
  # ----------------------------------------

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

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

171
  step 'I visit admin projects page' do
172
    visit admin_projects_path
173 174
  end

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

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

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

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

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

195
  step 'I visit admin teams page' do
196 197 198
    visit admin_teams_path
  end

199 200 201 202
  step 'I visit spam logs page' do
    visit admin_spam_logs_path
  end

203 204 205 206
  # ----------------------------------------
  # Generic Project
  # ----------------------------------------

207
  step "I visit my project's home page" do
Vinnie Okada committed
208
    visit namespace_project_path(@project.namespace, @project)
209 210
  end

211
  step "I visit my project's settings page" do
Vinnie Okada committed
212
    visit edit_namespace_project_path(@project.namespace, @project)
213 214
  end

215
  step "I visit my project's files page" do
Vinnie Okada committed
216
    visit namespace_project_tree_path(@project.namespace, @project, root_ref)
Nihad Abbasov committed
217 218
  end

219
  step 'I visit a binary file in the repo' do
220 221
    visit namespace_project_blob_path(@project.namespace, @project,
      File.join(root_ref, 'files/images/logo-black.png'))
222 223
  end

224
  step "I visit my project's commits page" do
225
    visit namespace_project_commits_path(@project.namespace, @project, root_ref, { limit: 5 })
226 227
  end

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

232
  step 'I visit my project\'s commits stats page' do
Vinnie Okada committed
233
    visit stats_namespace_project_repository_path(@project.namespace, @project)
randx committed
234 235
  end

236
  step "I visit my project's graph page" do
237 238
    # Stub Graph max_size to speed up test (10 commits vs. 650)
    Network::Graph.stub(max_count: 10)
239

Vinnie Okada committed
240
    visit namespace_project_network_path(@project.namespace, @project, root_ref)
241 242
  end

243
  step "I visit my project's issues page" do
Vinnie Okada committed
244
    visit namespace_project_issues_path(@project.namespace, @project)
245 246
  end

247
  step "I visit my project's merge requests page" do
Vinnie Okada committed
248
    visit namespace_project_merge_requests_path(@project.namespace, @project)
249 250
  end

251 252 253 254
  step "I visit my project's members page" do
    visit namespace_project_project_members_path(@project.namespace, @project)
  end

255
  step "I visit my project's wiki page" do
Vinnie Okada committed
256
    visit namespace_project_wiki_path(@project.namespace, @project, :home)
257 258
  end

259
  step 'I visit project hooks page' do
260
    visit namespace_project_settings_integrations_path(@project.namespace, @project)
261 262
  end

263
  step 'I visit project deploy keys page' do
Vinnie Okada committed
264
    visit namespace_project_deploy_keys_path(@project.namespace, @project)
265 266
  end

267 268 269 270
  step 'I visit project find file page' do
    visit namespace_project_find_file_path(@project.namespace, @project, root_ref)
  end

271 272 273 274
  # ----------------------------------------
  # "Shop" Project
  # ----------------------------------------

275
  step 'I visit project "Shop" page' do
Vinnie Okada committed
276
    visit namespace_project_path(project.namespace, project)
Nihad Abbasov committed
277 278
  end

279 280 281 282
  step 'I visit project "Shop" activity page' do
    visit activity_namespace_project_path(project.namespace, project)
  end

283
  step 'I visit project "Forked Shop" merge requests page' do
Vinnie Okada committed
284
    visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project)
285 286
  end

287
  step 'I visit edit project "Shop" page' do
Vinnie Okada committed
288
    visit edit_namespace_project_path(project.namespace, project)
289 290
  end

291
  step 'I visit project branches page' do
Vinnie Okada committed
292
    visit namespace_project_branches_path(@project.namespace, @project)
Nihad Abbasov committed
293 294
  end

Dmitriy Zaporozhets committed
295
  step 'I visit project protected branches page' do
Vinnie Okada committed
296
    visit namespace_project_protected_branches_path(@project.namespace, @project)
Dmitriy Zaporozhets committed
297 298
  end

299
  step 'I visit compare refs page' do
Vinnie Okada committed
300
    visit namespace_project_compare_index_path(@project.namespace, @project)
Nihad Abbasov committed
301 302
  end

303
  step 'I visit project commits page' do
304
    visit namespace_project_commits_path(@project.namespace, @project, root_ref, { limit: 5 })
305 306
  end

307
  step 'I visit project commits page for stable branch' do
308
    visit namespace_project_commits_path(@project.namespace, @project, 'stable', { limit: 5 })
Nihad Abbasov committed
309 310
  end

311
  step 'I visit project source page' do
Vinnie Okada committed
312
    visit namespace_project_tree_path(@project.namespace, @project, root_ref)
Nihad Abbasov committed
313 314
  end

315
  step 'I visit blob file from repo' do
Vinnie Okada committed
316
    visit namespace_project_blob_path(@project.namespace, @project, File.join(sample_commit.id, sample_blob.path))
Nihad Abbasov committed
317 318
  end

319
  step 'I visit ".gitignore" file in repo' do
Vinnie Okada committed
320
    visit namespace_project_blob_path(@project.namespace, @project, File.join(root_ref, '.gitignore'))
321 322
  end

323
  step 'I am on the new file page' do
324
    expect(current_path).to eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref))
325 326 327
  end

  step 'I am on the ".gitignore" edit file page' do
328 329
    expect(current_path).to eq(
      namespace_project_edit_blob_path(@project.namespace, @project, File.join(root_ref, '.gitignore')))
330 331
  end

332
  step 'I visit project source page for "6d39438"' do
Vinnie Okada committed
333
    visit namespace_project_tree_path(@project.namespace, @project, "6d39438")
Nihad Abbasov committed
334 335
  end

336 337
  step 'I visit project source page for' \
       ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
Vinnie Okada committed
338
    visit namespace_project_tree_path(@project.namespace, @project,
339 340 341
                            '6d394385cf567f80a8fd85055db1ab4c5295806f')
  end

342
  step 'I visit project tags page' do
Vinnie Okada committed
343
    visit namespace_project_tags_path(@project.namespace, @project)
Nihad Abbasov committed
344 345
  end

346
  step 'I visit project commit page' do
Vinnie Okada committed
347
    visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
Nihad Abbasov committed
348 349
  end

350
  step 'I visit project "Shop" issues page' do
Vinnie Okada committed
351
    visit namespace_project_issues_path(project.namespace, project)
Nihad Abbasov committed
352 353
  end

354
  step 'I visit issue page "Release 0.4"' do
skv committed
355
    issue = Issue.find_by(title: "Release 0.4")
Vinnie Okada committed
356
    visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
Nihad Abbasov committed
357 358
  end

359
  step 'I visit project "Shop" labels page' do
360
    project = Project.find_by(name: 'Shop')
Vinnie Okada committed
361
    visit namespace_project_labels_path(project.namespace, project)
Nihad Abbasov committed
362 363
  end

364 365
  step 'I visit project "Forum" labels page' do
    project = Project.find_by(name: 'Forum')
Vinnie Okada committed
366
    visit namespace_project_labels_path(project.namespace, project)
367 368 369 370
  end

  step 'I visit project "Shop" new label page' do
    project = Project.find_by(name: 'Shop')
Vinnie Okada committed
371
    visit new_namespace_project_label_path(project.namespace, project)
372 373 374 375
  end

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

379
  step 'I visit merge request page "Bug NS-04"' do
380
    visit merge_request_path("Bug NS-04")
381
    wait_for_requests
Nihad Abbasov committed
382 383
  end

384
  step 'I visit merge request page "Bug NS-05"' do
385
    visit merge_request_path("Bug NS-05")
386
    wait_for_requests
387 388
  end

389 390
  step 'I visit merge request page "Bug NS-07"' do
    visit merge_request_path("Bug NS-07")
391
    wait_for_requests
392 393 394 395
  end

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

399 400 401
  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)
402
    wait_for_requests
403 404
  end

405
  step 'I visit project "Shop" merge requests page' do
Vinnie Okada committed
406
    visit namespace_project_merge_requests_path(project.namespace, project)
Nihad Abbasov committed
407 408
  end

409
  step 'I visit forked project "Shop" merge requests page' do
Vinnie Okada committed
410
    visit namespace_project_merge_requests_path(project.namespace, project)
411 412
  end

413
  step 'I visit project "Shop" milestones page' do
Vinnie Okada committed
414
    visit namespace_project_milestones_path(project.namespace, project)
Nihad Abbasov committed
415 416
  end

417
  step 'I visit project "Shop" team page' do
418
    visit namespace_project_project_members_path(project.namespace, project)
Nihad Abbasov committed
419 420
  end

421
  step 'I visit project wiki page' do
Vinnie Okada committed
422
    visit namespace_project_wiki_path(@project.namespace, @project, :home)
Nihad Abbasov committed
423
  end
424

Ciro Santilli committed
425 426 427 428 429 430
  # ----------------------------------------
  # Visibility Projects
  # ----------------------------------------

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

434 435
  step 'I visit project "Community" source page' do
    project = Project.find_by(name: 'Community')
Vinnie Okada committed
436
    visit namespace_project_tree_path(project.namespace, project, root_ref)
437 438
  end

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

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

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

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

458 459 460 461
  step "I should not see command line instructions" do
    expect(page).not_to have_css('.empty_wrapper')
  end

462 463 464 465
  # ----------------------------------------
  # Public Projects
  # ----------------------------------------

466
  step 'I visit the public projects area' do
467
    visit explore_projects_path
468 469
  end

470 471 472
  step 'I visit the explore trending projects' do
    visit trending_explore_projects_path
  end
473

474 475 476
  step 'I visit the explore starred projects' do
    visit starred_explore_projects_path
  end
477 478

  step 'I visit the public groups area' do
479
    visit explore_groups_path
480 481
  end

482 483 484 485
  # ----------------------------------------
  # Snippets
  # ----------------------------------------

486
  step 'I visit project "Shop" snippets page' do
Vinnie Okada committed
487
    visit namespace_project_snippets_path(project.namespace, project)
488 489
  end

490
  step 'I visit snippets page' do
491
    visit explore_snippets_path
492 493
  end

494
  step 'I visit new snippet page' do
495 496 497
    visit new_snippet_path
  end

498 499 500
  def root_ref
    @project.repository.root_ref
  end
501 502

  def project
503
    Project.find_by!(name: 'Shop')
504
  end
505

506 507 508 509 510
  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

511 512 513 514
  # ----------------------------------------
  # Errors
  # ----------------------------------------

515
  step 'page status code should be 404' do
516
    expect(status_code).to eq 404
517
  end
Nihad Abbasov committed
518
end