diff options
Diffstat (limited to 'features/steps/shared')
-rw-r--r-- | features/steps/shared/active_tab.rb | 47 | ||||
-rw-r--r-- | features/steps/shared/admin.rb | 12 | ||||
-rw-r--r-- | features/steps/shared/authentication.rb | 34 | ||||
-rw-r--r-- | features/steps/shared/diff_note.rb | 167 | ||||
-rw-r--r-- | features/steps/shared/group.rb | 44 | ||||
-rw-r--r-- | features/steps/shared/issuable.rb | 15 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 102 | ||||
-rw-r--r-- | features/steps/shared/note.rb | 155 | ||||
-rw-r--r-- | features/steps/shared/paths.rb | 480 | ||||
-rw-r--r-- | features/steps/shared/project.rb | 160 | ||||
-rw-r--r-- | features/steps/shared/project_tab.rb | 48 | ||||
-rw-r--r-- | features/steps/shared/search.rb | 11 | ||||
-rw-r--r-- | features/steps/shared/shortcuts.rb | 18 | ||||
-rw-r--r-- | features/steps/shared/snippet.rb | 63 | ||||
-rw-r--r-- | features/steps/shared/user.rb | 17 |
15 files changed, 0 insertions, 1373 deletions
diff --git a/features/steps/shared/active_tab.rb b/features/steps/shared/active_tab.rb deleted file mode 100644 index 9beb688bd16..00000000000 --- a/features/steps/shared/active_tab.rb +++ /dev/null @@ -1,47 +0,0 @@ -module SharedActiveTab - include Spinach::DSL - - def ensure_active_main_tab(content) - find('.nav-sidebar > li.active').should have_content(content) - end - - def ensure_active_sub_tab(content) - find('div.content ul.nav-tabs li.active').should have_content(content) - end - - def ensure_active_sub_nav(content) - find('.sidebar-subnav > li.active').should have_content(content) - end - - step 'no other main tabs should be active' do - page.should have_selector('.nav-sidebar > li.active', count: 1) - end - - step 'no other sub tabs should be active' do - page.should have_selector('div.content ul.nav-tabs li.active', count: 1) - end - - step 'no other sub navs should be active' do - page.should have_selector('.sidebar-subnav > li.active', count: 1) - end - - step 'the active main tab should be Home' do - ensure_active_main_tab('Your Projects') - end - - step 'the active main tab should be Projects' do - ensure_active_main_tab('Projects') - end - - step 'the active main tab should be Issues' do - ensure_active_main_tab('Issues') - end - - step 'the active main tab should be Merge Requests' do - ensure_active_main_tab('Merge Requests') - end - - step 'the active main tab should be Help' do - ensure_active_main_tab('Help') - end -end diff --git a/features/steps/shared/admin.rb b/features/steps/shared/admin.rb deleted file mode 100644 index b6072995677..00000000000 --- a/features/steps/shared/admin.rb +++ /dev/null @@ -1,12 +0,0 @@ -module SharedAdmin - include Spinach::DSL - - step 'there are projects in system' do - 2.times { create(:project) } - end - - step 'system has users' do - 2.times { create(:user) } - end -end - diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb deleted file mode 100644 index ac8a3df6bb9..00000000000 --- a/features/steps/shared/authentication.rb +++ /dev/null @@ -1,34 +0,0 @@ -require Rails.root.join('spec', 'support', 'login_helpers') - -module SharedAuthentication - include Spinach::DSL - include LoginHelpers - - step 'I sign in as a user' do - login_as :user - end - - step 'I sign in as an admin' do - login_as :admin - end - - step 'I sign in as "John Doe"' do - login_with(user_exists("John Doe")) - end - - step 'I sign in as "Mary Jane"' do - login_with(user_exists("Mary Jane")) - end - - step 'I should be redirected to sign in page' do - current_path.should == new_user_session_path - end - - step "I logout" do - logout - end - - def current_user - @user || User.first - end -end diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb deleted file mode 100644 index 510e0f0f938..00000000000 --- a/features/steps/shared/diff_note.rb +++ /dev/null @@ -1,167 +0,0 @@ -module SharedDiffNote - include Spinach::DSL - include RepoHelpers - - step 'I cancel the diff comment' do - within(diff_file_selector) do - find(".js-close-discussion-note-form").click - end - end - - step 'I delete a diff comment' do - find('.note').hover - find(".js-note-delete").click - end - - step 'I haven\'t written any diff comment text' do - within(diff_file_selector) do - fill_in "note[note]", with: "" - end - end - - step 'I leave a diff comment like "Typo, please fix"' do - click_diff_line(sample_commit.line_code) - within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do - fill_in "note[note]", with: "Typo, please fix" - find(".js-comment-button").trigger("click") - sleep 0.05 - end - end - - step 'I preview a diff comment text like "Should fix it :smile:"' do - click_diff_line(sample_commit.line_code) - within("#{diff_file_selector} form[rel$='#{sample_commit.line_code}']") do - fill_in "note[note]", with: "Should fix it :smile:" - find('.js-md-preview-button').click - end - end - - step 'I preview another diff comment text like "DRY this up"' do - click_diff_line(sample_commit.del_line_code) - - within("#{diff_file_selector} form[rel$='#{sample_commit.del_line_code}']") do - fill_in "note[note]", with: "DRY this up" - find('.js-md-preview-button').click - end - end - - step 'I open a diff comment form' do - click_diff_line(sample_commit.line_code) - end - - step 'I open another diff comment form' do - click_diff_line(sample_commit.del_line_code) - end - - step 'I write a diff comment like ":-1: I don\'t like this"' do - within(diff_file_selector) do - fill_in "note[note]", with: ":-1: I don\'t like this" - end - end - - step 'I submit the diff comment' do - within(diff_file_selector) do - click_button("Add Comment") - end - end - - step 'I should not see the diff comment form' do - within(diff_file_selector) do - page.should_not have_css("form.new_note") - end - end - - step 'The diff comment preview tab should say there is nothing to do' do - within(diff_file_selector) do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_content('Nothing to preview.') - end - end - - step 'I should not see the diff comment text field' do - within(diff_file_selector) do - expect(find('.js-note-text')).not_to be_visible - end - end - - step 'I should only see one diff form' do - within(diff_file_selector) do - page.should have_css("form.new_note", count: 1) - end - end - - step 'I should see a diff comment form with ":-1: I don\'t like this"' do - within(diff_file_selector) do - page.should have_field("note[note]", with: ":-1: I don\'t like this") - end - end - - step 'I should see a diff comment saying "Typo, please fix"' do - within("#{diff_file_selector} .note") do - page.should have_content("Typo, please fix") - end - end - - step 'I should see a discussion reply button' do - within(diff_file_selector) do - page.should have_button('Reply') - end - end - - step 'I should see a temporary diff comment form' do - within(diff_file_selector) do - page.should have_css(".js-temp-notes-holder form.new_note") - end - end - - step 'I should see add a diff comment button' do - page.should have_css('.js-add-diff-note-button', visible: true) - end - - step 'I should see an empty diff comment form' do - within(diff_file_selector) do - page.should have_field("note[note]", with: "") - end - end - - step 'I should see the cancel comment button' do - within("#{diff_file_selector} form") do - page.should have_css(".js-close-discussion-note-form", text: "Cancel") - end - end - - step 'I should see the diff comment preview' do - within("#{diff_file_selector} form") do - expect(page).to have_css('.js-md-preview', visible: true) - end - end - - step 'I should see the diff comment write tab' do - within(diff_file_selector) do - expect(page).to have_css('.js-md-write-button', visible: true) - end - end - - step 'The diff comment preview tab should display rendered Markdown' do - within(diff_file_selector) do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) - end - end - - step 'I should see two separate previews' do - within(diff_file_selector) do - expect(page).to have_css('.js-md-preview', visible: true, count: 2) - expect(page).to have_content('Should fix it') - expect(page).to have_content('DRY this up') - end - end - - def diff_file_selector - ".diff-file:nth-of-type(1)" - end - - def click_diff_line(code) - find("button[data-line-code='#{code}']").click - end -end diff --git a/features/steps/shared/group.rb b/features/steps/shared/group.rb deleted file mode 100644 index 1b225dd61a6..00000000000 --- a/features/steps/shared/group.rb +++ /dev/null @@ -1,44 +0,0 @@ -module SharedGroup - include Spinach::DSL - - step '"John Doe" is owner of group "Owned"' do - is_member_of("John Doe", "Owned", Gitlab::Access::OWNER) - end - - step '"John Doe" is guest of group "Guest"' do - is_member_of("John Doe", "Guest", Gitlab::Access::GUEST) - end - - step '"Mary Jane" is owner of group "Owned"' do - is_member_of("Mary Jane", "Owned", Gitlab::Access::OWNER) - end - - step '"Mary Jane" is guest of group "Owned"' do - is_member_of("Mary Jane", "Owned", Gitlab::Access::GUEST) - end - - step '"Mary Jane" is guest of group "Guest"' do - is_member_of("Mary Jane", "Guest", Gitlab::Access::GUEST) - end - - step 'I should see group "TestGroup"' do - page.should have_content "TestGroup" - end - - step 'I should not see group "TestGroup"' do - page.should_not have_content "TestGroup" - end - - protected - - def is_member_of(username, groupname, role) - @project_count ||= 0 - user = User.find_by(name: username) || create(:user, name: username) - group = Group.find_by(name: groupname) || create(:group, name: groupname) - group.add_user(user, role) - project ||= create(:project, namespace: group, path: "project#{@project_count}") - event ||= create(:closed_issue_event, project: project) - project.team << [user, :master] - @project_count += 1 - end -end diff --git a/features/steps/shared/issuable.rb b/features/steps/shared/issuable.rb deleted file mode 100644 index 41db2612f26..00000000000 --- a/features/steps/shared/issuable.rb +++ /dev/null @@ -1,15 +0,0 @@ -module SharedIssuable - include Spinach::DSL - - def edit_issuable - find(:css, '.issuable-edit').click - end - - step 'I click link "Edit" for the merge request' do - edit_issuable - end - - step 'I click link "Edit" for the issue' do - edit_issuable - end -end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb deleted file mode 100644 index e71700880cd..00000000000 --- a/features/steps/shared/markdown.rb +++ /dev/null @@ -1,102 +0,0 @@ -module SharedMarkdown - include Spinach::DSL - - def header_should_have_correct_id_and_link(level, text, id, parent = ".wiki") - find(:css, "#{parent} h#{level}##{id}").text.should == text - find(:css, "#{parent} h#{level}##{id} > :last-child")[:href].should =~ /##{id}$/ - end - - def create_taskable(type, title) - desc_text = <<EOT.gsub(/^ {6}/, '') - * [ ] Task 1 - * [x] Task 2 -EOT - - case type - when :issue, :closed_issue - options = { project: project } - when :merge_request - options = { source_project: project, target_project: project } - end - - create( - type, - options.merge(title: title, - author: project.users.first, - description: desc_text) - ) - end - - step 'Header "Description header" should have correct id and link' do - header_should_have_correct_id_and_link(1, 'Description header', 'description-header') - end - - step 'I should see task checkboxes in the description' do - expect(page).to have_selector( - 'div.description li.task-list-item input[type="checkbox"]' - ) - end - - step 'I should see the task status for the Taskable' do - expect(find(:css, 'span.task-status').text).to eq( - '2 tasks (1 done, 1 unfinished)' - ) - end - - step 'Task checkboxes should be enabled' do - expect(page).to have_selector( - 'div.description li.task-list-item input[type="checkbox"]:enabled' - ) - end - - step 'Task checkboxes should be disabled' do - expect(page).to have_selector( - 'div.description li.task-list-item input[type="checkbox"]:disabled' - ) - end - - step 'I should not see the Markdown preview' do - expect(find('.gfm-form .js-md-preview')).not_to be_visible - end - - step 'The Markdown preview tab should say there is nothing to do' do - within('.gfm-form') do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_content('Nothing to preview.') - end - end - - step 'I should not see the Markdown text field' do - expect(find('.gfm-form textarea')).not_to be_visible - end - - step 'I should see the Markdown write tab' do - expect(find('.gfm-form')).to have_css('.js-md-write-button', visible: true) - end - - step 'I should see the Markdown preview' do - expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true) - end - - step 'The Markdown preview tab should display rendered Markdown' do - within('.gfm-form') do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) - end - end - - step 'I write a description like ":+1: Nice"' do - find('.gfm-form').fill_in 'Description', with: ':+1: Nice' - end - - step 'I preview a description text like "Bug fixed :smile:"' do - within('.gfm-form') do - fill_in 'Description', with: 'Bug fixed :smile:' - find('.js-md-preview-button').click - end - end - - step 'I haven\'t written any description text' do - find('.gfm-form').fill_in 'Description', with: '' - end -end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb deleted file mode 100644 index 583746d4475..00000000000 --- a/features/steps/shared/note.rb +++ /dev/null @@ -1,155 +0,0 @@ -module SharedNote - include Spinach::DSL - - step 'I delete a comment' do - find('.note').hover - find(".js-note-delete").click - end - - step 'I haven\'t written any comment text' do - within(".js-main-target-form") do - fill_in "note[note]", with: "" - end - end - - step 'I leave a comment like "XML attached"' do - within(".js-main-target-form") do - fill_in "note[note]", with: "XML attached" - click_button "Add Comment" - sleep 0.05 - end - end - - step 'I preview a comment text like "Bug fixed :smile:"' do - within(".js-main-target-form") do - fill_in "note[note]", with: "Bug fixed :smile:" - find('.js-md-preview-button').click - end - end - - step 'I submit the comment' do - within(".js-main-target-form") do - click_button "Add Comment" - end - end - - step 'I write a comment like ":+1: Nice"' do - within(".js-main-target-form") do - fill_in 'note[note]', with: ':+1: Nice' - end - end - - step 'I should not see a comment saying "XML attached"' do - page.should_not have_css(".note") - end - - step 'I should not see the cancel comment button' do - within(".js-main-target-form") do - should_not have_link("Cancel") - end - end - - step 'I should not see the comment preview' do - within(".js-main-target-form") do - expect(find('.js-md-preview')).not_to be_visible - end - end - - step 'The comment preview tab should say there is nothing to do' do - within(".js-main-target-form") do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_content('Nothing to preview.') - end - end - - step 'I should not see the comment text field' do - within(".js-main-target-form") do - expect(find('.js-note-text')).not_to be_visible - end - end - - step 'I should see a comment saying "XML attached"' do - within(".note") do - page.should have_content("XML attached") - end - end - - step 'I should see an empty comment text field' do - within(".js-main-target-form") do - page.should have_field("note[note]", with: "") - end - end - - step 'I should see the comment write tab' do - within(".js-main-target-form") do - expect(page).to have_css('.js-md-write-button', visible: true) - end - end - - step 'The comment preview tab should be display rendered Markdown' do - within(".js-main-target-form") do - find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) - end - end - - step 'I should see the comment preview' do - within(".js-main-target-form") do - expect(page).to have_css('.js-md-preview', visible: true) - end - end - - step 'I should see comment "XML attached"' do - within(".note") do - page.should have_content("XML attached") - end - end - - # Markdown - - step 'I leave a comment with a header containing "Comment with a header"' do - within(".js-main-target-form") do - fill_in "note[note]", with: "# Comment with a header" - click_button "Add Comment" - sleep 0.05 - end - end - - step 'The comment with the header should not have an ID' do - within(".note-body > .note-text") do - page.should have_content("Comment with a header") - page.should_not have_css("#comment-with-a-header") - end - end - - step 'I leave a comment with task markdown' do - within('.js-main-target-form') do - fill_in 'note[note]', with: '* [x] Task item' - click_button 'Add Comment' - sleep 0.05 - end - end - - step 'I should not see task checkboxes in the comment' do - expect(page).not_to have_selector( - 'li.note div.timeline-content input[type="checkbox"]' - ) - end - - step 'I edit the last comment with a +1' do - find(".note").hover - find('.js-note-edit').click - - within(".current-note-edit-form") do - fill_in 'note[note]', with: '+1 Awesome!' - click_button 'Save Comment' - sleep 0.05 - end - end - - step 'I should see +1 in the description' do - within(".note") do - page.should have_content("+1 Awesome!") - end - end -end diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb deleted file mode 100644 index e3cf1b92cda..00000000000 --- a/features/steps/shared/paths.rb +++ /dev/null @@ -1,480 +0,0 @@ -module SharedPaths - include Spinach::DSL - include RepoHelpers - include DashboardHelper - - 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 - - # ---------------------------------------- - # Group - # ---------------------------------------- - - step 'I visit group "Owned" page' do - visit 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" members page' do - visit group_group_members_path(Group.find_by(name:"Owned")) - end - - 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 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_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 merge requests page' do - visit assigned_mrs_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 - current_path.should == 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 design page' do - visit design_profile_path - end - - step 'I visit profile history page' do - visit history_profile_path - end - - # ---------------------------------------- - # Admin - # ---------------------------------------- - - step 'I visit admin page' do - visit admin_root_path - end - - step 'I visit admin projects page' do - visit admin_namespaces_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 groups page' do - visit admin_groups_path - end - - step 'I visit admin teams page' do - visit admin_teams_path - end - - step 'I visit admin settings page' do - visit admin_application_settings_path - end - - step 'I visit applications page' do - visit admin_applications_path - end - - # ---------------------------------------- - # Generic Project - # ---------------------------------------- - - step "I visit my project's home page" do - visit namespace_project_path(@project.namespace, @project) - end - - step "I visit my project's settings page" do - visit edit_namespace_project_path(@project.namespace, @project) - end - - step "I visit my project's files page" do - visit namespace_project_tree_path(@project.namespace, @project, root_ref) - 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 - - step "I visit my project's commits page" do - visit namespace_project_commits_path(@project.namespace, @project, root_ref, {limit: 5}) - end - - 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 - - step 'I visit my project\'s commits stats page' do - visit stats_namespace_project_repository_path(@project.namespace, @project) - end - - 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 - - step "I visit my project's issues page" do - visit namespace_project_issues_path(@project.namespace, @project) - end - - 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 wiki page" do - visit namespace_project_wiki_path(@project.namespace, @project, :home) - end - - step 'I visit project hooks page' do - visit namespace_project_hooks_path(@project.namespace, @project) - end - - step 'I visit project deploy keys page' do - visit namespace_project_deploy_keys_path(@project.namespace, @project) - end - - # ---------------------------------------- - # "Shop" Project - # ---------------------------------------- - - step 'I visit project "Shop" page' do - visit namespace_project_path(project.namespace, project) - end - - step 'I visit project "Forked Shop" merge requests page' do - visit namespace_project_merge_requests_path(@forked_project.namespace, @forked_project) - end - - step 'I visit edit project "Shop" page' do - visit edit_namespace_project_path(project.namespace, project) - end - - step 'I visit project branches page' do - visit namespace_project_branches_path(@project.namespace, @project) - end - - step 'I visit project protected branches page' do - visit namespace_project_protected_branches_path(@project.namespace, @project) - end - - step 'I visit compare refs page' do - visit namespace_project_compare_index_path(@project.namespace, @project) - end - - step 'I visit project commits page' do - visit namespace_project_commits_path(@project.namespace, @project, root_ref, {limit: 5}) - end - - step 'I visit project commits page for stable branch' do - visit namespace_project_commits_path(@project.namespace, @project, 'stable', {limit: 5}) - end - - step 'I visit project source page' do - visit namespace_project_tree_path(@project.namespace, @project, root_ref) - end - - step 'I visit blob file from repo' do - visit namespace_project_blob_path(@project.namespace, @project, File.join(sample_commit.id, sample_blob.path)) - 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 - current_path.should eq(namespace_project_create_blob_path(@project.namespace, @project, root_ref)) - end - - step 'I am on the ".gitignore" edit file page' do - current_path.should 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") - end - - step 'I visit project source page for' \ - ' "6d394385cf567f80a8fd85055db1ab4c5295806f"' do - visit namespace_project_tree_path(@project.namespace, @project, - '6d394385cf567f80a8fd85055db1ab4c5295806f') - end - - step 'I visit project tags page' do - visit namespace_project_tags_path(@project.namespace, @project) - end - - step 'I visit project commit page' do - visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id) - end - - step 'I visit project "Shop" issues page' do - visit namespace_project_issues_path(project.namespace, project) - end - - step 'I visit issue page "Release 0.4"' do - issue = Issue.find_by(title: "Release 0.4") - visit namespace_project_issue_path(issue.project.namespace, issue.project, issue) - end - - step 'I visit issue page "Tasks-open"' do - issue = Issue.find_by(title: 'Tasks-open') - visit namespace_project_issue_path(issue.project.namespace, issue.project, issue) - end - - step 'I visit issue page "Tasks-closed"' do - issue = Issue.find_by(title: 'Tasks-closed') - visit namespace_project_issue_path(issue.project.namespace, issue.project, issue) - end - - step 'I visit project "Shop" labels page' do - project = Project.find_by(name: 'Shop') - visit namespace_project_labels_path(project.namespace, project) - end - - step 'I visit project "Forum" labels page' do - project = Project.find_by(name: 'Forum') - visit namespace_project_labels_path(project.namespace, project) - 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) - 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 - - step 'I visit merge request page "Bug NS-04"' do - mr = MergeRequest.find_by(title: "Bug NS-04") - visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr) - end - - step 'I visit merge request page "Bug NS-05"' do - mr = MergeRequest.find_by(title: "Bug NS-05") - visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr) - end - - step 'I visit merge request page "MR-task-open"' do - mr = MergeRequest.find_by(title: 'MR-task-open') - visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr) - end - - step 'I visit merge request page "MR-task-closed"' do - mr = MergeRequest.find_by(title: 'MR-task-closed') - visit namespace_project_merge_request_path(mr.target_project.namespace, mr.target_project, mr) - end - - step 'I visit project "Shop" merge requests page' do - visit namespace_project_merge_requests_path(project.namespace, project) - end - - step 'I visit forked project "Shop" merge requests page' do - visit namespace_project_merge_requests_path(project.namespace, project) - end - - step 'I visit project "Shop" milestones page' do - visit namespace_project_milestones_path(project.namespace, project) - end - - step 'I visit project "Shop" team page' do - visit namespace_project_project_members_path(project.namespace, project) - end - - step 'I visit project wiki page' do - visit namespace_project_wiki_path(@project.namespace, @project, :home) - end - - # ---------------------------------------- - # Visibility Projects - # ---------------------------------------- - - step 'I visit project "Community" page' do - project = Project.find_by(name: "Community") - visit namespace_project_path(project.namespace, project) - 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 - - step 'I visit project "Internal" page' do - project = Project.find_by(name: "Internal") - visit namespace_project_path(project.namespace, project) - end - - step 'I visit project "Enterprise" page' do - project = Project.find_by(name: "Enterprise") - visit namespace_project_path(project.namespace, project) - 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) - end - - # ---------------------------------------- - # Public Projects - # ---------------------------------------- - - 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 - visit snippets_path - end - - step 'I visit new snippet page' do - visit new_snippet_path - end - - def root_ref - @project.repository.root_ref - end - - def project - Project.find_by!(name: 'Shop') - end - - # ---------------------------------------- - # Errors - # ---------------------------------------- - - step 'page status code should be 404' do - status_code.should == 404 - end -end diff --git a/features/steps/shared/project.rb b/features/steps/shared/project.rb deleted file mode 100644 index b60ac5e3423..00000000000 --- a/features/steps/shared/project.rb +++ /dev/null @@ -1,160 +0,0 @@ -module SharedProject - include Spinach::DSL - - # Create a project without caring about what it's called - step "I own a project" do - @project = create(:project, namespace: @user.namespace) - @project.team << [@user, :master] - end - - # Create a specific project called "Shop" - step 'I own project "Shop"' do - @project = Project.find_by(name: "Shop") - @project ||= create(:project, name: "Shop", namespace: @user.namespace, snippets_enabled: true) - @project.team << [@user, :master] - end - - # Add another user to project "Shop" - step 'I add a user to project "Shop"' do - @project = Project.find_by(name: "Shop") - other_user = create(:user, name: 'Alpha') - @project.team << [other_user, :master] - end - - # Create another specific project called "Forum" - step 'I own project "Forum"' do - @project = Project.find_by(name: "Forum") - @project ||= create(:project, name: "Forum", namespace: @user.namespace, path: 'forum_project') - @project.team << [@user, :master] - end - - # Create an empty project without caring about the name - step 'I own an empty project' do - @project = create(:empty_project, - name: 'Empty Project', namespace: @user.namespace) - @project.team << [@user, :master] - end - - step 'I visit my empty project page' do - project = Project.find_by(name: 'Empty Project') - visit namespace_project_path(project.namespace, project) - end - - step 'project "Shop" has push event' do - @project = Project.find_by(name: "Shop") - - data = { - before: Gitlab::Git::BLANK_SHA, - after: "6d394385cf567f80a8fd85055db1ab4c5295806f", - ref: "refs/heads/fix", - user_id: @user.id, - user_name: @user.name, - repository: { - name: @project.name, - url: "localhost/rubinius", - description: "", - homepage: "localhost/rubinius", - private: true - } - } - - @event = Event.create( - project: @project, - action: Event::PUSHED, - data: data, - author_id: @user.id - ) - end - - step 'I should see project "Shop" activity feed' do - project = Project.find_by(name: "Shop") - page.should have_content "#{@user.name} pushed new branch fix at #{project.name_with_namespace}" - end - - step 'I should see project settings' do - current_path.should == edit_namespace_project_path(@project.namespace, @project) - page.should have_content("Project name") - page.should have_content("Features:") - end - - def current_project - @project ||= Project.first - end - - # ---------------------------------------- - # Visibility level - # ---------------------------------------- - - step 'private project "Enterprise"' do - create :project, name: 'Enterprise' - end - - step 'I should see project "Enterprise"' do - page.should have_content "Enterprise" - end - - step 'I should not see project "Enterprise"' do - page.should_not have_content "Enterprise" - end - - step 'internal project "Internal"' do - create :project, :internal, name: 'Internal' - end - - step 'I should see project "Internal"' do - page.should have_content "Internal" - end - - step 'I should not see project "Internal"' do - page.should_not have_content "Internal" - end - - step 'public project "Community"' do - create :project, :public, name: 'Community' - end - - step 'I should see project "Community"' do - page.should have_content "Community" - end - - step 'I should not see project "Community"' do - page.should_not have_content "Community" - end - - step '"John Doe" owns private project "Enterprise"' do - user = user_exists("John Doe", username: "john_doe") - project = Project.find_by(name: "Enterprise") - project ||= create(:empty_project, name: "Enterprise", namespace: user.namespace) - project.team << [user, :master] - end - - step '"John Doe" owns internal project "Internal"' do - user = user_exists("John Doe", username: "john_doe") - project = Project.find_by(name: "Internal") - project ||= create :empty_project, :internal, name: 'Internal', namespace: user.namespace - project.team << [user, :master] - end - - step '"John Doe" owns public project "Community"' do - user = user_exists("John Doe", username: "john_doe") - project = Project.find_by(name: "Community") - project ||= create :empty_project, :public, name: 'Community', namespace: user.namespace - project.team << [user, :master] - end - - step 'public empty project "Empty Public Project"' do - create :project_empty_repo, :public, name: "Empty Public Project" - end - - step 'project "Community" has comments' do - project = Project.find_by(name: "Community") - 2.times { create(:note_on_issue, project: project) } - end - - step 'project "Shop" has labels: "bug", "feature", "enhancement"' do - project = Project.find_by(name: "Shop") - create(:label, project: project, title: 'bug') - create(:label, project: project, title: 'feature') - create(:label, project: project, title: 'enhancement') - end -end diff --git a/features/steps/shared/project_tab.rb b/features/steps/shared/project_tab.rb deleted file mode 100644 index c5aed19331c..00000000000 --- a/features/steps/shared/project_tab.rb +++ /dev/null @@ -1,48 +0,0 @@ -require_relative 'active_tab' - -module SharedProjectTab - include Spinach::DSL - include SharedActiveTab - - step 'the active main tab should be Home' do - ensure_active_main_tab('Project') - end - - step 'the active main tab should be Files' do - ensure_active_main_tab('Files') - end - - step 'the active main tab should be Commits' do - ensure_active_main_tab('Commits') - end - - step 'the active main tab should be Network' do - ensure_active_main_tab('Network') - end - - step 'the active main tab should be Graphs' do - ensure_active_main_tab('Graphs') - end - - step 'the active main tab should be Issues' do - ensure_active_main_tab('Issues') - end - - step 'the active main tab should be Merge Requests' do - ensure_active_main_tab('Merge Requests') - end - - step 'the active main tab should be Snippets' do - ensure_active_main_tab('Snippets') - end - - step 'the active main tab should be Wiki' do - ensure_active_main_tab('Wiki') - end - - step 'the active main tab should be Settings' do - within '.nav-sidebar' do - page.should have_content('Back to project') - end - end -end diff --git a/features/steps/shared/search.rb b/features/steps/shared/search.rb deleted file mode 100644 index 6c3d601763d..00000000000 --- a/features/steps/shared/search.rb +++ /dev/null @@ -1,11 +0,0 @@ -module SharedSearch - include Spinach::DSL - - def search_snippet_contents(query) - visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_blobs" - end - - def search_snippet_titles(query) - visit "/search?search=#{URI::encode(query)}&snippets=true&scope=snippet_titles" - end -end diff --git a/features/steps/shared/shortcuts.rb b/features/steps/shared/shortcuts.rb deleted file mode 100644 index bbb7afec0ad..00000000000 --- a/features/steps/shared/shortcuts.rb +++ /dev/null @@ -1,18 +0,0 @@ -module SharedActiveTab - include Spinach::DSL - - step 'I press "g" and "p"' do - find('body').native.send_key('g') - find('body').native.send_key('p') - end - - step 'I press "g" and "i"' do - find('body').native.send_key('g') - find('body').native.send_key('i') - end - - step 'I press "g" and "m"' do - find('body').native.send_key('g') - find('body').native.send_key('m') - end -end diff --git a/features/steps/shared/snippet.rb b/features/steps/shared/snippet.rb deleted file mode 100644 index bb596c1620a..00000000000 --- a/features/steps/shared/snippet.rb +++ /dev/null @@ -1,63 +0,0 @@ -module SharedSnippet - include Spinach::DSL - - step 'I have public "Personal snippet one" snippet' do - create(:personal_snippet, - title: "Personal snippet one", - content: "Test content", - file_name: "snippet.rb", - visibility_level: Snippet::PUBLIC, - author: current_user) - end - - step 'I have private "Personal snippet private" snippet' do - create(:personal_snippet, - title: "Personal snippet private", - content: "Provate content", - file_name: "private_snippet.rb", - visibility_level: Snippet::PRIVATE, - author: current_user) - end - - step 'I have internal "Personal snippet internal" snippet' do - create(:personal_snippet, - title: "Personal snippet internal", - content: "Provate content", - file_name: "internal_snippet.rb", - visibility_level: Snippet::INTERNAL, - author: current_user) - end - - step 'I have a public many lined snippet' do - create(:personal_snippet, - title: 'Many lined snippet', - content: <<-END.gsub(/^\s+\|/, ''), - |line one - |line two - |line three - |line four - |line five - |line six - |line seven - |line eight - |line nine - |line ten - |line eleven - |line twelve - |line thirteen - |line fourteen - END - file_name: 'many_lined_snippet.rb', - visibility_level: Snippet::PUBLIC, - author: current_user) - end - - step 'There is public "Personal snippet one" snippet' do - create(:personal_snippet, - title: "Personal snippet one", - content: "Test content", - file_name: "snippet.rb", - visibility_level: Snippet::PUBLIC, - author: create(:user)) - end -end diff --git a/features/steps/shared/user.rb b/features/steps/shared/user.rb deleted file mode 100644 index 209d77c7acf..00000000000 --- a/features/steps/shared/user.rb +++ /dev/null @@ -1,17 +0,0 @@ -module SharedUser - include Spinach::DSL - - step 'User "John Doe" exists' do - user_exists("John Doe", {username: "john_doe"}) - end - - step 'User "Mary Jane" exists' do - user_exists("Mary Jane", {username: "mary_jane"}) - end - - protected - - def user_exists(name, options = {}) - User.find_by(name: name) || create(:user, {name: name, admin: false}.merge(options)) - end -end |