1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
|
module SharedPaths
include Spinach::DSL
include RepoHelpers
include DashboardHelper
include WaitForRequests
step 'I visit new project page' do
visit new_project_path
end
step 'I visit login page' do
visit new_user_session_path
end
# ----------------------------------------
# User
# ----------------------------------------
step 'I visit user "John Doe" page' do
visit user_path("john_doe")
end
# ----------------------------------------
# Group
# ----------------------------------------
step 'I visit group "Owned" page' do
visit group_path(Group.find_by(name: "Owned"))
end
step 'I visit group "Owned" activity page' do
visit activity_group_path(Group.find_by(name: "Owned"))
end
step 'I visit group "Owned" issues page' do
visit issues_group_path(Group.find_by(name: "Owned"))
end
step 'I visit group "Owned" merge requests page' do
visit merge_requests_group_path(Group.find_by(name: "Owned"))
end
step 'I visit group "Owned" milestones page' do
visit group_milestones_path(Group.find_by(name: "Owned"))
end
step 'I visit group "Owned" members page' do
visit group_group_members_path(Group.find_by(name: "Owned"))
end
step 'I visit group "Owned" projects page' do
visit projects_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 group_group_members_path(Group.find_by(name: "Guest"))
end
step 'I visit group "Guest" settings page' do
visit edit_group_path(Group.find_by(name: "Guest"))
end
# ----------------------------------------
# Dashboard
# ----------------------------------------
step 'I visit dashboard page' do
visit dashboard_projects_path
end
step 'I visit dashboard activity page' do
visit activity_dashboard_path
end
step 'I visit dashboard projects page' do
visit projects_dashboard_path
end
step 'I visit dashboard issues page' do
visit assigned_issues_dashboard_path
end
step 'I visit dashboard search page' do
visit search_path
end
step 'I visit dashboard help page' do
visit help_path
end
step 'I visit dashboard groups page' do
visit dashboard_groups_path
end
step 'I should be redirected to the dashboard groups page' do
expect(current_path).to eq dashboard_groups_path
end
step 'I visit dashboard starred projects page' do
visit starred_dashboard_projects_path
end
# ----------------------------------------
# Profile
# ----------------------------------------
step 'I visit profile page' do
visit profile_path
end
step 'I visit profile applications page' do
visit applications_profile_path
end
step 'I visit profile password page' do
visit edit_profile_password_path
end
step 'I visit profile account page' do
visit profile_account_path
end
step 'I visit profile SSH keys page' do
visit profile_keys_path
end
step 'I visit profile preferences page' do
visit profile_preferences_path
end
step 'I visit Authentication log page' do
visit audit_log_profile_path
end
# ----------------------------------------
# Admin
# ----------------------------------------
step 'I visit admin page' do
visit admin_root_path
end
step 'I visit abuse reports page' do
visit admin_abuse_reports_path
end
step 'I visit admin projects page' do
visit admin_projects_path
end
step 'I visit admin users page' do
visit admin_users_path
end
step 'I visit admin logs page' do
visit admin_logs_path
end
step 'I visit admin messages page' do
visit admin_broadcast_messages_path
end
step 'I visit admin hooks page' do
visit admin_hooks_path
end
step 'I visit admin Resque page' do
visit admin_background_jobs_path
end
step 'I visit admin teams page' do
visit admin_teams_path
end
step 'I visit spam logs page' do
visit admin_spam_logs_path
end
# ----------------------------------------
# Generic Project
# ----------------------------------------
step "I visit my project's settings page" do
visit edit_project_path(@project)
end
step 'I visit a binary file in the repo' do
visit project_blob_path(@project,
File.join(root_ref, 'files/images/logo-black.png'))
end
step "I visit my project's commits page" do
visit project_commits_path(@project, root_ref, { limit: 5 })
end
step "I visit my project's commits page for a specific path" do
visit project_commits_path(@project, root_ref + "/files/ruby/regex.rb", { limit: 5 })
end
step 'I visit my project\'s commits stats page' do
visit stats_project_repository_path(@project)
end
step "I visit my project's graph page" do
# Stub Graph max_size to speed up test (10 commits vs. 650)
Network::Graph.stub(max_count: 10)
visit project_network_path(@project, root_ref)
end
step "I visit my project's issues page" do
visit project_issues_path(@project)
end
step "I visit my project's merge requests page" do
visit project_merge_requests_path(@project)
end
step "I visit my project's members page" do
visit project_project_members_path(@project)
end
step "I visit my project's wiki page" do
visit project_wiki_path(@project, :home)
end
step 'I visit project hooks page' do
visit project_settings_integrations_path(@project)
end
step 'I visit project find file page' do
visit project_find_file_path(@project, root_ref)
end
# ----------------------------------------
# "Shop" Project
# ----------------------------------------
step 'I visit project "Shop" page' do
visit project_path(project)
end
step 'I visit project "Forked Shop" merge requests page' do
visit project_merge_requests_path(@forked_project)
end
step 'I visit edit project "Shop" page' do
visit edit_project_path(project)
end
step 'I visit compare refs page' do
visit project_compare_index_path(@project)
end
step 'I visit project commits page' do
visit project_commits_path(@project, root_ref, { limit: 5 })
end
step 'I visit project commits page for stable branch' do
visit project_commits_path(@project, 'stable', { limit: 5 })
end
step 'I visit blob file from repo' do
visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
end
step 'I visit ".gitignore" file in repo' do
visit project_blob_path(@project, File.join(root_ref, '.gitignore'))
end
step 'I am on the new file page' do
expect(current_path).to eq(project_create_blob_path(@project, root_ref))
end
step 'I am on the ".gitignore" edit file page' do
expect(current_path).to eq(
project_edit_blob_path(@project, File.join(root_ref, '.gitignore')))
end
step 'I visit project source page for "6d39438"' do
visit project_tree_path(@project, "6d39438")
end
step 'I visit project source page for' \
' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
visit project_tree_path(@project,
'6d394385cf567f80a8fd85055db1ab4c5295806f')
end
step 'I visit project tags page' do
visit project_tags_path(@project)
end
step 'I visit issue page "Release 0.4"' do
issue = Issue.find_by(title: "Release 0.4")
visit project_issue_path(issue.project, issue)
end
step 'I visit project "Forum" labels page' do
project = Project.find_by(name: 'Forum')
visit project_labels_path(project)
end
step 'I visit project "Shop" new label page' do
project = Project.find_by(name: 'Shop')
visit new_project_label_path(project)
end
step 'I visit project "Forum" new label page' do
project = Project.find_by(name: 'Forum')
visit new_project_label_path(project)
end
step 'I visit merge request page "Bug NS-04"' do
visit merge_request_path("Bug NS-04")
wait_for_requests
end
step 'I visit merge request page "Bug NS-07"' do
visit merge_request_path("Bug NS-07")
wait_for_requests
end
step 'I visit merge request page "Bug NS-08"' do
visit merge_request_path("Bug NS-08")
wait_for_requests
end
step 'I visit merge request page "Bug CO-01"' do
mr = MergeRequest.find_by(title: "Bug CO-01")
visit project_merge_request_path(mr.target_project, mr)
wait_for_requests
end
step 'I visit forked project "Shop" merge requests page' do
visit project_merge_requests_path(project)
end
step 'I visit project "Shop" team page' do
visit project_project_members_path(project)
end
step 'I visit project wiki page' do
visit project_wiki_path(@project, :home)
end
# ----------------------------------------
# Visibility Projects
# ----------------------------------------
step 'I visit project "Community" source page' do
project = Project.find_by(name: 'Community')
visit project_tree_path(project, root_ref)
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 should not see command line instructions" do
expect(page).not_to have_css('.empty_wrapper')
end
# ----------------------------------------
# Public Projects
# ----------------------------------------
step 'I visit the public groups area' do
visit explore_groups_path
end
# ----------------------------------------
# Snippets
# ----------------------------------------
step 'I visit project "Shop" snippets page' do
visit project_snippets_path(project)
end
step 'I visit snippets page' do
visit explore_snippets_path
end
def root_ref
@project.repository.root_ref
end
def project
Project.find_by!(name: 'Shop')
end
def merge_request_path(title)
mr = MergeRequest.find_by(title: title)
project_merge_request_path(mr.target_project, mr)
end
end
|