Read about our upcoming Code of Conduct on this issue

paths.rb 9.22 KB
Newer Older
Nihad Abbasov's avatar
Nihad Abbasov committed
1
2
3
module SharedPaths
  include Spinach::DSL

4
  step 'I visit new project page' do
5
6
7
    visit new_project_path
  end

8
9
10
11
12
13
14
15
  # ----------------------------------------
  # User
  # ----------------------------------------

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

randx's avatar
randx committed
16
17
18
19
  # ----------------------------------------
  # Group
  # ----------------------------------------

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

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

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

32
33
  step 'I visit group "Owned" members page' do
    visit members_group_path(Group.find_by(name:"Owned"))
34
35
  end

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  step 'I visit group "Owned" settings page' do
    visit edit_group_path(Group.find_by(name:"Owned"))
  end

  step 'I visit group "Guest" page' do
    visit group_path(Group.find_by(name:"Guest"))
  end

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

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

  step 'I visit group "Guest" members page' do
    visit members_group_path(Group.find_by(name:"Guest"))
  end

  step 'I visit group "Guest" settings page' do
    visit edit_group_path(Group.find_by(name:"Guest"))
58
59
  end

60
61
62
63
  # ----------------------------------------
  # Dashboard
  # ----------------------------------------

64
  step 'I visit dashboard page' do
65
66
67
    visit dashboard_path
  end

68
  step 'I visit dashboard projects page' do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
69
70
71
    visit projects_dashboard_path
  end

72
  step 'I visit dashboard issues page' do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
73
    visit issues_dashboard_path
Nihad Abbasov's avatar
Nihad Abbasov committed
74
75
  end

76
  step 'I visit dashboard merge requests page' do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
77
    visit merge_requests_dashboard_path
Nihad Abbasov's avatar
Nihad Abbasov committed
78
79
  end

80
  step 'I visit dashboard search page' do
81
    visit search_path
Nihad Abbasov's avatar
Nihad Abbasov committed
82
83
  end

84
  step 'I visit dashboard help page' do
85
    visit help_path
Nihad Abbasov's avatar
Nihad Abbasov committed
86
87
  end

88
89
90
91
  # ----------------------------------------
  # Profile
  # ----------------------------------------

92
  step 'I visit profile page' do
Nihad Abbasov's avatar
Nihad Abbasov committed
93
94
95
    visit profile_path
  end

96
97
98
99
  step 'I visit profile password page' do
    visit edit_profile_password_path
  end

100
  step 'I visit profile account page' do
101
    visit profile_account_path
Nihad Abbasov's avatar
Nihad Abbasov committed
102
103
  end

104
  step 'I visit profile SSH keys page' do
105
    visit profile_keys_path
106
107
  end

108
  step 'I visit profile design page' do
109
    visit design_profile_path
110
111
  end

112
  step 'I visit profile history page' do
113
    visit history_profile_path
Nihad Abbasov's avatar
Nihad Abbasov committed
114
115
  end

116
117
118
119
120
121
122
123
  step 'I visit profile groups page' do
    visit profile_groups_path
  end

  step 'I should be redirected to the profile groups page' do
    current_path.should == profile_groups_path
  end

124
125
126
127
  # ----------------------------------------
  # Admin
  # ----------------------------------------

128
  step 'I visit admin page' do
129
130
131
    visit admin_root_path
  end

132
  step 'I visit admin projects page' do
133
134
135
    visit admin_projects_path
  end

136
  step 'I visit admin users page' do
137
138
139
    visit admin_users_path
  end

140
  step 'I visit admin logs page' do
141
142
143
    visit admin_logs_path
  end

144
145
146
147
  step 'I visit admin messages page' do
    visit admin_broadcast_messages_path
  end

148
  step 'I visit admin hooks page' do
149
150
151
    visit admin_hooks_path
  end

152
  step 'I visit admin Resque page' do
153
    visit admin_background_jobs_path
154
155
  end

156
  step 'I visit admin groups page' do
randx's avatar
randx committed
157
158
159
    visit admin_groups_path
  end

160
  step 'I visit admin teams page' do
Andrey Kumanyaev's avatar
Andrey Kumanyaev committed
161
162
163
    visit admin_teams_path
  end

164
165
166
167
  # ----------------------------------------
  # Generic Project
  # ----------------------------------------

168
  step "I visit my project's home page" do
169
170
171
    visit project_path(@project)
  end

172
  step "I visit my project's settings page" do
173
174
175
    visit edit_project_path(@project)
  end

176
  step "I visit my project's files page" do
177
    visit project_tree_path(@project, root_ref)
Nihad Abbasov's avatar
Nihad Abbasov committed
178
179
  end

180
  step "I visit my project's commits page" do
181
    visit project_commits_path(@project, root_ref, {limit: 5})
182
183
  end

184
  step "I visit my project's commits page for a specific path" do
185
    visit project_commits_path(@project, root_ref + "/app/models/project.rb", {limit: 5})
186
187
  end

188
  step 'I visit my project\'s commits stats page' do
randx's avatar
randx committed
189
190
191
    visit stats_project_repository_path(@project)
  end

192
  step "I visit my project's network page" do
193
194
    # Stub Graph max_size to speed up test (10 commits vs. 650)
    Network::Graph.stub(max_count: 10)
195

196
    visit project_network_path(@project, root_ref)
197
198
  end

199
  step "I visit my project's issues page" do
200
201
202
    visit project_issues_path(@project)
  end

203
  step "I visit my project's merge requests page" do
204
205
206
    visit project_merge_requests_path(@project)
  end

207
  step "I visit my project's wiki page" do
208
    visit project_wiki_path(@project, :home)
209
210
  end

211
  step 'I visit project hooks page' do
212
213
214
    visit project_hooks_path(@project)
  end

215
216
217
218
  step 'I visit project deploy keys page' do
    visit project_deploy_keys_path(@project)
  end

219
220
221
222
  # ----------------------------------------
  # "Shop" Project
  # ----------------------------------------

223
  step 'I visit project "Shop" page' do
Nihad Abbasov's avatar
Nihad Abbasov committed
224
225
226
    visit project_path(project)
  end

227
228
229
230
  step 'I visit project "Forked Shop" merge requests page' do
    visit project_merge_requests_path(@forked_project)
  end

231
  step 'I visit edit project "Shop" page' do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
232
233
234
    visit edit_project_path(project)
  end

235
  step 'I visit project branches page' do
236
    visit project_branches_path(@project)
Nihad Abbasov's avatar
Nihad Abbasov committed
237
238
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
239
240
241
242
  step 'I visit project protected branches page' do
    visit project_protected_branches_path(@project)
  end

243
  step 'I visit compare refs page' do
Robert Speicher's avatar
Robert Speicher committed
244
    visit project_compare_index_path(@project)
Nihad Abbasov's avatar
Nihad Abbasov committed
245
246
  end

247
  step 'I visit project commits page' do
248
    visit project_commits_path(@project, root_ref, {limit: 5})
249
250
  end

251
  step 'I visit project commits page for stable branch' do
252
    visit project_commits_path(@project, 'stable', {limit: 5})
Nihad Abbasov's avatar
Nihad Abbasov committed
253
254
  end

255
  step 'I visit project source page' do
256
    visit project_tree_path(@project, root_ref)
Nihad Abbasov's avatar
Nihad Abbasov committed
257
258
  end

259
  step 'I visit blob file from repo' do
260
    visit project_blob_path(@project, File.join(ValidCommit::ID, ValidCommit::BLOB_FILE_PATH))
Nihad Abbasov's avatar
Nihad Abbasov committed
261
262
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
263
264
265
266
  step 'I visit "Gemfile.lock" file in repo' do
    visit project_blob_path(@project, File.join(root_ref, 'Gemfile.lock'))
  end

267
  step 'I visit project source page for "8470d70"' do
268
    visit project_tree_path(@project, "8470d70")
Nihad Abbasov's avatar
Nihad Abbasov committed
269
270
  end

271
  step 'I visit project tags page' do
272
    visit project_tags_path(@project)
Nihad Abbasov's avatar
Nihad Abbasov committed
273
274
  end

275
  step 'I visit project commit page' do
Nihad Abbasov's avatar
Nihad Abbasov committed
276
277
278
    visit project_commit_path(@project, ValidCommit::ID)
  end

279
  step 'I visit project "Shop" issues page' do
280
    visit project_issues_path(project)
Nihad Abbasov's avatar
Nihad Abbasov committed
281
282
  end

283
  step 'I visit issue page "Release 0.4"' do
skv's avatar
skv committed
284
    issue = Issue.find_by(title: "Release 0.4")
Nihad Abbasov's avatar
Nihad Abbasov committed
285
286
287
    visit project_issue_path(issue.project, issue)
  end

288
  step 'I visit project "Shop" labels page' do
289
    visit project_labels_path(project)
Nihad Abbasov's avatar
Nihad Abbasov committed
290
291
  end

292
  step 'I visit merge request page "Bug NS-04"' do
skv's avatar
skv committed
293
    mr = MergeRequest.find_by(title: "Bug NS-04")
294
    visit project_merge_request_path(mr.target_project, mr)
Nihad Abbasov's avatar
Nihad Abbasov committed
295
296
  end

297
  step 'I visit merge request page "Bug NS-05"' do
skv's avatar
skv committed
298
    mr = MergeRequest.find_by(title: "Bug NS-05")
299
    visit project_merge_request_path(mr.target_project, mr)
300
301
  end

302
  step 'I visit project "Shop" merge requests page' do
303
    visit project_merge_requests_path(project)
Nihad Abbasov's avatar
Nihad Abbasov committed
304
305
  end

306
307
308
309
  step 'I visit forked project "Shop" merge requests page' do
    visit project_merge_requests_path(project)
  end

310
  step 'I visit project "Shop" milestones page' do
311
    visit project_milestones_path(project)
Nihad Abbasov's avatar
Nihad Abbasov committed
312
313
  end

314
  step 'I visit project "Shop" team page' do
315
    visit project_team_index_path(project)
Nihad Abbasov's avatar
Nihad Abbasov committed
316
317
  end

318
  step 'I visit project wiki page' do
319
    visit project_wiki_path(@project, :home)
Nihad Abbasov's avatar
Nihad Abbasov committed
320
  end
321

Ciro Santilli's avatar
Ciro Santilli committed
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
  # ----------------------------------------
  # Visibility Projects
  # ----------------------------------------

  step 'I visit project "Community" page' do
    project = Project.find_by(name: "Community")
    visit project_path(project)
  end

  step 'I visit project "Internal" page' do
    project = Project.find_by(name: "Internal")
    visit project_path(project)
  end

  step 'I visit project "Enterprise" page' do
    project = Project.find_by(name: "Enterprise")
    visit project_path(project)
  end

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

  step "I visit empty project page" do
    project = Project.find_by(name: "Empty Public Project")
    visit project_path(project)
  end

350
351
352
353
  # ----------------------------------------
  # Public Projects
  # ----------------------------------------

354
  step 'I visit the public projects area' do
355
356
357
    visit public_root_path
  end

358
359
360
361
  # ----------------------------------------
  # Snippets
  # ----------------------------------------

362
363
364
365
  Given 'I visit project "Shop" snippets page' do
    visit project_snippets_path(project)
  end

Andrew8xx8's avatar
Andrew8xx8 committed
366
367
368
369
370
371
372
373
  Given 'I visit snippets page' do
    visit snippets_path
  end

  Given 'I visit new snippet page' do
    visit new_snippet_path
  end

374
375
376
  def root_ref
    @project.repository.root_ref
  end
377
378

  def project
skv's avatar
skv committed
379
    project = Project.find_by!(name: "Shop")
380
  end
381
382
383
384
385
386
387
388

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

  Then 'page status code should be 404' do
    page.status_code.should == 404
  end
Nihad Abbasov's avatar
Nihad Abbasov committed
389
end