summaryrefslogtreecommitdiff
path: root/features/steps/project/network_graph.rb
blob: 9b59b682676ad6da8114da2c01a60be4aff2fce9 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
class Spinach::Features::ProjectNetworkGraph < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedPaths
  include SharedProject

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

  When 'I visit project "Shop" network page' do
    # Stub Graph max_size to speed up test (10 commits vs. 650)
    Network::Graph.stub(max_count: 10)

    @project = Project.find_by(name: "Shop")
    visit namespace_project_network_path(@project.namespace, @project, "master")
  end

  step "I visit project network page on branch 'test'" do
    visit namespace_project_network_path(@project.namespace, @project, "'test'")
  end

  step 'page should select "master" in select box' do
    expect(page).to have_selector '.select2-chosen', text: "master"
  end

  step 'page should select "v1.0.0" in select box' do
    expect(page).to have_selector '.select2-chosen', text: "v1.0.0"
  end

  step 'page should have "master" on graph' do
    page.within '.network-graph' do
      expect(page).to have_content 'master'
    end
  end

  step "page should have 'test' on graph" do
    page.within '.network-graph' do
      expect(page).to have_content "'test'"
    end
  end

  When 'I switch ref to "feature"' do
    select 'feature', from: 'ref'
  end

  When 'I switch ref to "v1.0.0"' do
    select 'v1.0.0', from: 'ref'
  end

  When 'click "Show only selected branch" checkbox' do
    find('#filter_ref').click
  end

  step 'page should have content not containing "v1.0.0"' do
    page.within '.network-graph' do
      expect(page).to have_content 'Change some files'
    end
  end

  step 'page should have "v1.0.0" in title' do
    expect(page).to have_css 'title', text: 'Network ยท v1.0.0', visible: false
  end

  step 'page should only have content from "v1.0.0"' do
    page.within '.network-graph' do
      expect(page).not_to have_content 'Change some files'
    end
  end

  step 'page should select "feature" in select box' do
    expect(page).to have_selector '.select2-chosen', text: "feature"
  end

  step 'page should select "v1.0.0" in select box' do
    expect(page).to have_selector '.select2-chosen', text: "v1.0.0"
  end

  step 'page should have "feature" on graph' do
    page.within '.network-graph' do
      expect(page).to have_content 'feature'
    end
  end

  When 'I looking for a commit by SHA of "v1.0.0"' do
    page.within ".network-form" do
      fill_in 'extended_sha1', with: '6f6d7e7ed97bb5f0054f2b1df789b39ca89b6ff9'
      find('button').click
    end
    sleep 2
  end

  step 'page should have "v1.0.0" on graph' do
    page.within '.network-graph' do
      expect(page).to have_content 'v1.0.0'
    end
  end

  When 'I look for a commit by ";"' do
    page.within ".network-form" do
      fill_in 'extended_sha1', with: ';'
      find('button').click
    end
  end
end