Commit 698500dd786cc931cabeb0f44087c0cd11bd0131
1 parent
080bd12e
Exists in
master
and in
4 other branches
add spinach steps for project issues and source features
Showing
11 changed files
with
345 additions
and
26 deletions
Show diff stats
features/project/issues/issues.feature
1 | -Feature: Issues | |
1 | +Feature: Project Issues | |
2 | 2 | Background: |
3 | - Given I signin as a user | |
3 | + Given I sign in as a user | |
4 | 4 | And I own project "Shop" |
5 | 5 | And project "Shop" have "Release 0.4" open issue |
6 | 6 | And project "Shop" have "Release 0.3" closed issue |
... | ... | @@ -79,4 +79,3 @@ Feature: Issues |
79 | 79 | When I select first assignee from "Shop" project |
80 | 80 | And I click link "New Issue" |
81 | 81 | Then I should see first assignee from "Shop" as selected assignee |
82 | - | ... | ... |
features/project/issues/labels.feature
1 | -Feature: Labels | |
1 | +Feature: Project Labels | |
2 | 2 | Background: |
3 | - Given I signin as a user | |
3 | + Given I sign in as a user | |
4 | 4 | And I own project "Shop" |
5 | - And project "Shop" have issues tags: | |
6 | - | name | | |
7 | - | bug | | |
8 | - | feature | | |
9 | - Given I visit project "Shop" labels page | |
5 | + And project "Shop" have issues tags: "bug", "feature" | |
6 | + Given I visit project "Shop" labels page | |
10 | 7 | |
11 | 8 | Scenario: I should see active milestones |
12 | 9 | Then I should see label "bug" | ... | ... |
features/project/issues/milestones.feature
1 | -Feature: Milestones | |
1 | +Feature: Project Milestones | |
2 | 2 | Background: |
3 | - Given I signin as a user | |
3 | + Given I sign in as a user | |
4 | 4 | And I own project "Shop" |
5 | 5 | And project "Shop" has milestone "v2.2" |
6 | - Given I visit project "Shop" milestones page | |
6 | + Given I visit project "Shop" milestones page | |
7 | 7 | |
8 | 8 | Scenario: I should see active milestones |
9 | 9 | Then I should see milestone "v2.2" | ... | ... |
features/project/source/browse_files.feature
1 | -Feature: Browse git repo | |
2 | - Background: | |
3 | - Given I signin as a user | |
1 | +Feature: Project Browse files | |
2 | + Background: | |
3 | + Given I sign in as a user | |
4 | 4 | And I own project "Shop" |
5 | 5 | Given I visit project source page |
6 | 6 | |
... | ... | @@ -12,12 +12,10 @@ Feature: Browse git repo |
12 | 12 | Then I should see files from repository for "8470d70" |
13 | 13 | |
14 | 14 | Scenario: I browse file content |
15 | - Given I click on file from repo | |
15 | + Given I click on "Gemfile" file in repo | |
16 | 16 | Then I should see it content |
17 | 17 | |
18 | 18 | Scenario: I browse raw file |
19 | - Given I visit blob file from repo | |
20 | - And I click on raw button | |
19 | + Given I visit blob file from repo | |
20 | + And I click link "raw" | |
21 | 21 | Then I should see raw file content |
22 | - | |
23 | - | ... | ... |
features/project/source/git_blame.feature
1 | -Feature: Browse git repo | |
2 | - Background: | |
3 | - Given I signin as a user | |
1 | +Feature: Project Browse git repo | |
2 | + Background: | |
3 | + Given I sign in as a user | |
4 | 4 | And I own project "Shop" |
5 | 5 | Given I visit project source page |
6 | 6 | |
7 | 7 | Scenario: I blame file |
8 | - Given I click on file from repo | |
8 | + Given I click on "Gemfile" file in repo | |
9 | 9 | And I click blame button |
10 | - Then I should see git file blame | |
10 | + Then I should see git file blame | ... | ... |
... | ... | @@ -0,0 +1,51 @@ |
1 | +class ProjectBrowseFiles < Spinach::FeatureSteps | |
2 | + Then 'I should see files from repository' do | |
3 | + page.should have_content "app" | |
4 | + page.should have_content "History" | |
5 | + page.should have_content "Gemfile" | |
6 | + end | |
7 | + | |
8 | + Given 'I visit project source page for "8470d70"' do | |
9 | + visit tree_project_ref_path(@project, "8470d70") | |
10 | + end | |
11 | + | |
12 | + Then 'I should see files from repository for "8470d70"' do | |
13 | + current_path.should == tree_project_ref_path(@project, "8470d70") | |
14 | + page.should have_content "app" | |
15 | + page.should have_content "History" | |
16 | + page.should have_content "Gemfile" | |
17 | + end | |
18 | + | |
19 | + Given 'I click on "Gemfile" file in repo' do | |
20 | + click_link "Gemfile" | |
21 | + end | |
22 | + | |
23 | + Then 'I should see it content' do | |
24 | + page.should have_content "rubygems.org" | |
25 | + end | |
26 | + | |
27 | + Given 'I visit blob file from repo' do | |
28 | + visit tree_project_ref_path(@project, ValidCommit::ID, :path => ValidCommit::BLOB_FILE_PATH) | |
29 | + end | |
30 | + | |
31 | + And 'I click link "raw"' do | |
32 | + click_link "raw" | |
33 | + end | |
34 | + | |
35 | + Then 'I should see raw file content' do | |
36 | + page.source.should == ValidCommit::BLOB_FILE | |
37 | + end | |
38 | + | |
39 | + Given 'I sign in as a user' do | |
40 | + login_as :user | |
41 | + end | |
42 | + | |
43 | + And 'I own project "Shop"' do | |
44 | + @project = Factory :project, :name => "Shop" | |
45 | + @project.add_access(@user, :admin) | |
46 | + end | |
47 | + | |
48 | + Given 'I visit project source page' do | |
49 | + visit tree_project_ref_path(@project, @project.root_ref) | |
50 | + end | |
51 | +end | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +class ProjectBrowseGitRepo < Spinach::FeatureSteps | |
2 | + Given 'I click on "Gemfile" file in repo' do | |
3 | + click_link "Gemfile" | |
4 | + end | |
5 | + | |
6 | + And 'I click blame button' do | |
7 | + click_link "blame" | |
8 | + end | |
9 | + | |
10 | + Then 'I should see git file blame' do | |
11 | + page.should have_content "rubygems.org" | |
12 | + page.should have_content "Dmitriy Zaporozhets" | |
13 | + page.should have_content "bc3735004cb Moving to rails 3.2" | |
14 | + end | |
15 | + | |
16 | + Given 'I sign in as a user' do | |
17 | + login_as :user | |
18 | + end | |
19 | + | |
20 | + And 'I own project "Shop"' do | |
21 | + @project = Factory :project, :name => "Shop" | |
22 | + @project.add_access(@user, :admin) | |
23 | + end | |
24 | + | |
25 | + Given 'I visit project source page' do | |
26 | + visit tree_project_ref_path(@project, @project.root_ref) | |
27 | + end | |
28 | +end | ... | ... |
... | ... | @@ -0,0 +1,160 @@ |
1 | +class ProjectIssues < Spinach::FeatureSteps | |
2 | + Given 'I should see "Release 0.4" in issues' do | |
3 | + page.should have_content "Release 0.4" | |
4 | + end | |
5 | + | |
6 | + And 'I should not see "Release 0.3" in issues' do | |
7 | + page.should_not have_content "Release 0.3" | |
8 | + end | |
9 | + | |
10 | + Given 'I click link "Closed"' do | |
11 | + click_link "Closed" | |
12 | + end | |
13 | + | |
14 | + Then 'I should see "Release 0.3" in issues' do | |
15 | + page.should have_content "Release 0.3" | |
16 | + end | |
17 | + | |
18 | + And 'I should not see "Release 0.4" in issues' do | |
19 | + page.should_not have_content "Release 0.4" | |
20 | + end | |
21 | + | |
22 | + Given 'I click link "All"' do | |
23 | + click_link "All" | |
24 | + end | |
25 | + | |
26 | + Given 'I click link "Release 0.4"' do | |
27 | + click_link "Release 0.4" | |
28 | + end | |
29 | + | |
30 | + Then 'I should see issue "Release 0.4"' do | |
31 | + page.should have_content "Release 0.4" | |
32 | + end | |
33 | + | |
34 | + Given 'I click link "New Issue"' do | |
35 | + click_link "New Issue" | |
36 | + end | |
37 | + | |
38 | + And 'I submit new issue "500 error on profile"' do | |
39 | + fill_in "issue_title", :with => "500 error on profile" | |
40 | + click_button "Submit new issue" | |
41 | + end | |
42 | + | |
43 | + Given 'I click link "500 error on profile"' do | |
44 | + click_link "500 error on profile" | |
45 | + end | |
46 | + | |
47 | + Then 'I should see issue "500 error on profile"' do | |
48 | + issue = Issue.find_by_title("500 error on profile") | |
49 | + page.should have_content issue.title | |
50 | + page.should have_content issue.author_name | |
51 | + page.should have_content issue.project.name | |
52 | + end | |
53 | + | |
54 | + Given 'I visit issue page "Release 0.4"' do | |
55 | + issue = Issue.find_by_title("Release 0.4") | |
56 | + visit project_issue_path(issue.project, issue) | |
57 | + end | |
58 | + | |
59 | + And 'I leave a comment like "XML attached"' do | |
60 | + fill_in "note_note", :with => "XML attached" | |
61 | + click_button "Add Comment" | |
62 | + end | |
63 | + | |
64 | + Then 'I should see comment "XML attached"' do | |
65 | + page.should have_content "XML attached" | |
66 | + end | |
67 | + | |
68 | + Given 'I fill in issue search with "Release"' do | |
69 | + fill_in 'issue_search', with: "Release" | |
70 | + end | |
71 | + | |
72 | + Given 'I fill in issue search with "Bug"' do | |
73 | + fill_in 'issue_search', with: "Bug" | |
74 | + end | |
75 | + | |
76 | + And 'I fill in issue search with "0.3"' do | |
77 | + fill_in 'issue_search', with: "0.3" | |
78 | + end | |
79 | + | |
80 | + And 'I fill in issue search with "Something"' do | |
81 | + fill_in 'issue_search', with: "Something" | |
82 | + end | |
83 | + | |
84 | + And 'I fill in issue search with ""' do | |
85 | + page.execute_script("$('.issue_search').val('').keyup();"); | |
86 | + fill_in 'issue_search', with: "" | |
87 | + end | |
88 | + | |
89 | + Given 'project "Shop" has milestone "v2.2"' do | |
90 | + project = Project.find_by_name("Shop") | |
91 | + milestone = Factory :milestone, :title => "v2.2", :project => project | |
92 | + | |
93 | + 3.times do | |
94 | + issue = Factory :issue, :project => project, :milestone => milestone | |
95 | + end | |
96 | + end | |
97 | + | |
98 | + And 'project "Shop" has milestone "v3.0"' do | |
99 | + project = Project.find_by_name("Shop") | |
100 | + milestone = Factory :milestone, :title => "v3.0", :project => project | |
101 | + | |
102 | + 3.times do | |
103 | + issue = Factory :issue, :project => project, :milestone => milestone | |
104 | + end | |
105 | + end | |
106 | + | |
107 | + And 'I visit project "Shop" issues page' do | |
108 | + visit project_issues_path(Project.find_by_name("Shop")) | |
109 | + end | |
110 | + | |
111 | + When 'I select milestone "v3.0"' do | |
112 | + select "v3.0", from: "milestone_id" | |
113 | + end | |
114 | + | |
115 | + Then 'I should see selected milestone with title "v3.0"' do | |
116 | + issues_milestone_selector = "#issue_milestone_id_chzn/a" | |
117 | + wait_until { page.has_content?("Details") } | |
118 | + page.find(issues_milestone_selector).should have_content("v3.0") | |
119 | + end | |
120 | + | |
121 | + When 'I select first assignee from "Shop" project' do | |
122 | + project = Project.find_by_name "Shop" | |
123 | + first_assignee = project.users.first | |
124 | + select first_assignee.name, from: "assignee_id" | |
125 | + end | |
126 | + | |
127 | + Then 'I should see first assignee from "Shop" as selected assignee' do | |
128 | + issues_assignee_selector = "#issue_assignee_id_chzn/a" | |
129 | + wait_until { page.has_content?("Details") } | |
130 | + project = Project.find_by_name "Shop" | |
131 | + assignee_name = project.users.first.name | |
132 | + page.find(issues_assignee_selector).should have_content(assignee_name) | |
133 | + end | |
134 | + | |
135 | + Given 'I sign in as a user' do | |
136 | + login_as :user | |
137 | + end | |
138 | + | |
139 | + And 'I own project "Shop"' do | |
140 | + @project = Factory :project, :name => "Shop" | |
141 | + @project.add_access(@user, :admin) | |
142 | + end | |
143 | + | |
144 | + And 'project "Shop" have "Release 0.4" open issue' do | |
145 | + project = Project.find_by_name("Shop") | |
146 | + Factory.create(:issue, | |
147 | + :title => "Release 0.4", | |
148 | + :project => project, | |
149 | + :author => project.users.first) | |
150 | + end | |
151 | + | |
152 | + And 'project "Shop" have "Release 0.3" closed issue' do | |
153 | + project = Project.find_by_name("Shop") | |
154 | + Factory.create(:issue, | |
155 | + :title => "Release 0.3", | |
156 | + :project => project, | |
157 | + :author => project.users.first, | |
158 | + :closed => true) | |
159 | + end | |
160 | +end | ... | ... |
... | ... | @@ -0,0 +1,33 @@ |
1 | +class ProjectLabels < Spinach::FeatureSteps | |
2 | + Then 'I should see label "bug"' do | |
3 | + within ".labels-table" do | |
4 | + page.should have_content "bug" | |
5 | + end | |
6 | + end | |
7 | + | |
8 | + And 'I should see label "feature"' do | |
9 | + within ".labels-table" do | |
10 | + page.should have_content "feature" | |
11 | + end | |
12 | + end | |
13 | + | |
14 | + Given 'I sign in as a user' do | |
15 | + login_as :user | |
16 | + end | |
17 | + | |
18 | + And 'I own project "Shop"' do | |
19 | + @project = Factory :project, :name => "Shop" | |
20 | + @project.add_access(@user, :admin) | |
21 | + end | |
22 | + | |
23 | + And 'project "Shop" have issues tags: "bug", "feature"' do | |
24 | + project = Project.find_by_name("Shop") | |
25 | + ['bug', 'feature'].each do |label| | |
26 | + Factory :issue, project: project, label_list: label | |
27 | + end | |
28 | + end | |
29 | + | |
30 | + Given 'I visit project "Shop" labels page' do | |
31 | + visit project_labels_path(Project.find_by_name("Shop")) | |
32 | + end | |
33 | +end | ... | ... |
... | ... | @@ -0,0 +1,51 @@ |
1 | +class ProjectMilestones < Spinach::FeatureSteps | |
2 | + Then 'I should see milestone "v2.2"' do | |
3 | + milestone = @project.milestones.find_by_title("v2.2") | |
4 | + page.should have_content(milestone.title[0..10]) | |
5 | + page.should have_content(milestone.expires_at) | |
6 | + page.should have_content("Browse Issues") | |
7 | + end | |
8 | + | |
9 | + Given 'I click link "v2.2"' do | |
10 | + click_link "v2.2" | |
11 | + end | |
12 | + | |
13 | + Given 'I click link "New Milestone"' do | |
14 | + click_link "New Milestone" | |
15 | + end | |
16 | + | |
17 | + And 'I submit new milestone "v2.3"' do | |
18 | + fill_in "milestone_title", :with => "v2.3" | |
19 | + click_button "Create milestone" | |
20 | + end | |
21 | + | |
22 | + Then 'I should see milestone "v2.3"' do | |
23 | + milestone = @project.milestones.find_by_title("v2.3") | |
24 | + page.should have_content(milestone.title[0..10]) | |
25 | + page.should have_content(milestone.expires_at) | |
26 | + page.should have_content("Browse Issues") | |
27 | + end | |
28 | + | |
29 | + Given 'I sign in as a user' do | |
30 | + login_as :user | |
31 | + end | |
32 | + | |
33 | + And 'I own project "Shop"' do | |
34 | + @project = Factory :project, :name => "Shop" | |
35 | + @project.add_access(@user, :admin) | |
36 | + end | |
37 | + | |
38 | + And 'project "Shop" has milestone "v2.2"' do | |
39 | + project = Project.find_by_name("Shop") | |
40 | + milestone = Factory :milestone, :title => "v2.2", :project => project | |
41 | + | |
42 | + 3.times do | |
43 | + issue = Factory :issue, :project => project, :milestone => milestone | |
44 | + end | |
45 | + end | |
46 | + | |
47 | + Given 'I visit project "Shop" milestones page' do | |
48 | + @project = Project.find_by_name("Shop") | |
49 | + visit project_milestones_path(@project) | |
50 | + end | |
51 | +end | ... | ... |
features/support/env.rb
... | ... | @@ -3,6 +3,7 @@ require './config/environment' |
3 | 3 | |
4 | 4 | require 'rspec' |
5 | 5 | require 'database_cleaner' |
6 | +require 'spinach/capybara' | |
6 | 7 | |
7 | 8 | %w(gitolite_stub login_helpers stubbed_repository valid_commit).each do |f| |
8 | 9 | require Rails.root.join('spec', 'support', f) |
... | ... | @@ -12,6 +13,7 @@ include LoginHelpers |
12 | 13 | include GitoliteStub |
13 | 14 | |
14 | 15 | WebMock.allow_net_connect! |
16 | +Capybara.javascript_driver = :webkit | |
15 | 17 | |
16 | 18 | DatabaseCleaner.strategy = :truncation |
17 | 19 | Spinach.hooks.before_scenario { DatabaseCleaner.start } | ... | ... |