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

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

10 11 12 13 14 15 16 17
  # ----------------------------------------
  # User
  # ----------------------------------------

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

randx's avatar
randx committed
18 19 20 21
  # ----------------------------------------
  # Group
  # ----------------------------------------

22
  step 'I visit group "Owned" page' do
23
    visit group_path(Group.find_by(name: "Owned"))
randx's avatar
randx committed
24 25
  end

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

30
  step 'I visit group "Owned" merge requests page' do
31
    visit merge_requests_group_path(Group.find_by(name: "Owned"))
randx's avatar
randx committed
32 33
  end

34 35 36 37
  step 'I visit group "Owned" milestones page' do
    visit group_milestones_path(Group.find_by(name: "Owned"))
  end

38
  step 'I visit group "Owned" members page' do
39
    visit group_group_members_path(Group.find_by(name: "Owned"))
40 41
  end

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

Artem Sidorenko's avatar
Artem Sidorenko committed
46 47 48 49
  step 'I visit group "Owned" projects page' do
    visit projects_group_path(Group.find_by(name: "Owned"))
  end

50
  step 'I visit group "Guest" page' do
51
    visit group_path(Group.find_by(name: "Guest"))
52 53 54
  end

  step 'I visit group "Guest" issues page' do
55
    visit issues_group_path(Group.find_by(name: "Guest"))
56 57 58
  end

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

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

  step 'I visit group "Guest" settings page' do
67
    visit edit_group_path(Group.find_by(name: "Guest"))
68 69
  end

70 71 72 73
  # ----------------------------------------
  # Dashboard
  # ----------------------------------------

74
  step 'I visit dashboard page' do
Douwe Maan's avatar
Douwe Maan committed
75
    visit dashboard_projects_path
76 77
  end

78 79 80 81
  step 'I visit dashboard activity page' do
    visit activity_dashboard_path
  end

82
  step 'I visit dashboard projects page' do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
83 84 85
    visit projects_dashboard_path
  end

86
  step 'I visit dashboard issues page' do
87
    visit assigned_issues_dashboard_path
Nihad Abbasov's avatar
Nihad Abbasov committed
88 89
  end

90
  step 'I visit dashboard merge requests page' do
91
    visit assigned_mrs_dashboard_path
Nihad Abbasov's avatar
Nihad Abbasov committed
92 93
  end

94
  step 'I visit dashboard search page' do
95
    visit search_path
Nihad Abbasov's avatar
Nihad Abbasov committed
96 97
  end

98 99 100 101
  step 'I visit dashboard help page' do
    visit help_path
  end

102 103 104 105 106
  step 'I visit dashboard groups page' do
    visit dashboard_groups_path
  end

  step 'I should be redirected to the dashboard groups page' do
107
    expect(current_path).to eq dashboard_groups_path
108 109 110 111
  end

  step 'I visit dashboard starred projects page' do
    visit starred_dashboard_projects_path
112 113
  end

114 115 116 117
  # ----------------------------------------
  # Profile
  # ----------------------------------------

118
  step 'I visit profile page' do
Nihad Abbasov's avatar
Nihad Abbasov committed
119 120 121
    visit profile_path
  end

122 123 124 125
  step 'I visit profile applications page' do
    visit applications_profile_path
  end

126 127 128 129
  step 'I visit profile password page' do
    visit edit_profile_password_path
  end

130
  step 'I visit profile account page' do
131
    visit profile_account_path
Nihad Abbasov's avatar
Nihad Abbasov committed
132 133
  end

134
  step 'I visit profile SSH keys page' do
135
    visit profile_keys_path
136 137
  end

138 139
  step 'I visit profile preferences page' do
    visit profile_preferences_path
140 141
  end

142 143
  step 'I visit Audit Log page' do
    visit audit_log_profile_path
Nihad Abbasov's avatar
Nihad Abbasov committed
144 145
  end

146 147 148 149
  # ----------------------------------------
  # Admin
  # ----------------------------------------

150
  step 'I visit admin page' do
151 152 153
    visit admin_root_path
  end

154 155 156 157
  step 'I visit abuse reports page' do
    visit admin_abuse_reports_path
  end

158
  step 'I visit admin projects page' do
Vinnie Okada's avatar
Vinnie Okada committed
159
    visit admin_namespaces_projects_path
160 161
  end

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

166
  step 'I visit admin logs page' do
167 168 169
    visit admin_logs_path
  end

170 171 172 173
  step 'I visit admin messages page' do
    visit admin_broadcast_messages_path
  end

174
  step 'I visit admin hooks page' do
175 176 177
    visit admin_hooks_path
  end

178
  step 'I visit admin Resque page' do
179
    visit admin_background_jobs_path
180 181
  end

182
  step 'I visit admin groups page' do
randx's avatar
randx committed
183 184 185
    visit admin_groups_path
  end

186
  step 'I visit admin teams page' do
187 188 189
    visit admin_teams_path
  end

190 191 192 193
  step 'I visit admin settings page' do
    visit admin_application_settings_path
  end

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

198 199 200 201
  step 'I visit applications page' do
    visit admin_applications_path
  end

202 203 204 205
  # ----------------------------------------
  # Generic Project
  # ----------------------------------------

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

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

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

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

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

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

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

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

Vinnie Okada's avatar
Vinnie Okada committed
239
    visit namespace_project_network_path(@project.namespace, @project, root_ref)
240 241
  end

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

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

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

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

258
  step 'I visit project hooks page' do
Vinnie Okada's avatar
Vinnie Okada committed
259
    visit namespace_project_hooks_path(@project.namespace, @project)
260 261
  end

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

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

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

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

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
278 279 280 281
  step 'I visit project "Shop" activity page' do
    visit activity_namespace_project_path(project.namespace, project)
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

378
  step 'I visit merge request page "Bug NS-04"' do
skv's avatar
skv committed
379
    mr = MergeRequest.find_by(title: "Bug NS-04")
Vinnie Okada's avatar
Vinnie Okada committed
380
    visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
Nihad Abbasov's avatar
Nihad Abbasov committed
381 382
  end

383
  step 'I visit merge request page "Bug NS-05"' do
skv's avatar
skv committed
384
    mr = MergeRequest.find_by(title: "Bug NS-05")
Vinnie Okada's avatar
Vinnie Okada committed
385
    visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
386 387
  end

388 389 390 391 392
  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

393
  step 'I visit project "Shop" merge requests page' do
Vinnie Okada's avatar
Vinnie Okada committed
394
    visit namespace_project_merge_requests_path(project.namespace, project)
Nihad Abbasov's avatar
Nihad Abbasov committed
395 396
  end

397
  step 'I visit forked project "Shop" merge requests page' do
Vinnie Okada's avatar
Vinnie Okada committed
398
    visit namespace_project_merge_requests_path(project.namespace, project)
399 400
  end

401
  step 'I visit project "Shop" milestones page' do
Vinnie Okada's avatar
Vinnie Okada committed
402
    visit namespace_project_milestones_path(project.namespace, project)
Nihad Abbasov's avatar
Nihad Abbasov committed
403 404
  end

405
  step 'I visit project "Shop" team page' do
406
    visit namespace_project_project_members_path(project.namespace, project)
Nihad Abbasov's avatar
Nihad Abbasov committed
407 408
  end

409
  step 'I visit project wiki page' do
Vinnie Okada's avatar
Vinnie Okada committed
410
    visit namespace_project_wiki_path(@project.namespace, @project, :home)
Nihad Abbasov's avatar
Nihad Abbasov committed
411
  end
412

Ciro Santilli's avatar
Ciro Santilli committed
413 414 415 416 417 418
  # ----------------------------------------
  # Visibility Projects
  # ----------------------------------------

  step 'I visit project "Community" page' do
    project = Project.find_by(name: "Community")
Vinnie Okada's avatar
Vinnie Okada committed
419
    visit namespace_project_path(project.namespace, project)
Ciro Santilli's avatar
Ciro Santilli committed
420 421
  end

422 423
  step 'I visit project "Community" source page' do
    project = Project.find_by(name: 'Community')
Vinnie Okada's avatar
Vinnie Okada committed
424
    visit namespace_project_tree_path(project.namespace, project, root_ref)
425 426
  end

Ciro Santilli's avatar
Ciro Santilli committed
427 428
  step 'I visit project "Internal" page' do
    project = Project.find_by(name: "Internal")
Vinnie Okada's avatar
Vinnie Okada committed
429
    visit namespace_project_path(project.namespace, project)
Ciro Santilli's avatar
Ciro Santilli committed
430 431 432 433
  end

  step 'I visit project "Enterprise" page' do
    project = Project.find_by(name: "Enterprise")
Vinnie Okada's avatar
Vinnie Okada committed
434
    visit namespace_project_path(project.namespace, project)
Ciro Santilli's avatar
Ciro Santilli committed
435 436 437 438 439 440 441 442
  end

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

  step "I visit empty project page" do
    project = Project.find_by(name: "Empty Public Project")
Vinnie Okada's avatar
Vinnie Okada committed
443
    visit namespace_project_path(project.namespace, project)
Ciro Santilli's avatar
Ciro Santilli committed
444 445
  end

446 447 448 449
  # ----------------------------------------
  # Public Projects
  # ----------------------------------------

450
  step 'I visit the public projects area' do
451
    visit explore_projects_path
452 453
  end

454 455 456
  step 'I visit the explore trending projects' do
    visit trending_explore_projects_path
  end
457

458 459 460
  step 'I visit the explore starred projects' do
    visit starred_explore_projects_path
  end
461 462

  step 'I visit the public groups area' do
463
    visit explore_groups_path
464 465
  end

466 467 468 469
  # ----------------------------------------
  # Snippets
  # ----------------------------------------

470
  step 'I visit project "Shop" snippets page' do
Vinnie Okada's avatar
Vinnie Okada committed
471
    visit namespace_project_snippets_path(project.namespace, project)
472 473
  end

474
  step 'I visit snippets page' do
475
    visit explore_snippets_path
476 477
  end

478
  step 'I visit new snippet page' do
479 480 481
    visit new_snippet_path
  end

482 483 484
  def root_ref
    @project.repository.root_ref
  end
485 486

  def project
487
    Project.find_by!(name: 'Shop')
488
  end
489 490 491 492 493

  # ----------------------------------------
  # Errors
  # ----------------------------------------

494
  step 'page status code should be 404' do
495
    expect(status_code).to eq 404
496
  end
Nihad Abbasov's avatar
Nihad Abbasov committed
497
end