From f0bfeb6e33f8d3620b7d5d6da8439fbdf954d6cb Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 23 Jul 2014 12:18:51 +0300 Subject: Refactor explore area tests. Replaced old links Signed-off-by: Dmitriy Zaporozhets --- .../dashboard/_zero_authorized_projects.html.haml | 2 +- app/views/explore/projects/index.html.haml | 12 +- app/views/explore/projects/trending.html.haml | 2 +- app/views/layouts/_public_head_panel.html.haml | 2 +- features/explore/projects.feature | 102 ++++++++++++ features/explore/public_groups.feature | 151 ++++++++++++++++++ features/public/projects.feature | 102 ------------ features/public/public_groups.feature | 151 ------------------ features/steps/explore/groups_feature.rb | 93 +++++++++++ features/steps/explore/projects.rb | 172 +++++++++++++++++++++ features/steps/public/groups_feature.rb | 93 ----------- features/steps/public/projects.rb | 172 --------------------- features/steps/shared/paths.rb | 4 +- 13 files changed, 529 insertions(+), 529 deletions(-) create mode 100644 features/explore/projects.feature create mode 100644 features/explore/public_groups.feature delete mode 100644 features/public/projects.feature delete mode 100644 features/public/public_groups.feature create mode 100644 features/steps/explore/groups_feature.rb create mode 100644 features/steps/explore/projects.rb delete mode 100644 features/steps/public/groups_feature.rb delete mode 100644 features/steps/public/projects.rb diff --git a/app/views/dashboard/_zero_authorized_projects.html.haml b/app/views/dashboard/_zero_authorized_projects.html.haml index ee086d88e3e..ff85e32bc4e 100644 --- a/app/views/dashboard/_zero_authorized_projects.html.haml +++ b/app/views/dashboard/_zero_authorized_projects.html.haml @@ -46,5 +46,5 @@ %br Public projects are an easy way to allow everyone to have read-only access. .link_holder - = link_to public_projects_path, class: "btn btn-new" do + = link_to explore_projects_path, class: "btn btn-new" do Browse public projects ยป diff --git a/app/views/explore/projects/index.html.haml b/app/views/explore/projects/index.html.haml index 32796c8b2b8..c8bf78385e8 100644 --- a/app/views/explore/projects/index.html.haml +++ b/app/views/explore/projects/index.html.haml @@ -1,6 +1,6 @@ .clearfix .pull-left - = form_tag public_projects_path, method: :get, class: 'form-inline form-tiny' do |f| + = form_tag explore_projects_path, method: :get, class: 'form-inline form-tiny' do |f| .form-group = search_field_tag :search, params[:search], placeholder: "Filter by name", class: "form-control search-text-input input-mn-300", id: "projects_search" .form-group @@ -17,15 +17,15 @@ %b.caret %ul.dropdown-menu %li - = link_to public_projects_path(sort: nil) do + = link_to explore_projects_path(sort: nil) do Name - = link_to public_projects_path(sort: 'newest') do + = link_to explore_projects_path(sort: 'newest') do Newest - = link_to public_projects_path(sort: 'oldest') do + = link_to explore_projects_path(sort: 'oldest') do Oldest - = link_to public_projects_path(sort: 'recently_updated') do + = link_to explore_projects_path(sort: 'recently_updated') do Recently updated - = link_to public_projects_path(sort: 'last_updated') do + = link_to explore_projects_path(sort: 'last_updated') do Last updated %hr diff --git a/app/views/explore/projects/trending.html.haml b/app/views/explore/projects/trending.html.haml index 5b28273d5dd..18bb1ac0ba4 100644 --- a/app/views/explore/projects/trending.html.haml +++ b/app/views/explore/projects/trending.html.haml @@ -8,4 +8,4 @@ = render @trending_projects .center - = link_to 'Show all projects', public_projects_path, class: 'btn btn-primary' + = link_to 'Show all projects', explore_projects_path, class: 'btn btn-primary' diff --git a/app/views/layouts/_public_head_panel.html.haml b/app/views/layouts/_public_head_panel.html.haml index 63992a22f32..5d7f72e6b31 100644 --- a/app/views/layouts/_public_head_panel.html.haml +++ b/app/views/layouts/_public_head_panel.html.haml @@ -3,7 +3,7 @@ .container %div.app_logo %span.separator - = link_to public_root_path, class: "home" do + = link_to explore_root_path, class: "home" do %h1 GITLAB %span.separator %h1.title= title diff --git a/features/explore/projects.feature b/features/explore/projects.feature new file mode 100644 index 00000000000..2ed9707ec39 --- /dev/null +++ b/features/explore/projects.feature @@ -0,0 +1,102 @@ +@public +Feature: Explore Projects Feature + Background: + Given public project "Community" + And internal project "Internal" + And private project "Enterprise" + + Scenario: I visit public area + When I visit the public projects area + Then I should see project "Community" + And I should not see project "Internal" + And I should not see project "Enterprise" + + Scenario: I visit public project page + When I visit project "Community" page + Then I should see project "Community" home page + + Scenario: I visit internal project page + When I visit project "Internal" page + Then I should be redirected to sign in page + + Scenario: I visit private project page + When I visit project "Enterprise" page + Then I should be redirected to sign in page + + Scenario: I visit an empty public project page + Given public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + And I should see empty public project details with http clone info + + Scenario: I visit an empty public project page as user + Given I sign in as a user + And public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + And I should see empty public project details with ssh clone info + + Scenario: I visit public area as user + Given I sign in as a user + When I visit the public projects area + Then I should see project "Community" + And I should see project "Internal" + And I should not see project "Enterprise" + + Scenario: I visit internal project page as user + Given I sign in as a user + When I visit project "Internal" page + Then I should see project "Internal" home page + + Scenario: I visit public project page + When I visit project "Community" page + Then I should see project "Community" home page + And I should see an http link to the repository + + Scenario: I visit public project page as user + Given I sign in as a user + When I visit project "Community" page + Then I should see project "Community" home page + And I should see an ssh link to the repository + + Scenario: I visit an empty public project page + Given public empty project "Empty Public Project" + When I visit empty project page + Then I should see empty public project details + + Scenario: I visit public project issues page as a non authorized user + Given I visit project "Community" page + And I visit "Community" issues page + Then I should see list of issues for "Community" project + + Scenario: I visit public project issues page as authorized user + Given I sign in as a user + Given I visit project "Community" page + And I visit "Community" issues page + Then I should see list of issues for "Community" project + + Scenario: I visit internal project issues page as authorized user + Given I sign in as a user + Given I visit project "Internal" page + And I visit "Internal" issues page + Then I should see list of issues for "Internal" project + + Scenario: I visit public project merge requests page as an authorized user + Given I sign in as a user + Given I visit project "Community" page + And I visit "Community" merge requests page + And project "Community" has "Bug fix" open merge request + Then I should see list of merge requests for "Community" project + + Scenario: I visit public project merge requests page as a non authorized user + Given I visit project "Community" page + And I visit "Community" merge requests page + And project "Community" has "Bug fix" open merge request + Then I should see list of merge requests for "Community" project + + Scenario: I visit internal project merge requests page as an authorized user + Given I sign in as a user + Given I visit project "Internal" page + And I visit "Internal" merge requests page + And project "Internal" has "Feature implemented" open merge request + Then I should see list of merge requests for "Internal" project diff --git a/features/explore/public_groups.feature b/features/explore/public_groups.feature new file mode 100644 index 00000000000..825e3da934e --- /dev/null +++ b/features/explore/public_groups.feature @@ -0,0 +1,151 @@ +@public +Feature: Explore Groups Feature + Background: + Given group "TestGroup" has private project "Enterprise" + + Scenario: I should not see group with private projects as visitor + When I visit group "TestGroup" page + Then I should be redirected to sign in page + + Scenario: I should not see group with private projects group as user + When I sign in as a user + And I visit group "TestGroup" page + Then page status code should be 404 + + Scenario: I should not see group with private and internal projects as visitor + Given group "TestGroup" has internal project "Internal" + When I visit group "TestGroup" page + Then I should be redirected to sign in page + + Scenario: I should see group with private and internal projects as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit group "TestGroup" page + Then I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group issues for internal project as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit group "TestGroup" issues page + And I change filter to Everyone's + Then I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group merge requests for internal project as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit group "TestGroup" merge requests page + And I change filter to Everyone's + Then I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group's members as user + Given group "TestGroup" has internal project "Internal" + And "John Doe" is owner of group "TestGroup" + When I sign in as a user + And I visit group "TestGroup" members page + Then I should see group member "John Doe" + And I should not see member roles + + Scenario: I should see group with private, internal and public projects as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I visit group "TestGroup" page + Then I should see project "Community" items + And I should not see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group issues for public project as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I visit group "TestGroup" issues page + Then I should see project "Community" items + And I should not see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group merge requests for public project as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I visit group "TestGroup" merge requests page + Then I should see project "Community" items + And I should not see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group's members as visitor + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + And "John Doe" is owner of group "TestGroup" + When I visit group "TestGroup" members page + Then I should see group member "John Doe" + And I should not see member roles + + Scenario: I should see group with private, internal and public projects as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit group "TestGroup" page + Then I should see project "Community" items + And I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group issues for internal and public projects as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit group "TestGroup" issues page + And I change filter to Everyone's + Then I should see project "Community" items + And I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group merge requests for internal and public projects as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit group "TestGroup" merge requests page + And I change filter to Everyone's + Then I should see project "Community" items + And I should see project "Internal" items + And I should not see project "Enterprise" items + + Scenario: I should see group's members as user + Given group "TestGroup" has internal project "Internal" + Given group "TestGroup" has public project "Community" + And "John Doe" is owner of group "TestGroup" + When I sign in as a user + And I visit group "TestGroup" members page + Then I should see group member "John Doe" + And I should not see member roles + + Scenario: I should see group with public project in public groups area + Given group "TestGroup" has public project "Community" + When I visit the public groups area + Then I should see group "TestGroup" + + Scenario: I should not see group with internal project in public groups area + Given group "TestGroup" has internal project "Internal" + When I visit the public groups area + Then I should not see group "TestGroup" + + Scenario: I should not see group with private project in public groups area + When I visit the public groups area + Then I should not see group "TestGroup" + + Scenario: I should see group with public project in public groups area as user + Given group "TestGroup" has public project "Community" + When I sign in as a user + And I visit the public groups area + Then I should see group "TestGroup" + + Scenario: I should see group with internal project in public groups area as user + Given group "TestGroup" has internal project "Internal" + When I sign in as a user + And I visit the public groups area + Then I should see group "TestGroup" + + Scenario: I should not see group with private project in public groups area as user + When I sign in as a user + And I visit the public groups area + Then I should not see group "TestGroup" + diff --git a/features/public/projects.feature b/features/public/projects.feature deleted file mode 100644 index c7bb3b4f8ce..00000000000 --- a/features/public/projects.feature +++ /dev/null @@ -1,102 +0,0 @@ -@public -Feature: Public Projects Feature - Background: - Given public project "Community" - And internal project "Internal" - And private project "Enterprise" - - Scenario: I visit public area - When I visit the public projects area - Then I should see project "Community" - And I should not see project "Internal" - And I should not see project "Enterprise" - - Scenario: I visit public project page - When I visit project "Community" page - Then I should see project "Community" home page - - Scenario: I visit internal project page - When I visit project "Internal" page - Then I should be redirected to sign in page - - Scenario: I visit private project page - When I visit project "Enterprise" page - Then I should be redirected to sign in page - - Scenario: I visit an empty public project page - Given public empty project "Empty Public Project" - When I visit empty project page - Then I should see empty public project details - And I should see empty public project details with http clone info - - Scenario: I visit an empty public project page as user - Given I sign in as a user - And public empty project "Empty Public Project" - When I visit empty project page - Then I should see empty public project details - And I should see empty public project details with ssh clone info - - Scenario: I visit public area as user - Given I sign in as a user - When I visit the public projects area - Then I should see project "Community" - And I should see project "Internal" - And I should not see project "Enterprise" - - Scenario: I visit internal project page as user - Given I sign in as a user - When I visit project "Internal" page - Then I should see project "Internal" home page - - Scenario: I visit public project page - When I visit project "Community" page - Then I should see project "Community" home page - And I should see an http link to the repository - - Scenario: I visit public project page as user - Given I sign in as a user - When I visit project "Community" page - Then I should see project "Community" home page - And I should see an ssh link to the repository - - Scenario: I visit an empty public project page - Given public empty project "Empty Public Project" - When I visit empty project page - Then I should see empty public project details - - Scenario: I visit public project issues page as a non authorized user - Given I visit project "Community" page - And I visit "Community" issues page - Then I should see list of issues for "Community" project - - Scenario: I visit public project issues page as authorized user - Given I sign in as a user - Given I visit project "Community" page - And I visit "Community" issues page - Then I should see list of issues for "Community" project - - Scenario: I visit internal project issues page as authorized user - Given I sign in as a user - Given I visit project "Internal" page - And I visit "Internal" issues page - Then I should see list of issues for "Internal" project - - Scenario: I visit public project merge requests page as an authorized user - Given I sign in as a user - Given I visit project "Community" page - And I visit "Community" merge requests page - And project "Community" has "Bug fix" open merge request - Then I should see list of merge requests for "Community" project - - Scenario: I visit public project merge requests page as a non authorized user - Given I visit project "Community" page - And I visit "Community" merge requests page - And project "Community" has "Bug fix" open merge request - Then I should see list of merge requests for "Community" project - - Scenario: I visit internal project merge requests page as an authorized user - Given I sign in as a user - Given I visit project "Internal" page - And I visit "Internal" merge requests page - And project "Internal" has "Feature implemented" open merge request - Then I should see list of merge requests for "Internal" project diff --git a/features/public/public_groups.feature b/features/public/public_groups.feature deleted file mode 100644 index ff3e1e3e955..00000000000 --- a/features/public/public_groups.feature +++ /dev/null @@ -1,151 +0,0 @@ -@public -Feature: Public Projects Feature - Background: - Given group "TestGroup" has private project "Enterprise" - - Scenario: I should not see group with private projects as visitor - When I visit group "TestGroup" page - Then I should be redirected to sign in page - - Scenario: I should not see group with private projects group as user - When I sign in as a user - And I visit group "TestGroup" page - Then page status code should be 404 - - Scenario: I should not see group with private and internal projects as visitor - Given group "TestGroup" has internal project "Internal" - When I visit group "TestGroup" page - Then I should be redirected to sign in page - - Scenario: I should see group with private and internal projects as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" page - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group issues for internal project as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" issues page - And I change filter to Everyone's - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group merge requests for internal project as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit group "TestGroup" merge requests page - And I change filter to Everyone's - Then I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group's members as user - Given group "TestGroup" has internal project "Internal" - And "John Doe" is owner of group "TestGroup" - When I sign in as a user - And I visit group "TestGroup" members page - Then I should see group member "John Doe" - And I should not see member roles - - Scenario: I should see group with private, internal and public projects as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group issues for public project as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" issues page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group merge requests for public project as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I visit group "TestGroup" merge requests page - Then I should see project "Community" items - And I should not see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group's members as visitor - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - And "John Doe" is owner of group "TestGroup" - When I visit group "TestGroup" members page - Then I should see group member "John Doe" - And I should not see member roles - - Scenario: I should see group with private, internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" page - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group issues for internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" issues page - And I change filter to Everyone's - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group merge requests for internal and public projects as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit group "TestGroup" merge requests page - And I change filter to Everyone's - Then I should see project "Community" items - And I should see project "Internal" items - And I should not see project "Enterprise" items - - Scenario: I should see group's members as user - Given group "TestGroup" has internal project "Internal" - Given group "TestGroup" has public project "Community" - And "John Doe" is owner of group "TestGroup" - When I sign in as a user - And I visit group "TestGroup" members page - Then I should see group member "John Doe" - And I should not see member roles - - Scenario: I should see group with public project in public groups area - Given group "TestGroup" has public project "Community" - When I visit the public groups area - Then I should see group "TestGroup" - - Scenario: I should not see group with internal project in public groups area - Given group "TestGroup" has internal project "Internal" - When I visit the public groups area - Then I should not see group "TestGroup" - - Scenario: I should not see group with private project in public groups area - When I visit the public groups area - Then I should not see group "TestGroup" - - Scenario: I should see group with public project in public groups area as user - Given group "TestGroup" has public project "Community" - When I sign in as a user - And I visit the public groups area - Then I should see group "TestGroup" - - Scenario: I should see group with internal project in public groups area as user - Given group "TestGroup" has internal project "Internal" - When I sign in as a user - And I visit the public groups area - Then I should see group "TestGroup" - - Scenario: I should not see group with private project in public groups area as user - When I sign in as a user - And I visit the public groups area - Then I should not see group "TestGroup" - diff --git a/features/steps/explore/groups_feature.rb b/features/steps/explore/groups_feature.rb new file mode 100644 index 00000000000..48486a83424 --- /dev/null +++ b/features/steps/explore/groups_feature.rb @@ -0,0 +1,93 @@ +class Spinach::Features::ExploreGroupsFeature < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedGroup + include SharedProject + + step 'group "TestGroup" has private project "Enterprise"' do + group_has_project("TestGroup", "Enterprise", Gitlab::VisibilityLevel::PRIVATE) + end + + step 'group "TestGroup" has internal project "Internal"' do + group_has_project("TestGroup", "Internal", Gitlab::VisibilityLevel::INTERNAL) + end + + step 'group "TestGroup" has public project "Community"' do + group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC) + end + + step '"John Doe" is owner of group "TestGroup"' do + group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup") + user = create(:user, name: "John Doe") + group.add_user(user, Gitlab::Access::OWNER) + end + + step 'I visit group "TestGroup" page' do + visit group_path(Group.find_by(name: "TestGroup")) + end + + step 'I visit group "TestGroup" issues page' do + visit issues_group_path(Group.find_by(name: "TestGroup")) + end + + step 'I visit group "TestGroup" merge requests page' do + visit merge_requests_group_path(Group.find_by(name: "TestGroup")) + end + + step 'I visit group "TestGroup" members page' do + visit members_group_path(Group.find_by(name: "TestGroup")) + end + + step 'I should not see project "Enterprise" items' do + page.should_not have_content "Enterprise" + end + + step 'I should see project "Internal" items' do + page.should have_content "Internal" + end + + step 'I should not see project "Internal" items' do + page.should_not have_content "Internal" + end + + step 'I should see project "Community" items' do + page.should have_content "Community" + end + + step 'I change filter to Everyone\'s' do + click_link "Everyone's" + end + + step 'I should see group member "John Doe"' do + page.should have_content "John Doe" + end + + step 'I should not see member roles' do + page.body.should_not match(%r{owner|developer|reporter|guest}i) + end + + protected + + def group_has_project(groupname, projectname, visibility_level) + group = Group.find_by(name: groupname) || create(:group, name: groupname) + project = create(:project, + namespace: group, + name: projectname, + path: "#{groupname}-#{projectname}", + visibility_level: visibility_level + ) + create(:issue, + title: "#{projectname} feature", + project: project + ) + create(:merge_request, + title: "#{projectname} feature implemented", + source_project: project, + target_project: project + ) + create(:closed_issue_event, + project: project + ) + end +end + diff --git a/features/steps/explore/projects.rb b/features/steps/explore/projects.rb new file mode 100644 index 00000000000..8aa2916014b --- /dev/null +++ b/features/steps/explore/projects.rb @@ -0,0 +1,172 @@ +class Spinach::Features::ExploreProjectsFeature < Spinach::FeatureSteps + include SharedAuthentication + include SharedPaths + include SharedProject + + step 'public empty project "Empty Public Project"' do + create :empty_project, :public, name: 'Empty Public Project' + end + + step 'I should see project "Empty Public Project"' do + page.should have_content "Empty Public Project" + end + + step 'I should see public project details' do + page.should have_content '32 branches' + page.should have_content '16 tags' + end + + step 'I should see project readme' do + page.should have_content 'README.md' + end + + step 'I visit empty project page' do + project = Project.find_by(name: 'Empty Public Project') + visit project_path(project) + end + + step 'I visit project "Community" page' do + project = Project.find_by(name: 'Community') + visit project_path(project) + end + + step 'I should see empty public project details' do + page.should have_content 'Git global setup' + end + + step 'I should see empty public project details with http clone info' do + project = Project.find_by(name: 'Empty Public Project') + page.all(:css, '.git-empty .clone').each do |element| + element.text.should include(project.http_url_to_repo) + end + end + + step 'I should see empty public project details with ssh clone info' do + project = Project.find_by(name: 'Empty Public Project') + page.all(:css, '.git-empty .clone').each do |element| + element.text.should include(project.url_to_repo) + end + end + + step 'I visit project "Enterprise" page' do + project = Project.find_by(name: 'Enterprise') + visit project_path(project) + end + + step 'I should see project "Community" home page' do + within '.project-home-title' do + page.should have_content 'Community' + end + end + + step 'I visit project "Internal" page' do + project = Project.find_by(name: 'Internal') + visit project_path(project) + end + + step 'I should see project "Internal" home page' do + within '.project-home-title' do + page.should have_content 'Internal' + end + end + + step 'I should see an http link to the repository' do + project = Project.find_by(name: 'Community') + page.should have_field('project_clone', with: project.http_url_to_repo) + end + + step 'I should see an ssh link to the repository' do + project = Project.find_by(name: 'Community') + page.should have_field('project_clone', with: project.url_to_repo) + end + + step 'I visit "Community" issues page' do + create(:issue, + title: "Bug", + project: public_project + ) + create(:issue, + title: "New feature", + project: public_project + ) + visit project_issues_path(public_project) + end + + + step 'I should see list of issues for "Community" project' do + page.should have_content "Bug" + page.should have_content public_project.name + page.should have_content "New feature" + end + + step 'I visit "Internal" issues page' do + create(:issue, + title: "Internal Bug", + project: internal_project + ) + create(:issue, + title: "New internal feature", + project: internal_project + ) + visit project_issues_path(internal_project) + end + + + step 'I should see list of issues for "Internal" project' do + page.should have_content "Internal Bug" + page.should have_content internal_project.name + page.should have_content "New internal feature" + end + + step 'I visit "Community" merge requests page' do + visit project_merge_requests_path(public_project) + end + + step 'project "Community" has "Bug fix" open merge request' do + create(:merge_request, + title: "Bug fix for public project", + source_project: public_project, + target_project: public_project, + ) + end + + step 'I should see list of merge requests for "Community" project' do + page.should have_content public_project.name + page.should have_content public_merge_request.source_project.name + end + + step 'I visit "Internal" merge requests page' do + visit project_merge_requests_path(internal_project) + end + + step 'project "Internal" has "Feature implemented" open merge request' do + create(:merge_request, + title: "Feature implemented", + source_project: internal_project, + target_project: internal_project + ) + end + + step 'I should see list of merge requests for "Internal" project' do + page.should have_content internal_project.name + page.should have_content internal_merge_request.source_project.name + end + + def internal_project + @internal_project ||= Project.find_by!(name: 'Internal') + end + + def public_project + @public_project ||= Project.find_by!(name: 'Community') + end + + + def internal_merge_request + @internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented') + end + + def public_merge_request + @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') + end +end + diff --git a/features/steps/public/groups_feature.rb b/features/steps/public/groups_feature.rb deleted file mode 100644 index 015deca5427..00000000000 --- a/features/steps/public/groups_feature.rb +++ /dev/null @@ -1,93 +0,0 @@ -class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedGroup - include SharedProject - - step 'group "TestGroup" has private project "Enterprise"' do - group_has_project("TestGroup", "Enterprise", Gitlab::VisibilityLevel::PRIVATE) - end - - step 'group "TestGroup" has internal project "Internal"' do - group_has_project("TestGroup", "Internal", Gitlab::VisibilityLevel::INTERNAL) - end - - step 'group "TestGroup" has public project "Community"' do - group_has_project("TestGroup", "Community", Gitlab::VisibilityLevel::PUBLIC) - end - - step '"John Doe" is owner of group "TestGroup"' do - group = Group.find_by(name: "TestGroup") || create(:group, name: "TestGroup") - user = create(:user, name: "John Doe") - group.add_user(user, Gitlab::Access::OWNER) - end - - step 'I visit group "TestGroup" page' do - visit group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" issues page' do - visit issues_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" merge requests page' do - visit merge_requests_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I visit group "TestGroup" members page' do - visit members_group_path(Group.find_by(name: "TestGroup")) - end - - step 'I should not see project "Enterprise" items' do - page.should_not have_content "Enterprise" - end - - step 'I should see project "Internal" items' do - page.should have_content "Internal" - end - - step 'I should not see project "Internal" items' do - page.should_not have_content "Internal" - end - - step 'I should see project "Community" items' do - page.should have_content "Community" - end - - step 'I change filter to Everyone\'s' do - click_link "Everyone's" - end - - step 'I should see group member "John Doe"' do - page.should have_content "John Doe" - end - - step 'I should not see member roles' do - page.body.should_not match(%r{owner|developer|reporter|guest}i) - end - - protected - - def group_has_project(groupname, projectname, visibility_level) - group = Group.find_by(name: groupname) || create(:group, name: groupname) - project = create(:project, - namespace: group, - name: projectname, - path: "#{groupname}-#{projectname}", - visibility_level: visibility_level - ) - create(:issue, - title: "#{projectname} feature", - project: project - ) - create(:merge_request, - title: "#{projectname} feature implemented", - source_project: project, - target_project: project - ) - create(:closed_issue_event, - project: project - ) - end -end - diff --git a/features/steps/public/projects.rb b/features/steps/public/projects.rb deleted file mode 100644 index 7c7311bb91c..00000000000 --- a/features/steps/public/projects.rb +++ /dev/null @@ -1,172 +0,0 @@ -class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps - include SharedAuthentication - include SharedPaths - include SharedProject - - step 'public empty project "Empty Public Project"' do - create :empty_project, :public, name: 'Empty Public Project' - end - - step 'I should see project "Empty Public Project"' do - page.should have_content "Empty Public Project" - end - - step 'I should see public project details' do - page.should have_content '32 branches' - page.should have_content '16 tags' - end - - step 'I should see project readme' do - page.should have_content 'README.md' - end - - step 'I visit empty project page' do - project = Project.find_by(name: 'Empty Public Project') - visit project_path(project) - end - - step 'I visit project "Community" page' do - project = Project.find_by(name: 'Community') - visit project_path(project) - end - - step 'I should see empty public project details' do - page.should have_content 'Git global setup' - end - - step 'I should see empty public project details with http clone info' do - project = Project.find_by(name: 'Empty Public Project') - page.all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.http_url_to_repo) - end - end - - step 'I should see empty public project details with ssh clone info' do - project = Project.find_by(name: 'Empty Public Project') - page.all(:css, '.git-empty .clone').each do |element| - element.text.should include(project.url_to_repo) - end - end - - step 'I visit project "Enterprise" page' do - project = Project.find_by(name: 'Enterprise') - visit project_path(project) - end - - step 'I should see project "Community" home page' do - within '.project-home-title' do - page.should have_content 'Community' - end - end - - step 'I visit project "Internal" page' do - project = Project.find_by(name: 'Internal') - visit project_path(project) - end - - step 'I should see project "Internal" home page' do - within '.project-home-title' do - page.should have_content 'Internal' - end - end - - step 'I should see an http link to the repository' do - project = Project.find_by(name: 'Community') - page.should have_field('project_clone', with: project.http_url_to_repo) - end - - step 'I should see an ssh link to the repository' do - project = Project.find_by(name: 'Community') - page.should have_field('project_clone', with: project.url_to_repo) - end - - step 'I visit "Community" issues page' do - create(:issue, - title: "Bug", - project: public_project - ) - create(:issue, - title: "New feature", - project: public_project - ) - visit project_issues_path(public_project) - end - - - step 'I should see list of issues for "Community" project' do - page.should have_content "Bug" - page.should have_content public_project.name - page.should have_content "New feature" - end - - step 'I visit "Internal" issues page' do - create(:issue, - title: "Internal Bug", - project: internal_project - ) - create(:issue, - title: "New internal feature", - project: internal_project - ) - visit project_issues_path(internal_project) - end - - - step 'I should see list of issues for "Internal" project' do - page.should have_content "Internal Bug" - page.should have_content internal_project.name - page.should have_content "New internal feature" - end - - step 'I visit "Community" merge requests page' do - visit project_merge_requests_path(public_project) - end - - step 'project "Community" has "Bug fix" open merge request' do - create(:merge_request, - title: "Bug fix for public project", - source_project: public_project, - target_project: public_project, - ) - end - - step 'I should see list of merge requests for "Community" project' do - page.should have_content public_project.name - page.should have_content public_merge_request.source_project.name - end - - step 'I visit "Internal" merge requests page' do - visit project_merge_requests_path(internal_project) - end - - step 'project "Internal" has "Feature implemented" open merge request' do - create(:merge_request, - title: "Feature implemented", - source_project: internal_project, - target_project: internal_project - ) - end - - step 'I should see list of merge requests for "Internal" project' do - page.should have_content internal_project.name - page.should have_content internal_merge_request.source_project.name - end - - def internal_project - @internal_project ||= Project.find_by!(name: 'Internal') - end - - def public_project - @public_project ||= Project.find_by!(name: 'Community') - end - - - def internal_merge_request - @internal_merge_request ||= MergeRequest.find_by!(title: 'Feature implemented') - end - - def public_merge_request - @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project') - end -end - diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb index d92c70c952e..a0b4099ab3e 100644 --- a/features/steps/shared/paths.rb +++ b/features/steps/shared/paths.rb @@ -324,7 +324,7 @@ module SharedPaths # ---------------------------------------- step 'I visit the public projects area' do - visit public_root_path + visit explore_projects_path end step 'I visit public page for "Community" project' do @@ -336,7 +336,7 @@ module SharedPaths # ---------------------------------------- step 'I visit the public groups area' do - visit public_groups_path + visit explore_groups_path end # ---------------------------------------- -- cgit v1.2.1