gitlab-org--gitlab-foss/features/steps/shared/paths.rb

486 lines
13 KiB
Ruby
Raw Normal View History

2012-09-10 11:35:03 -04:00
module SharedPaths
include Spinach::DSL
include RepoHelpers
include DashboardHelper
2012-09-10 11:35:03 -04:00
2013-05-06 08:09:41 -04:00
step 'I visit new project page' do
visit new_project_path
end
# ----------------------------------------
# User
# ----------------------------------------
step 'I visit user "John Doe" page' do
visit user_path("john_doe")
end
2012-10-22 14:42:06 -04:00
# ----------------------------------------
# Group
# ----------------------------------------
2014-02-07 11:59:55 -05:00
step 'I visit group "Owned" page' do
visit group_path(Group.find_by(name: "Owned"))
2012-10-22 14:42:06 -04:00
end
2014-02-07 11:59:55 -05:00
step 'I visit group "Owned" issues page' do
visit issues_group_path(Group.find_by(name: "Owned"))
2012-10-22 14:42:06 -04:00
end
2014-02-07 11:59:55 -05:00
step 'I visit group "Owned" merge requests page' do
visit merge_requests_group_path(Group.find_by(name: "Owned"))
2012-10-22 14:42:06 -04:00
end
2014-02-07 11:59:55 -05:00
step 'I visit group "Owned" members page' do
visit group_group_members_path(Group.find_by(name: "Owned"))
2012-12-25 17:52:49 -05:00
end
2014-02-07 11:59:55 -05:00
step 'I visit group "Owned" settings page' do
visit edit_group_path(Group.find_by(name: "Owned"))
2014-02-07 11:59:55 -05:00
end
2015-08-18 11:46:57 -04:00
step 'I visit group "Owned" projects page' do
visit projects_group_path(Group.find_by(name: "Owned"))
end
2014-02-07 11:59:55 -05:00
step 'I visit group "Guest" page' do
visit group_path(Group.find_by(name: "Guest"))
2014-02-07 11:59:55 -05:00
end
step 'I visit group "Guest" issues page' do
visit issues_group_path(Group.find_by(name: "Guest"))
2014-02-07 11:59:55 -05:00
end
step 'I visit group "Guest" merge requests page' do
visit merge_requests_group_path(Group.find_by(name: "Guest"))
2014-02-07 11:59:55 -05:00
end
step 'I visit group "Guest" members page' do
visit group_group_members_path(Group.find_by(name: "Guest"))
2014-02-07 11:59:55 -05:00
end
step 'I visit group "Guest" settings page' do
visit edit_group_path(Group.find_by(name: "Guest"))
end
# ----------------------------------------
# Dashboard
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step 'I visit dashboard page' do
visit dashboard_path
end
step 'I visit dashboard activity page' do
visit activity_dashboard_path
end
2013-05-06 08:09:41 -04:00
step 'I visit dashboard projects page' do
2013-01-27 08:41:35 -05:00
visit projects_dashboard_path
end
2013-05-06 08:09:41 -04:00
step 'I visit dashboard issues page' do
visit assigned_issues_dashboard_path
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit dashboard merge requests page' do
visit assigned_mrs_dashboard_path
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit dashboard search page' do
visit search_path
2012-09-10 11:35:03 -04:00
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
2015-03-09 17:25:14 -04:00
end
step 'I visit dashboard starred projects page' do
visit starred_dashboard_projects_path
end
# ----------------------------------------
# Profile
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step 'I visit profile page' do
2012-09-10 11:35:03 -04:00
visit profile_path
end
step 'I visit profile applications page' do
visit applications_profile_path
end
2013-10-09 10:01:04 -04:00
step 'I visit profile password page' do
visit edit_profile_password_path
end
2013-05-06 08:09:41 -04:00
step 'I visit profile account page' do
2013-10-09 10:01:04 -04:00
visit profile_account_path
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit profile SSH keys page' do
visit profile_keys_path
end
2015-06-05 14:00:21 -04:00
step 'I visit profile preferences page' do
visit profile_preferences_path
end
2015-07-03 07:54:50 -04:00
step 'I visit Audit Log page' do
visit audit_log_profile_path
2012-09-10 11:35:03 -04:00
end
# ----------------------------------------
# Admin
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step 'I visit admin page' do
visit admin_root_path
end
step 'I visit abuse reports page' do
visit admin_abuse_reports_path
end
2013-05-06 08:09:41 -04:00
step 'I visit admin projects page' do
visit admin_namespaces_projects_path
end
2013-05-06 08:09:41 -04:00
step 'I visit admin users page' do
visit admin_users_path
end
2013-05-06 08:09:41 -04:00
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
2013-05-06 08:09:41 -04:00
step 'I visit admin hooks page' do
visit admin_hooks_path
end
2013-05-06 08:09:41 -04:00
step 'I visit admin Resque page' do
visit admin_background_jobs_path
end
2013-05-06 08:09:41 -04:00
step 'I visit admin groups page' do
2012-10-22 14:42:06 -04:00
visit admin_groups_path
end
2013-05-06 08:09:41 -04:00
step 'I visit admin teams page' do
2013-01-19 12:11:11 -05:00
visit admin_teams_path
end
step 'I visit admin settings page' do
visit admin_application_settings_path
end
2015-01-19 14:18:00 -05:00
step 'I visit applications page' do
visit admin_applications_path
end
# ----------------------------------------
# Generic Project
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step "I visit my project's home page" do
visit namespace_project_path(@project.namespace, @project)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's settings page" do
visit edit_namespace_project_path(@project.namespace, @project)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's files page" do
visit namespace_project_tree_path(@project.namespace, @project, root_ref)
2012-09-10 11:35:03 -04:00
end
step 'I visit a binary file in the repo' do
visit namespace_project_blob_path(@project.namespace, @project, File.join(
root_ref, 'files/images/logo-black.png'))
end
2013-05-06 08:09:41 -04:00
step "I visit my project's commits page" do
visit namespace_project_commits_path(@project.namespace, @project, root_ref, { limit: 5 })
end
2013-05-06 08:09:41 -04:00
step "I visit my project's commits page for a specific path" do
visit namespace_project_commits_path(@project.namespace, @project, root_ref + "/app/models/project.rb", { limit: 5 })
end
2013-05-06 08:09:41 -04:00
step 'I visit my project\'s commits stats page' do
visit stats_namespace_project_repository_path(@project.namespace, @project)
2012-11-10 16:33:10 -05:00
end
2013-05-06 08:09:41 -04:00
step "I visit my project's network page" do
# Stub Graph max_size to speed up test (10 commits vs. 650)
Network::Graph.stub(max_count: 10)
visit namespace_project_network_path(@project.namespace, @project, root_ref)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's issues page" do
visit namespace_project_issues_path(@project.namespace, @project)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's merge requests page" do
visit namespace_project_merge_requests_path(@project.namespace, @project)
end
step "I visit my project's members page" do
visit namespace_project_project_members_path(@project.namespace, @project)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's wiki page" do
visit namespace_project_wiki_path(@project.namespace, @project, :home)
end
2013-05-06 08:09:41 -04:00
step 'I visit project hooks page' do
visit namespace_project_hooks_path(@project.namespace, @project)
end
2013-05-06 08:09:41 -04:00
step 'I visit project deploy keys page' do
visit namespace_project_deploy_keys_path(@project.namespace, @project)
2013-05-06 08:09:41 -04:00
end
# ----------------------------------------
# "Shop" Project
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" page' do
visit namespace_project_path(project.namespace, project)
2012-09-10 11:35:03 -04:00
end
step 'I visit project "Shop" activity page' do
visit activity_namespace_project_path(project.namespace, project)
end
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
step 'I visit project "Forked Shop" merge requests page' do
visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project)
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit edit project "Shop" page' do
visit edit_namespace_project_path(project.namespace, project)
2013-01-09 00:14:05 -05:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project branches page' do
visit namespace_project_branches_path(@project.namespace, @project)
2012-09-10 11:35:03 -04:00
end
step 'I visit project protected branches page' do
visit namespace_project_protected_branches_path(@project.namespace, @project)
end
2013-05-06 08:09:41 -04:00
step 'I visit compare refs page' do
visit namespace_project_compare_index_path(@project.namespace, @project)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project commits page' do
visit namespace_project_commits_path(@project.namespace, @project, root_ref, { limit: 5 })
end
2013-05-06 08:09:41 -04:00
step 'I visit project commits page for stable branch' do
visit namespace_project_commits_path(@project.namespace, @project, 'stable', { limit: 5 })
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project source page' do
visit namespace_project_tree_path(@project.namespace, @project, root_ref)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit blob file from repo' do
visit namespace_project_blob_path(@project.namespace, @project, File.join(sample_commit.id, sample_blob.path))
2012-09-10 11:35:03 -04:00
end
step 'I visit ".gitignore" file in repo' do
visit namespace_project_blob_path(@project.namespace, @project, File.join(root_ref, '.gitignore'))
end
step 'I am on the new file page' do
expect(current_path).to eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref))
end
step 'I am on the ".gitignore" edit file page' do
expect(current_path).to eq(namespace_project_edit_blob_path(
@project.namespace, @project, File.join(root_ref, '.gitignore')))
end
step 'I visit project source page for "6d39438"' do
visit namespace_project_tree_path(@project.namespace, @project, "6d39438")
2012-09-10 11:35:03 -04:00
end
step 'I visit project source page for' \
' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
visit namespace_project_tree_path(@project.namespace, @project,
'6d394385cf567f80a8fd85055db1ab4c5295806f')
end
2013-05-06 08:09:41 -04:00
step 'I visit project tags page' do
visit namespace_project_tags_path(@project.namespace, @project)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project commit page' do
visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" issues page' do
visit namespace_project_issues_path(project.namespace, project)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit issue page "Release 0.4"' do
2014-01-19 13:55:59 -05:00
issue = Issue.find_by(title: "Release 0.4")
visit namespace_project_issue_path(issue.project.namespace, issue.project, issue)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" labels page' do
2014-08-13 08:12:05 -04:00
project = Project.find_by(name: 'Shop')
visit namespace_project_labels_path(project.namespace, project)
2012-09-10 11:35:03 -04:00
end
2014-08-13 08:12:05 -04:00
step 'I visit project "Forum" labels page' do
project = Project.find_by(name: 'Forum')
visit namespace_project_labels_path(project.namespace, project)
2014-08-13 08:12:05 -04:00
end
step 'I visit project "Shop" new label page' do
project = Project.find_by(name: 'Shop')
visit new_namespace_project_label_path(project.namespace, project)
2014-08-13 08:12:05 -04:00
end
step 'I visit project "Forum" new label page' do
project = Project.find_by(name: 'Forum')
visit new_namespace_project_label_path(project.namespace, project)
end
2013-05-06 08:09:41 -04:00
step 'I visit merge request page "Bug NS-04"' do
2014-01-19 13:55:59 -05:00
mr = MergeRequest.find_by(title: "Bug NS-04")
visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit merge request page "Bug NS-05"' do
2014-01-19 13:55:59 -05:00
mr = MergeRequest.find_by(title: "Bug NS-05")
visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr)
2012-10-29 17:23:49 -04:00
end
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
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" merge requests page' do
visit namespace_project_merge_requests_path(project.namespace, project)
2012-09-10 11:35:03 -04:00
end
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
step 'I visit forked project "Shop" merge requests page' do
visit namespace_project_merge_requests_path(project.namespace, project)
Merge Request on forked projects The good: - You can do a merge request for a forked commit and it will merge properly (i.e. it does work). - Push events take into account merge requests on forked projects - Tests around merge_actions now present, spinach, and other rspec tests - Satellites now clean themselves up rather then recreate The questionable: - Events only know about target projects - Project's merge requests only hold on to MR's where they are the target - All operations performed in the satellite The bad: - Duplication between project's repositories and satellites (e.g. commits_between) (for reference: http://feedback.gitlab.com/forums/176466-general/suggestions/3456722-merge-requests-between-projects-repos) Fixes: Make test repos/satellites only create when needed -Spinach/Rspec now only initialize test directory, and setup stubs (things that are relatively cheap) -project_with_code, source_project_with_code, and target_project_with_code now create/destroy their repos individually -fixed remote removal -How to merge renders properly -Update emails to show project/branches -Edit MR doesn't set target branch -Fix some failures on editing/creating merge requests, added a test -Added back a test around merge request observer -Clean up project_transfer_spec, Remove duplicate enable/disable observers -Ensure satellite lock files are cleaned up, Attempted to add some testing around these as well -Signifant speed ups for tests -Update formatting ordering in notes_on_merge_requests -Remove wiki schema update Fixes for search/search results -Search results was using by_project for a list of projects, updated this to use in_projects -updated search results to reference the correct (target) project -udpated search results to print both sides of the merge request Change-Id: I19407990a0950945cc95d62089cbcc6262dab1a8
2013-04-25 10:15:33 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" milestones page' do
visit namespace_project_milestones_path(project.namespace, project)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" team page' do
visit namespace_project_project_members_path(project.namespace, project)
2012-09-10 11:35:03 -04:00
end
2013-05-06 08:09:41 -04:00
step 'I visit project wiki page' do
visit namespace_project_wiki_path(@project.namespace, @project, :home)
2012-09-10 11:35:03 -04:00
end
2014-06-26 03:49:14 -04:00
# ----------------------------------------
# Visibility Projects
# ----------------------------------------
step 'I visit project "Community" page' do
project = Project.find_by(name: "Community")
visit namespace_project_path(project.namespace, project)
2014-06-26 03:49:14 -04:00
end
step 'I visit project "Community" source page' do
project = Project.find_by(name: 'Community')
visit namespace_project_tree_path(project.namespace, project, root_ref)
end
2014-06-26 03:49:14 -04:00
step 'I visit project "Internal" page' do
project = Project.find_by(name: "Internal")
visit namespace_project_path(project.namespace, project)
2014-06-26 03:49:14 -04:00
end
step 'I visit project "Enterprise" page' do
project = Project.find_by(name: "Enterprise")
visit namespace_project_path(project.namespace, project)
2014-06-26 03:49:14 -04:00
end
# ----------------------------------------
# Empty Projects
# ----------------------------------------
step "I visit empty project page" do
project = Project.find_by(name: "Empty Public Project")
visit namespace_project_path(project.namespace, project)
2014-06-26 03:49:14 -04:00
end
# ----------------------------------------
# Public Projects
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step 'I visit the public projects area' do
visit explore_projects_path
end
step 'I visit the explore trending projects' do
visit trending_explore_projects_path
end
step 'I visit the explore starred projects' do
visit starred_explore_projects_path
end
step 'I visit the public groups area' do
visit explore_groups_path
end
# ----------------------------------------
# Snippets
# ----------------------------------------
step 'I visit project "Shop" snippets page' do
visit namespace_project_snippets_path(project.namespace, project)
end
step 'I visit snippets page' do
2013-03-24 18:17:38 -04:00
visit snippets_path
end
step 'I visit new snippet page' do
2013-03-24 18:17:38 -04:00
visit new_snippet_path
end
def root_ref
@project.repository.root_ref
end
def project
2014-10-03 06:19:31 -04:00
Project.find_by!(name: 'Shop')
end
2014-02-07 11:59:55 -05:00
# ----------------------------------------
# Errors
# ----------------------------------------
step 'page status code should be 404' do
expect(status_code).to eq 404
2014-02-07 11:59:55 -05:00
end
2012-09-10 11:35:03 -04:00
end