debian-mirror-gitlab/features/steps/shared/paths.rb

463 lines
11 KiB
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module SharedPaths
include Spinach::DSL
include RepoHelpers
2015-04-26 12:48:37 +05:30
include DashboardHelper
2017-09-10 17:25:29 +05:30
include WaitForRequests
2014-09-02 18:07:02 +05:30
step 'I visit new project page' do
visit new_project_path
end
2016-04-02 18:10:28 +05:30
step 'I visit login page' do
visit new_user_session_path
end
2014-09-02 18:07:02 +05:30
# ----------------------------------------
# User
# ----------------------------------------
step 'I visit user "John Doe" page' do
visit user_path("john_doe")
end
# ----------------------------------------
# Group
# ----------------------------------------
step 'I visit group "Owned" page' do
2015-09-11 14:41:01 +05:30
visit group_path(Group.find_by(name: "Owned"))
2014-09-02 18:07:02 +05:30
end
2016-06-02 11:05:42 +05:30
step 'I visit group "Owned" activity page' do
visit activity_group_path(Group.find_by(name: "Owned"))
end
2014-09-02 18:07:02 +05:30
step 'I visit group "Owned" issues page' do
2015-09-11 14:41:01 +05:30
visit issues_group_path(Group.find_by(name: "Owned"))
2014-09-02 18:07:02 +05:30
end
step 'I visit group "Owned" merge requests page' do
2015-09-11 14:41:01 +05:30
visit merge_requests_group_path(Group.find_by(name: "Owned"))
2014-09-02 18:07:02 +05:30
end
2015-11-26 14:37:03 +05:30
step 'I visit group "Owned" milestones page' do
visit group_milestones_path(Group.find_by(name: "Owned"))
end
2014-09-02 18:07:02 +05:30
step 'I visit group "Owned" members page' do
2015-09-11 14:41:01 +05:30
visit group_group_members_path(Group.find_by(name: "Owned"))
2014-09-02 18:07:02 +05:30
end
step 'I visit group "Owned" settings page' do
2015-09-11 14:41:01 +05:30
visit edit_group_path(Group.find_by(name: "Owned"))
2014-09-02 18:07:02 +05:30
end
2015-09-25 12:07:36 +05:30
step 'I visit group "Owned" projects page' do
visit projects_group_path(Group.find_by(name: "Owned"))
end
2014-09-02 18:07:02 +05:30
step 'I visit group "Guest" page' do
2015-09-11 14:41:01 +05:30
visit group_path(Group.find_by(name: "Guest"))
2014-09-02 18:07:02 +05:30
end
step 'I visit group "Guest" issues page' do
2015-09-11 14:41:01 +05:30
visit issues_group_path(Group.find_by(name: "Guest"))
2014-09-02 18:07:02 +05:30
end
step 'I visit group "Guest" merge requests page' do
2015-09-11 14:41:01 +05:30
visit merge_requests_group_path(Group.find_by(name: "Guest"))
2014-09-02 18:07:02 +05:30
end
step 'I visit group "Guest" members page' do
2015-09-11 14:41:01 +05:30
visit group_group_members_path(Group.find_by(name: "Guest"))
2014-09-02 18:07:02 +05:30
end
step 'I visit group "Guest" settings page' do
2015-09-11 14:41:01 +05:30
visit edit_group_path(Group.find_by(name: "Guest"))
2014-09-02 18:07:02 +05:30
end
# ----------------------------------------
# Dashboard
# ----------------------------------------
step 'I visit dashboard page' do
2015-09-25 12:07:36 +05:30
visit dashboard_projects_path
end
step 'I visit dashboard activity page' do
visit activity_dashboard_path
2014-09-02 18:07:02 +05:30
end
step 'I visit dashboard projects page' do
visit projects_dashboard_path
end
step 'I visit dashboard issues page' do
2015-04-26 12:48:37 +05:30
visit assigned_issues_dashboard_path
2014-09-02 18:07:02 +05:30
end
step 'I visit dashboard search page' do
visit search_path
end
step 'I visit dashboard help page' do
visit help_path
end
2015-04-26 12:48:37 +05:30
step 'I visit dashboard groups page' do
visit dashboard_groups_path
end
step 'I should be redirected to the dashboard groups page' do
2015-09-11 14:41:01 +05:30
expect(current_path).to eq dashboard_groups_path
2015-04-26 12:48:37 +05:30
end
step 'I visit dashboard starred projects page' do
visit starred_dashboard_projects_path
end
2014-09-02 18:07:02 +05:30
# ----------------------------------------
# Profile
# ----------------------------------------
step 'I visit profile page' do
visit profile_path
end
2015-04-26 12:48:37 +05:30
step 'I visit profile applications page' do
visit applications_profile_path
end
2014-09-02 18:07:02 +05:30
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
2015-09-11 14:41:01 +05:30
step 'I visit profile preferences page' do
visit profile_preferences_path
2014-09-02 18:07:02 +05:30
end
2017-09-10 17:25:29 +05:30
step 'I visit Authentication log page' do
2015-09-11 14:41:01 +05:30
visit audit_log_profile_path
2014-09-02 18:07:02 +05:30
end
# ----------------------------------------
# Admin
# ----------------------------------------
step 'I visit admin page' do
visit admin_root_path
end
2015-09-11 14:41:01 +05:30
step 'I visit abuse reports page' do
visit admin_abuse_reports_path
end
2014-09-02 18:07:02 +05:30
step 'I visit admin projects page' do
2017-08-17 22:00:37 +05:30
visit admin_projects_path
2014-09-02 18:07:02 +05:30
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
2016-04-02 18:10:28 +05:30
step 'I visit spam logs page' do
visit admin_spam_logs_path
end
2014-09-02 18:07:02 +05:30
# ----------------------------------------
# Generic Project
# ----------------------------------------
step "I visit my project's settings page" do
2017-09-10 17:25:29 +05:30
visit edit_project_path(@project)
2014-09-02 18:07:02 +05:30
end
step "I visit my project's files page" do
2017-09-10 17:25:29 +05:30
visit project_tree_path(@project, root_ref)
2015-04-26 12:48:37 +05:30
end
step 'I visit a binary file in the repo' do
2017-09-10 17:25:29 +05:30
visit project_blob_path(@project,
2015-12-23 02:04:40 +05:30
File.join(root_ref, 'files/images/logo-black.png'))
2014-09-02 18:07:02 +05:30
end
step "I visit my project's commits page" do
2017-09-10 17:25:29 +05:30
visit project_commits_path(@project, root_ref, { limit: 5 })
2014-09-02 18:07:02 +05:30
end
step "I visit my project's commits page for a specific path" do
2018-03-17 18:26:18 +05:30
visit project_commits_path(@project, root_ref + "/files/ruby/regex.rb", { limit: 5 })
2014-09-02 18:07:02 +05:30
end
step 'I visit my project\'s commits stats page' do
2017-09-10 17:25:29 +05:30
visit stats_project_repository_path(@project)
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
step "I visit my project's graph page" do
2014-09-02 18:07:02 +05:30
# Stub Graph max_size to speed up test (10 commits vs. 650)
Network::Graph.stub(max_count: 10)
2017-09-10 17:25:29 +05:30
visit project_network_path(@project, root_ref)
2014-09-02 18:07:02 +05:30
end
step "I visit my project's issues page" do
2017-09-10 17:25:29 +05:30
visit project_issues_path(@project)
2014-09-02 18:07:02 +05:30
end
step "I visit my project's merge requests page" do
2017-09-10 17:25:29 +05:30
visit project_merge_requests_path(@project)
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
step "I visit my project's members page" do
2017-09-10 17:25:29 +05:30
visit project_project_members_path(@project)
2015-09-11 14:41:01 +05:30
end
2014-09-02 18:07:02 +05:30
step "I visit my project's wiki page" do
2017-09-10 17:25:29 +05:30
visit project_wiki_path(@project, :home)
2014-09-02 18:07:02 +05:30
end
step 'I visit project hooks page' do
2017-09-10 17:25:29 +05:30
visit project_settings_integrations_path(@project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project deploy keys page' do
2017-09-10 17:25:29 +05:30
visit project_deploy_keys_path(@project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project find file page' do
2017-09-10 17:25:29 +05:30
visit project_find_file_path(@project, root_ref)
end
2014-09-02 18:07:02 +05:30
# ----------------------------------------
# "Shop" Project
# ----------------------------------------
step 'I visit project "Shop" page' do
2017-09-10 17:25:29 +05:30
visit project_path(project)
2014-09-02 18:07:02 +05:30
end
2015-09-11 14:41:01 +05:30
step 'I visit project "Shop" activity page' do
2017-09-10 17:25:29 +05:30
visit activity_project_path(project)
2015-09-11 14:41:01 +05:30
end
2014-09-02 18:07:02 +05:30
step 'I visit project "Forked Shop" merge requests page' do
2017-09-10 17:25:29 +05:30
visit project_merge_requests_path(@forked_project)
2014-09-02 18:07:02 +05:30
end
step 'I visit edit project "Shop" page' do
2017-09-10 17:25:29 +05:30
visit edit_project_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project branches page' do
2017-09-10 17:25:29 +05:30
visit project_branches_path(@project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project protected branches page' do
2017-09-10 17:25:29 +05:30
visit project_protected_branches_path(@project)
2014-09-02 18:07:02 +05:30
end
step 'I visit compare refs page' do
2017-09-10 17:25:29 +05:30
visit project_compare_index_path(@project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project commits page' do
2017-09-10 17:25:29 +05:30
visit project_commits_path(@project, root_ref, { limit: 5 })
2014-09-02 18:07:02 +05:30
end
step 'I visit project commits page for stable branch' do
2017-09-10 17:25:29 +05:30
visit project_commits_path(@project, 'stable', { limit: 5 })
2014-09-02 18:07:02 +05:30
end
step 'I visit blob file from repo' do
2017-09-10 17:25:29 +05:30
visit project_blob_path(@project, File.join(sample_commit.id, sample_blob.path))
2014-09-02 18:07:02 +05:30
end
step 'I visit ".gitignore" file in repo' do
2017-09-10 17:25:29 +05:30
visit project_blob_path(@project, File.join(root_ref, '.gitignore'))
2015-04-26 12:48:37 +05:30
end
step 'I am on the new file page' do
2017-09-10 17:25:29 +05:30
expect(current_path).to eq(project_create_blob_path(@project, root_ref))
2015-04-26 12:48:37 +05:30
end
step 'I am on the ".gitignore" edit file page' do
2015-12-23 02:04:40 +05:30
expect(current_path).to eq(
2017-09-10 17:25:29 +05:30
project_edit_blob_path(@project, File.join(root_ref, '.gitignore')))
2014-09-02 18:07:02 +05:30
end
step 'I visit project source page for "6d39438"' do
2017-09-10 17:25:29 +05:30
visit project_tree_path(@project, "6d39438")
2015-04-26 12:48:37 +05:30
end
step 'I visit project source page for' \
' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
2017-09-10 17:25:29 +05:30
visit project_tree_path(@project,
2015-04-26 12:48:37 +05:30
'6d394385cf567f80a8fd85055db1ab4c5295806f')
2014-09-02 18:07:02 +05:30
end
step 'I visit project tags page' do
2017-09-10 17:25:29 +05:30
visit project_tags_path(@project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project commit page' do
2017-09-10 17:25:29 +05:30
visit project_commit_path(@project, sample_commit.id)
2014-09-02 18:07:02 +05:30
end
step 'I visit issue page "Release 0.4"' do
issue = Issue.find_by(title: "Release 0.4")
2017-09-10 17:25:29 +05:30
visit project_issue_path(issue.project, issue)
2015-04-26 12:48:37 +05:30
end
2014-09-02 18:07:02 +05:30
step 'I visit project "Forum" labels page' do
project = Project.find_by(name: 'Forum')
2017-09-10 17:25:29 +05:30
visit project_labels_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "Shop" new label page' do
project = Project.find_by(name: 'Shop')
2017-09-10 17:25:29 +05:30
visit new_project_label_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "Forum" new label page' do
project = Project.find_by(name: 'Forum')
2017-09-10 17:25:29 +05:30
visit new_project_label_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit merge request page "Bug NS-04"' do
2016-06-02 11:05:42 +05:30
visit merge_request_path("Bug NS-04")
2017-09-10 17:25:29 +05:30
wait_for_requests
2014-09-02 18:07:02 +05:30
end
step 'I visit merge request page "Bug NS-05"' do
2016-06-02 11:05:42 +05:30
visit merge_request_path("Bug NS-05")
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-06-02 11:05:42 +05:30
end
step 'I visit merge request page "Bug NS-07"' do
visit merge_request_path("Bug NS-07")
2017-09-10 17:25:29 +05:30
wait_for_requests
2016-06-02 11:05:42 +05:30
end
step 'I visit merge request page "Bug NS-08"' do
visit merge_request_path("Bug NS-08")
2017-09-10 17:25:29 +05:30
wait_for_requests
2015-04-26 12:48:37 +05:30
end
2015-09-11 14:41:01 +05:30
step 'I visit merge request page "Bug CO-01"' do
mr = MergeRequest.find_by(title: "Bug CO-01")
2017-09-10 17:25:29 +05:30
visit project_merge_request_path(mr.target_project, mr)
wait_for_requests
2014-09-02 18:07:02 +05:30
end
step 'I visit forked project "Shop" merge requests page' do
2017-09-10 17:25:29 +05:30
visit project_merge_requests_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "Shop" milestones page' do
2017-09-10 17:25:29 +05:30
visit project_milestones_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "Shop" team page' do
2017-09-10 17:25:29 +05:30
visit project_project_members_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project wiki page' do
2017-09-10 17:25:29 +05:30
visit project_wiki_path(@project, :home)
2014-09-02 18:07:02 +05:30
end
# ----------------------------------------
# Visibility Projects
# ----------------------------------------
2015-04-26 12:48:37 +05:30
step 'I visit project "Community" source page' do
project = Project.find_by(name: 'Community')
2017-09-10 17:25:29 +05:30
visit project_tree_path(project, root_ref)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "Internal" page' do
project = Project.find_by(name: "Internal")
2017-09-10 17:25:29 +05:30
visit project_path(project)
2014-09-02 18:07:02 +05:30
end
step 'I visit project "Enterprise" page' do
project = Project.find_by(name: "Enterprise")
2017-09-10 17:25:29 +05:30
visit project_path(project)
2014-09-02 18:07:02 +05:30
end
# ----------------------------------------
# Empty Projects
# ----------------------------------------
2016-06-02 11:05:42 +05:30
step "I should not see command line instructions" do
expect(page).not_to have_css('.empty_wrapper')
end
2014-09-02 18:07:02 +05:30
# ----------------------------------------
# Public Projects
# ----------------------------------------
step 'I visit the public groups area' do
visit explore_groups_path
end
# ----------------------------------------
# Snippets
# ----------------------------------------
2015-04-26 12:48:37 +05:30
step 'I visit project "Shop" snippets page' do
2017-09-10 17:25:29 +05:30
visit project_snippets_path(project)
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
step 'I visit snippets page' do
2015-09-25 12:07:36 +05:30
visit explore_snippets_path
2014-09-02 18:07:02 +05:30
end
def root_ref
@project.repository.root_ref
end
def project
2015-04-26 12:48:37 +05:30
Project.find_by!(name: 'Shop')
2014-09-02 18:07:02 +05:30
end
2016-06-02 11:05:42 +05:30
def merge_request_path(title)
mr = MergeRequest.find_by(title: title)
2017-09-10 17:25:29 +05:30
project_merge_request_path(mr.target_project, mr)
2016-06-02 11:05:42 +05:30
end
2014-09-02 18:07:02 +05:30
# ----------------------------------------
# Errors
# ----------------------------------------
2015-04-26 12:48:37 +05:30
step 'page status code should be 404' do
2015-09-11 14:41:01 +05:30
expect(status_code).to eq 404
2014-09-02 18:07:02 +05:30
end
end