BigW Consortium Gitlab

projects_feature.rb 4.86 KB
Newer Older
1
class Spinach::Features::PublicProjectsFeature < Spinach::FeatureSteps
2
  include SharedAuthentication
3
  include SharedPaths
4
  include SharedProject
5

6 7
  step 'public empty project "Empty Public Project"' do
    create :empty_project, name: 'Empty Public Project', visibility_level: Gitlab::VisibilityLevel::PUBLIC
8 9
  end

10 11 12 13
  step 'I should see project "Empty Public Project"' do
    page.should have_content "Empty Public Project"
  end

14 15 16 17 18 19 20 21 22
  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

23
  step 'I visit empty project page' do
skv committed
24
    project = Project.find_by(name: 'Empty Public Project')
25 26 27 28
    visit project_path(project)
  end

  step 'I visit project "Community" page' do
skv committed
29
    project = Project.find_by(name: 'Community')
30
    visit project_path(project)
31 32 33
  end

  step 'I should see empty public project details' do
34
    page.should have_content 'Git global setup'
35 36
  end

37
  step 'I should see empty public project details with http clone info' do
skv committed
38
    project = Project.find_by(name: 'Empty Public Project')
39 40 41 42 43 44
    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
skv committed
45
    project = Project.find_by(name: 'Empty Public Project')
46 47 48 49 50
    page.all(:css, '.git-empty .clone').each do |element|
      element.text.should include(project.url_to_repo)
    end
  end

51
  step 'I visit project "Enterprise" page' do
skv committed
52
    project = Project.find_by(name: 'Enterprise')
53 54 55
    visit project_path(project)
  end

56
  step 'I should see project "Community" home page' do
Dmitriy Zaporozhets committed
57 58 59
    within '.project-home-title' do
      page.should have_content 'Community'
    end
60 61
  end

62
  step 'I visit project "Internal" page' do
skv committed
63
    project = Project.find_by(name: 'Internal')
64 65 66 67 68 69 70
    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
71
  end
72

73
  step 'I should see an http link to the repository' do
skv committed
74
    project = Project.find_by(name: 'Community')
75 76 77
    page.should have_field('project_clone', with: project.http_url_to_repo)
  end

78
  step 'I should see an ssh link to the repository' do
skv committed
79
    project = Project.find_by(name: 'Community')
80 81
    page.should have_field('project_clone', with: project.url_to_repo)
  end
82 83 84 85

  step 'I visit "Community" issues page' do
    create(:issue,
       title: "Bug",
86
       project: public_project
87 88 89
      )
    create(:issue,
       title: "New feature",
90
       project: public_project
91
      )
92
    visit project_issues_path(public_project)
93 94 95 96 97
  end


  step 'I should see list of issues for "Community" project' do
    page.should have_content "Bug"
98
    page.should have_content public_project.name
99 100
    page.should have_content "New feature"
  end
101 102 103 104

  step 'I visit "Internal" issues page' do
    create(:issue,
       title: "Internal Bug",
105
       project: internal_project
106 107 108
      )
    create(:issue,
       title: "New internal feature",
109
       project: internal_project
110
      )
111
    visit project_issues_path(internal_project)
112 113 114 115 116
  end


  step 'I should see list of issues for "Internal" project' do
    page.should have_content "Internal Bug"
117
    page.should have_content internal_project.name
118 119
    page.should have_content "New internal feature"
  end
120 121

  step 'I visit "Community" merge requests page' do
122 123 124 125
    visit project_merge_requests_path(public_project)
  end

  step 'project "Community" has "Bug fix" open merge request' do
126
    create(:merge_request,
127 128 129
      title: "Bug fix for public project",
      source_project: public_project,
      target_project: public_project,
130 131 132 133
    )
  end

  step 'I should see list of merge requests for "Community" project' do
134 135
    page.should have_content public_project.name
    page.should have_content public_merge_request.source_project.name
136 137 138
  end

  step 'I visit "Internal" merge requests page' do
139 140 141 142
    visit project_merge_requests_path(internal_project)
  end

  step 'project "Internal" has "Feature implemented" open merge request' do
143
    create(:merge_request,
144 145 146
      title: "Feature implemented",
      source_project: internal_project,
      target_project: internal_project
147 148 149 150
    )
  end

  step 'I should see list of merge requests for "Internal" project' do
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
    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
167

168 169
  def public_merge_request
    @public_merge_request ||= MergeRequest.find_by!(title: 'Bug fix for public project')
170
  end
171 172
end