summaryrefslogtreecommitdiff
path: root/features/steps/project/graph.rb
blob: 176d04d721cc430a92d279b108780ada5630f995 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Spinach::Features::ProjectGraph < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedProject

  step 'page should have graphs' do
    expect(page).to have_selector ".stat-graph"
  end

  When 'I visit project "Shop" graph page' do
    visit namespace_project_graph_path(project.namespace, project, "master")
  end

  step 'I visit project "Shop" commits graph page' do
    visit commits_namespace_project_graph_path(project.namespace, project, "master")
  end

  step 'I visit project "Shop" languages graph page' do
    visit languages_namespace_project_graph_path(project.namespace, project, "master")
  end

  step 'I visit project "Shop" chart page' do
    visit charts_namespace_project_graph_path(project.namespace, project, "master")
  end

  step 'page should have languages graphs' do
    expect(page).to have_content /Ruby 66.* %/
    expect(page).to have_content /JavaScript 22.* %/
  end

  step 'page should have commits graphs' do
    expect(page).to have_content "Commit statistics for master"
    expect(page).to have_content "Commits per day of month"
  end

  step 'I visit project "Shop" CI graph page' do
    visit ci_namespace_project_graph_path(project.namespace, project, 'master')
  end

  step 'page should have CI graphs' do
    expect(page).to have_content 'Overall'
    expect(page).to have_content 'Jobs for last week'
    expect(page).to have_content 'Jobs for last month'
    expect(page).to have_content 'Jobs for last year'
    expect(page).to have_content 'Commit duration in minutes for last 30 commits'
  end

  def project
    @project ||= Project.find_by(name: "Shop")
  end
end