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

507 lines
12 KiB
Ruby
Raw Normal View History

2012-09-10 11:35:03 -04:00
module SharedPaths
include Spinach::DSL
include RepoHelpers
include DashboardHelper
include WaitForRequests
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
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
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
step 'I visit group "Owned" activity page' do
visit activity_group_path(Group.find_by(name: "Owned"))
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
step 'I visit group "Owned" milestones page' do
visit group_milestones_path(Group.find_by(name: "Owned"))
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
2015-09-08 12:14:02 -04:00
visit dashboard_projects_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
2017-05-16 08:54:57 -04:00
step 'I visit Authentication log page' do
2015-07-03 07:54:50 -04:00
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_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 teams page' do
2013-01-19 12:11:11 -05:00
visit admin_teams_path
end
step 'I visit spam logs page' do
visit admin_spam_logs_path
end
# ----------------------------------------
# Generic Project
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step "I visit my project's home page" do
visit project_path(@project)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's settings page" do
visit edit_project_path(@project)
end
2013-05-06 08:09:41 -04:00
step "I visit my project's files page" do
visit project_tree_path(@project, root_ref)
2012-09-10 11:35:03 -04:00
end
step 'I visit a binary file in the repo' do
visit project_blob_path(@project,
2015-12-14 21:53:52 -05:00
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 project_commits_path(@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 project_commits_path(@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_project_repository_path(@project)
2012-11-10 16:33:10 -05:00
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
2013-05-06 08:09:41 -04:00
step "I visit my project's issues page" do
visit project_issues_path(@project)
end
2013-05-06 08:09:41 -04:00
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
2013-05-06 08:09:41 -04:00
step "I visit my project's wiki page" do
visit project_wiki_path(@project, :home)
end
2013-05-06 08:09:41 -04:00
step 'I visit project hooks page' do
visit project_settings_integrations_path(@project)
end
2013-05-06 08:09:41 -04:00
step 'I visit project deploy keys page' do
visit project_deploy_keys_path(@project)
2013-05-06 08:09:41 -04:00
end
step 'I visit project find file page' do
visit project_find_file_path(@project, root_ref)
end
# ----------------------------------------
# "Shop" Project
# ----------------------------------------
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" page' do
visit project_path(project)
2012-09-10 11:35:03 -04:00
end
step 'I visit project "Shop" activity page' do
visit activity_project_path(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 project_merge_requests_path(@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_project_path(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 project_branches_path(@project)
2012-09-10 11:35:03 -04:00
end
step 'I visit project protected branches page' do
visit project_protected_branches_path(@project)
end
2013-05-06 08:09:41 -04:00
step 'I visit compare refs page' do
visit project_compare_index_path(@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 project_commits_path(@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 project_commits_path(@project, 'stable', { limit: 5 })
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 project_blob_path(@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 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
2015-12-14 21:53:52 -05:00
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")
2012-09-10 11:35:03 -04:00
end
step 'I visit project source page for' \
' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do
visit project_tree_path(@project,
'6d394385cf567f80a8fd85055db1ab4c5295806f')
end
2013-05-06 08:09:41 -04:00
step 'I visit project tags page' do
visit project_tags_path(@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 project_commit_path(@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 project_issues_path(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 project_issue_path(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 project_labels_path(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 project_labels_path(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_project_label_path(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_project_label_path(project)
end
2013-05-06 08:09:41 -04:00
step 'I visit merge request page "Bug NS-04"' do
visit merge_request_path("Bug NS-04")
wait_for_requests
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
visit merge_request_path("Bug NS-05")
wait_for_requests
2012-10-29 17:23:49 -04:00
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
2013-05-06 08:09:41 -04:00
step 'I visit project "Shop" merge requests page' do
visit project_merge_requests_path(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 project_merge_requests_path(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 project_milestones_path(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 project_project_members_path(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 project_wiki_path(@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 project_path(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 project_tree_path(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 project_path(project)
2014-06-26 03:49:14 -04:00
end
step 'I visit project "Enterprise" page' do
project = Project.find_by(name: "Enterprise")
visit project_path(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 project_path(project)
2014-06-26 03:49:14 -04:00
end
step "I should not see command line instructions" do
expect(page).not_to have_css('.empty_wrapper')
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 project_snippets_path(project)
end
step 'I visit snippets page' do
2015-09-09 04:29:42 -04:00
visit explore_snippets_path
2013-03-24 18:17:38 -04:00
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
def merge_request_path(title)
mr = MergeRequest.find_by(title: title)
project_merge_request_path(mr.target_project, mr)
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