Commit 95b826071f09f3bb63d663f2210e654609aace52
1 parent
f8009a48
Exists in
master
and in
4 other branches
Add some tests for network graph
Showing
2 changed files
with
55 additions
and
4 deletions
Show diff stats
features/project/network.feature
... | ... | @@ -7,3 +7,19 @@ Feature: Project Network Graph |
7 | 7 | @javascript |
8 | 8 | Scenario: I should see project network |
9 | 9 | Then page should have network graph |
10 | + And page should select "master" in select box | |
11 | + And page should have "master" on graph | |
12 | + | |
13 | + @javascript | |
14 | + Scenario: I should switch ref to "stable" | |
15 | + When I switch ref to "stable" | |
16 | + Then page should have network graph | |
17 | + And page should select "stable" in select box | |
18 | + And page should have "stable" on graph | |
19 | + | |
20 | + @javascript | |
21 | + Scenario: I should looking for a commit by SHA of "v2.1.0" | |
22 | + When I looking for a commit by SHA of "v2.1.0" | |
23 | + Then page should have network graph | |
24 | + And page should select "master" in select box | |
25 | + And page should have "v2.1.0" on graph | ... | ... |
features/steps/project/project_network_graph.rb
... | ... | @@ -4,16 +4,51 @@ class ProjectNetworkGraph < Spinach::FeatureSteps |
4 | 4 | |
5 | 5 | Then 'page should have network graph' do |
6 | 6 | page.should have_content "Project Network Graph" |
7 | - within ".graph" do | |
8 | - page.should have_content "master" | |
9 | - end | |
7 | + page.should have_selector ".graph" | |
10 | 8 | end |
11 | 9 | |
12 | - And 'I visit project "Shop" network page' do | |
10 | + When 'I visit project "Shop" network page' do | |
13 | 11 | # Stub Graph::JsonBuilder max_size to speed up test (10 commits vs. 650) |
14 | 12 | Graph::JsonBuilder.stub(max_count: 10) |
15 | 13 | |
16 | 14 | project = Project.find_by_name("Shop") |
17 | 15 | visit project_graph_path(project, "master") |
18 | 16 | end |
17 | + | |
18 | + And 'page should select "master" in select box' do | |
19 | + page.should have_selector '#ref_chzn span', :text => "master" | |
20 | + end | |
21 | + | |
22 | + And 'page should have "master" on graph' do | |
23 | + within '.graph' do | |
24 | + page.should have_content 'master' | |
25 | + end | |
26 | + end | |
27 | + | |
28 | + And 'I switch ref to "stable"' do | |
29 | + page.select 'stable', :from => 'ref' | |
30 | + end | |
31 | + | |
32 | + And 'page should select "stable" in select box' do | |
33 | + page.should have_selector '#ref_chzn span', :text => "stable" | |
34 | + end | |
35 | + | |
36 | + And 'page should have "stable" on graph' do | |
37 | + within '.graph' do | |
38 | + page.should have_content 'stable' | |
39 | + end | |
40 | + end | |
41 | + | |
42 | + And 'I looking for a commit by SHA of "v2.1.0"' do | |
43 | + within ".content .search" do | |
44 | + fill_in 'q', :with => '98d6492' | |
45 | + find('button').click | |
46 | + end | |
47 | + end | |
48 | + | |
49 | + And 'page should have "v2.1.0" on graph' do | |
50 | + within '.graph' do | |
51 | + page.should have_content 'v2.1.0' | |
52 | + end | |
53 | + end | |
19 | 54 | end | ... | ... |